Commit f26c96bf authored by pcregut's avatar pcregut

Added toString to encoded value to make them easier to debug.

parent a328bf64
......@@ -183,4 +183,20 @@ public class EncodedValueAnnotation extends EncodedValue {
}
return result;
}
@Override
public String toString() {
StringBuilder result = new StringBuilder("@");
result.append(annotationType);
boolean isFirst = true;
for(AnnotationElement ae: annotationElements) {
if (isFirst) {
result.append("(");
isFirst = false;
} else result.append(",");
result.append(ae);
}
result.append(")");
return result.toString();
}
}
......@@ -31,12 +31,12 @@
package org.ow2.asmdex.encodedValue;
import java.util.ArrayList;
import org.ow2.asmdex.Opcodes;
import org.ow2.asmdex.lowLevelUtils.ByteVector;
import org.ow2.asmdex.structureWriter.ConstantPool;
import java.util.ArrayList;
/**
* Class representing an Encoded Array.
*
......@@ -165,4 +165,19 @@ public class EncodedValueArray extends EncodedValue {
}
return result;
}
@Override
public String toString() {
StringBuilder result = new StringBuilder();
boolean isFirst = true;
for(EncodedValue ev: encodedValues) {
if (isFirst) {
result.append("{");
isFirst = false;
} else result.append(",");
result.append(ev);
}
result.append("}");
return result.toString();
}
}
......@@ -110,6 +110,10 @@ public class EncodedValueBoolean extends EncodedValue {
return (value == eb.value ? 0 : (value ? 1 : -1));
}
@Override
public String toString() {
return String.valueOf(value);
}
}
......@@ -116,4 +116,10 @@ public class EncodedValueByte extends EncodedValue {
byte value2 = eb.value;
return (value == value2 ? 0 : (value > value2 ? 1 : -1));
}
@Override
public String toString() {
return String.valueOf(value);
}
}
......@@ -130,4 +130,10 @@ public class EncodedValueCharacter extends EncodedValue {
char value2 = ec.value;
return (value == value2 ? 0 : (value > value2 ? 1 : -1));
}
@Override
public String toString() {
return String.valueOf(value);
}
}
......@@ -113,4 +113,10 @@ public class EncodedValueDouble extends EncodedValue {
double value2 = ed.value;
return (value == value2 ? 0 : (value > value2 ? 1 : -1));
}
@Override
public String toString() {
return String.valueOf(value);
}
}
\ No newline at end of file
......@@ -113,4 +113,10 @@ public class EncodedValueEnum extends EncodedValue {
EncodedValueEnum ee = (EncodedValueEnum)encodedValue;
return value.compareTo(ee.value);
}
@Override
public String toString() {
return String.valueOf(value);
}
}
......@@ -113,4 +113,10 @@ public class EncodedValueFloat extends EncodedValue {
float value2 = ef.value;
return (value == value2 ? 0 : (value > value2 ? 1 : -1));
}
@Override
public String toString() {
return String.valueOf(value);
}
}
......@@ -113,4 +113,10 @@ public class EncodedValueInteger extends EncodedValue {
int value2 = ei.value;
return (value == value2 ? 0 : (value > value2 ? 1 : -1));
}
@Override
public String toString() {
return String.valueOf(value);
}
}
......@@ -113,4 +113,10 @@ public class EncodedValueLong extends EncodedValue {
long value2 = el.value;
return (value == value2 ? 0 : (value > value2 ? 1 : -1));
}
@Override
public String toString() {
return String.valueOf(value);
}
}
......@@ -86,4 +86,10 @@ public class EncodedValueNull extends EncodedValue {
int compareValue(EncodedValue encodedValue) {
return 0;
}
@Override
public String toString() {
return "null";
}
}
......@@ -113,4 +113,10 @@ public class EncodedValueShort extends EncodedValue {
short value2 = es.value;
return (value == value2 ? 0 : (value > value2 ? 1 : -1));
}
@Override
public String toString() {
return String.valueOf(value);
}
}
......@@ -106,4 +106,10 @@ public class EncodedValueString extends EncodedValue {
EncodedValueString ev = (EncodedValueString)encodedValue;
return value.compareTo(ev.value);
}
@Override
public String toString() {
return '"' + value + '"';
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment