diff options
author | Sebastien Hertz <shertz@google.com> | 2017-03-27 13:39:41 +0000 |
---|---|---|
committer | android-build-merger <android-build-merger@google.com> | 2017-03-27 13:39:41 +0000 |
commit | 8a226b8bb5856935a45a8848935e13d4ebde80dd (patch) | |
tree | 860a410a37e47b41b75dea14d111bba4b2c43133 | |
parent | 7c602f3c0b905ea24a0a709a90299588ccd676be (diff) | |
parent | 5b35c3351b1b7ae948822a787ed8b01425ebd7fb (diff) | |
download | apache-harmony-8a226b8bb5856935a45a8848935e13d4ebde80dd.tar.gz |
Merge "Cleanup construction of Value instances"
am: 5b35c3351b
Change-Id: Ib5b846458e00c7783e439b16ca2eb6676c7c5b78
25 files changed, 241 insertions, 204 deletions
diff --git a/jdwp/src/test/java/org/apache/harmony/jpda/tests/framework/jdwp/Packet.java b/jdwp/src/test/java/org/apache/harmony/jpda/tests/framework/jdwp/Packet.java index 22e62d2..88482ce 100644 --- a/jdwp/src/test/java/org/apache/harmony/jpda/tests/framework/jdwp/Packet.java +++ b/jdwp/src/test/java/org/apache/harmony/jpda/tests/framework/jdwp/Packet.java @@ -1076,48 +1076,37 @@ public class Packet { * @return the next value of the data of the Packet as VM-sensitive value. */ public Value getNextValueAsUntaggedValue(byte tag) { - Value value = null; switch (tag) { - case JDWPConstants.Tag.BOOLEAN_TAG: - value = new Value(this.getNextValueAsBoolean()); - break; - case JDWPConstants.Tag.BYTE_TAG: - value = new Value(this.getNextValueAsByte()); - break; - case JDWPConstants.Tag.CHAR_TAG: - value = new Value(this.getNextValueAsChar()); - break; - case JDWPConstants.Tag.DOUBLE_TAG: - value = new Value(this.getNextValueAsDouble()); - break; - case JDWPConstants.Tag.FLOAT_TAG: - value = new Value(this.getNextValueAsFloat()); - break; - case JDWPConstants.Tag.INT_TAG: - value = new Value(this.getNextValueAsInt()); - break; - case JDWPConstants.Tag.LONG_TAG: - value = new Value(this.getNextValueAsLong()); - break; - case JDWPConstants.Tag.SHORT_TAG: - value = new Value(this.getNextValueAsShort()); - break; - case JDWPConstants.Tag.STRING_TAG: - case JDWPConstants.Tag.ARRAY_TAG: - case JDWPConstants.Tag.CLASS_LOADER_TAG: - case JDWPConstants.Tag.CLASS_OBJECT_TAG: - case JDWPConstants.Tag.OBJECT_TAG: - case JDWPConstants.Tag.THREAD_GROUP_TAG: - case JDWPConstants.Tag.THREAD_TAG: - value = new Value(tag, this.getNextValueAsObjectID()); - break; - case JDWPConstants.Tag.VOID_TAG: - // no bytes to read. - break; - default: - throw new TestErrorException("Illegal tag value = " + tag); + case JDWPConstants.Tag.BOOLEAN_TAG: + return Value.createBoolean(this.getNextValueAsBoolean()); + case JDWPConstants.Tag.BYTE_TAG: + return Value.createByte(this.getNextValueAsByte()); + case JDWPConstants.Tag.CHAR_TAG: + return Value.createChar(this.getNextValueAsChar()); + case JDWPConstants.Tag.DOUBLE_TAG: + return Value.createDouble(this.getNextValueAsDouble()); + case JDWPConstants.Tag.FLOAT_TAG: + return Value.createFloat(this.getNextValueAsFloat()); + case JDWPConstants.Tag.INT_TAG: + return Value.createInt(this.getNextValueAsInt()); + case JDWPConstants.Tag.LONG_TAG: + return Value.createLong(this.getNextValueAsLong()); + case JDWPConstants.Tag.SHORT_TAG: + return Value.createShort(this.getNextValueAsShort()); + case JDWPConstants.Tag.STRING_TAG: + case JDWPConstants.Tag.ARRAY_TAG: + case JDWPConstants.Tag.CLASS_LOADER_TAG: + case JDWPConstants.Tag.CLASS_OBJECT_TAG: + case JDWPConstants.Tag.OBJECT_TAG: + case JDWPConstants.Tag.THREAD_GROUP_TAG: + case JDWPConstants.Tag.THREAD_TAG: + return Value.createObjectValue(tag, this.getNextValueAsObjectID()); + case JDWPConstants.Tag.VOID_TAG: + // no bytes to read. + return null; + default: + throw new TestErrorException("Illegal tag value = " + tag); } - return value; } /** diff --git a/jdwp/src/test/java/org/apache/harmony/jpda/tests/framework/jdwp/Value.java b/jdwp/src/test/java/org/apache/harmony/jpda/tests/framework/jdwp/Value.java index e515404..c7b0584 100644 --- a/jdwp/src/test/java/org/apache/harmony/jpda/tests/framework/jdwp/Value.java +++ b/jdwp/src/test/java/org/apache/harmony/jpda/tests/framework/jdwp/Value.java @@ -33,96 +33,120 @@ import org.apache.harmony.jpda.tests.framework.jdwp.JDWPConstants; */ public class Value { - private byte tag; - - private Number numberValue; - - private boolean booleanValue; - - private char charValue; - /** - * Creates new value with no tag. + * Creates new boolean value. */ - public Value() { - tag = JDWPConstants.Tag.NO_TAG; + public static Value createBoolean(boolean value) { + return new Value(value); } /** - * Creates new ID value with specified tag. + * Creates new byte value. */ - public Value(byte tag, long value) { - this.tag = tag; - this.numberValue = new Long(value); + public static Value createByte(byte value) { + return new Value(JDWPConstants.Tag.BYTE_TAG, Byte.valueOf(value)); } /** - * Creates new byte value. + * Creates new char value. */ - public Value(byte value) { - this.tag = JDWPConstants.Tag.BYTE_TAG; - this.numberValue = new Byte(value); + public static Value createChar(char value) { + return new Value(value); } /** * Creates new short value. */ - public Value(short value) { - this.tag = JDWPConstants.Tag.SHORT_TAG; - this.numberValue = new Short(value); + public static Value createShort(short value) { + return new Value(JDWPConstants.Tag.SHORT_TAG, Short.valueOf(value)); } /** * Creates new int value. */ - public Value(int value) { - this.tag = JDWPConstants.Tag.INT_TAG; - this.numberValue = new Integer(value); + public static Value createInt(int value) { + return new Value(JDWPConstants.Tag.INT_TAG, Integer.valueOf(value)); } /** * Creates new long value. */ - public Value(long value) { - this.tag = JDWPConstants.Tag.LONG_TAG; - this.numberValue = new Long(value); + public static Value createLong(long value) { + return new Value(JDWPConstants.Tag.LONG_TAG, Long.valueOf(value)); } /** - * Creates new short value. + * Creates new float value. */ - public Value(float value) { - this.tag = JDWPConstants.Tag.FLOAT_TAG; - this.numberValue = new Float(value); + public static Value createFloat(float value) { + return new Value(JDWPConstants.Tag.FLOAT_TAG, Float.valueOf(value)); } /** * Creates new double value. */ - public Value(double value) { - this.tag = JDWPConstants.Tag.DOUBLE_TAG; - this.numberValue = new Double(value); + public static Value createDouble(double value) { + return new Value(JDWPConstants.Tag.DOUBLE_TAG, Double.valueOf(value)); + } + + /** + * Creates void value. + */ + public static Value createVoidValue() { + return new Value(JDWPConstants.Tag.VOID_TAG, Long.valueOf(0)); + } + + /** + * Creates object value. + */ + public static Value createObjectValue(byte tag, long value) { + if (isPrimitiveTag(tag)) { + throw new AssertionError(JDWPConstants.Tag.getName(tag) + " is primitive"); + } + return new Value(tag, Long.valueOf(value)); + } + + private final byte tag; + + private final Number numberValue; + + private final boolean booleanValue; + + private final char charValue; + + /** + * Creates new value. + */ + private Value(byte tag, Number numberValue) { + this.tag = tag; + this.numberValue = numberValue; + this.booleanValue = false; + this.charValue = 0; } /** * Creates new boolean value. */ - public Value(boolean value) { + private Value(boolean value) { this.tag = JDWPConstants.Tag.BOOLEAN_TAG; this.booleanValue = value; + this.numberValue = null; + this.charValue = 0; } /** * Creates new char value. */ - public Value(char value) { + private Value(char value) { this.tag = JDWPConstants.Tag.CHAR_TAG; this.charValue = value; + this.numberValue = null; + this.booleanValue = false; } /** * Returns tag of this value. - * + * * @return Returns the tag. */ public byte getTag() { @@ -131,7 +155,7 @@ public class Value { /** * Returns byte representation of this value. - * + * * @return byte value */ public byte getByteValue() { @@ -140,7 +164,7 @@ public class Value { /** * Returns short representation of this value. - * + * * @return short value */ public short getShortValue() { @@ -149,7 +173,7 @@ public class Value { /** * Returns int representation of this value. - * + * * @return int value */ public int getIntValue() { @@ -158,7 +182,7 @@ public class Value { /** * Returns long representation of this value. - * + * * @return long value */ public long getLongValue() { @@ -167,7 +191,7 @@ public class Value { /** * Returns float representation of this value. - * + * * @return float value */ public float getFloatValue() { @@ -176,7 +200,7 @@ public class Value { /** * Returns double representation of this value. - * + * * @return double value */ public double getDoubleValue() { @@ -185,7 +209,7 @@ public class Value { /** * Returns boolean representation of this value. - * + * * @return boolean value */ public boolean getBooleanValue() { @@ -194,13 +218,39 @@ public class Value { /** * Returns char representation of this value. - * + * * @return char value */ public char getCharValue() { return charValue; } + private static boolean isPrimitiveTag(byte tag) { + switch (tag) { + case JDWPConstants.Tag.BOOLEAN_TAG: + case JDWPConstants.Tag.BYTE_TAG: + case JDWPConstants.Tag.CHAR_TAG: + case JDWPConstants.Tag.SHORT_TAG: + case JDWPConstants.Tag.INT_TAG: + case JDWPConstants.Tag.LONG_TAG: + case JDWPConstants.Tag.FLOAT_TAG: + case JDWPConstants.Tag.DOUBLE_TAG: + case JDWPConstants.Tag.VOID_TAG: + return true; + case JDWPConstants.Tag.NO_TAG: + case JDWPConstants.Tag.ARRAY_TAG: + case JDWPConstants.Tag.CLASS_LOADER_TAG: + case JDWPConstants.Tag.CLASS_OBJECT_TAG: + case JDWPConstants.Tag.OBJECT_TAG: + case JDWPConstants.Tag.STRING_TAG: + case JDWPConstants.Tag.THREAD_TAG: + case JDWPConstants.Tag.THREAD_GROUP_TAG: + return false; + default: + throw new TestErrorException("Illegal tag value: " + tag); + } + } + /** * Compares with other value. */ @@ -210,7 +260,7 @@ public class Value { return false; Value value0 = (Value) arg0; - if (value0.tag != value0.tag) + if (tag != value0.tag) return false; switch (tag) { @@ -275,8 +325,7 @@ public class Value { case JDWPConstants.Tag.STRING_TAG: return "StringID: " + getLongValue(); case JDWPConstants.Tag.ARRAY_TAG: - return "ObjectID: " + getLongValue(); - + return "ArrayID: " + getLongValue(); case JDWPConstants.Tag.CLASS_LOADER_TAG: return "ClassLoaderID: " + getLongValue(); case JDWPConstants.Tag.CLASS_OBJECT_TAG: diff --git a/jdwp/src/test/java/org/apache/harmony/jpda/tests/jdwp/ArrayReference/SetValuesTest.java b/jdwp/src/test/java/org/apache/harmony/jpda/tests/jdwp/ArrayReference/SetValuesTest.java index a853dde..a282e7f 100644 --- a/jdwp/src/test/java/org/apache/harmony/jpda/tests/jdwp/ArrayReference/SetValuesTest.java +++ b/jdwp/src/test/java/org/apache/harmony/jpda/tests/jdwp/ArrayReference/SetValuesTest.java @@ -72,21 +72,21 @@ public class SetValuesTest extends JDWPArrayReferenceTestCase { ArrayRegion valuesRegion = new ArrayRegion( JDWPConstants.Tag.INT_TAG, 10); for (int j = 0; j < valuesRegion.getLength(); j++) { - valuesRegion.setValue(j, new Value(-j)); + valuesRegion.setValue(j, Value.createInt(-j)); } checkArrayValues(valuesRegion, classID, fieldID); } else if (name.equals("longArray")) { ArrayRegion valuesRegion = new ArrayRegion( JDWPConstants.Tag.LONG_TAG, 10); for (int j = 0; j < valuesRegion.getLength(); j++) { - valuesRegion.setValue(j, new Value((long)-j)); + valuesRegion.setValue(j, Value.createLong((long)-j)); } checkArrayValues(valuesRegion, classID, fieldID); } else if (name.equals("byteArray")) { ArrayRegion valuesRegion = new ArrayRegion( JDWPConstants.Tag.BYTE_TAG, 10); for (int j = 0; j < valuesRegion.getLength(); j++) { - valuesRegion.setValue(j, new Value((byte)-j)); + valuesRegion.setValue(j, Value.createByte((byte)-j)); } checkArrayValues(valuesRegion, classID, fieldID); } diff --git a/jdwp/src/test/java/org/apache/harmony/jpda/tests/jdwp/ClassType/InvokeMethod003Test.java b/jdwp/src/test/java/org/apache/harmony/jpda/tests/jdwp/ClassType/InvokeMethod003Test.java index 63a9c2c..b53d95a 100644 --- a/jdwp/src/test/java/org/apache/harmony/jpda/tests/jdwp/ClassType/InvokeMethod003Test.java +++ b/jdwp/src/test/java/org/apache/harmony/jpda/tests/jdwp/ClassType/InvokeMethod003Test.java @@ -108,7 +108,7 @@ public class InvokeMethod003Test extends JDWPSyncTestCase { assertTrue("Failed to find method", targetMethodID != 0); // Invoke test method with null argument. - Value nullObjectValue = new Value(JDWPConstants.Tag.OBJECT_TAG, 0); + Value nullObjectValue = Value.createObjectValue(JDWPConstants.Tag.OBJECT_TAG, 0); packet = new CommandPacket( JDWPCommands.ClassTypeCommandSet.CommandSetID, JDWPCommands.ClassTypeCommandSet.InvokeMethodCommand); diff --git a/jdwp/src/test/java/org/apache/harmony/jpda/tests/jdwp/ClassType/InvokeMethodTest.java b/jdwp/src/test/java/org/apache/harmony/jpda/tests/jdwp/ClassType/InvokeMethodTest.java index 36db152..c92fb14 100644 --- a/jdwp/src/test/java/org/apache/harmony/jpda/tests/jdwp/ClassType/InvokeMethodTest.java +++ b/jdwp/src/test/java/org/apache/harmony/jpda/tests/jdwp/ClassType/InvokeMethodTest.java @@ -169,7 +169,7 @@ public class InvokeMethodTest extends JDWPSyncTestCase { packet.setNextValueAsThreadID(targetThreadID); packet.setNextValueAsMethodID(targetMethodID); packet.setNextValueAsInt(1); - packet.setNextValueAsValue(new Value(false)); + packet.setNextValueAsValue(Value.createBoolean(false)); packet.setNextValueAsInt(0); logWriter.println(" Send ClassType.InvokeMethod without Exception"); reply = debuggeeWrapper.vmMirror.performCommand(packet); @@ -199,7 +199,7 @@ public class InvokeMethodTest extends JDWPSyncTestCase { packet.setNextValueAsThreadID(targetThreadID); packet.setNextValueAsMethodID(targetMethodID); packet.setNextValueAsInt(1); - packet.setNextValueAsValue(new Value(true)); + packet.setNextValueAsValue(Value.createBoolean(true)); packet.setNextValueAsInt(0); logWriter.println(" Send ClassType.InvokeMethod with Exception"); reply = debuggeeWrapper.vmMirror.performCommand(packet); @@ -334,7 +334,7 @@ public class InvokeMethodTest extends JDWPSyncTestCase { packet.setNextValueAsThreadID(targetThreadID); packet.setNextValueAsMethodID(testMethodID); packet.setNextValueAsInt(1); - packet.setNextValueAsValue(new Value(false)); + packet.setNextValueAsValue(Value.createBoolean(false)); packet.setNextValueAsInt(0); reply = debuggeeWrapper.vmMirror.performCommand(packet); short errorCode = reply.getErrorCode(); @@ -461,7 +461,7 @@ public class InvokeMethodTest extends JDWPSyncTestCase { packet.setNextValueAsThreadID(targetThreadID); packet.setNextValueAsMethodID(nonStaticMethodID); packet.setNextValueAsInt(1); - packet.setNextValueAsValue(new Value(false)); + packet.setNextValueAsValue(Value.createBoolean(false)); packet.setNextValueAsInt(0); reply = debuggeeWrapper.vmMirror.performCommand(packet); short errorCode = reply.getErrorCode(); diff --git a/jdwp/src/test/java/org/apache/harmony/jpda/tests/jdwp/ClassType/NewInstance002Test.java b/jdwp/src/test/java/org/apache/harmony/jpda/tests/jdwp/ClassType/NewInstance002Test.java index 6b5531d..83dda3c 100644 --- a/jdwp/src/test/java/org/apache/harmony/jpda/tests/jdwp/ClassType/NewInstance002Test.java +++ b/jdwp/src/test/java/org/apache/harmony/jpda/tests/jdwp/ClassType/NewInstance002Test.java @@ -114,7 +114,7 @@ public class NewInstance002Test extends JDWPSyncTestCase { assertTrue("Failed to find constructor", targetMethodID != 0); // Make NewInstance without Exception - Value nullObjectValue = new Value(JDWPConstants.Tag.OBJECT_TAG, 0); + Value nullObjectValue = Value.createObjectValue(JDWPConstants.Tag.OBJECT_TAG, 0); packet = new CommandPacket( JDWPCommands.ClassTypeCommandSet.CommandSetID, JDWPCommands.ClassTypeCommandSet.NewInstanceCommand); diff --git a/jdwp/src/test/java/org/apache/harmony/jpda/tests/jdwp/ClassType/NewInstanceStringTest.java b/jdwp/src/test/java/org/apache/harmony/jpda/tests/jdwp/ClassType/NewInstanceStringTest.java index ef2e3c3..53ae4de 100644 --- a/jdwp/src/test/java/org/apache/harmony/jpda/tests/jdwp/ClassType/NewInstanceStringTest.java +++ b/jdwp/src/test/java/org/apache/harmony/jpda/tests/jdwp/ClassType/NewInstanceStringTest.java @@ -71,8 +71,8 @@ public class NewInstanceStringTest extends AbstractNewInstanceTestCase { long debuggeeClassId = getClassIDBySignature(getDebuggeeClassSignature()); Value byteArrayValue = getStaticFieldValue(debuggeeClassId, "BYTE_ARRAY"); constructorArguments.add(byteArrayValue); - constructorArguments.add(new Value(0)); - constructorArguments.add(new Value(1)); + constructorArguments.add(Value.createInt(0)); + constructorArguments.add(Value.createInt(1)); } }); } @@ -92,8 +92,8 @@ public class NewInstanceStringTest extends AbstractNewInstanceTestCase { Value byteArrayValue = getStaticFieldValue(debuggeeClassId, "BYTE_ARRAY"); Value stringCharsetValue = getStaticFieldValue(debuggeeClassId, "STRING_CHARSET"); constructorArguments.add(byteArrayValue); - constructorArguments.add(new Value(0)); - constructorArguments.add(new Value(1)); + constructorArguments.add(Value.createInt(0)); + constructorArguments.add(Value.createInt(1)); constructorArguments.add(stringCharsetValue); } }); @@ -135,8 +135,8 @@ public class NewInstanceStringTest extends AbstractNewInstanceTestCase { Value byteArrayValue = getStaticFieldValue(debuggeeClassId, "BYTE_ARRAY"); Value charsetValue = getStaticFieldValue(debuggeeClassId, "CHARSET"); constructorArguments.add(byteArrayValue); - constructorArguments.add(new Value(0)); - constructorArguments.add(new Value(1)); + constructorArguments.add(Value.createInt(0)); + constructorArguments.add(Value.createInt(1)); constructorArguments.add(charsetValue); } }); @@ -190,8 +190,8 @@ public class NewInstanceStringTest extends AbstractNewInstanceTestCase { long debuggeeClassId = getClassIDBySignature(getDebuggeeClassSignature()); Value charArrayValue = getStaticFieldValue(debuggeeClassId, "CHAR_ARRAY"); constructorArguments.add(charArrayValue); - constructorArguments.add(new Value(0)); - constructorArguments.add(new Value(1)); + constructorArguments.add(Value.createInt(0)); + constructorArguments.add(Value.createInt(1)); } }); } @@ -242,8 +242,8 @@ public class NewInstanceStringTest extends AbstractNewInstanceTestCase { long debuggeeClassId = getClassIDBySignature(getDebuggeeClassSignature()); Value intArrayValue = getStaticFieldValue(debuggeeClassId, "INT_ARRAY"); constructorArguments.add(intArrayValue); - constructorArguments.add(new Value(0)); - constructorArguments.add(new Value(1)); + constructorArguments.add(Value.createInt(0)); + constructorArguments.add(Value.createInt(1)); } }); } diff --git a/jdwp/src/test/java/org/apache/harmony/jpda/tests/jdwp/ClassType/NewInstanceTagTest.java b/jdwp/src/test/java/org/apache/harmony/jpda/tests/jdwp/ClassType/NewInstanceTagTest.java index 57b2bf3..5dc24a2 100644 --- a/jdwp/src/test/java/org/apache/harmony/jpda/tests/jdwp/ClassType/NewInstanceTagTest.java +++ b/jdwp/src/test/java/org/apache/harmony/jpda/tests/jdwp/ClassType/NewInstanceTagTest.java @@ -110,7 +110,7 @@ public class NewInstanceTagTest extends AbstractNewInstanceTestCase { assertTrue("Invalid string id", stringId != -1); assertTrue("Null string id", stringId != 0); // Pass created string to constructor. - constructorArguments.add(new Value(JDWPConstants.Tag.STRING_TAG, stringId)); + constructorArguments.add(Value.createObjectValue(JDWPConstants.Tag.STRING_TAG, stringId)); } }, new Checker(JDWPConstants.Tag.THREAD_GROUP_TAG)); } diff --git a/jdwp/src/test/java/org/apache/harmony/jpda/tests/jdwp/ClassType/NewInstanceTest.java b/jdwp/src/test/java/org/apache/harmony/jpda/tests/jdwp/ClassType/NewInstanceTest.java index 4628e25..dc4bd1c 100644 --- a/jdwp/src/test/java/org/apache/harmony/jpda/tests/jdwp/ClassType/NewInstanceTest.java +++ b/jdwp/src/test/java/org/apache/harmony/jpda/tests/jdwp/ClassType/NewInstanceTest.java @@ -168,7 +168,7 @@ public class NewInstanceTest extends JDWPSyncTestCase { packet.setNextValueAsThreadID(targetThreadID); packet.setNextValueAsMethodID(targetMethodID); packet.setNextValueAsInt(1); - packet.setNextValueAsValue(new Value(false)); + packet.setNextValueAsValue(Value.createBoolean(false)); packet.setNextValueAsInt(0); logWriter.println(" Send ClassType.NewInstance (without Exception)"); reply = debuggeeWrapper.vmMirror.performCommand(packet); @@ -219,7 +219,7 @@ public class NewInstanceTest extends JDWPSyncTestCase { packet.setNextValueAsThreadID(targetThreadID); packet.setNextValueAsMethodID(targetMethodID); packet.setNextValueAsInt(1); - packet.setNextValueAsValue(new Value(true)); + packet.setNextValueAsValue(Value.createBoolean(true)); packet.setNextValueAsInt(0); logWriter.println(" Send ClassType.NewInstance (with Exception)"); reply = debuggeeWrapper.vmMirror.performCommand(packet); diff --git a/jdwp/src/test/java/org/apache/harmony/jpda/tests/jdwp/ClassType/SetValuesTest.java b/jdwp/src/test/java/org/apache/harmony/jpda/tests/jdwp/ClassType/SetValuesTest.java index 57668b5..d9122a5 100644 --- a/jdwp/src/test/java/org/apache/harmony/jpda/tests/jdwp/ClassType/SetValuesTest.java +++ b/jdwp/src/test/java/org/apache/harmony/jpda/tests/jdwp/ClassType/SetValuesTest.java @@ -67,48 +67,48 @@ public class SetValuesTest extends JDWPClassTypeTestCase { if (fieldInfo.getSignature().length()>=1) { switch (fieldInfo.getSignature().charAt(0)) { case 'B': // byte - testField(classID, fieldInfo, new Value(Byte.MIN_VALUE)); - testField(classID, fieldInfo, new Value(Byte.MAX_VALUE)); - testField(classID, fieldInfo, new Value((byte)0)); + testField(classID, fieldInfo, Value.createByte(Byte.MIN_VALUE)); + testField(classID, fieldInfo, Value.createByte(Byte.MAX_VALUE)); + testField(classID, fieldInfo, Value.createByte((byte)0)); break; case 'C': // char - testField(classID, fieldInfo, new Value((char)Character.MAX_VALUE)); - testField(classID, fieldInfo, new Value((char)Character.MIN_VALUE)); + testField(classID, fieldInfo, Value.createChar(Character.MAX_VALUE)); + testField(classID, fieldInfo, Value.createChar(Character.MIN_VALUE)); break; case 'F': // float - testField(classID, fieldInfo, new Value((float)Float.MIN_VALUE)); - testField(classID, fieldInfo, new Value((float)Float.MAX_VALUE)); - testField(classID, fieldInfo, new Value((float)Float.NaN)); - testField(classID, fieldInfo, new Value((float)Float.NEGATIVE_INFINITY)); - testField(classID, fieldInfo, new Value((float)Float.POSITIVE_INFINITY)); - testField(classID, fieldInfo, new Value((float)0)); + testField(classID, fieldInfo, Value.createFloat(Float.MIN_VALUE)); + testField(classID, fieldInfo, Value.createFloat(Float.MAX_VALUE)); + testField(classID, fieldInfo, Value.createFloat(Float.NaN)); + testField(classID, fieldInfo, Value.createFloat(Float.NEGATIVE_INFINITY)); + testField(classID, fieldInfo, Value.createFloat(Float.POSITIVE_INFINITY)); + testField(classID, fieldInfo, Value.createFloat(0)); break; case 'D': // double - testField(classID, fieldInfo, new Value((double)Double.MIN_VALUE)); - testField(classID, fieldInfo, new Value((double)Double.MAX_VALUE)); - testField(classID, fieldInfo, new Value((double)Double.NaN)); - testField(classID, fieldInfo, new Value((double)Double.NEGATIVE_INFINITY)); - testField(classID, fieldInfo, new Value((double)Double.POSITIVE_INFINITY)); - testField(classID, fieldInfo, new Value((double)0)); + testField(classID, fieldInfo, Value.createDouble(Double.MIN_VALUE)); + testField(classID, fieldInfo, Value.createDouble(Double.MAX_VALUE)); + testField(classID, fieldInfo, Value.createDouble(Double.NaN)); + testField(classID, fieldInfo, Value.createDouble(Double.NEGATIVE_INFINITY)); + testField(classID, fieldInfo, Value.createDouble(Double.POSITIVE_INFINITY)); + testField(classID, fieldInfo, Value.createDouble(0)); break; case 'I': // int - testField(classID, fieldInfo, new Value((int)Integer.MIN_VALUE)); - testField(classID, fieldInfo, new Value((int)Integer.MAX_VALUE)); - testField(classID, fieldInfo, new Value((int)0)); + testField(classID, fieldInfo, Value.createInt(Integer.MIN_VALUE)); + testField(classID, fieldInfo, Value.createInt(Integer.MAX_VALUE)); + testField(classID, fieldInfo, Value.createInt(0)); break; case 'J': // long - testField(classID, fieldInfo, new Value((long)Long.MIN_VALUE)); - testField(classID, fieldInfo, new Value((long)Long.MAX_VALUE)); - testField(classID, fieldInfo, new Value((long)0)); + testField(classID, fieldInfo, Value.createLong(Long.MIN_VALUE)); + testField(classID, fieldInfo, Value.createLong(Long.MAX_VALUE)); + testField(classID, fieldInfo, Value.createLong(0)); break; case 'S': // short - testField(classID, fieldInfo, new Value((short)Short.MIN_VALUE)); - testField(classID, fieldInfo, new Value((short)Short.MAX_VALUE)); - testField(classID, fieldInfo, new Value((short)0)); + testField(classID, fieldInfo, Value.createShort(Short.MIN_VALUE)); + testField(classID, fieldInfo, Value.createShort(Short.MAX_VALUE)); + testField(classID, fieldInfo, Value.createShort((short)0)); break; case 'Z': // boolean - testField(classID, fieldInfo, new Value((boolean)Boolean.FALSE.booleanValue())); - testField(classID, fieldInfo, new Value((boolean)Boolean.TRUE.booleanValue())); + testField(classID, fieldInfo, Value.createBoolean(Boolean.FALSE.booleanValue())); + testField(classID, fieldInfo, Value.createBoolean(Boolean.TRUE.booleanValue())); break; } } diff --git a/jdwp/src/test/java/org/apache/harmony/jpda/tests/jdwp/InterfaceType/InvokeMethodTest.java b/jdwp/src/test/java/org/apache/harmony/jpda/tests/jdwp/InterfaceType/InvokeMethodTest.java index 4d1c361..9f433fc 100644 --- a/jdwp/src/test/java/org/apache/harmony/jpda/tests/jdwp/InterfaceType/InvokeMethodTest.java +++ b/jdwp/src/test/java/org/apache/harmony/jpda/tests/jdwp/InterfaceType/InvokeMethodTest.java @@ -100,7 +100,7 @@ public class InvokeMethodTest extends JDWPSyncTestCase { "testInvokeMethodStatic1"); assertTrue("Failed to find method", targetMethodID != 0); - Value throwValue = new Value(shouldThrow); + Value throwValue = Value.createBoolean(shouldThrow); // Invoke test method with null argument. packet = new CommandPacket( JDWPCommands.InterfaceTypeCommandSet.CommandSetID, diff --git a/jdwp/src/test/java/org/apache/harmony/jpda/tests/jdwp/ObjectReference/InvokeMethod002Test.java b/jdwp/src/test/java/org/apache/harmony/jpda/tests/jdwp/ObjectReference/InvokeMethod002Test.java index 9ac6ca6..7364c96 100644 --- a/jdwp/src/test/java/org/apache/harmony/jpda/tests/jdwp/ObjectReference/InvokeMethod002Test.java +++ b/jdwp/src/test/java/org/apache/harmony/jpda/tests/jdwp/ObjectReference/InvokeMethod002Test.java @@ -135,7 +135,7 @@ public class InvokeMethod002Test extends JDWPSyncTestCase { assertTrue("Failed to find method", targetMethodID != 0); // Invoke test method with null argument. - Value nullObjectValue = new Value(JDWPConstants.Tag.OBJECT_TAG, 0); + Value nullObjectValue = Value.createObjectValue(JDWPConstants.Tag.OBJECT_TAG, 0); packet = new CommandPacket( JDWPCommands.ObjectReferenceCommandSet.CommandSetID, JDWPCommands.ObjectReferenceCommandSet.InvokeMethodCommand); diff --git a/jdwp/src/test/java/org/apache/harmony/jpda/tests/jdwp/ObjectReference/InvokeMethodDefault002Test.java b/jdwp/src/test/java/org/apache/harmony/jpda/tests/jdwp/ObjectReference/InvokeMethodDefault002Test.java index 99f6eb7..bde8a34 100644 --- a/jdwp/src/test/java/org/apache/harmony/jpda/tests/jdwp/ObjectReference/InvokeMethodDefault002Test.java +++ b/jdwp/src/test/java/org/apache/harmony/jpda/tests/jdwp/ObjectReference/InvokeMethodDefault002Test.java @@ -125,7 +125,7 @@ public class InvokeMethodDefault002Test extends JDWPSyncTestCase { logWriter.println(" Method ID=" + targetMethodID); // The method argument. - Value throwValue = new Value(shouldThrow); + Value throwValue = Value.createBoolean(shouldThrow); // Invoke method. packet = new CommandPacket( JDWPCommands.ObjectReferenceCommandSet.CommandSetID, diff --git a/jdwp/src/test/java/org/apache/harmony/jpda/tests/jdwp/ObjectReference/InvokeMethodDefaultTest.java b/jdwp/src/test/java/org/apache/harmony/jpda/tests/jdwp/ObjectReference/InvokeMethodDefaultTest.java index fcb432d..8ef0015 100644 --- a/jdwp/src/test/java/org/apache/harmony/jpda/tests/jdwp/ObjectReference/InvokeMethodDefaultTest.java +++ b/jdwp/src/test/java/org/apache/harmony/jpda/tests/jdwp/ObjectReference/InvokeMethodDefaultTest.java @@ -125,7 +125,7 @@ public class InvokeMethodDefaultTest extends JDWPSyncTestCase { logWriter.println(" Method ID=" + targetMethodID); // The method argument. - Value throwValue = new Value(shouldThrow); + Value throwValue = Value.createBoolean(shouldThrow); // Invoke method. packet = new CommandPacket( JDWPCommands.ObjectReferenceCommandSet.CommandSetID, diff --git a/jdwp/src/test/java/org/apache/harmony/jpda/tests/jdwp/ObjectReference/InvokeMethodTest.java b/jdwp/src/test/java/org/apache/harmony/jpda/tests/jdwp/ObjectReference/InvokeMethodTest.java index ab83eda..6a1f74d 100644 --- a/jdwp/src/test/java/org/apache/harmony/jpda/tests/jdwp/ObjectReference/InvokeMethodTest.java +++ b/jdwp/src/test/java/org/apache/harmony/jpda/tests/jdwp/ObjectReference/InvokeMethodTest.java @@ -126,7 +126,7 @@ public class InvokeMethodTest extends JDWPSyncTestCase { packet.setNextValueAsMethodID(constructorID); if ( testNumber == 1 ) { packet.setNextValueAsInt(1); // number of parameters - packet.setNextValueAsValue(new Value(false)); + packet.setNextValueAsValue(Value.createBoolean(false)); } if ( testNumber == 2 ) { packet.setNextValueAsInt(0); // number of parameters @@ -207,7 +207,7 @@ public class InvokeMethodTest extends JDWPSyncTestCase { packet.setNextValueAsClassID(typeID); packet.setNextValueAsMethodID(targetMethodID); packet.setNextValueAsInt(1); - packet.setNextValueAsValue(new Value(false)); + packet.setNextValueAsValue(Value.createBoolean(false)); packet.setNextValueAsInt(0); logWriter.println("\nSend ObjectReference.InvokeMethod without exception..."); ReplyPacket reply = debuggeeWrapper.vmMirror.performCommand(packet); @@ -241,7 +241,7 @@ public class InvokeMethodTest extends JDWPSyncTestCase { packet.setNextValueAsClassID(typeID); packet.setNextValueAsMethodID(targetMethodID); packet.setNextValueAsInt(1); - packet.setNextValueAsValue(new Value(true)); + packet.setNextValueAsValue(Value.createBoolean(true)); packet.setNextValueAsInt(0); logWriter.println("\nSend ObjectReference.InvokeMethod with exception..."); reply = debuggeeWrapper.vmMirror.performCommand(packet); @@ -322,7 +322,7 @@ public class InvokeMethodTest extends JDWPSyncTestCase { packet.setNextValueAsClassID(typeIDChild); packet.setNextValueAsMethodID(targetMethodIDChild); packet.setNextValueAsInt(1); - packet.setNextValueAsValue(new Value(false)); + packet.setNextValueAsValue(Value.createBoolean(false)); packet.setNextValueAsInt(JDWPConstants.InvokeOptions.INVOKE_NONVIRTUAL); logWriter.println ("\nSend ObjectReference.InvokeMethod:: nonvirtual child method without exception..."); @@ -357,7 +357,7 @@ public class InvokeMethodTest extends JDWPSyncTestCase { packet.setNextValueAsClassID(typeIDSuper); packet.setNextValueAsMethodID(targetMethodIDSuper); packet.setNextValueAsInt(1); - packet.setNextValueAsValue(new Value(false)); + packet.setNextValueAsValue(Value.createBoolean(false)); packet.setNextValueAsInt(JDWPConstants.InvokeOptions.INVOKE_NONVIRTUAL); logWriter.println ("\nSend ObjectReference.InvokeMethod: nonvirtual super method without exception..."); diff --git a/jdwp/src/test/java/org/apache/harmony/jpda/tests/jdwp/StackFrame/GetValues002Test.java b/jdwp/src/test/java/org/apache/harmony/jpda/tests/jdwp/StackFrame/GetValues002Test.java index 02d234b..034c041 100644 --- a/jdwp/src/test/java/org/apache/harmony/jpda/tests/jdwp/StackFrame/GetValues002Test.java +++ b/jdwp/src/test/java/org/apache/harmony/jpda/tests/jdwp/StackFrame/GetValues002Test.java @@ -32,7 +32,7 @@ public class GetValues002Test extends JDWPStackFrameAccessTest { */ public void testGetValues001_Boolean() { StackFrameTester tester = new StackFrameTester(StackTrace002Debuggee.BOOLEAN_SIGNAL); - Value oldValue = new Value(StackTrace002Debuggee.BOOLEAN_PARAM_VALUE); + Value oldValue = Value.createBoolean(StackTrace002Debuggee.BOOLEAN_PARAM_VALUE); MethodInfo suspensionMethodInfo = tester.addTestMethod("breakpointBoolean"); suspensionMethodInfo.addVariable("param", oldValue); MethodInfo methodInfo = tester.addTestMethod("runBreakpointBoolean"); @@ -48,7 +48,7 @@ public class GetValues002Test extends JDWPStackFrameAccessTest { */ public void testGetValues002_Byte() { StackFrameTester tester = new StackFrameTester(StackTrace002Debuggee.BYTE_SIGNAL); - Value expectedValue = new Value(StackTrace002Debuggee.BYTE_PARAM_VALUE); + Value expectedValue = Value.createByte(StackTrace002Debuggee.BYTE_PARAM_VALUE); MethodInfo suspensionMethodInfo = tester.addTestMethod("breakpointByte"); suspensionMethodInfo.addVariable("param", expectedValue); MethodInfo methodInfo = tester.addTestMethod("runBreakpointByte"); @@ -64,7 +64,7 @@ public class GetValues002Test extends JDWPStackFrameAccessTest { */ public void testGetValues003_Char() { StackFrameTester tester = new StackFrameTester(StackTrace002Debuggee.CHAR_SIGNAL); - Value expectedValue = new Value(StackTrace002Debuggee.CHAR_PARAM_VALUE); + Value expectedValue = Value.createChar(StackTrace002Debuggee.CHAR_PARAM_VALUE); MethodInfo suspensionMethodInfo = tester.addTestMethod("breakpointChar"); suspensionMethodInfo.addVariable("param", expectedValue); MethodInfo methodInfo = tester.addTestMethod("runBreakpointChar"); @@ -80,7 +80,7 @@ public class GetValues002Test extends JDWPStackFrameAccessTest { */ public void testGetValues004_Short() { StackFrameTester tester = new StackFrameTester(StackTrace002Debuggee.SHORT_SIGNAL); - Value oldValue = new Value(StackTrace002Debuggee.SHORT_PARAM_VALUE); + Value oldValue = Value.createShort(StackTrace002Debuggee.SHORT_PARAM_VALUE); MethodInfo suspensionMethodInfo = tester.addTestMethod("breakpointShort"); suspensionMethodInfo.addVariable("param", oldValue); MethodInfo methodInfo = tester.addTestMethod("runBreakpointShort"); @@ -96,7 +96,7 @@ public class GetValues002Test extends JDWPStackFrameAccessTest { */ public void testGetValues005_Int() { StackFrameTester tester = new StackFrameTester(StackTrace002Debuggee.INT_SIGNAL); - Value oldValue = new Value(StackTrace002Debuggee.INT_PARAM_VALUE); + Value oldValue = Value.createInt(StackTrace002Debuggee.INT_PARAM_VALUE); MethodInfo suspensionMethodInfo = tester.addTestMethod("breakpointInt"); suspensionMethodInfo.addVariable("param", oldValue); MethodInfo methodInfo = tester.addTestMethod("runBreakpointInt"); @@ -112,8 +112,8 @@ public class GetValues002Test extends JDWPStackFrameAccessTest { */ public void testGetValues005_Int2() { StackFrameTester tester = new StackFrameTester(StackTrace002Debuggee.INT_METHOD2_SIGNAL); - Value oldValue = new Value(StackTrace002Debuggee.INT_PARAM_VALUE); - Value nextValue = new Value(StackTrace002Debuggee.INT_PARAM_VALUE * 2); + Value oldValue = Value.createInt(StackTrace002Debuggee.INT_PARAM_VALUE); + Value nextValue = Value.createInt(StackTrace002Debuggee.INT_PARAM_VALUE * 2); MethodInfo suspensionMethodInfo = tester.addTestMethod("breakpointInt2"); suspensionMethodInfo.addVariable("param", oldValue, null /* no set value */, nextValue); MethodInfo methodInfo = tester.addTestMethod("runBreakpointInt2"); @@ -130,7 +130,7 @@ public class GetValues002Test extends JDWPStackFrameAccessTest { */ public void testGetValues006_Long() { StackFrameTester tester = new StackFrameTester(StackTrace002Debuggee.LONG_METHOD_SIGNAL); - Value oldValue = new Value(StackTrace002Debuggee.LONG_PARAM_VALUE); + Value oldValue = Value.createLong(StackTrace002Debuggee.LONG_PARAM_VALUE); MethodInfo suspensionMethodInfo = tester.addTestMethod("breakpointLong"); suspensionMethodInfo.addVariable("param", oldValue); MethodInfo methodInfo = tester.addTestMethod("runBreakpointLong"); @@ -146,7 +146,7 @@ public class GetValues002Test extends JDWPStackFrameAccessTest { */ public void testGetValues007_Float() { StackFrameTester tester = new StackFrameTester(StackTrace002Debuggee.FLOAT_METHOD); - Value oldValue = new Value(StackTrace002Debuggee.FLOAT_PARAM_VALUE); + Value oldValue = Value.createFloat(StackTrace002Debuggee.FLOAT_PARAM_VALUE); MethodInfo suspensionMethodInfo = tester.addTestMethod("breakpointFloat"); suspensionMethodInfo.addVariable("param", oldValue); MethodInfo methodInfo = tester.addTestMethod("runBreakpointFloat"); @@ -162,7 +162,7 @@ public class GetValues002Test extends JDWPStackFrameAccessTest { */ public void testGetValues008_Double() { StackFrameTester tester = new StackFrameTester(StackTrace002Debuggee.DOUBLE_METHOD); - Value oldValue = new Value(StackTrace002Debuggee.DOUBLE_PARAM_VALUE); + Value oldValue = Value.createDouble(StackTrace002Debuggee.DOUBLE_PARAM_VALUE); MethodInfo suspensionMethodInfo = tester.addTestMethod("breakpointDouble"); suspensionMethodInfo.addVariable("param", oldValue); MethodInfo methodInfo = tester.addTestMethod("runBreakpointDouble"); diff --git a/jdwp/src/test/java/org/apache/harmony/jpda/tests/jdwp/StackFrame/PopFrames002Test.java b/jdwp/src/test/java/org/apache/harmony/jpda/tests/jdwp/StackFrame/PopFrames002Test.java index e948249..2fa4d2e 100644 --- a/jdwp/src/test/java/org/apache/harmony/jpda/tests/jdwp/StackFrame/PopFrames002Test.java +++ b/jdwp/src/test/java/org/apache/harmony/jpda/tests/jdwp/StackFrame/PopFrames002Test.java @@ -364,7 +364,7 @@ public class PopFrames002Test extends JDWPStackFrameTestCase { invokeCommand.setNextValueAsThreadID(breakpointThreadID); invokeCommand.setNextValueAsMethodID(toInvokeMethodID); invokeCommand.setNextValueAsInt(1); // args number - invokeCommand.setNextValueAsValue(new Value(timeOfMethodInvocation)); + invokeCommand.setNextValueAsValue(Value.createLong(timeOfMethodInvocation)); invokeCommand .setNextValueAsInt(JDWPConstants.InvokeOptions.INVOKE_SINGLE_THREADED); diff --git a/jdwp/src/test/java/org/apache/harmony/jpda/tests/jdwp/StackFrame/SetValues002Test.java b/jdwp/src/test/java/org/apache/harmony/jpda/tests/jdwp/StackFrame/SetValues002Test.java index d528758..257a652 100644 --- a/jdwp/src/test/java/org/apache/harmony/jpda/tests/jdwp/StackFrame/SetValues002Test.java +++ b/jdwp/src/test/java/org/apache/harmony/jpda/tests/jdwp/StackFrame/SetValues002Test.java @@ -32,8 +32,8 @@ public class SetValues002Test extends JDWPStackFrameAccessTest { */ public void testSetValues001_Boolean() { StackFrameTester tester = new StackFrameTester(StackTrace002Debuggee.BOOLEAN_SIGNAL); - Value oldValue = new Value(StackTrace002Debuggee.BOOLEAN_PARAM_VALUE); - Value newValue = new Value(StackTrace002Debuggee.BOOLEAN_PARAM_VALUE_TO_SET); + Value oldValue = Value.createBoolean(StackTrace002Debuggee.BOOLEAN_PARAM_VALUE); + Value newValue = Value.createBoolean(StackTrace002Debuggee.BOOLEAN_PARAM_VALUE_TO_SET); MethodInfo suspensionMethodInfo = tester.addTestMethod("breakpointBoolean"); suspensionMethodInfo.addVariable("param", oldValue, newValue); MethodInfo methodInfo = tester.addTestMethod("runBreakpointBoolean"); @@ -49,8 +49,8 @@ public class SetValues002Test extends JDWPStackFrameAccessTest { */ public void testSetValues002_Byte() { StackFrameTester tester = new StackFrameTester(StackTrace002Debuggee.BYTE_SIGNAL); - Value oldValue = new Value(StackTrace002Debuggee.BYTE_PARAM_VALUE); - Value newValue = new Value(StackTrace002Debuggee.BYTE_PARAM_VALUE_TO_SET); + Value oldValue = Value.createByte(StackTrace002Debuggee.BYTE_PARAM_VALUE); + Value newValue = Value.createByte(StackTrace002Debuggee.BYTE_PARAM_VALUE_TO_SET); MethodInfo suspensionMethodInfo = tester.addTestMethod("breakpointByte"); suspensionMethodInfo.addVariable("param", oldValue, newValue); MethodInfo methodInfo = tester.addTestMethod("runBreakpointByte"); @@ -66,8 +66,8 @@ public class SetValues002Test extends JDWPStackFrameAccessTest { */ public void testSetValues003_Char() { StackFrameTester tester = new StackFrameTester(StackTrace002Debuggee.CHAR_SIGNAL); - Value oldValue = new Value(StackTrace002Debuggee.CHAR_PARAM_VALUE); - Value newValue = new Value(StackTrace002Debuggee.CHAR_PARAM_VALUE_TO_SET); + Value oldValue = Value.createChar(StackTrace002Debuggee.CHAR_PARAM_VALUE); + Value newValue = Value.createChar(StackTrace002Debuggee.CHAR_PARAM_VALUE_TO_SET); MethodInfo suspensionMethodInfo = tester.addTestMethod("breakpointChar"); suspensionMethodInfo.addVariable("param", oldValue, newValue); MethodInfo methodInfo = tester.addTestMethod("runBreakpointChar"); @@ -83,8 +83,8 @@ public class SetValues002Test extends JDWPStackFrameAccessTest { */ public void testSetValues004_Short() { StackFrameTester tester = new StackFrameTester(StackTrace002Debuggee.SHORT_SIGNAL); - Value oldValue = new Value(StackTrace002Debuggee.SHORT_PARAM_VALUE); - Value newValue = new Value(StackTrace002Debuggee.SHORT_PARAM_VALUE_TO_SET); + Value oldValue = Value.createShort(StackTrace002Debuggee.SHORT_PARAM_VALUE); + Value newValue = Value.createShort(StackTrace002Debuggee.SHORT_PARAM_VALUE_TO_SET); MethodInfo suspensionMethodInfo = tester.addTestMethod("breakpointShort"); suspensionMethodInfo.addVariable("param", oldValue, newValue); MethodInfo methodInfo = tester.addTestMethod("runBreakpointShort"); @@ -100,8 +100,8 @@ public class SetValues002Test extends JDWPStackFrameAccessTest { */ public void testSetValues005_Int() { StackFrameTester tester = new StackFrameTester(StackTrace002Debuggee.INT_SIGNAL); - Value oldValue = new Value(StackTrace002Debuggee.INT_PARAM_VALUE); - Value newValue = new Value(StackTrace002Debuggee.INT_PARAM_VALUE_TO_SET); + Value oldValue = Value.createInt(StackTrace002Debuggee.INT_PARAM_VALUE); + Value newValue = Value.createInt(StackTrace002Debuggee.INT_PARAM_VALUE_TO_SET); MethodInfo suspensionMethodInfo = tester.addTestMethod("breakpointInt"); suspensionMethodInfo.addVariable("param", oldValue, newValue); MethodInfo methodInfo = tester.addTestMethod("runBreakpointInt"); @@ -118,8 +118,8 @@ public class SetValues002Test extends JDWPStackFrameAccessTest { public void testSetValues005_IntConstant() { StackFrameTester tester = new StackFrameTester( StackTrace002Debuggee.INT_CONSTANT_METHOD_SIGNAL); - Value oldValue = new Value(StackTrace002Debuggee.INT_PARAM_VALUE); - Value newValue = new Value(StackTrace002Debuggee.INT_PARAM_VALUE_TO_SET); + Value oldValue = Value.createInt(StackTrace002Debuggee.INT_PARAM_VALUE); + Value newValue = Value.createInt(StackTrace002Debuggee.INT_PARAM_VALUE_TO_SET); MethodInfo suspensionMethodInfo = tester.addTestMethod("breakpointIntConstant"); suspensionMethodInfo.addVariable("param", oldValue, newValue); MethodInfo methodInfo = tester.addTestMethod("runBreakpointIntConstant"); @@ -136,10 +136,10 @@ public class SetValues002Test extends JDWPStackFrameAccessTest { public void testSetValues005_IntTwoConstants() { StackFrameTester tester = new StackFrameTester( StackTrace002Debuggee.INT_TWO_CONSTANTS_METHOD_SIGNAL); - Value oldValueForLocal1 = new Value(StackTrace002Debuggee.INT_PARAM_VALUE); - Value newValueForLocal1 = new Value(StackTrace002Debuggee.INT_PARAM_VALUE_TO_SET); - Value oldValueForLocal2 = new Value(-StackTrace002Debuggee.INT_PARAM_VALUE); - Value newValueForLocal2 = new Value(-StackTrace002Debuggee.INT_PARAM_VALUE_TO_SET); + Value oldValueForLocal1 = Value.createInt(StackTrace002Debuggee.INT_PARAM_VALUE); + Value newValueForLocal1 = Value.createInt(StackTrace002Debuggee.INT_PARAM_VALUE_TO_SET); + Value oldValueForLocal2 = Value.createInt(-StackTrace002Debuggee.INT_PARAM_VALUE); + Value newValueForLocal2 = Value.createInt(-StackTrace002Debuggee.INT_PARAM_VALUE_TO_SET); MethodInfo suspensionMethodInfo = tester.addTestMethod("breakpointIntTwoConstants"); suspensionMethodInfo.addVariable("param1", oldValueForLocal1, newValueForLocal1); suspensionMethodInfo.addVariable("param2", oldValueForLocal2, newValueForLocal2); @@ -159,8 +159,8 @@ public class SetValues002Test extends JDWPStackFrameAccessTest { public void testSetValues005_IntConstantWithException() { StackFrameTester tester = new StackFrameTester( StackTrace002Debuggee.INT_CONSTANT_METHOD_WITH_EXCEPTION_SIGNAL); - Value oldValue = new Value(StackTrace002Debuggee.INT_PARAM_VALUE); - Value newValue = new Value(StackTrace002Debuggee.INT_PARAM_VALUE_TO_SET); + Value oldValue = Value.createInt(StackTrace002Debuggee.INT_PARAM_VALUE); + Value newValue = Value.createInt(StackTrace002Debuggee.INT_PARAM_VALUE_TO_SET); MethodInfo suspensionMethodInfo = tester.addTestMethod("breakpointIntConstantWithException"); suspensionMethodInfo.addVariable("param", oldValue, newValue); @@ -179,8 +179,8 @@ public class SetValues002Test extends JDWPStackFrameAccessTest { public void testSetValues005_IntConstantWithExceptionInCallee() { StackFrameTester tester = new StackFrameTester( StackTrace002Debuggee.INT_CONSTANT_METHOD_WITH_EXCEPTION_IN_CALLEE_SIGNAL); - Value oldValue = new Value(StackTrace002Debuggee.INT_PARAM_VALUE); - Value newValue = new Value(StackTrace002Debuggee.INT_PARAM_VALUE_TO_SET); + Value oldValue = Value.createInt(StackTrace002Debuggee.INT_PARAM_VALUE); + Value newValue = Value.createInt(StackTrace002Debuggee.INT_PARAM_VALUE_TO_SET); MethodInfo suspensionMethodInfo = tester.addTestMethod("breakpointIntConstantWithException"); suspensionMethodInfo.addVariable("param", oldValue, newValue); @@ -200,8 +200,8 @@ public class SetValues002Test extends JDWPStackFrameAccessTest { public void testSetValues005_IntConstantWithExceptionInCaller() { StackFrameTester tester = new StackFrameTester( StackTrace002Debuggee.INT_CONSTANT_METHOD_WITH_EXCEPTION_IN_CALLER_SIGNAL); - Value oldValue = new Value(StackTrace002Debuggee.INT_PARAM_VALUE); - Value newValue = new Value(StackTrace002Debuggee.INT_PARAM_VALUE_TO_SET); + Value oldValue = Value.createInt(StackTrace002Debuggee.INT_PARAM_VALUE); + Value newValue = Value.createInt(StackTrace002Debuggee.INT_PARAM_VALUE_TO_SET); // Throwing an exception will unwind the frame where we set the value. So we expect to // read the initial value on second suspension. Value expectedValueAfterSet = oldValue; @@ -224,8 +224,8 @@ public class SetValues002Test extends JDWPStackFrameAccessTest { public void testSetValues005_IntConstantWithExceptionAndNativeTransition() { StackFrameTester tester = new StackFrameTester( StackTrace002Debuggee.INT_CONSTANT_METHOD_WITH_EXCEPTION_FROM_NATIVE_SIGNAL); - Value oldValue = new Value(StackTrace002Debuggee.INT_PARAM_VALUE); - Value newValue = new Value(StackTrace002Debuggee.INT_PARAM_VALUE_TO_SET); + Value oldValue = Value.createInt(StackTrace002Debuggee.INT_PARAM_VALUE); + Value newValue = Value.createInt(StackTrace002Debuggee.INT_PARAM_VALUE_TO_SET); MethodInfo suspensionMethodInfo = tester.addTestMethod("breakpointIntConstantWithException"); suspensionMethodInfo.addVariable("param", oldValue, newValue); @@ -243,8 +243,8 @@ public class SetValues002Test extends JDWPStackFrameAccessTest { */ public void testSetValues006_Long() { StackFrameTester tester = new StackFrameTester(StackTrace002Debuggee.LONG_METHOD_SIGNAL); - Value oldValue = new Value(StackTrace002Debuggee.LONG_PARAM_VALUE); - Value newValue = new Value(StackTrace002Debuggee.LONG_PARAM_VALUE_TO_SET); + Value oldValue = Value.createLong(StackTrace002Debuggee.LONG_PARAM_VALUE); + Value newValue = Value.createLong(StackTrace002Debuggee.LONG_PARAM_VALUE_TO_SET); MethodInfo suspensionMethodInfo = tester.addTestMethod("breakpointLong"); suspensionMethodInfo.addVariable("param", oldValue, newValue); MethodInfo methodInfo = tester.addTestMethod("runBreakpointLong"); @@ -260,8 +260,8 @@ public class SetValues002Test extends JDWPStackFrameAccessTest { */ public void testSetValues007_Float() { StackFrameTester tester = new StackFrameTester(StackTrace002Debuggee.FLOAT_METHOD); - Value oldValue = new Value(StackTrace002Debuggee.FLOAT_PARAM_VALUE); - Value newValue = new Value(StackTrace002Debuggee.FLOAT_PARAM_VALUE_TO_SET); + Value oldValue = Value.createFloat(StackTrace002Debuggee.FLOAT_PARAM_VALUE); + Value newValue = Value.createFloat(StackTrace002Debuggee.FLOAT_PARAM_VALUE_TO_SET); MethodInfo suspensionMethodInfo = tester.addTestMethod("breakpointFloat"); suspensionMethodInfo.addVariable("param", oldValue, newValue); MethodInfo methodInfo = tester.addTestMethod("runBreakpointFloat"); @@ -277,8 +277,8 @@ public class SetValues002Test extends JDWPStackFrameAccessTest { */ public void testSetValues008_Double() { StackFrameTester tester = new StackFrameTester(StackTrace002Debuggee.DOUBLE_METHOD); - Value oldValue = new Value(StackTrace002Debuggee.DOUBLE_PARAM_VALUE); - Value newValue = new Value(StackTrace002Debuggee.DOUBLE_PARAM_VALUE_TO_SET); + Value oldValue = Value.createDouble(StackTrace002Debuggee.DOUBLE_PARAM_VALUE); + Value newValue = Value.createDouble(StackTrace002Debuggee.DOUBLE_PARAM_VALUE_TO_SET); MethodInfo suspensionMethodInfo = tester.addTestMethod("breakpointDouble"); suspensionMethodInfo.addVariable("param", oldValue, newValue); MethodInfo methodInfo = tester.addTestMethod("runBreakpointDouble"); diff --git a/jdwp/src/test/java/org/apache/harmony/jpda/tests/jdwp/StackFrame/SetValuesTest.java b/jdwp/src/test/java/org/apache/harmony/jpda/tests/jdwp/StackFrame/SetValuesTest.java index 39763d0..cc1d5d7 100644 --- a/jdwp/src/test/java/org/apache/harmony/jpda/tests/jdwp/StackFrame/SetValuesTest.java +++ b/jdwp/src/test/java/org/apache/harmony/jpda/tests/jdwp/StackFrame/SetValuesTest.java @@ -203,9 +203,9 @@ public class SetValuesTest extends JDWPStackTraceBaseTest { packet.setNextValueAsInt(varTags.length-2); packet.setNextValueAsInt(varInfoByName("boolLocalVariable").getSlot()); - packet.setNextValueAsValue(new Value(false)); + packet.setNextValueAsValue(Value.createBoolean(false)); packet.setNextValueAsInt(varInfoByName("intLocalVariable").getSlot()); - packet.setNextValueAsValue(new Value((int)12345)); + packet.setNextValueAsValue(Value.createInt(12345)); ReplyPacket reply = debuggeeWrapper.vmMirror.performCommand(packet); checkReplyPacket(reply, "StackFrame::SetValues command"); diff --git a/jdwp/src/test/java/org/apache/harmony/jpda/tests/jdwp/ThreadReference/ForceEarlyReturn002Test.java b/jdwp/src/test/java/org/apache/harmony/jpda/tests/jdwp/ThreadReference/ForceEarlyReturn002Test.java index 97ab6c2..befaf77 100644 --- a/jdwp/src/test/java/org/apache/harmony/jpda/tests/jdwp/ThreadReference/ForceEarlyReturn002Test.java +++ b/jdwp/src/test/java/org/apache/harmony/jpda/tests/jdwp/ThreadReference/ForceEarlyReturn002Test.java @@ -76,7 +76,7 @@ public class ForceEarlyReturn002Test extends JDWPSyncTestCase { JDWPCommands.ThreadReferenceCommandSet.CommandSetID, JDWPCommands.ThreadReferenceCommandSet.ForceEarlyReturnCommand); forceEarlyReturnPacket.setNextValueAsThreadID(testedThreadID); - forceEarlyReturnPacket.setNextValueAsValue(new Value(EXPECTED_LONG)); + forceEarlyReturnPacket.setNextValueAsValue(Value.createLong(EXPECTED_LONG)); // Perform the command logWriter.println("==> Perform " + thisCommandName); diff --git a/jdwp/src/test/java/org/apache/harmony/jpda/tests/jdwp/ThreadReference/ForceEarlyReturn003Test.java b/jdwp/src/test/java/org/apache/harmony/jpda/tests/jdwp/ThreadReference/ForceEarlyReturn003Test.java index 5f8cad3..17b3f27 100644 --- a/jdwp/src/test/java/org/apache/harmony/jpda/tests/jdwp/ThreadReference/ForceEarlyReturn003Test.java +++ b/jdwp/src/test/java/org/apache/harmony/jpda/tests/jdwp/ThreadReference/ForceEarlyReturn003Test.java @@ -80,7 +80,7 @@ public class ForceEarlyReturn003Test extends JDWPSyncTestCase { JDWPCommands.ThreadReferenceCommandSet.CommandSetID, JDWPCommands.ThreadReferenceCommandSet.ForceEarlyReturnCommand); forceEarlyReturnPacket.setNextValueAsThreadID(testedThreadID); - forceEarlyReturnPacket.setNextValueAsValue(new Value(EXPECTED_FLOAT)); + forceEarlyReturnPacket.setNextValueAsValue(Value.createFloat(EXPECTED_FLOAT)); // Perform the command logWriter.println("==> Perform " + thisCommandName); diff --git a/jdwp/src/test/java/org/apache/harmony/jpda/tests/jdwp/ThreadReference/ForceEarlyReturn004Test.java b/jdwp/src/test/java/org/apache/harmony/jpda/tests/jdwp/ThreadReference/ForceEarlyReturn004Test.java index 0cc91c2..e660143 100644 --- a/jdwp/src/test/java/org/apache/harmony/jpda/tests/jdwp/ThreadReference/ForceEarlyReturn004Test.java +++ b/jdwp/src/test/java/org/apache/harmony/jpda/tests/jdwp/ThreadReference/ForceEarlyReturn004Test.java @@ -80,7 +80,7 @@ public class ForceEarlyReturn004Test extends JDWPSyncTestCase { JDWPCommands.ThreadReferenceCommandSet.CommandSetID, JDWPCommands.ThreadReferenceCommandSet.ForceEarlyReturnCommand); forceEarlyReturnPacket.setNextValueAsThreadID(testedThreadID); - forceEarlyReturnPacket.setNextValueAsValue(new Value(EXPECTED_DOUBLE)); + forceEarlyReturnPacket.setNextValueAsValue(Value.createDouble(EXPECTED_DOUBLE)); // Perform the command logWriter.println("==> Perform " + thisCommandName); diff --git a/jdwp/src/test/java/org/apache/harmony/jpda/tests/jdwp/ThreadReference/ForceEarlyReturn005Test.java b/jdwp/src/test/java/org/apache/harmony/jpda/tests/jdwp/ThreadReference/ForceEarlyReturn005Test.java index 83cc7ce..10b2f2d 100644 --- a/jdwp/src/test/java/org/apache/harmony/jpda/tests/jdwp/ThreadReference/ForceEarlyReturn005Test.java +++ b/jdwp/src/test/java/org/apache/harmony/jpda/tests/jdwp/ThreadReference/ForceEarlyReturn005Test.java @@ -22,7 +22,6 @@ import org.apache.harmony.jpda.tests.framework.jdwp.CommandPacket; import org.apache.harmony.jpda.tests.framework.jdwp.JDWPCommands; import org.apache.harmony.jpda.tests.framework.jdwp.ReplyPacket; import org.apache.harmony.jpda.tests.framework.jdwp.Value; -import org.apache.harmony.jpda.tests.framework.jdwp.JDWPConstants.Tag; import org.apache.harmony.jpda.tests.jdwp.share.JDWPSyncTestCase; import org.apache.harmony.jpda.tests.share.JPDADebuggeeSynchronizer; @@ -80,7 +79,7 @@ public class ForceEarlyReturn005Test extends JDWPSyncTestCase { JDWPCommands.ThreadReferenceCommandSet.CommandSetID, JDWPCommands.ThreadReferenceCommandSet.ForceEarlyReturnCommand); forceEarlyReturnPacket.setNextValueAsThreadID(testedThreadID); - forceEarlyReturnPacket.setNextValueAsValue(new Value(Tag.VOID_TAG, 0)); + forceEarlyReturnPacket.setNextValueAsValue(Value.createVoidValue()); // Perform the command logWriter.println("==> Perform " + thisCommandName); diff --git a/jdwp/src/test/java/org/apache/harmony/jpda/tests/jdwp/ThreadReference/ForceEarlyReturn006Test.java b/jdwp/src/test/java/org/apache/harmony/jpda/tests/jdwp/ThreadReference/ForceEarlyReturn006Test.java index 04023b2..43946d6 100644 --- a/jdwp/src/test/java/org/apache/harmony/jpda/tests/jdwp/ThreadReference/ForceEarlyReturn006Test.java +++ b/jdwp/src/test/java/org/apache/harmony/jpda/tests/jdwp/ThreadReference/ForceEarlyReturn006Test.java @@ -109,8 +109,8 @@ public class ForceEarlyReturn006Test extends JDWPSyncTestCase { JDWPCommands.ThreadReferenceCommandSet.CommandSetID, JDWPCommands.ThreadReferenceCommandSet.ForceEarlyReturnCommand); forceEarlyReturnPacket.setNextValueAsThreadID(testedThreadID); - forceEarlyReturnPacket.setNextValueAsValue(new Value(Tag.OBJECT_TAG, - testObjID)); + forceEarlyReturnPacket + .setNextValueAsValue(Value.createObjectValue(Tag.OBJECT_TAG, testObjID)); // Perform the command logWriter.println("==> Perform " + thisCommandName); diff --git a/jdwp/src/test/java/org/apache/harmony/jpda/tests/jdwp/ThreadReference/ForceEarlyReturnTest.java b/jdwp/src/test/java/org/apache/harmony/jpda/tests/jdwp/ThreadReference/ForceEarlyReturnTest.java index 6838b7c..19f3a21 100644 --- a/jdwp/src/test/java/org/apache/harmony/jpda/tests/jdwp/ThreadReference/ForceEarlyReturnTest.java +++ b/jdwp/src/test/java/org/apache/harmony/jpda/tests/jdwp/ThreadReference/ForceEarlyReturnTest.java @@ -150,7 +150,7 @@ public class ForceEarlyReturnTest extends JDWPSyncTestCase { public void testForceEarlyReturn_ReturnInt() { thisTestName = "testForceEarlyReturn_ReturnInt"; testThreadName = ForceEarlyReturnDebuggee.THREAD_INT; - expectedValue = new Value(EXPECTED_INT); + expectedValue = Value.createInt(EXPECTED_INT); RunTestForceEarlyReturn(); } @@ -166,7 +166,7 @@ public class ForceEarlyReturnTest extends JDWPSyncTestCase { public void testForceEarlyReturn_ReturnShort() { thisTestName = "testForceEarlyReturn_ReturnShort"; testThreadName = ForceEarlyReturnDebuggee.THREAD_SHORT; - expectedValue = new Value(EXPECTED_SHORT); + expectedValue = Value.createShort(EXPECTED_SHORT); RunTestForceEarlyReturn(); } @@ -182,7 +182,7 @@ public class ForceEarlyReturnTest extends JDWPSyncTestCase { public void testForceEarlyReturn_ReturnByte() { thisTestName = "testForceEarlyReturn_ReturnByte"; testThreadName = ForceEarlyReturnDebuggee.THREAD_BYTE; - expectedValue = new Value(EXPECTED_BYTE); + expectedValue = Value.createByte(EXPECTED_BYTE); RunTestForceEarlyReturn(); } @@ -198,7 +198,7 @@ public class ForceEarlyReturnTest extends JDWPSyncTestCase { public void testForceEarlyReturn_ReturnChar() { thisTestName = "testForceEarlyReturn_ReturnChar"; testThreadName = ForceEarlyReturnDebuggee.THREAD_CHAR; - expectedValue = new Value(EXPECTED_CHAR); + expectedValue = Value.createChar(EXPECTED_CHAR); RunTestForceEarlyReturn(); } @@ -214,7 +214,7 @@ public class ForceEarlyReturnTest extends JDWPSyncTestCase { public void testForceEarlyReturn_ReturnBoolean() { thisTestName = "testForceEarlyReturn_ReturnBoolean"; testThreadName = ForceEarlyReturnDebuggee.THREAD_BOOLEAN; - expectedValue = new Value(EXPECTED_BOOLEAN); + expectedValue = Value.createBoolean(EXPECTED_BOOLEAN); RunTestForceEarlyReturn(); } @@ -228,7 +228,7 @@ public class ForceEarlyReturnTest extends JDWPSyncTestCase { public void testForceEarlyReturn_NotSuspended() { thisTestName = "testForceEarlyReturn_NotSuspended"; testThreadName = "test"; - expectedValue = new Value(Tag.VOID_TAG, 0); + expectedValue = Value.createVoidValue(); logWriter.println("==> " + thisTestName + " for " + thisCommandName + ": START..."); |