8153782: [JVMCI] update JVMCI sources to Eclipse 4.5.2 format style

Reviewed-by: twisti, never
This commit is contained in:
Doug Simon 2016-05-11 16:40:04 +00:00
parent 1917be9572
commit 1d60ce77a0
29 changed files with 592 additions and 616 deletions

View File

@ -25,8 +25,8 @@ package jdk.vm.ci.code;
/**
* Constants and intrinsic definition for memory barriers.
*
* The documentation for each constant is taken from Doug Lea's <a
* href="http://gee.cs.oswego.edu/dl/jmm/cookbook.html">The JSR-133 Cookbook for Compiler
* The documentation for each constant is taken from Doug Lea's
* <a href="http://gee.cs.oswego.edu/dl/jmm/cookbook.html">The JSR-133 Cookbook for Compiler
* Writers</a>.
* <p>
* The {@code JMM_*} constants capture the memory barriers necessary to implement the Java Memory

View File

@ -56,8 +56,8 @@ public class TargetDescription {
public final JavaKind wordJavaKind;
/**
* The stack alignment requirement of the platform. For example, from Appendix D of <a
* href="http://www.intel.com/Assets/PDF/manual/248966.pdf">Intel 64 and IA-32 Architectures
* The stack alignment requirement of the platform. For example, from Appendix D of
* <a href="http://www.intel.com/Assets/PDF/manual/248966.pdf">Intel 64 and IA-32 Architectures
* Optimization Reference Manual</a>:
*
* <pre>

View File

@ -21,10 +21,10 @@
* questions.
*/
/**
* Package that defines the interface between a Java application that wants to install code and the runtime.
* The runtime provides in implementation of the {@link jdk.vm.ci.code.CodeCacheProvider} interface.
* The method {@link jdk.vm.ci.code.CodeCacheProvider#addCode(jdk.vm.ci.meta.ResolvedJavaMethod, CompiledCode, jdk.vm.ci.meta.SpeculationLog, InstalledCode)}
* Package that defines the interface between a Java application that wants to install code and the
* runtime. The runtime provides in implementation of the {@link jdk.vm.ci.code.CodeCacheProvider}
* interface. The method
* {@link jdk.vm.ci.code.CodeCacheProvider#addCode(jdk.vm.ci.meta.ResolvedJavaMethod, CompiledCode, jdk.vm.ci.meta.SpeculationLog, InstalledCode)}
* can be used to install code.
*/
package jdk.vm.ci.code;

View File

@ -122,7 +122,8 @@ public class AArch64HotSpotJVMCIBackendFactory implements HotSpotJVMCIBackendFac
}
}
protected JVMCIBackend createBackend(HotSpotMetaAccessProvider metaAccess, HotSpotCodeCacheProvider codeCache, ConstantReflectionProvider constantReflection, StackIntrospection stackIntrospection) {
protected JVMCIBackend createBackend(HotSpotMetaAccessProvider metaAccess, HotSpotCodeCacheProvider codeCache, ConstantReflectionProvider constantReflection,
StackIntrospection stackIntrospection) {
return new JVMCIBackend(metaAccess, codeCache, constantReflection, stackIntrospection);
}
}

View File

@ -206,7 +206,8 @@ public class AMD64HotSpotJVMCIBackendFactory implements HotSpotJVMCIBackendFacto
}
}
protected JVMCIBackend createBackend(HotSpotMetaAccessProvider metaAccess, HotSpotCodeCacheProvider codeCache, ConstantReflectionProvider constantReflection, StackIntrospection stackIntrospection) {
protected JVMCIBackend createBackend(HotSpotMetaAccessProvider metaAccess, HotSpotCodeCacheProvider codeCache, ConstantReflectionProvider constantReflection,
StackIntrospection stackIntrospection) {
return new JVMCIBackend(metaAccess, codeCache, constantReflection, stackIntrospection);
}
}

View File

@ -246,8 +246,8 @@ final class CompilerToVM {
native void resolveInvokeDynamicInPool(HotSpotConstantPool constantPool, int cpi);
/**
* Ensures that the type referenced by the entry for a <a
* href="https://docs.oracle.com/javase/specs/jvms/se8/html/jvms-2.html#jvms-2.9">signature
* Ensures that the type referenced by the entry for a
* <a href="https://docs.oracle.com/javase/specs/jvms/se8/html/jvms-2.html#jvms-2.9">signature
* polymorphic</a> method at index {@code cpi} in {@code constantPool} is loaded and
* initialized.
*

View File

@ -152,7 +152,8 @@ public class HotSpotMetaAccessProvider implements MetaAccessProvider, HotSpotPro
int actionValue = convertDeoptAction(action);
int reasonValue = convertDeoptReason(reason);
int debugValue = debugId & intMaskRight(config.deoptimizationDebugIdBits);
JavaConstant c = JavaConstant.forInt(~((debugValue << config.deoptimizationDebugIdShift) | (reasonValue << config.deoptimizationReasonShift) | (actionValue << config.deoptimizationActionShift)));
JavaConstant c = JavaConstant.forInt(
~((debugValue << config.deoptimizationDebugIdShift) | (reasonValue << config.deoptimizationReasonShift) | (actionValue << config.deoptimizationActionShift)));
assert c.asInt() < 0;
return c;
}

View File

@ -32,7 +32,7 @@ import java.util.Formatter;
import jdk.vm.ci.meta.JavaMethod;
import jdk.vm.ci.meta.ResolvedJavaMethod;
abstract class HotSpotMethod implements JavaMethod, Formattable /* , JavaMethodContex */{
abstract class HotSpotMethod implements JavaMethod, Formattable /* , JavaMethodContex */ {
public static String applyFormattingFlagsAndWidth(String s, int flags, int width) {
if (flags == 0 && width < 0) {

View File

@ -27,8 +27,8 @@ package jdk.vm.ci.inittimer;
*/
public @interface SuppressFBWarnings {
/**
* The set of FindBugs <a
* href="http://findbugs.sourceforge.net/bugDescriptions.html">warnings</a> that are to be
* The set of FindBugs
* <a href="http://findbugs.sourceforge.net/bugDescriptions.html">warnings</a> that are to be
* suppressed in annotated element. The value can be a bug category, kind or pattern.
*/
String[] value();

View File

@ -123,10 +123,10 @@ public interface ConstantReflectionProvider {
JavaConstant boxPrimitive(JavaConstant source);
/**
* Converts the given {@link JavaKind#Object object} constant to a
* {@link JavaKind#isPrimitive() primitive} constant, according to the Java unboxing rules.
* Returns {@code null} if the source is is not an object constant that can be unboxed, or the
* unboxed value is not available at this point.
* Converts the given {@link JavaKind#Object object} constant to a {@link JavaKind#isPrimitive()
* primitive} constant, according to the Java unboxing rules. Returns {@code null} if the source
* is is not an object constant that can be unboxed, or the unboxed value is not available at
* this point.
*/
JavaConstant unboxPrimitive(JavaConstant source);

View File

@ -81,8 +81,8 @@ public interface MetaAccessProvider {
long getMemorySize(JavaConstant constant);
/**
* Parses a <a
* href="http://docs.oracle.com/javase/specs/jvms/se7/html/jvms-4.html#jvms-4.3.3">method
* Parses a
* <a href="http://docs.oracle.com/javase/specs/jvms/se7/html/jvms-4.html#jvms-4.3.3">method
* descriptor</a> into a {@link Signature}. The behavior of this method is undefined if the
* method descriptor is not well formed.
*/

View File

@ -94,8 +94,8 @@ public interface ResolvedJavaMethod extends JavaMethod, InvokeTarget, ModifiersP
}
/**
* Checks that the method is a <a
* href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-4.html#jvms-4.6">varargs</a>
* Checks that the method is a
* <a href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-4.html#jvms-4.6">varargs</a>
* method.
*
* @return whether the method is a varargs method
@ -105,8 +105,8 @@ public interface ResolvedJavaMethod extends JavaMethod, InvokeTarget, ModifiersP
}
/**
* Checks that the method is a <a
* href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-4.html#jvms-4.6">bridge</a>
* Checks that the method is a
* <a href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-4.html#jvms-4.6">bridge</a>
* method.
*
* @return whether the method is a bridge method
@ -332,8 +332,8 @@ public interface ResolvedJavaMethod extends JavaMethod, InvokeTarget, ModifiersP
SpeculationLog getSpeculationLog();
/**
* Determines if the method identified by its holder and name is a <a
* href="https://docs.oracle.com/javase/specs/jvms/se8/html/jvms-2.html#jvms-2.9">signature
* Determines if the method identified by its holder and name is a
* <a href="https://docs.oracle.com/javase/specs/jvms/se8/html/jvms-2.html#jvms-2.9">signature
* polymorphic</a> method.
*/
static boolean isSignaturePolymorphic(JavaType holder, String name, MetaAccessProvider metaAccess) {

View File

@ -276,10 +276,10 @@ public interface ResolvedJavaType extends JavaType, ModifiersProvider, Annotated
ResolvedJavaField[] getInstanceFields(boolean includeSuperclasses);
/**
* Returns the static fields of this class, including
* {@linkplain ResolvedJavaField#isInternal() internal} fields. A zero-length array is returned
* for array and primitive types. The order of fields returned by this method is stable. That
* is, for a single JVM execution the same order is returned each time this method is called.
* Returns the static fields of this class, including {@linkplain ResolvedJavaField#isInternal()
* internal} fields. A zero-length array is returned for array and primitive types. The order of
* fields returned by this method is stable. That is, for a single JVM execution the same order
* is returned each time this method is called.
*/
ResolvedJavaField[] getStaticFields();

View File

@ -84,8 +84,8 @@ public interface Signature {
}
/**
* Gets the <a
* href="http://docs.oracle.com/javase/specs/jvms/se7/html/jvms-4.html#jvms-4.3.3">method
* Gets the
* <a href="http://docs.oracle.com/javase/specs/jvms/se7/html/jvms-4.html#jvms-4.3.3">method
* descriptor</a> corresponding to this signature. For example:
*
* <pre>

View File

@ -22,8 +22,8 @@
*/
/**
* Package that defines the interface between a runtime and a Java application that wants to access meta information. The runtime
* provides an implementation of the {@link jdk.vm.ci.meta.MetaAccessProvider} interface.
* Package that defines the interface between a runtime and a Java application that wants to access
* meta information. The runtime provides an implementation of the
* {@link jdk.vm.ci.meta.MetaAccessProvider} interface.
*/
package jdk.vm.ci.meta;

View File

@ -34,26 +34,26 @@ public class AsJavaTypeDataProvider {
@DataProvider(name = "asJavaTypeDataProvider")
public static Object[][] asJavaTypeDataProvider() {
return new Object[][]{
{CONSTANT_REFLECTION_PROVIDER.forObject(DummyClass.class),
"jdk.vm.ci.hotspot.test.DummyClass"},
{CONSTANT_REFLECTION_PROVIDER.forObject(boolean.class), "boolean"},
{CONSTANT_REFLECTION_PROVIDER.forObject(byte.class), "byte"},
{CONSTANT_REFLECTION_PROVIDER.forObject(short.class), "short"},
{CONSTANT_REFLECTION_PROVIDER.forObject(char.class), "char"},
{CONSTANT_REFLECTION_PROVIDER.forObject(int.class), "int"},
{CONSTANT_REFLECTION_PROVIDER.forObject(long.class), "long"},
{CONSTANT_REFLECTION_PROVIDER.forObject(float.class), "float"},
{CONSTANT_REFLECTION_PROVIDER.forObject(double.class), "double"},
{CONSTANT_REFLECTION_PROVIDER.forObject(Object.class), "java.lang.Object"},
{CONSTANT_REFLECTION_PROVIDER.forObject(boolean[].class), "boolean[]"},
{CONSTANT_REFLECTION_PROVIDER.forObject(boolean[][].class), "boolean[][]"},
{CONSTANT_REFLECTION_PROVIDER.forObject(Object[].class), "java.lang.Object[]"},
{CONSTANT_REFLECTION_PROVIDER.forObject(Object[][].class), "java.lang.Object[][]"},
{JavaConstant.forBoolean(DUMMY_CLASS_INSTANCE.booleanField), null},
{CONSTANT_REFLECTION_PROVIDER.forObject(DUMMY_CLASS_INSTANCE.objectField), null},
{CONSTANT_REFLECTION_PROVIDER.forObject(DUMMY_CLASS_INSTANCE), null},
{CONSTANT_REFLECTION_PROVIDER.forObject(DUMMY_CLASS_INSTANCE.booleanArrayWithValues), null},
{CONSTANT_REFLECTION_PROVIDER.forObject(DUMMY_CLASS_INSTANCE.booleanArrayArrayWithValues), null},
{JavaConstant.NULL_POINTER, null}, {null, null}};
{CONSTANT_REFLECTION_PROVIDER.forObject(DummyClass.class),
"jdk.vm.ci.hotspot.test.DummyClass"},
{CONSTANT_REFLECTION_PROVIDER.forObject(boolean.class), "boolean"},
{CONSTANT_REFLECTION_PROVIDER.forObject(byte.class), "byte"},
{CONSTANT_REFLECTION_PROVIDER.forObject(short.class), "short"},
{CONSTANT_REFLECTION_PROVIDER.forObject(char.class), "char"},
{CONSTANT_REFLECTION_PROVIDER.forObject(int.class), "int"},
{CONSTANT_REFLECTION_PROVIDER.forObject(long.class), "long"},
{CONSTANT_REFLECTION_PROVIDER.forObject(float.class), "float"},
{CONSTANT_REFLECTION_PROVIDER.forObject(double.class), "double"},
{CONSTANT_REFLECTION_PROVIDER.forObject(Object.class), "java.lang.Object"},
{CONSTANT_REFLECTION_PROVIDER.forObject(boolean[].class), "boolean[]"},
{CONSTANT_REFLECTION_PROVIDER.forObject(boolean[][].class), "boolean[][]"},
{CONSTANT_REFLECTION_PROVIDER.forObject(Object[].class), "java.lang.Object[]"},
{CONSTANT_REFLECTION_PROVIDER.forObject(Object[][].class), "java.lang.Object[][]"},
{JavaConstant.forBoolean(DUMMY_CLASS_INSTANCE.booleanField), null},
{CONSTANT_REFLECTION_PROVIDER.forObject(DUMMY_CLASS_INSTANCE.objectField), null},
{CONSTANT_REFLECTION_PROVIDER.forObject(DUMMY_CLASS_INSTANCE), null},
{CONSTANT_REFLECTION_PROVIDER.forObject(DUMMY_CLASS_INSTANCE.booleanArrayWithValues), null},
{CONSTANT_REFLECTION_PROVIDER.forObject(DUMMY_CLASS_INSTANCE.booleanArrayArrayWithValues), null},
{JavaConstant.NULL_POINTER, null}, {null, null}};
}
}

View File

@ -37,25 +37,25 @@ public class BoxPrimitiveDataProvider {
LinkedList<Object[]> cfgSet = new LinkedList<>();
// Boolean testing
cfgSet.add(
new Object[]{JavaConstant.forBoolean(true), CONSTANT_REFLECTION_PROVIDER.forObject((Boolean) true)});
new Object[]{JavaConstant.forBoolean(true), CONSTANT_REFLECTION_PROVIDER.forObject((Boolean) true)});
cfgSet.add(new Object[]{JavaConstant.forBoolean(false),
CONSTANT_REFLECTION_PROVIDER.forObject((Boolean) false)});
CONSTANT_REFLECTION_PROVIDER.forObject((Boolean) false)});
// Boxed boolean testing (returns null)
cfgSet.add(new Object[]{CONSTANT_REFLECTION_PROVIDER.forObject((Boolean) true), null});
cfgSet.add(new Object[]{CONSTANT_REFLECTION_PROVIDER.forObject((Boolean) false), null});
for (byte number : new byte[]{-128, 0, 1, 127}) {
// Integer primitives testing
cfgSet.add(new Object[]{JavaConstant.forByte(number),
CONSTANT_REFLECTION_PROVIDER.forObject(Byte.valueOf(number))});
CONSTANT_REFLECTION_PROVIDER.forObject(Byte.valueOf(number))});
cfgSet.add(new Object[]{JavaConstant.forShort(number),
CONSTANT_REFLECTION_PROVIDER.forObject(Short.valueOf(number))});
CONSTANT_REFLECTION_PROVIDER.forObject(Short.valueOf(number))});
cfgSet.add(new Object[]{JavaConstant.forInt(number),
CONSTANT_REFLECTION_PROVIDER.forObject(Integer.valueOf(number))});
CONSTANT_REFLECTION_PROVIDER.forObject(Integer.valueOf(number))});
cfgSet.add(new Object[]{JavaConstant.forLong(number),
CONSTANT_REFLECTION_PROVIDER.forObject(Long.valueOf(number))});
CONSTANT_REFLECTION_PROVIDER.forObject(Long.valueOf(number))});
if (number >= 0) {
cfgSet.add(new Object[]{JavaConstant.forChar((char) number),
CONSTANT_REFLECTION_PROVIDER.forObject(Character.valueOf((char) number))});
CONSTANT_REFLECTION_PROVIDER.forObject(Character.valueOf((char) number))});
}
// Float and Double variables are not cached,
// so the tested method returns "null" on them
@ -78,7 +78,7 @@ public class BoxPrimitiveDataProvider {
// Non-primitives testing
cfgSet.add(new Object[]{CONSTANT_REFLECTION_PROVIDER.forObject(DUMMY_CLASS_INSTANCE.objectField), null});
cfgSet.add(new Object[]{CONSTANT_REFLECTION_PROVIDER.forObject(DUMMY_CLASS_INSTANCE.booleanArrayWithValues),
null});
null});
// Null testing
cfgSet.add(new Object[]{JavaConstant.NULL_POINTER, null});
cfgSet.add(new Object[]{null, null});

View File

@ -39,53 +39,53 @@ public class ConstantEqualsDataProvider {
HashMap<Object, Constant> constMap = new HashMap<>();
constMap.put(DUMMY_CLASS_INSTANCE.booleanField, JavaConstant.forBoolean(DUMMY_CLASS_INSTANCE.booleanField));
constMap.put(DUMMY_CLASS_INSTANCE.stableDefaultBooleanField,
JavaConstant.forBoolean(DUMMY_CLASS_INSTANCE.stableDefaultBooleanField));
JavaConstant.forBoolean(DUMMY_CLASS_INSTANCE.stableDefaultBooleanField));
constMap.put(DUMMY_CLASS_INSTANCE.byteField, JavaConstant.forByte(DUMMY_CLASS_INSTANCE.byteField));
constMap.put(DUMMY_CLASS_INSTANCE.finalByteField, JavaConstant.forByte(DUMMY_CLASS_INSTANCE.finalByteField));
constMap.put(DUMMY_CLASS_INSTANCE.stableDefaultByteField,
JavaConstant.forByte(DUMMY_CLASS_INSTANCE.stableDefaultByteField));
JavaConstant.forByte(DUMMY_CLASS_INSTANCE.stableDefaultByteField));
constMap.put(DUMMY_CLASS_INSTANCE.shortField, JavaConstant.forShort(DUMMY_CLASS_INSTANCE.shortField));
constMap.put(DUMMY_CLASS_INSTANCE.finalShortField, JavaConstant.forShort(DUMMY_CLASS_INSTANCE.finalShortField));
constMap.put(DUMMY_CLASS_INSTANCE.stableDefaultShortField,
JavaConstant.forShort(DUMMY_CLASS_INSTANCE.stableDefaultShortField));
JavaConstant.forShort(DUMMY_CLASS_INSTANCE.stableDefaultShortField));
constMap.put(DUMMY_CLASS_INSTANCE.intField, JavaConstant.forInt(DUMMY_CLASS_INSTANCE.intField));
constMap.put(DUMMY_CLASS_INSTANCE.finalIntField, JavaConstant.forInt(DUMMY_CLASS_INSTANCE.finalIntField));
constMap.put(DUMMY_CLASS_INSTANCE.stableDefaultIntField,
JavaConstant.forInt(DUMMY_CLASS_INSTANCE.stableDefaultIntField));
JavaConstant.forInt(DUMMY_CLASS_INSTANCE.stableDefaultIntField));
constMap.put(DUMMY_CLASS_INSTANCE.longField, JavaConstant.forLong(DUMMY_CLASS_INSTANCE.longField));
constMap.put(DUMMY_CLASS_INSTANCE.finalLongField, JavaConstant.forLong(DUMMY_CLASS_INSTANCE.finalLongField));
constMap.put(DUMMY_CLASS_INSTANCE.stableDefaultLongField,
JavaConstant.forLong(DUMMY_CLASS_INSTANCE.stableDefaultLongField));
JavaConstant.forLong(DUMMY_CLASS_INSTANCE.stableDefaultLongField));
constMap.put(DUMMY_CLASS_INSTANCE.doubleField, JavaConstant.forDouble(DUMMY_CLASS_INSTANCE.doubleField));
constMap.put(DUMMY_CLASS_INSTANCE.finalDoubleField,
JavaConstant.forDouble(DUMMY_CLASS_INSTANCE.finalDoubleField));
JavaConstant.forDouble(DUMMY_CLASS_INSTANCE.finalDoubleField));
constMap.put(DUMMY_CLASS_INSTANCE.stableDefaultDoubleField,
JavaConstant.forDouble(DUMMY_CLASS_INSTANCE.stableDefaultDoubleField));
JavaConstant.forDouble(DUMMY_CLASS_INSTANCE.stableDefaultDoubleField));
constMap.put(DUMMY_CLASS_INSTANCE.floatField, JavaConstant.forFloat(DUMMY_CLASS_INSTANCE.floatField));
constMap.put(DUMMY_CLASS_INSTANCE.finalFloatField, JavaConstant.forFloat(DUMMY_CLASS_INSTANCE.finalFloatField));
constMap.put(DUMMY_CLASS_INSTANCE.stableDefaultFloatField,
JavaConstant.forFloat(DUMMY_CLASS_INSTANCE.stableDefaultFloatField));
JavaConstant.forFloat(DUMMY_CLASS_INSTANCE.stableDefaultFloatField));
constMap.put(DUMMY_CLASS_INSTANCE.charField, JavaConstant.forChar(DUMMY_CLASS_INSTANCE.charField));
constMap.put(DUMMY_CLASS_INSTANCE.finalCharField, JavaConstant.forChar(DUMMY_CLASS_INSTANCE.finalCharField));
constMap.put(DUMMY_CLASS_INSTANCE.stableDefaultCharField,
JavaConstant.forChar(DUMMY_CLASS_INSTANCE.stableDefaultCharField));
JavaConstant.forChar(DUMMY_CLASS_INSTANCE.stableDefaultCharField));
constMap.put(DUMMY_CLASS_INSTANCE.stringField,
CONSTANT_REFLECTION_PROVIDER.forString(DUMMY_CLASS_INSTANCE.stringField));
CONSTANT_REFLECTION_PROVIDER.forString(DUMMY_CLASS_INSTANCE.stringField));
constMap.put(DUMMY_CLASS_INSTANCE.stringField2,
CONSTANT_REFLECTION_PROVIDER.forString(DUMMY_CLASS_INSTANCE.stringField2));
CONSTANT_REFLECTION_PROVIDER.forString(DUMMY_CLASS_INSTANCE.stringField2));
constMap.put(DUMMY_CLASS_INSTANCE.objectField,
CONSTANT_REFLECTION_PROVIDER.forObject(DUMMY_CLASS_INSTANCE.objectField));
CONSTANT_REFLECTION_PROVIDER.forObject(DUMMY_CLASS_INSTANCE.objectField));
constMap.put(DUMMY_CLASS_INSTANCE.finalObjectField,
CONSTANT_REFLECTION_PROVIDER.forObject(DUMMY_CLASS_INSTANCE.finalObjectField));
CONSTANT_REFLECTION_PROVIDER.forObject(DUMMY_CLASS_INSTANCE.finalObjectField));
constMap.put(DUMMY_CLASS_INSTANCE.stableDefaultObjectField,
CONSTANT_REFLECTION_PROVIDER.forObject(DUMMY_CLASS_INSTANCE.stableDefaultObjectField));
CONSTANT_REFLECTION_PROVIDER.forObject(DUMMY_CLASS_INSTANCE.stableDefaultObjectField));
constMap.put(null, null);
constMap.put(JavaConstant.NULL_POINTER, JavaConstant.NULL_POINTER);
LinkedList<Object[]> cfgSet = new LinkedList<>();
constMap.entrySet().stream().forEach((obj1) -> {
constMap.entrySet().stream().forEach((obj2) -> {
cfgSet.add(new Object[]{obj1.getValue(), obj2.getValue(),
Objects.equals(obj1.getKey(), obj2.getKey())});
Objects.equals(obj1.getKey(), obj2.getKey())});
});
});
return cfgSet.toArray(new Object[0][0]);

View File

@ -29,27 +29,27 @@ public class ForObjectDataProvider {
@DataProvider(name = "forObjectDataProvider")
public static Object[][] forObjectDataProvider() {
return new Object[][]{
{TestHelper.DUMMY_CLASS_INSTANCE.objectField,
"Object[Object@" + TestHelper.DUMMY_CLASS_INSTANCE.objectField.hashCode() + "]"},
{TestHelper.DUMMY_CLASS_INSTANCE.stringField,
"Object[String:\"" + TestHelper.DUMMY_CLASS_INSTANCE.stringField + "\"]"},
{TestHelper.DUMMY_CLASS_INSTANCE.booleanField,
"Object[" + TestHelper.DUMMY_CLASS_INSTANCE.booleanField + "]"},
{TestHelper.DUMMY_CLASS_INSTANCE.byteField,
"Object[" + TestHelper.DUMMY_CLASS_INSTANCE.byteField + "]"},
{TestHelper.DUMMY_CLASS_INSTANCE.charField,
"Object[" + TestHelper.DUMMY_CLASS_INSTANCE.charField + "]"},
{TestHelper.DUMMY_CLASS_INSTANCE.shortField,
"Object[" + TestHelper.DUMMY_CLASS_INSTANCE.shortField + "]"},
{TestHelper.DUMMY_CLASS_INSTANCE.intField,
"Object[" + TestHelper.DUMMY_CLASS_INSTANCE.intField + "]"},
{TestHelper.DUMMY_CLASS_INSTANCE.longField,
"Object[" + TestHelper.DUMMY_CLASS_INSTANCE.longField + "]"},
{TestHelper.DUMMY_CLASS_INSTANCE.floatField,
"Object[" + TestHelper.DUMMY_CLASS_INSTANCE.floatField + "]"},
{TestHelper.DUMMY_CLASS_INSTANCE.doubleField,
"Object[" + TestHelper.DUMMY_CLASS_INSTANCE.doubleField + "]"},
{new Object[0], "Object[Object[" + 0 + "]{}]"}, {new Object[1], "Object[Object[" + 1 + "]{null}]"},
{null, "Object[null]"}};
{TestHelper.DUMMY_CLASS_INSTANCE.objectField,
"Object[Object@" + TestHelper.DUMMY_CLASS_INSTANCE.objectField.hashCode() + "]"},
{TestHelper.DUMMY_CLASS_INSTANCE.stringField,
"Object[String:\"" + TestHelper.DUMMY_CLASS_INSTANCE.stringField + "\"]"},
{TestHelper.DUMMY_CLASS_INSTANCE.booleanField,
"Object[" + TestHelper.DUMMY_CLASS_INSTANCE.booleanField + "]"},
{TestHelper.DUMMY_CLASS_INSTANCE.byteField,
"Object[" + TestHelper.DUMMY_CLASS_INSTANCE.byteField + "]"},
{TestHelper.DUMMY_CLASS_INSTANCE.charField,
"Object[" + TestHelper.DUMMY_CLASS_INSTANCE.charField + "]"},
{TestHelper.DUMMY_CLASS_INSTANCE.shortField,
"Object[" + TestHelper.DUMMY_CLASS_INSTANCE.shortField + "]"},
{TestHelper.DUMMY_CLASS_INSTANCE.intField,
"Object[" + TestHelper.DUMMY_CLASS_INSTANCE.intField + "]"},
{TestHelper.DUMMY_CLASS_INSTANCE.longField,
"Object[" + TestHelper.DUMMY_CLASS_INSTANCE.longField + "]"},
{TestHelper.DUMMY_CLASS_INSTANCE.floatField,
"Object[" + TestHelper.DUMMY_CLASS_INSTANCE.floatField + "]"},
{TestHelper.DUMMY_CLASS_INSTANCE.doubleField,
"Object[" + TestHelper.DUMMY_CLASS_INSTANCE.doubleField + "]"},
{new Object[0], "Object[Object[" + 0 + "]{}]"}, {new Object[1], "Object[Object[" + 1 + "]{null}]"},
{null, "Object[null]"}};
}
}

View File

@ -31,8 +31,8 @@ public class ForStringDataProvider {
@DataProvider(name = "forStringDataProvider")
public static Object[][] forStringDataProvider() {
return new Object[][]{
{DUMMY_CLASS_INSTANCE.stringField, "Object[String:\"" + DUMMY_CLASS_INSTANCE.stringField + "\"]"},
{DUMMY_CLASS_INSTANCE.stringEmptyField, "Object[String:\"\"]"},
{null, "Object[null]"}};
{DUMMY_CLASS_INSTANCE.stringField, "Object[String:\"" + DUMMY_CLASS_INSTANCE.stringField + "\"]"},
{DUMMY_CLASS_INSTANCE.stringEmptyField, "Object[String:\"\"]"},
{null, "Object[null]"}};
}
}

View File

@ -58,7 +58,7 @@ public class HotSpotConstantReflectionProviderTest {
public void testForObject(Object obj, String expected) {
JavaConstant jConst = TestHelper.CONSTANT_REFLECTION_PROVIDER.forObject(obj);
Assert.assertNotNull(jConst,
"An instance of JavaConstant returned by" + " \"forObject\" method should not be null");
"An instance of JavaConstant returned by" + " \"forObject\" method should not be null");
Assert.assertEquals(jConst.toString(), expected, "Unexpected result:");
}
@ -66,67 +66,63 @@ public class HotSpotConstantReflectionProviderTest {
public void testForString(String string, String expected) {
JavaConstant jConst = CONSTANT_REFLECTION_PROVIDER.forString(string);
Assert.assertNotNull(jConst,
"An instance of JavaConstant returned by" + " \"forString\" method should not be null");
"An instance of JavaConstant returned by" + " \"forString\" method should not be null");
Assert.assertEquals(jConst.toString(), expected, "Unexpected result:");
}
@Test(dataProvider = "constantEqualsDataProvider", dataProviderClass = ConstantEqualsDataProvider.class)
public void testConstantEquals(Constant const1, Constant const2, Boolean expected) {
Assert.assertEquals(CONSTANT_REFLECTION_PROVIDER.constantEquals(const1, const2), expected,
"Unexpected result:");
"Unexpected result:");
}
@Test(dataProvider = "readArrayLengthDataProvider", dataProviderClass = ReadArrayLengthDataProvider.class)
public void testReadArrayLength(JavaConstant array, Integer expected) {
Assert.assertEquals(CONSTANT_REFLECTION_PROVIDER.readArrayLength(array), expected,
"Unexpected result:");
"Unexpected result:");
}
@Test(dataProvider = "readArrayElementDataProvider", dataProviderClass = ReadArrayElementDataProvider.class)
public void testReadArrayElement(JavaConstant array, int index, Object expected) {
Assert.assertEquals(CONSTANT_REFLECTION_PROVIDER.readArrayElement(array, index), expected,
"Unexpected result:");
"Unexpected result:");
}
@Test(dataProvider = "readFieldValueDataProvider", dataProviderClass = ReadFieldValueDataProvider.class)
public void testReadFieldValue(ResolvedJavaField field, JavaConstant receiver, JavaConstant expected) {
JavaConstant actual = CONSTANT_REFLECTION_PROVIDER.readFieldValue(field, receiver);
Assert.assertEquals(actual == null ? "null" : actual.toString(),
expected == null ? "null" : expected.toString(), "Unexpected result:");
expected == null ? "null" : expected.toString(), "Unexpected result:");
}
@Test(dataProvider = "readFieldValueNegativeDataProvider",
dataProviderClass = ReadFieldValueDataProvider.class,
expectedExceptions = {NullPointerException.class})
@Test(dataProvider = "readFieldValueNegativeDataProvider", dataProviderClass = ReadFieldValueDataProvider.class, expectedExceptions = {NullPointerException.class})
public void testNegativeReadFieldValue(ResolvedJavaField field, JavaConstant receiver) {
CONSTANT_REFLECTION_PROVIDER.readFieldValue(field, receiver);
}
@Test(dataProvider = "readStableFieldValueDataProvider",
dataProviderClass = ReadStableFieldValueDataProvider.class)
@Test(dataProvider = "readStableFieldValueDataProvider", dataProviderClass = ReadStableFieldValueDataProvider.class)
public void testReadStableFieldValue(ResolvedJavaField field, JavaConstant receiver, boolean isDefStab,
JavaConstant expected) {
JavaConstant expected) {
Assert.assertEquals(
CONSTANT_REFLECTION_PROVIDER.readStableFieldValue(field, receiver, isDefStab),
expected,
"Unexpected result:");
CONSTANT_REFLECTION_PROVIDER.readStableFieldValue(field, receiver, isDefStab),
expected,
"Unexpected result:");
}
@Test(dataProvider = "readStableFieldValueArrayDataProvider",
dataProviderClass = ReadStableFieldValueDataProvider.class)
@Test(dataProvider = "readStableFieldValueArrayDataProvider", dataProviderClass = ReadStableFieldValueDataProvider.class)
public void testReadStableFieldValueForArray(ResolvedJavaField field, JavaConstant receiver, boolean isDefStab,
int arrayDim, JavaConstant expected) {
int arrayDim, JavaConstant expected) {
JavaConstant result = CONSTANT_REFLECTION_PROVIDER.readStableFieldValue(field, receiver,
isDefStab);
isDefStab);
boolean resultDefStab = false;
int resultStableDim = -1;
try {
Class<?> hotSpotObjectConstantImplClass = Class.forName(
"jdk.vm.ci.hotspot.HotSpotObjectConstantImpl");
"jdk.vm.ci.hotspot.HotSpotObjectConstantImpl");
Method getStableDimensionMethod = hotSpotObjectConstantImplClass.getDeclaredMethod(
"getStableDimension");
"getStableDimension");
Method isDefaultStableMethod = hotSpotObjectConstantImplClass.getDeclaredMethod(
"isDefaultStable");
"isDefaultStable");
getStableDimensionMethod.setAccessible(true);
isDefaultStableMethod.setAccessible(true);
resultDefStab = (boolean) isDefaultStableMethod.invoke(result);
@ -135,62 +131,55 @@ public class HotSpotConstantReflectionProviderTest {
throw new Error("Unexpected error: " + e, e);
}
Assert.assertEquals(resultDefStab, isDefStab,
"Wrong default stable value for " + result.toString());
"Wrong default stable value for " + result.toString());
Assert.assertEquals(resultStableDim, arrayDim,
"Wrong array dimension for " + result.toString());
"Wrong array dimension for " + result.toString());
Assert.assertEquals(result.toString(), expected.toString(), "Unexpected result:");
}
@Test(dataProvider = "readStableFieldValueNegativeDataProvider",
dataProviderClass = ReadStableFieldValueDataProvider.class,
expectedExceptions = {NullPointerException.class})
@Test(dataProvider = "readStableFieldValueNegativeDataProvider", dataProviderClass = ReadStableFieldValueDataProvider.class, expectedExceptions = {NullPointerException.class})
public void testNegativeReadStableFieldValue(ResolvedJavaField field, JavaConstant receiver, boolean isDefStab) {
CONSTANT_REFLECTION_PROVIDER.readStableFieldValue(field, receiver, isDefStab);
}
@Test(dataProvider = "readConstantFieldValueDataProvider",
dataProviderClass = ReadConstantFieldValueDataProvider.class)
@Test(dataProvider = "readConstantFieldValueDataProvider", dataProviderClass = ReadConstantFieldValueDataProvider.class)
public void testReadConstantFieldValue(ResolvedJavaField field, JavaConstant receiver, JavaConstant expected,
String testInfo) {
String testInfo) {
String msg = String.format("Unexpected result for %s. Field is stable = %s.", testInfo,
((HotSpotResolvedJavaField) field).isStable());
((HotSpotResolvedJavaField) field).isStable());
Assert.assertEquals(CONSTANT_REFLECTION_PROVIDER.readConstantFieldValue(field, receiver),
expected, msg);
expected, msg);
}
@Test(dataProvider = "readConstantFieldValueNegativeDataProvider",
dataProviderClass = ReadConstantFieldValueDataProvider.class,
expectedExceptions = {NullPointerException.class})
@Test(dataProvider = "readConstantFieldValueNegativeDataProvider", dataProviderClass = ReadConstantFieldValueDataProvider.class, expectedExceptions = {NullPointerException.class})
public void testNegativeReadConstantFieldValue(ResolvedJavaField field, JavaConstant receiver) {
CONSTANT_REFLECTION_PROVIDER.readConstantFieldValue(field, receiver);
}
@Test(dataProvider = "readConstantArrayElementDataProvider",
dataProviderClass = ReadConstantArrayElementDataProvider.class)
@Test(dataProvider = "readConstantArrayElementDataProvider", dataProviderClass = ReadConstantArrayElementDataProvider.class)
public void testReadConstantArrayElement(JavaConstant array, int index, JavaConstant expected, String testInfo) {
JavaConstant actual = CONSTANT_REFLECTION_PROVIDER.readConstantArrayElement(array, index);
Assert.assertEquals(actual == null ? "null" : actual.toString(),
expected == null ? "null" : expected.toString(),
String.format("Unexpected result while testing %s:", testInfo));
expected == null ? "null" : expected.toString(),
String.format("Unexpected result while testing %s:", testInfo));
}
@Test(dataProvider = "readConstantArrayElementForOffsetDataProvider",
dataProviderClass = ReadConstantArrayElementDataProvider.class)
@Test(dataProvider = "readConstantArrayElementForOffsetDataProvider", dataProviderClass = ReadConstantArrayElementDataProvider.class)
public void testReadConstantArrayElementForOffset(JavaConstant array, long offset, JavaConstant expected,
String testInfo) {
String testInfo) {
JavaConstant actual = CONSTANT_REFLECTION_PROVIDER.readConstantArrayElementForOffset(array,
offset);
offset);
Assert.assertEquals(actual == null ? "null" : actual.toString(),
expected == null ? "null" : expected.toString(),
String.format("Unexpected result while testing %s:", testInfo));
expected == null ? "null" : expected.toString(),
String.format("Unexpected result while testing %s:", testInfo));
}
@Test(dataProvider = "asJavaTypeDataProvider", dataProviderClass = AsJavaTypeDataProvider.class)
public void testAsJavaType(JavaConstant constant, String expected) {
ResolvedJavaType actual = CONSTANT_REFLECTION_PROVIDER.asJavaType(constant);
Assert.assertEquals(actual == null ? "null" : actual.toJavaName(),
expected == null ? "null" : expected,
"Unexpected result, wrong type returned:");
expected == null ? "null" : expected,
"Unexpected result, wrong type returned:");
}
@Test(dataProvider = "boxPrimitiveDataProvider", dataProviderClass = BoxPrimitiveDataProvider.class)
@ -221,6 +210,6 @@ public class HotSpotConstantReflectionProviderTest {
public void testGetMethodHandleAccess() {
MethodHandleAccessProvider actual = CONSTANT_REFLECTION_PROVIDER.getMethodHandleAccess();
Assert.assertNotNull(actual,
"Returned MethodHandleAccessProvider instance should not be null");
"Returned MethodHandleAccessProvider instance should not be null");
}
}

View File

@ -33,14 +33,14 @@ public class IsEmbeddableDataProvider {
@DataProvider(name = "isEmbeddableDataProvider")
public static Object[][] isEmbeddableDataProvider() {
return new Object[][]{{JavaConstant.forBoolean(DUMMY_CLASS_INSTANCE.booleanField), true},
{JavaConstant.forByte(DUMMY_CLASS_INSTANCE.byteField), true},
{JavaConstant.forShort(DUMMY_CLASS_INSTANCE.shortField), true},
{JavaConstant.forInt(DUMMY_CLASS_INSTANCE.intField), true},
{JavaConstant.forLong(DUMMY_CLASS_INSTANCE.longField), true},
{JavaConstant.forChar(DUMMY_CLASS_INSTANCE.charField), true},
{JavaConstant.forFloat(DUMMY_CLASS_INSTANCE.floatField), true},
{JavaConstant.forDouble(DUMMY_CLASS_INSTANCE.doubleField), true},
{CONSTANT_REFLECTION_PROVIDER.forObject(DUMMY_CLASS_INSTANCE.objectField), true},
{JavaConstant.NULL_POINTER, true}, {null, true}};
{JavaConstant.forByte(DUMMY_CLASS_INSTANCE.byteField), true},
{JavaConstant.forShort(DUMMY_CLASS_INSTANCE.shortField), true},
{JavaConstant.forInt(DUMMY_CLASS_INSTANCE.intField), true},
{JavaConstant.forLong(DUMMY_CLASS_INSTANCE.longField), true},
{JavaConstant.forChar(DUMMY_CLASS_INSTANCE.charField), true},
{JavaConstant.forFloat(DUMMY_CLASS_INSTANCE.floatField), true},
{JavaConstant.forDouble(DUMMY_CLASS_INSTANCE.doubleField), true},
{CONSTANT_REFLECTION_PROVIDER.forObject(DUMMY_CLASS_INSTANCE.objectField), true},
{JavaConstant.NULL_POINTER, true}, {null, true}};
}
}

View File

@ -42,50 +42,50 @@ public class ReadArrayElementDataProvider {
LinkedList<Object[]> cfgSet = new LinkedList<>();
for (int i : new int[]{0, 1}) {
cfgSet.add(new Object[]{CONSTANT_REFLECTION_PROVIDER.forObject(DUMMY_CLASS_INSTANCE.booleanArrayWithValues),
i, JavaConstant.forBoolean(DUMMY_CLASS_INSTANCE.booleanArrayWithValues[i])});
i, JavaConstant.forBoolean(DUMMY_CLASS_INSTANCE.booleanArrayWithValues[i])});
cfgSet.add(new Object[]{CONSTANT_REFLECTION_PROVIDER.forObject(DUMMY_CLASS_INSTANCE.byteArrayWithValues),
i, JavaConstant.forByte(DUMMY_CLASS_INSTANCE.byteArrayWithValues[i])});
i, JavaConstant.forByte(DUMMY_CLASS_INSTANCE.byteArrayWithValues[i])});
cfgSet.add(new Object[]{CONSTANT_REFLECTION_PROVIDER.forObject(DUMMY_CLASS_INSTANCE.shortArrayWithValues),
i, JavaConstant.forShort(DUMMY_CLASS_INSTANCE.shortArrayWithValues[i])});
i, JavaConstant.forShort(DUMMY_CLASS_INSTANCE.shortArrayWithValues[i])});
cfgSet.add(new Object[]{CONSTANT_REFLECTION_PROVIDER.forObject(DUMMY_CLASS_INSTANCE.charArrayWithValues),
i, JavaConstant.forChar(DUMMY_CLASS_INSTANCE.charArrayWithValues[i])});
i, JavaConstant.forChar(DUMMY_CLASS_INSTANCE.charArrayWithValues[i])});
cfgSet.add(new Object[]{CONSTANT_REFLECTION_PROVIDER.forObject(DUMMY_CLASS_INSTANCE.intArrayWithValues),
i, JavaConstant.forInt(DUMMY_CLASS_INSTANCE.intArrayWithValues[i])});
i, JavaConstant.forInt(DUMMY_CLASS_INSTANCE.intArrayWithValues[i])});
cfgSet.add(new Object[]{CONSTANT_REFLECTION_PROVIDER.forObject(DUMMY_CLASS_INSTANCE.longArrayWithValues),
i, JavaConstant.forLong(DUMMY_CLASS_INSTANCE.longArrayWithValues[i])});
i, JavaConstant.forLong(DUMMY_CLASS_INSTANCE.longArrayWithValues[i])});
cfgSet.add(new Object[]{CONSTANT_REFLECTION_PROVIDER.forObject(DUMMY_CLASS_INSTANCE.floatArrayWithValues),
i, JavaConstant.forFloat(DUMMY_CLASS_INSTANCE.floatArrayWithValues[i])});
i, JavaConstant.forFloat(DUMMY_CLASS_INSTANCE.floatArrayWithValues[i])});
cfgSet.add(new Object[]{CONSTANT_REFLECTION_PROVIDER.forObject(DUMMY_CLASS_INSTANCE.doubleArrayWithValues),
i, JavaConstant.forDouble(DUMMY_CLASS_INSTANCE.doubleArrayWithValues[i])});
i, JavaConstant.forDouble(DUMMY_CLASS_INSTANCE.doubleArrayWithValues[i])});
cfgSet.add(new Object[]{CONSTANT_REFLECTION_PROVIDER.forObject(DUMMY_CLASS_INSTANCE.objectArrayWithValues),
i, CONSTANT_REFLECTION_PROVIDER.forObject(DUMMY_CLASS_INSTANCE.objectArrayWithValues[i])});
i, CONSTANT_REFLECTION_PROVIDER.forObject(DUMMY_CLASS_INSTANCE.objectArrayWithValues[i])});
cfgSet.add(new Object[]{
CONSTANT_REFLECTION_PROVIDER.forObject(DUMMY_CLASS_INSTANCE.booleanArrayArrayWithValues), i,
CONSTANT_REFLECTION_PROVIDER.forObject(DUMMY_CLASS_INSTANCE.booleanArrayArrayWithValues[i])});
CONSTANT_REFLECTION_PROVIDER.forObject(DUMMY_CLASS_INSTANCE.booleanArrayArrayWithValues), i,
CONSTANT_REFLECTION_PROVIDER.forObject(DUMMY_CLASS_INSTANCE.booleanArrayArrayWithValues[i])});
cfgSet.add(new Object[]{
CONSTANT_REFLECTION_PROVIDER.forObject(DUMMY_CLASS_INSTANCE.byteArrayArrayWithValues), i,
CONSTANT_REFLECTION_PROVIDER.forObject(DUMMY_CLASS_INSTANCE.byteArrayArrayWithValues[i])});
CONSTANT_REFLECTION_PROVIDER.forObject(DUMMY_CLASS_INSTANCE.byteArrayArrayWithValues), i,
CONSTANT_REFLECTION_PROVIDER.forObject(DUMMY_CLASS_INSTANCE.byteArrayArrayWithValues[i])});
cfgSet.add(new Object[]{
CONSTANT_REFLECTION_PROVIDER.forObject(DUMMY_CLASS_INSTANCE.shortArrayArrayWithValues), i,
CONSTANT_REFLECTION_PROVIDER.forObject(DUMMY_CLASS_INSTANCE.shortArrayArrayWithValues[i])});
CONSTANT_REFLECTION_PROVIDER.forObject(DUMMY_CLASS_INSTANCE.shortArrayArrayWithValues), i,
CONSTANT_REFLECTION_PROVIDER.forObject(DUMMY_CLASS_INSTANCE.shortArrayArrayWithValues[i])});
cfgSet.add(new Object[]{
CONSTANT_REFLECTION_PROVIDER.forObject(DUMMY_CLASS_INSTANCE.charArrayArrayWithValues), i,
CONSTANT_REFLECTION_PROVIDER.forObject(DUMMY_CLASS_INSTANCE.charArrayArrayWithValues[i])});
CONSTANT_REFLECTION_PROVIDER.forObject(DUMMY_CLASS_INSTANCE.charArrayArrayWithValues), i,
CONSTANT_REFLECTION_PROVIDER.forObject(DUMMY_CLASS_INSTANCE.charArrayArrayWithValues[i])});
cfgSet.add(new Object[]{
CONSTANT_REFLECTION_PROVIDER.forObject(DUMMY_CLASS_INSTANCE.intArrayArrayWithValues), i,
CONSTANT_REFLECTION_PROVIDER.forObject(DUMMY_CLASS_INSTANCE.intArrayArrayWithValues[i])});
CONSTANT_REFLECTION_PROVIDER.forObject(DUMMY_CLASS_INSTANCE.intArrayArrayWithValues), i,
CONSTANT_REFLECTION_PROVIDER.forObject(DUMMY_CLASS_INSTANCE.intArrayArrayWithValues[i])});
cfgSet.add(new Object[]{
CONSTANT_REFLECTION_PROVIDER.forObject(DUMMY_CLASS_INSTANCE.longArrayArrayWithValues), i,
CONSTANT_REFLECTION_PROVIDER.forObject(DUMMY_CLASS_INSTANCE.longArrayArrayWithValues[i])});
CONSTANT_REFLECTION_PROVIDER.forObject(DUMMY_CLASS_INSTANCE.longArrayArrayWithValues), i,
CONSTANT_REFLECTION_PROVIDER.forObject(DUMMY_CLASS_INSTANCE.longArrayArrayWithValues[i])});
cfgSet.add(new Object[]{
CONSTANT_REFLECTION_PROVIDER.forObject(DUMMY_CLASS_INSTANCE.floatArrayArrayWithValues), i,
CONSTANT_REFLECTION_PROVIDER.forObject(DUMMY_CLASS_INSTANCE.floatArrayArrayWithValues[i])});
CONSTANT_REFLECTION_PROVIDER.forObject(DUMMY_CLASS_INSTANCE.floatArrayArrayWithValues), i,
CONSTANT_REFLECTION_PROVIDER.forObject(DUMMY_CLASS_INSTANCE.floatArrayArrayWithValues[i])});
cfgSet.add(new Object[]{
CONSTANT_REFLECTION_PROVIDER.forObject(DUMMY_CLASS_INSTANCE.doubleArrayArrayWithValues), i,
CONSTANT_REFLECTION_PROVIDER.forObject(DUMMY_CLASS_INSTANCE.doubleArrayArrayWithValues[i])});
CONSTANT_REFLECTION_PROVIDER.forObject(DUMMY_CLASS_INSTANCE.doubleArrayArrayWithValues), i,
CONSTANT_REFLECTION_PROVIDER.forObject(DUMMY_CLASS_INSTANCE.doubleArrayArrayWithValues[i])});
cfgSet.add(new Object[]{
CONSTANT_REFLECTION_PROVIDER.forObject(DUMMY_CLASS_INSTANCE.objectArrayArrayWithValues), i,
CONSTANT_REFLECTION_PROVIDER.forObject(DUMMY_CLASS_INSTANCE.objectArrayArrayWithValues[i])});
CONSTANT_REFLECTION_PROVIDER.forObject(DUMMY_CLASS_INSTANCE.objectArrayArrayWithValues), i,
CONSTANT_REFLECTION_PROVIDER.forObject(DUMMY_CLASS_INSTANCE.objectArrayArrayWithValues[i])});
}
Stream.concat(ARRAYS_MAP.values().stream(), ARRAY_ARRAYS_MAP.values().stream()).forEach((array) -> {
for (int i : new int[]{-1, 2}) {

View File

@ -48,69 +48,67 @@ import jdk.vm.ci.meta.ResolvedJavaField;
public class ReadConstantArrayElementDataProvider {
// Non-stable array fields names mapped to their base offsets and index scale
private static final List<ArrayFieldParams> NON_STABLE_ARRAY_NAMES
= new LinkedList<>();
private static final List<ArrayFieldParams> NON_STABLE_ARRAY_NAMES = new LinkedList<>();
static {
NON_STABLE_ARRAY_NAMES.add(
new ArrayFieldParams("booleanArrayWithValues", Unsafe.ARRAY_BOOLEAN_BASE_OFFSET,
Unsafe.ARRAY_BOOLEAN_INDEX_SCALE));
new ArrayFieldParams("booleanArrayWithValues", Unsafe.ARRAY_BOOLEAN_BASE_OFFSET,
Unsafe.ARRAY_BOOLEAN_INDEX_SCALE));
NON_STABLE_ARRAY_NAMES.add(new ArrayFieldParams("byteArrayWithValues",
Unsafe.ARRAY_BYTE_BASE_OFFSET,
Unsafe.ARRAY_BYTE_INDEX_SCALE));
Unsafe.ARRAY_BYTE_BASE_OFFSET,
Unsafe.ARRAY_BYTE_INDEX_SCALE));
NON_STABLE_ARRAY_NAMES.add(new ArrayFieldParams("shortArrayWithValues",
Unsafe.ARRAY_SHORT_BASE_OFFSET,
Unsafe.ARRAY_SHORT_INDEX_SCALE));
Unsafe.ARRAY_SHORT_BASE_OFFSET,
Unsafe.ARRAY_SHORT_INDEX_SCALE));
NON_STABLE_ARRAY_NAMES.add(new ArrayFieldParams("charArrayWithValues",
Unsafe.ARRAY_CHAR_BASE_OFFSET,
Unsafe.ARRAY_CHAR_INDEX_SCALE));
Unsafe.ARRAY_CHAR_BASE_OFFSET,
Unsafe.ARRAY_CHAR_INDEX_SCALE));
NON_STABLE_ARRAY_NAMES.add(new ArrayFieldParams("intArrayWithValues",
Unsafe.ARRAY_INT_BASE_OFFSET,
Unsafe.ARRAY_INT_INDEX_SCALE));
Unsafe.ARRAY_INT_BASE_OFFSET,
Unsafe.ARRAY_INT_INDEX_SCALE));
NON_STABLE_ARRAY_NAMES.add(new ArrayFieldParams("longArrayWithValues",
Unsafe.ARRAY_LONG_BASE_OFFSET,
Unsafe.ARRAY_LONG_INDEX_SCALE));
Unsafe.ARRAY_LONG_BASE_OFFSET,
Unsafe.ARRAY_LONG_INDEX_SCALE));
NON_STABLE_ARRAY_NAMES.add(new ArrayFieldParams("floatArrayWithValues",
Unsafe.ARRAY_FLOAT_BASE_OFFSET,
Unsafe.ARRAY_FLOAT_INDEX_SCALE));
Unsafe.ARRAY_FLOAT_BASE_OFFSET,
Unsafe.ARRAY_FLOAT_INDEX_SCALE));
NON_STABLE_ARRAY_NAMES.add(new ArrayFieldParams("doubleArrayWithValues",
Unsafe.ARRAY_DOUBLE_BASE_OFFSET,
Unsafe.ARRAY_DOUBLE_INDEX_SCALE));
Unsafe.ARRAY_DOUBLE_BASE_OFFSET,
Unsafe.ARRAY_DOUBLE_INDEX_SCALE));
NON_STABLE_ARRAY_NAMES.add(new ArrayFieldParams("objectArrayWithValues",
Unsafe.ARRAY_BOOLEAN_BASE_OFFSET,
Unsafe.ARRAY_BOOLEAN_INDEX_SCALE));
Unsafe.ARRAY_BOOLEAN_BASE_OFFSET,
Unsafe.ARRAY_BOOLEAN_INDEX_SCALE));
NON_STABLE_ARRAY_NAMES.add(new ArrayFieldParams("booleanArrayArrayWithValues",
Unsafe.ARRAY_OBJECT_BASE_OFFSET,
Unsafe.ARRAY_OBJECT_INDEX_SCALE));
Unsafe.ARRAY_OBJECT_BASE_OFFSET,
Unsafe.ARRAY_OBJECT_INDEX_SCALE));
NON_STABLE_ARRAY_NAMES.add(new ArrayFieldParams("byteArrayArrayWithValues",
Unsafe.ARRAY_OBJECT_BASE_OFFSET,
Unsafe.ARRAY_OBJECT_INDEX_SCALE));
Unsafe.ARRAY_OBJECT_BASE_OFFSET,
Unsafe.ARRAY_OBJECT_INDEX_SCALE));
NON_STABLE_ARRAY_NAMES.add(new ArrayFieldParams("shortArrayArrayWithValues",
Unsafe.ARRAY_OBJECT_BASE_OFFSET,
Unsafe.ARRAY_OBJECT_INDEX_SCALE));
Unsafe.ARRAY_OBJECT_BASE_OFFSET,
Unsafe.ARRAY_OBJECT_INDEX_SCALE));
NON_STABLE_ARRAY_NAMES.add(new ArrayFieldParams("charArrayArrayWithValues",
Unsafe.ARRAY_OBJECT_BASE_OFFSET,
Unsafe.ARRAY_OBJECT_INDEX_SCALE));
Unsafe.ARRAY_OBJECT_BASE_OFFSET,
Unsafe.ARRAY_OBJECT_INDEX_SCALE));
NON_STABLE_ARRAY_NAMES.add(new ArrayFieldParams("intArrayArrayWithValues",
Unsafe.ARRAY_OBJECT_BASE_OFFSET,
Unsafe.ARRAY_OBJECT_INDEX_SCALE));
Unsafe.ARRAY_OBJECT_BASE_OFFSET,
Unsafe.ARRAY_OBJECT_INDEX_SCALE));
NON_STABLE_ARRAY_NAMES.add(new ArrayFieldParams("longArrayArrayWithValues",
Unsafe.ARRAY_OBJECT_BASE_OFFSET,
Unsafe.ARRAY_OBJECT_INDEX_SCALE));
Unsafe.ARRAY_OBJECT_BASE_OFFSET,
Unsafe.ARRAY_OBJECT_INDEX_SCALE));
NON_STABLE_ARRAY_NAMES.add(new ArrayFieldParams("floatArrayArrayWithValues",
Unsafe.ARRAY_OBJECT_BASE_OFFSET,
Unsafe.ARRAY_OBJECT_INDEX_SCALE));
Unsafe.ARRAY_OBJECT_BASE_OFFSET,
Unsafe.ARRAY_OBJECT_INDEX_SCALE));
NON_STABLE_ARRAY_NAMES.add(new ArrayFieldParams("doubleArrayArrayWithValues",
Unsafe.ARRAY_OBJECT_BASE_OFFSET,
Unsafe.ARRAY_OBJECT_INDEX_SCALE));
Unsafe.ARRAY_OBJECT_BASE_OFFSET,
Unsafe.ARRAY_OBJECT_INDEX_SCALE));
NON_STABLE_ARRAY_NAMES.add(new ArrayFieldParams("objectArrayArrayWithValues",
Unsafe.ARRAY_OBJECT_BASE_OFFSET,
Unsafe.ARRAY_OBJECT_INDEX_SCALE));
Unsafe.ARRAY_OBJECT_BASE_OFFSET,
Unsafe.ARRAY_OBJECT_INDEX_SCALE));
}
// Stable array fields names mapped to their base offsets and index scale
private static final List<ArrayFieldParams> STABLE_ARRAY_NAMES
= new LinkedList<>();
private static final List<ArrayFieldParams> STABLE_ARRAY_NAMES = new LinkedList<>();
static {
NON_STABLE_ARRAY_NAMES.stream().forEach((entry) -> {
@ -118,7 +116,7 @@ public class ReadConstantArrayElementDataProvider {
char firstChar = nsFieldName.charAt(0);
char newFirstChar = Character.toUpperCase(firstChar);
String sFieldName = nsFieldName.replaceFirst("" + firstChar,
"" + newFirstChar);
"" + newFirstChar);
sFieldName = "stable" + sFieldName;
STABLE_ARRAY_NAMES.add(new ArrayFieldParams(sFieldName, entry.offsetBase, entry.scale));
});
@ -131,33 +129,31 @@ public class ReadConstantArrayElementDataProvider {
NON_STABLE_ARRAY_NAMES.stream().forEach((entry) -> {
String fieldName = entry.name;
cfgSet.add(new Object[]{
readFieldValue(fieldName),
i,
null,
"array field \"" + fieldName + "\" for index " + i});
readFieldValue(fieldName),
i,
null,
"array field \"" + fieldName + "\" for index " + i});
});
STABLE_ARRAY_NAMES.stream().forEach((entry) -> {
String fieldName = entry.name;
cfgSet.add(new Object[]{
readFieldValue(fieldName),
i,
i == 0 ? getJavaConstant(fieldName) : null,
"array field \"" + fieldName + "\" for index " + i});
readFieldValue(fieldName),
i,
i == 0 ? getJavaConstant(fieldName) : null,
"array field \"" + fieldName + "\" for index " + i});
});
}
Stream<Map.Entry<ResolvedJavaField, JavaConstant>> arraysStream1
= Stream.concat(ARRAYS_MAP.entrySet().stream(),
ARRAY_ARRAYS_MAP.entrySet().stream());
Stream<Map.Entry<ResolvedJavaField, JavaConstant>> arraysStream2
= Stream.concat(STABLE_ARRAYS_MAP.entrySet().stream(),
STABLE_ARRAY_ARRAYS_MAP.entrySet().stream());
Stream<Map.Entry<ResolvedJavaField, JavaConstant>> arraysStream1 = Stream.concat(ARRAYS_MAP.entrySet().stream(),
ARRAY_ARRAYS_MAP.entrySet().stream());
Stream<Map.Entry<ResolvedJavaField, JavaConstant>> arraysStream2 = Stream.concat(STABLE_ARRAYS_MAP.entrySet().stream(),
STABLE_ARRAY_ARRAYS_MAP.entrySet().stream());
Stream.concat(arraysStream1, arraysStream2).forEach((array) -> {
for (int i : new int[]{-1, 2}) {
cfgSet.add(new Object[]{
array.getValue(),
i,
null,
"array field \"" + array.getKey() + "\" for index " + i});
array.getValue(),
i,
null,
"array field \"" + array.getKey() + "\" for index " + i});
}
});
cfgSet.add(new Object[]{null, 0, null, "null"});
@ -180,10 +176,10 @@ public class ReadConstantArrayElementDataProvider {
String fieldName = entry.name;
long offset = (long) (entry.offsetBase + i * entry.scale);
cfgSet.add(new Object[]{
readFieldValue(fieldName),
offset,
null,
"array field \"" + fieldName + "\" for offset " + offset});
readFieldValue(fieldName),
offset,
null,
"array field \"" + fieldName + "\" for offset " + offset});
});
}
// Testing stable arrays. Result should be null in all cases except "offset = base + 0"
@ -192,10 +188,10 @@ public class ReadConstantArrayElementDataProvider {
String fieldName = entry.name;
long offset = (long) Math.ceil(entry.offsetBase + i * entry.scale);
cfgSet.add(new Object[]{
readFieldValue(fieldName),
offset,
null,
"array field \"" + fieldName + "\" for offset " + offset});
readFieldValue(fieldName),
offset,
null,
"array field \"" + fieldName + "\" for offset " + offset});
});
}
// Testing stable arrays "offset = base + 0". Result should be non-null
@ -203,10 +199,10 @@ public class ReadConstantArrayElementDataProvider {
String fieldName = entry.name;
long offset = (long) entry.offsetBase;
cfgSet.add(new Object[]{
readFieldValue(fieldName),
offset,
getJavaConstant(fieldName),
"array field \"" + fieldName + "\" for offset " + offset});
readFieldValue(fieldName),
offset,
getJavaConstant(fieldName),
"array field \"" + fieldName + "\" for offset " + offset});
});
// Testing null as array
cfgSet.add(new Object[]{null, 0, null, "null"});
@ -225,7 +221,7 @@ public class ReadConstantArrayElementDataProvider {
private static JavaConstant readFieldValue(String fieldName) {
return CONSTANT_REFLECTION_PROVIDER.readFieldValue(getResolvedJavaField(DummyClass.class, fieldName),
DUMMY_CLASS_CONSTANT);
DUMMY_CLASS_CONSTANT);
}
private static JavaConstant getJavaConstant(String fieldName) {
@ -281,10 +277,10 @@ public class ReadConstantArrayElementDataProvider {
public final int offsetBase;
public final int scale;
ArrayFieldParams(String name, int offsetBase, int scale) {
this.name = name;
this.offsetBase = offsetBase;
this.scale = scale;
}
ArrayFieldParams(String name, int offsetBase, int scale) {
this.name = name;
this.offsetBase = offsetBase;
this.scale = scale;
}
}
}

View File

@ -39,7 +39,6 @@ import jdk.vm.ci.hotspot.HotSpotJVMCIRuntime;
import jdk.vm.ci.meta.JavaConstant;
import org.testng.annotations.DataProvider;
public class ReadConstantFieldValueDataProvider {
@DataProvider(name = "readConstantFieldValueDataProvider")
@ -56,32 +55,32 @@ public class ReadConstantFieldValueDataProvider {
// Testing instance final non-default fields
INSTANCE_FINAL_FIELDS_MAP.entrySet().stream().forEach((field) -> {
cfgSet.add(new Object[]{field.getKey(),
DUMMY_CLASS_CONSTANT,
field.getValue(),
"instance final field"});
DUMMY_CLASS_CONSTANT,
field.getValue(),
"instance final field"});
});
// Testing instance final default fields.
boolean trustDefFinal = HotSpotJVMCIRuntime.Option.TrustFinalDefaultFields.getBoolean();
INSTANCE_FINAL_DEFAULT_FIELDS_MAP.entrySet().stream().forEach((field) -> {
JavaConstant expected = trustDefFinal ? field.getValue() : null;
cfgSet.add(new Object[]{field.getKey(),
DUMMY_CLASS_CONSTANT,
expected,
"instance final default field"});
DUMMY_CLASS_CONSTANT,
expected,
"instance final default field"});
});
// Testing instance stable non-default fields
INSTANCE_STABLE_FIELDS_MAP.entrySet().stream().forEach((field) -> {
cfgSet.add(new Object[]{field.getKey(),
DUMMY_CLASS_CONSTANT,
field.getValue(),
"instance stable field"});
DUMMY_CLASS_CONSTANT,
field.getValue(),
"instance stable field"});
});
// Testing instance stable default fields
INSTANCE_STABLE_DEFAULT_FIELDS_MAP.entrySet().stream().forEach((field) -> {
cfgSet.add(new Object[]{field.getKey(),
DUMMY_CLASS_CONSTANT,
null,
"instance stable default field"});
DUMMY_CLASS_CONSTANT,
null,
"instance stable default field"});
});
// Testing regular instance fields
INSTANCE_FIELDS_MAP.entrySet().stream().forEach((field) -> {

View File

@ -39,7 +39,6 @@ import java.util.LinkedList;
import jdk.vm.ci.meta.JavaConstant;
import org.testng.annotations.DataProvider;
public class ReadFieldValueDataProvider {
@DataProvider(name = "readFieldValueDataProvider")
@ -48,8 +47,8 @@ public class ReadFieldValueDataProvider {
// Testing instance non-stable fields
INSTANCE_FIELDS_MAP.entrySet().stream().forEach((instanceField) -> {
cfgSet.add(new Object[]{instanceField.getKey(),
DUMMY_CLASS_CONSTANT,
instanceField.getValue()});
DUMMY_CLASS_CONSTANT,
instanceField.getValue()});
});
// Testing static non-stable fields with null as receiver
STATIC_FIELDS_MAP.entrySet().stream().forEach((staticField) -> {
@ -58,14 +57,14 @@ public class ReadFieldValueDataProvider {
// Testing static non-stable fields with JavaConstant.NULL_POINTER as receiver
STATIC_FIELDS_MAP.entrySet().stream().forEach((staticField) -> {
cfgSet.add(new Object[]{staticField.getKey(),
JavaConstant.NULL_POINTER,
staticField.getValue()});
JavaConstant.NULL_POINTER,
staticField.getValue()});
});
// Testing instance stable fields
INSTANCE_STABLE_FIELDS_MAP.entrySet().stream().forEach((instanceField) -> {
cfgSet.add(new Object[]{instanceField.getKey(),
DUMMY_CLASS_CONSTANT,
instanceField.getValue()});
DUMMY_CLASS_CONSTANT,
instanceField.getValue()});
});
// Testing static stable fields with null as receiver
STATIC_STABLE_FIELDS_MAP.entrySet().stream().forEach((staticField) -> {
@ -74,32 +73,32 @@ public class ReadFieldValueDataProvider {
// Testing static stable fields with JavaConstant.NULL_POINTER as receiver
STATIC_STABLE_FIELDS_MAP.entrySet().stream().forEach((staticField) -> {
cfgSet.add(new Object[]{staticField.getKey(),
JavaConstant.NULL_POINTER,
staticField.getValue()});
JavaConstant.NULL_POINTER,
staticField.getValue()});
});
// Testing instance non-stable array fields
ARRAYS_MAP.entrySet().stream().forEach((instanceField) -> {
cfgSet.add(new Object[]{instanceField.getKey(),
DUMMY_CLASS_CONSTANT,
instanceField.getValue()});
DUMMY_CLASS_CONSTANT,
instanceField.getValue()});
});
// Testing instance stable array fields
STABLE_ARRAYS_MAP.entrySet().stream().forEach((instanceField) -> {
cfgSet.add(new Object[]{instanceField.getKey(),
DUMMY_CLASS_CONSTANT,
instanceField.getValue()});
DUMMY_CLASS_CONSTANT,
instanceField.getValue()});
});
// Testing instance non-stable array-of-array fields
ARRAY_ARRAYS_MAP.entrySet().stream().forEach((instanceField) -> {
cfgSet.add(new Object[]{instanceField.getKey(),
DUMMY_CLASS_CONSTANT,
instanceField.getValue()});
DUMMY_CLASS_CONSTANT,
instanceField.getValue()});
});
// Testing instance stable array-of-array fields
STABLE_ARRAY_ARRAYS_MAP.entrySet().stream().forEach((instanceField) -> {
cfgSet.add(new Object[]{instanceField.getKey(),
DUMMY_CLASS_CONSTANT,
instanceField.getValue()});
DUMMY_CLASS_CONSTANT,
instanceField.getValue()});
});
// Testing instance fields with JavaConstant.NULL_POINTER as receiver
INSTANCE_FIELDS_MAP.entrySet().stream().forEach((instanceField) -> {
@ -108,8 +107,8 @@ public class ReadFieldValueDataProvider {
// Testing instance fields with an object that does not have the field
INSTANCE_FIELDS_MAP.entrySet().stream().forEach((instanceField) -> {
cfgSet.add(new Object[]{instanceField.getKey(),
CONSTANT_REFLECTION_PROVIDER.forObject(DUMMY_CLASS_INSTANCE.objectField),
null});
CONSTANT_REFLECTION_PROVIDER.forObject(DUMMY_CLASS_INSTANCE.objectField),
null});
});
return cfgSet.toArray(new Object[0][0]);
}

View File

@ -48,58 +48,58 @@ public class ReadStableFieldValueDataProvider {
// Testing instance non-stable fields
INSTANCE_FIELDS_MAP.entrySet().stream().forEach((instanceField) -> {
cfgSet.add(new Object[]{instanceField.getKey(),
DUMMY_CLASS_CONSTANT,
isDefStab,
instanceField.getValue()});
DUMMY_CLASS_CONSTANT,
isDefStab,
instanceField.getValue()});
});
// Testing static non-stable fields with null as receiver
STATIC_FIELDS_MAP.entrySet().stream().forEach((staticField) -> {
cfgSet.add(new Object[]{staticField.getKey(),
null,
isDefStab,
staticField.getValue()});
null,
isDefStab,
staticField.getValue()});
});
// Testing static non-stable fields with JavaConstant.NULL_POINTER as receiver
STATIC_FIELDS_MAP.entrySet().stream().forEach((staticField) -> {
cfgSet.add(new Object[]{staticField.getKey(),
JavaConstant.NULL_POINTER,
isDefStab,
staticField.getValue()});
JavaConstant.NULL_POINTER,
isDefStab,
staticField.getValue()});
});
// Testing instance stable fields
INSTANCE_STABLE_FIELDS_MAP.entrySet().stream().forEach((instanceField) -> {
cfgSet.add(new Object[]{instanceField.getKey(),
DUMMY_CLASS_CONSTANT,
isDefStab,
instanceField.getValue()});
DUMMY_CLASS_CONSTANT,
isDefStab,
instanceField.getValue()});
});
// Testing static stable fields with null as receiver
STATIC_STABLE_FIELDS_MAP.entrySet().stream().forEach((staticField) -> {
cfgSet.add(new Object[]{staticField.getKey(),
null,
isDefStab,
staticField.getValue()});
null,
isDefStab,
staticField.getValue()});
});
// Testing static stable fields with JavaConstant.NULL_POINTER as receiver
STATIC_STABLE_FIELDS_MAP.entrySet().stream().forEach((staticField) -> {
cfgSet.add(new Object[]{staticField.getKey(),
JavaConstant.NULL_POINTER,
isDefStab,
staticField.getValue()});
JavaConstant.NULL_POINTER,
isDefStab,
staticField.getValue()});
});
// Testing instance fields with JavaConstant.NULL_POINTER as receiver
INSTANCE_FIELDS_MAP.entrySet().stream().forEach((instanceField) -> {
cfgSet.add(new Object[]{instanceField.getKey(),
JavaConstant.NULL_POINTER,
isDefStab,
null});
JavaConstant.NULL_POINTER,
isDefStab,
null});
});
// Testing instance fields with an object that does not have the field
INSTANCE_FIELDS_MAP.entrySet().stream().forEach((instanceField) -> {
cfgSet.add(new Object[]{instanceField.getKey(),
CONSTANT_REFLECTION_PROVIDER.forObject(DUMMY_CLASS_INSTANCE.objectField),
isDefStab,
null});
CONSTANT_REFLECTION_PROVIDER.forObject(DUMMY_CLASS_INSTANCE.objectField),
isDefStab,
null});
});
}
return cfgSet.toArray(new Object[0][0]);
@ -112,34 +112,34 @@ public class ReadStableFieldValueDataProvider {
// Testing instance non-stable array fields
ARRAYS_MAP.entrySet().stream().forEach((instanceField) -> {
cfgSet.add(new Object[]{instanceField.getKey(),
DUMMY_CLASS_CONSTANT,
isDefStab,
TestHelper.ARRAY_DIMENSION,
instanceField.getValue()});
DUMMY_CLASS_CONSTANT,
isDefStab,
TestHelper.ARRAY_DIMENSION,
instanceField.getValue()});
});
// Testing instance stable array fields
STABLE_ARRAYS_MAP.entrySet().stream().forEach((instanceField) -> {
cfgSet.add(new Object[]{instanceField.getKey(),
DUMMY_CLASS_CONSTANT,
isDefStab,
TestHelper.ARRAY_DIMENSION,
instanceField.getValue()});
DUMMY_CLASS_CONSTANT,
isDefStab,
TestHelper.ARRAY_DIMENSION,
instanceField.getValue()});
});
// Testing instance non-stable array-of-array fields
ARRAY_ARRAYS_MAP.entrySet().stream().forEach((instanceField) -> {
cfgSet.add(new Object[]{instanceField.getKey(),
DUMMY_CLASS_CONSTANT,
isDefStab,
TestHelper.ARRAY_OF_ARRAYS_DIMENSION,
instanceField.getValue()});
DUMMY_CLASS_CONSTANT,
isDefStab,
TestHelper.ARRAY_OF_ARRAYS_DIMENSION,
instanceField.getValue()});
});
// Testing instance stable array-of-array fields
STABLE_ARRAY_ARRAYS_MAP.entrySet().stream().forEach((instanceField) -> {
cfgSet.add(new Object[]{instanceField.getKey(),
DUMMY_CLASS_CONSTANT,
isDefStab,
TestHelper.ARRAY_OF_ARRAYS_DIMENSION,
instanceField.getValue()});
DUMMY_CLASS_CONSTANT,
isDefStab,
TestHelper.ARRAY_OF_ARRAYS_DIMENSION,
instanceField.getValue()});
});
}
return cfgSet.toArray(new Object[0][0]);

View File

@ -35,298 +35,288 @@ import jdk.vm.ci.runtime.JVMCI;
public class TestHelper {
public static final DummyClass DUMMY_CLASS_INSTANCE = new DummyClass();
public static final HotSpotConstantReflectionProvider CONSTANT_REFLECTION_PROVIDER
= (HotSpotConstantReflectionProvider) JVMCI.getRuntime().getHostJVMCIBackend().getConstantReflection();
public static final JavaConstant DUMMY_CLASS_CONSTANT
= CONSTANT_REFLECTION_PROVIDER.forObject(DUMMY_CLASS_INSTANCE);
public static final HotSpotConstantReflectionProvider CONSTANT_REFLECTION_PROVIDER = (HotSpotConstantReflectionProvider) JVMCI.getRuntime().getHostJVMCIBackend().getConstantReflection();
public static final JavaConstant DUMMY_CLASS_CONSTANT = CONSTANT_REFLECTION_PROVIDER.forObject(DUMMY_CLASS_INSTANCE);
public static final Map<ResolvedJavaField, JavaConstant> INSTANCE_FIELDS_MAP
= new HashMap<>();
public static final Map<ResolvedJavaField, JavaConstant> INSTANCE_FIELDS_MAP = new HashMap<>();
static {
INSTANCE_FIELDS_MAP.put(getResolvedJavaField(DummyClass.class, "booleanField"),
JavaConstant.forBoolean(DUMMY_CLASS_INSTANCE.booleanField));
JavaConstant.forBoolean(DUMMY_CLASS_INSTANCE.booleanField));
INSTANCE_FIELDS_MAP.put(getResolvedJavaField(DummyClass.class, "byteField"),
JavaConstant.forByte(DUMMY_CLASS_INSTANCE.byteField));
JavaConstant.forByte(DUMMY_CLASS_INSTANCE.byteField));
INSTANCE_FIELDS_MAP.put(getResolvedJavaField(DummyClass.class, "shortField"),
JavaConstant.forShort(DUMMY_CLASS_INSTANCE.shortField));
JavaConstant.forShort(DUMMY_CLASS_INSTANCE.shortField));
INSTANCE_FIELDS_MAP.put(getResolvedJavaField(DummyClass.class, "charField"),
JavaConstant.forChar(DUMMY_CLASS_INSTANCE.charField));
JavaConstant.forChar(DUMMY_CLASS_INSTANCE.charField));
INSTANCE_FIELDS_MAP.put(getResolvedJavaField(DummyClass.class, "intField"),
JavaConstant.forInt(DUMMY_CLASS_INSTANCE.intField));
JavaConstant.forInt(DUMMY_CLASS_INSTANCE.intField));
INSTANCE_FIELDS_MAP.put(getResolvedJavaField(DummyClass.class, "longField"),
JavaConstant.forLong(DUMMY_CLASS_INSTANCE.longField));
JavaConstant.forLong(DUMMY_CLASS_INSTANCE.longField));
INSTANCE_FIELDS_MAP.put(getResolvedJavaField(DummyClass.class, "floatField"),
JavaConstant.forFloat(DUMMY_CLASS_INSTANCE.floatField));
JavaConstant.forFloat(DUMMY_CLASS_INSTANCE.floatField));
INSTANCE_FIELDS_MAP.put(getResolvedJavaField(DummyClass.class, "doubleField"),
JavaConstant.forDouble(DUMMY_CLASS_INSTANCE.doubleField));
JavaConstant.forDouble(DUMMY_CLASS_INSTANCE.doubleField));
INSTANCE_FIELDS_MAP.put(getResolvedJavaField(DummyClass.class, "objectField"),
CONSTANT_REFLECTION_PROVIDER.forObject(
CONSTANT_REFLECTION_PROVIDER.forObject(
DUMMY_CLASS_INSTANCE.objectField));
}
public static final Map<ResolvedJavaField, JavaConstant> INSTANCE_FINAL_FIELDS_MAP
= new HashMap<>();
public static final Map<ResolvedJavaField, JavaConstant> INSTANCE_FINAL_FIELDS_MAP = new HashMap<>();
static {
INSTANCE_FINAL_FIELDS_MAP.put(getResolvedJavaField(DummyClass.class, "finalBooleanField"),
JavaConstant.forBoolean(
DUMMY_CLASS_INSTANCE.finalBooleanField));
JavaConstant.forBoolean(
DUMMY_CLASS_INSTANCE.finalBooleanField));
INSTANCE_FINAL_FIELDS_MAP.put(getResolvedJavaField(DummyClass.class, "finalByteField"),
JavaConstant.forByte(DUMMY_CLASS_INSTANCE.finalByteField));
JavaConstant.forByte(DUMMY_CLASS_INSTANCE.finalByteField));
INSTANCE_FINAL_FIELDS_MAP.put(getResolvedJavaField(DummyClass.class, "finalShortField"),
JavaConstant.forShort(DUMMY_CLASS_INSTANCE.finalShortField));
JavaConstant.forShort(DUMMY_CLASS_INSTANCE.finalShortField));
INSTANCE_FINAL_FIELDS_MAP.put(getResolvedJavaField(DummyClass.class, "finalCharField"),
JavaConstant.forChar(DUMMY_CLASS_INSTANCE.finalCharField));
JavaConstant.forChar(DUMMY_CLASS_INSTANCE.finalCharField));
INSTANCE_FINAL_FIELDS_MAP.put(getResolvedJavaField(DummyClass.class, "finalIntField"),
JavaConstant.forInt(DUMMY_CLASS_INSTANCE.finalIntField));
JavaConstant.forInt(DUMMY_CLASS_INSTANCE.finalIntField));
INSTANCE_FINAL_FIELDS_MAP.put(getResolvedJavaField(DummyClass.class, "finalLongField"),
JavaConstant.forLong(DUMMY_CLASS_INSTANCE.finalLongField));
JavaConstant.forLong(DUMMY_CLASS_INSTANCE.finalLongField));
INSTANCE_FINAL_FIELDS_MAP.put(getResolvedJavaField(DummyClass.class, "finalFloatField"),
JavaConstant.forFloat(DUMMY_CLASS_INSTANCE.finalFloatField));
JavaConstant.forFloat(DUMMY_CLASS_INSTANCE.finalFloatField));
INSTANCE_FINAL_FIELDS_MAP.put(getResolvedJavaField(DummyClass.class, "finalDoubleField"),
JavaConstant.forDouble(
DUMMY_CLASS_INSTANCE.finalDoubleField));
JavaConstant.forDouble(
DUMMY_CLASS_INSTANCE.finalDoubleField));
INSTANCE_FINAL_FIELDS_MAP.put(getResolvedJavaField(DummyClass.class, "finalObjectField"),
CONSTANT_REFLECTION_PROVIDER.forObject(
DUMMY_CLASS_INSTANCE.finalObjectField));
CONSTANT_REFLECTION_PROVIDER.forObject(
DUMMY_CLASS_INSTANCE.finalObjectField));
}
public static final Map<ResolvedJavaField, JavaConstant> INSTANCE_FINAL_DEFAULT_FIELDS_MAP
= new HashMap<>();
public static final Map<ResolvedJavaField, JavaConstant> INSTANCE_FINAL_DEFAULT_FIELDS_MAP = new HashMap<>();
static {
INSTANCE_FINAL_DEFAULT_FIELDS_MAP.put(getResolvedJavaField(DummyClass.class,
"finalDefaultBooleanField"),
JavaConstant.forBoolean(
DUMMY_CLASS_INSTANCE.finalDefaultBooleanField));
"finalDefaultBooleanField"),
JavaConstant.forBoolean(
DUMMY_CLASS_INSTANCE.finalDefaultBooleanField));
INSTANCE_FINAL_DEFAULT_FIELDS_MAP.put(getResolvedJavaField(DummyClass.class,
"finalDefaultByteField"),
JavaConstant.forByte(
DUMMY_CLASS_INSTANCE.finalDefaultByteField));
"finalDefaultByteField"),
JavaConstant.forByte(
DUMMY_CLASS_INSTANCE.finalDefaultByteField));
INSTANCE_FINAL_DEFAULT_FIELDS_MAP.put(getResolvedJavaField(DummyClass.class,
"finalDefaultShortField"),
JavaConstant.forShort(
DUMMY_CLASS_INSTANCE.finalDefaultShortField));
"finalDefaultShortField"),
JavaConstant.forShort(
DUMMY_CLASS_INSTANCE.finalDefaultShortField));
INSTANCE_FINAL_DEFAULT_FIELDS_MAP.put(getResolvedJavaField(DummyClass.class,
"finalDefaultCharField"),
JavaConstant.forChar(
DUMMY_CLASS_INSTANCE.finalDefaultCharField));
"finalDefaultCharField"),
JavaConstant.forChar(
DUMMY_CLASS_INSTANCE.finalDefaultCharField));
INSTANCE_FINAL_DEFAULT_FIELDS_MAP.put(getResolvedJavaField(DummyClass.class,
"finalDefaultIntField"),
JavaConstant.forInt(
DUMMY_CLASS_INSTANCE.finalDefaultIntField));
"finalDefaultIntField"),
JavaConstant.forInt(
DUMMY_CLASS_INSTANCE.finalDefaultIntField));
INSTANCE_FINAL_DEFAULT_FIELDS_MAP.put(getResolvedJavaField(DummyClass.class,
"finalDefaultLongField"),
JavaConstant.forLong(
DUMMY_CLASS_INSTANCE.finalDefaultLongField));
"finalDefaultLongField"),
JavaConstant.forLong(
DUMMY_CLASS_INSTANCE.finalDefaultLongField));
INSTANCE_FINAL_DEFAULT_FIELDS_MAP.put(getResolvedJavaField(DummyClass.class,
"finalDefaultFloatField"),
JavaConstant.forFloat(
DUMMY_CLASS_INSTANCE.finalDefaultFloatField));
"finalDefaultFloatField"),
JavaConstant.forFloat(
DUMMY_CLASS_INSTANCE.finalDefaultFloatField));
INSTANCE_FINAL_DEFAULT_FIELDS_MAP.put(getResolvedJavaField(DummyClass.class,
"finalDefaultDoubleField"),
JavaConstant.forDouble(
DUMMY_CLASS_INSTANCE.finalDefaultDoubleField));
"finalDefaultDoubleField"),
JavaConstant.forDouble(
DUMMY_CLASS_INSTANCE.finalDefaultDoubleField));
INSTANCE_FINAL_DEFAULT_FIELDS_MAP.put(getResolvedJavaField(DummyClass.class,
"finalDefaultObjectField"),
CONSTANT_REFLECTION_PROVIDER.forObject(
DUMMY_CLASS_INSTANCE.finalDefaultObjectField));
"finalDefaultObjectField"),
CONSTANT_REFLECTION_PROVIDER.forObject(
DUMMY_CLASS_INSTANCE.finalDefaultObjectField));
}
public static final Map<ResolvedJavaField, JavaConstant> INSTANCE_STABLE_FIELDS_MAP
= new HashMap<>();
public static final Map<ResolvedJavaField, JavaConstant> INSTANCE_STABLE_FIELDS_MAP = new HashMap<>();
static {
INSTANCE_STABLE_FIELDS_MAP.put(getResolvedJavaField(DummyClass.class, "stableBooleanField"),
JavaConstant.forBoolean(
DUMMY_CLASS_INSTANCE.stableBooleanField));
JavaConstant.forBoolean(
DUMMY_CLASS_INSTANCE.stableBooleanField));
INSTANCE_STABLE_FIELDS_MAP.put(getResolvedJavaField(DummyClass.class, "stableByteField"),
JavaConstant.forByte(DUMMY_CLASS_INSTANCE.stableByteField));
JavaConstant.forByte(DUMMY_CLASS_INSTANCE.stableByteField));
INSTANCE_STABLE_FIELDS_MAP.put(getResolvedJavaField(DummyClass.class, "stableShortField"),
JavaConstant.forShort(
DUMMY_CLASS_INSTANCE.stableShortField));
JavaConstant.forShort(
DUMMY_CLASS_INSTANCE.stableShortField));
INSTANCE_STABLE_FIELDS_MAP.put(getResolvedJavaField(DummyClass.class, "stableCharField"),
JavaConstant.forChar(DUMMY_CLASS_INSTANCE.stableCharField));
JavaConstant.forChar(DUMMY_CLASS_INSTANCE.stableCharField));
INSTANCE_STABLE_FIELDS_MAP.put(getResolvedJavaField(DummyClass.class, "stableIntField"),
JavaConstant.forInt(DUMMY_CLASS_INSTANCE.stableIntField));
JavaConstant.forInt(DUMMY_CLASS_INSTANCE.stableIntField));
INSTANCE_STABLE_FIELDS_MAP.put(getResolvedJavaField(DummyClass.class, "stableLongField"),
JavaConstant.forLong(DUMMY_CLASS_INSTANCE.stableLongField));
JavaConstant.forLong(DUMMY_CLASS_INSTANCE.stableLongField));
INSTANCE_STABLE_FIELDS_MAP.put(getResolvedJavaField(DummyClass.class, "stableFloatField"),
JavaConstant.forFloat(
DUMMY_CLASS_INSTANCE.stableFloatField));
JavaConstant.forFloat(
DUMMY_CLASS_INSTANCE.stableFloatField));
INSTANCE_STABLE_FIELDS_MAP.put(getResolvedJavaField(DummyClass.class, "stableDoubleField"),
JavaConstant.forDouble(
DUMMY_CLASS_INSTANCE.stableDoubleField));
JavaConstant.forDouble(
DUMMY_CLASS_INSTANCE.stableDoubleField));
INSTANCE_STABLE_FIELDS_MAP.put(getResolvedJavaField(DummyClass.class, "stableObjectField"),
CONSTANT_REFLECTION_PROVIDER.forObject(
DUMMY_CLASS_INSTANCE.stableObjectField));
CONSTANT_REFLECTION_PROVIDER.forObject(
DUMMY_CLASS_INSTANCE.stableObjectField));
}
public static final Map<ResolvedJavaField, JavaConstant> INSTANCE_STABLE_DEFAULT_FIELDS_MAP
= new HashMap<>();
public static final Map<ResolvedJavaField, JavaConstant> INSTANCE_STABLE_DEFAULT_FIELDS_MAP = new HashMap<>();
static {
INSTANCE_STABLE_DEFAULT_FIELDS_MAP.put(getResolvedJavaField(DummyClass.class,
"stableDefaultBooleanField"),
JavaConstant.forBoolean(
DUMMY_CLASS_INSTANCE.stableDefaultBooleanField));
"stableDefaultBooleanField"),
JavaConstant.forBoolean(
DUMMY_CLASS_INSTANCE.stableDefaultBooleanField));
INSTANCE_STABLE_DEFAULT_FIELDS_MAP.put(getResolvedJavaField(DummyClass.class,
"stableDefaultByteField"),
JavaConstant.forByte(
DUMMY_CLASS_INSTANCE.stableDefaultByteField));
"stableDefaultByteField"),
JavaConstant.forByte(
DUMMY_CLASS_INSTANCE.stableDefaultByteField));
INSTANCE_STABLE_DEFAULT_FIELDS_MAP.put(getResolvedJavaField(DummyClass.class,
"stableDefaultShortField"),
JavaConstant.forShort(
DUMMY_CLASS_INSTANCE.stableDefaultShortField));
"stableDefaultShortField"),
JavaConstant.forShort(
DUMMY_CLASS_INSTANCE.stableDefaultShortField));
INSTANCE_STABLE_DEFAULT_FIELDS_MAP.put(getResolvedJavaField(DummyClass.class,
"stableDefaultCharField"),
JavaConstant.forChar(
DUMMY_CLASS_INSTANCE.stableDefaultCharField));
"stableDefaultCharField"),
JavaConstant.forChar(
DUMMY_CLASS_INSTANCE.stableDefaultCharField));
INSTANCE_STABLE_DEFAULT_FIELDS_MAP.put(getResolvedJavaField(DummyClass.class,
"stableDefaultIntField"),
JavaConstant.forInt(
DUMMY_CLASS_INSTANCE.stableDefaultIntField));
"stableDefaultIntField"),
JavaConstant.forInt(
DUMMY_CLASS_INSTANCE.stableDefaultIntField));
INSTANCE_STABLE_DEFAULT_FIELDS_MAP.put(getResolvedJavaField(DummyClass.class,
"stableDefaultLongField"),
JavaConstant.forLong(
DUMMY_CLASS_INSTANCE.stableDefaultLongField));
"stableDefaultLongField"),
JavaConstant.forLong(
DUMMY_CLASS_INSTANCE.stableDefaultLongField));
INSTANCE_STABLE_DEFAULT_FIELDS_MAP.put(getResolvedJavaField(DummyClass.class,
"stableDefaultFloatField"),
JavaConstant.forFloat(
DUMMY_CLASS_INSTANCE.stableDefaultFloatField));
"stableDefaultFloatField"),
JavaConstant.forFloat(
DUMMY_CLASS_INSTANCE.stableDefaultFloatField));
INSTANCE_STABLE_DEFAULT_FIELDS_MAP.put(getResolvedJavaField(DummyClass.class,
"stableDefaultDoubleField"),
JavaConstant.forDouble(
DUMMY_CLASS_INSTANCE.stableDefaultDoubleField));
"stableDefaultDoubleField"),
JavaConstant.forDouble(
DUMMY_CLASS_INSTANCE.stableDefaultDoubleField));
INSTANCE_STABLE_DEFAULT_FIELDS_MAP.put(getResolvedJavaField(DummyClass.class,
"stableDefaultObjectField"),
CONSTANT_REFLECTION_PROVIDER.forObject(
DUMMY_CLASS_INSTANCE.stableDefaultObjectField));
"stableDefaultObjectField"),
CONSTANT_REFLECTION_PROVIDER.forObject(
DUMMY_CLASS_INSTANCE.stableDefaultObjectField));
}
public static final Map<ResolvedJavaField, JavaConstant> STATIC_FIELDS_MAP = new HashMap<>();
static {
STATIC_FIELDS_MAP.put(getResolvedJavaField(DummyClass.class, "staticBooleanField"),
JavaConstant.forBoolean(DummyClass.staticBooleanField));
JavaConstant.forBoolean(DummyClass.staticBooleanField));
STATIC_FIELDS_MAP.put(getResolvedJavaField(DummyClass.class, "staticByteField"),
JavaConstant.forByte(DummyClass.staticByteField));
JavaConstant.forByte(DummyClass.staticByteField));
STATIC_FIELDS_MAP.put(getResolvedJavaField(DummyClass.class, "staticShortField"),
JavaConstant.forShort(DummyClass.staticShortField));
JavaConstant.forShort(DummyClass.staticShortField));
STATIC_FIELDS_MAP.put(getResolvedJavaField(DummyClass.class, "staticCharField"),
JavaConstant.forChar(DummyClass.staticCharField));
JavaConstant.forChar(DummyClass.staticCharField));
STATIC_FIELDS_MAP.put(getResolvedJavaField(DummyClass.class, "staticIntField"),
JavaConstant.forInt(DummyClass.staticIntField));
JavaConstant.forInt(DummyClass.staticIntField));
STATIC_FIELDS_MAP.put(getResolvedJavaField(DummyClass.class, "staticLongField"),
JavaConstant.forLong(DummyClass.staticLongField));
JavaConstant.forLong(DummyClass.staticLongField));
STATIC_FIELDS_MAP.put(getResolvedJavaField(DummyClass.class, "staticFloatField"),
JavaConstant.forFloat(DummyClass.staticFloatField));
JavaConstant.forFloat(DummyClass.staticFloatField));
STATIC_FIELDS_MAP.put(getResolvedJavaField(DummyClass.class, "staticDoubleField"),
JavaConstant.forDouble(DummyClass.staticDoubleField));
JavaConstant.forDouble(DummyClass.staticDoubleField));
STATIC_FIELDS_MAP.put(getResolvedJavaField(DummyClass.class, "staticObjectField"),
CONSTANT_REFLECTION_PROVIDER.forObject(DummyClass.staticObjectField));
CONSTANT_REFLECTION_PROVIDER.forObject(DummyClass.staticObjectField));
}
public static final Map<ResolvedJavaField, JavaConstant> STATIC_FINAL_FIELDS_MAP
= new HashMap<>();
public static final Map<ResolvedJavaField, JavaConstant> STATIC_FINAL_FIELDS_MAP = new HashMap<>();
static {
STATIC_FINAL_FIELDS_MAP.put(
getResolvedJavaField(DummyClass.class, "staticFinalBooleanField"),
JavaConstant.forBoolean(DummyClass.staticFinalBooleanField));
getResolvedJavaField(DummyClass.class, "staticFinalBooleanField"),
JavaConstant.forBoolean(DummyClass.staticFinalBooleanField));
STATIC_FINAL_FIELDS_MAP.put(getResolvedJavaField(DummyClass.class, "staticFinalByteField"),
JavaConstant.forByte(DummyClass.staticFinalByteField));
JavaConstant.forByte(DummyClass.staticFinalByteField));
STATIC_FINAL_FIELDS_MAP.put(getResolvedJavaField(DummyClass.class, "staticFinalShortField"),
JavaConstant.forShort(DummyClass.staticFinalShortField));
JavaConstant.forShort(DummyClass.staticFinalShortField));
STATIC_FINAL_FIELDS_MAP.put(getResolvedJavaField(DummyClass.class, "staticFinalCharField"),
JavaConstant.forChar(DummyClass.staticFinalCharField));
JavaConstant.forChar(DummyClass.staticFinalCharField));
STATIC_FINAL_FIELDS_MAP.put(getResolvedJavaField(DummyClass.class, "staticFinalIntField"),
JavaConstant.forInt(DummyClass.staticFinalIntField));
JavaConstant.forInt(DummyClass.staticFinalIntField));
STATIC_FINAL_FIELDS_MAP.put(getResolvedJavaField(DummyClass.class, "staticFinalLongField"),
JavaConstant.forLong(DummyClass.staticFinalLongField));
JavaConstant.forLong(DummyClass.staticFinalLongField));
STATIC_FINAL_FIELDS_MAP.put(getResolvedJavaField(DummyClass.class, "staticFinalFloatField"),
JavaConstant.forFloat(DummyClass.staticFinalFloatField));
JavaConstant.forFloat(DummyClass.staticFinalFloatField));
STATIC_FINAL_FIELDS_MAP.put(
getResolvedJavaField(DummyClass.class, "staticFinalDoubleField"),
JavaConstant.forDouble(DummyClass.staticFinalDoubleField));
getResolvedJavaField(DummyClass.class, "staticFinalDoubleField"),
JavaConstant.forDouble(DummyClass.staticFinalDoubleField));
STATIC_FINAL_FIELDS_MAP.put(
getResolvedJavaField(DummyClass.class, "staticFinalObjectField"),
CONSTANT_REFLECTION_PROVIDER.forObject(DummyClass.staticFinalObjectField));
getResolvedJavaField(DummyClass.class, "staticFinalObjectField"),
CONSTANT_REFLECTION_PROVIDER.forObject(DummyClass.staticFinalObjectField));
}
public static final Map<ResolvedJavaField, JavaConstant> STATIC_STABLE_FIELDS_MAP
= new HashMap<>();
public static final Map<ResolvedJavaField, JavaConstant> STATIC_STABLE_FIELDS_MAP = new HashMap<>();
static {
STATIC_STABLE_FIELDS_MAP.put(
getResolvedJavaField(DummyClass.class, "staticStableBooleanField"),
JavaConstant.forBoolean(DummyClass.staticStableBooleanField));
getResolvedJavaField(DummyClass.class, "staticStableBooleanField"),
JavaConstant.forBoolean(DummyClass.staticStableBooleanField));
STATIC_STABLE_FIELDS_MAP.put(
getResolvedJavaField(DummyClass.class, "staticStableByteField"),
JavaConstant.forByte(DummyClass.staticStableByteField));
getResolvedJavaField(DummyClass.class, "staticStableByteField"),
JavaConstant.forByte(DummyClass.staticStableByteField));
STATIC_STABLE_FIELDS_MAP.put(
getResolvedJavaField(DummyClass.class, "staticStableShortField"),
JavaConstant.forShort(DummyClass.staticStableShortField));
getResolvedJavaField(DummyClass.class, "staticStableShortField"),
JavaConstant.forShort(DummyClass.staticStableShortField));
STATIC_STABLE_FIELDS_MAP.put(
getResolvedJavaField(DummyClass.class, "staticStableCharField"),
JavaConstant.forChar(DummyClass.staticStableCharField));
getResolvedJavaField(DummyClass.class, "staticStableCharField"),
JavaConstant.forChar(DummyClass.staticStableCharField));
STATIC_STABLE_FIELDS_MAP.put(getResolvedJavaField(DummyClass.class, "staticStableIntField"),
JavaConstant.forInt(DummyClass.staticStableIntField));
JavaConstant.forInt(DummyClass.staticStableIntField));
STATIC_STABLE_FIELDS_MAP.put(
getResolvedJavaField(DummyClass.class, "staticStableLongField"),
JavaConstant.forLong(DummyClass.staticStableLongField));
getResolvedJavaField(DummyClass.class, "staticStableLongField"),
JavaConstant.forLong(DummyClass.staticStableLongField));
STATIC_STABLE_FIELDS_MAP.put(
getResolvedJavaField(DummyClass.class, "staticStableFloatField"),
JavaConstant.forFloat(DummyClass.staticStableFloatField));
getResolvedJavaField(DummyClass.class, "staticStableFloatField"),
JavaConstant.forFloat(DummyClass.staticStableFloatField));
STATIC_STABLE_FIELDS_MAP.put(
getResolvedJavaField(DummyClass.class, "staticStableDoubleField"),
JavaConstant.forDouble(DummyClass.staticStableDoubleField));
getResolvedJavaField(DummyClass.class, "staticStableDoubleField"),
JavaConstant.forDouble(DummyClass.staticStableDoubleField));
STATIC_STABLE_FIELDS_MAP.put(
getResolvedJavaField(DummyClass.class, "staticStableObjectField"),
CONSTANT_REFLECTION_PROVIDER.forObject(DummyClass.staticStableObjectField));
getResolvedJavaField(DummyClass.class, "staticStableObjectField"),
CONSTANT_REFLECTION_PROVIDER.forObject(DummyClass.staticStableObjectField));
}
public static final Map<ResolvedJavaField, JavaConstant> STATIC_STABLE_DEFAULT_FIELDS_MAP
= new HashMap<>();
public static final Map<ResolvedJavaField, JavaConstant> STATIC_STABLE_DEFAULT_FIELDS_MAP = new HashMap<>();
static {
STATIC_STABLE_DEFAULT_FIELDS_MAP.put(getResolvedJavaField(DummyClass.class,
"staticStableDefaultBooleanField"),
JavaConstant.forBoolean(
DummyClass.staticStableDefaultBooleanField));
"staticStableDefaultBooleanField"),
JavaConstant.forBoolean(
DummyClass.staticStableDefaultBooleanField));
STATIC_STABLE_DEFAULT_FIELDS_MAP.put(getResolvedJavaField(DummyClass.class,
"staticStableDefaultByteField"),
JavaConstant.forByte(
DummyClass.staticStableDefaultByteField));
"staticStableDefaultByteField"),
JavaConstant.forByte(
DummyClass.staticStableDefaultByteField));
STATIC_STABLE_DEFAULT_FIELDS_MAP.put(getResolvedJavaField(DummyClass.class,
"staticStableDefaultShortField"),
JavaConstant.forShort(
DummyClass.staticStableDefaultShortField));
"staticStableDefaultShortField"),
JavaConstant.forShort(
DummyClass.staticStableDefaultShortField));
STATIC_STABLE_DEFAULT_FIELDS_MAP.put(getResolvedJavaField(DummyClass.class,
"staticStableDefaultCharField"),
JavaConstant.forChar(
DummyClass.staticStableDefaultCharField));
"staticStableDefaultCharField"),
JavaConstant.forChar(
DummyClass.staticStableDefaultCharField));
STATIC_STABLE_DEFAULT_FIELDS_MAP.put(getResolvedJavaField(DummyClass.class,
"staticStableDefaultIntField"),
JavaConstant.forInt(
DummyClass.staticStableDefaultIntField));
"staticStableDefaultIntField"),
JavaConstant.forInt(
DummyClass.staticStableDefaultIntField));
STATIC_STABLE_DEFAULT_FIELDS_MAP.put(getResolvedJavaField(DummyClass.class,
"staticStableDefaultLongField"),
JavaConstant.forLong(
DummyClass.staticStableDefaultLongField));
"staticStableDefaultLongField"),
JavaConstant.forLong(
DummyClass.staticStableDefaultLongField));
STATIC_STABLE_DEFAULT_FIELDS_MAP.put(getResolvedJavaField(DummyClass.class,
"staticStableDefaultFloatField"),
JavaConstant.forFloat(
DummyClass.staticStableDefaultFloatField));
"staticStableDefaultFloatField"),
JavaConstant.forFloat(
DummyClass.staticStableDefaultFloatField));
STATIC_STABLE_DEFAULT_FIELDS_MAP.put(getResolvedJavaField(DummyClass.class,
"staticStableDefaultDoubleField"),
JavaConstant.forDouble(
DummyClass.staticStableDefaultDoubleField));
"staticStableDefaultDoubleField"),
JavaConstant.forDouble(
DummyClass.staticStableDefaultDoubleField));
STATIC_STABLE_DEFAULT_FIELDS_MAP.put(getResolvedJavaField(DummyClass.class,
"staticStableDefaultObjectField"),
CONSTANT_REFLECTION_PROVIDER.forObject(
DummyClass.staticStableDefaultObjectField));
"staticStableDefaultObjectField"),
CONSTANT_REFLECTION_PROVIDER.forObject(
DummyClass.staticStableDefaultObjectField));
}
public static final int ARRAY_DIMENSION = 1;
@ -336,138 +326,138 @@ public class TestHelper {
static {
ARRAYS_MAP.put(getResolvedJavaField(DummyClass.class, "booleanArrayWithValues"),
CONSTANT_REFLECTION_PROVIDER.forObject(
DUMMY_CLASS_INSTANCE.booleanArrayWithValues));
CONSTANT_REFLECTION_PROVIDER.forObject(
DUMMY_CLASS_INSTANCE.booleanArrayWithValues));
ARRAYS_MAP.put(getResolvedJavaField(DummyClass.class, "byteArrayWithValues"),
CONSTANT_REFLECTION_PROVIDER.forObject(
DUMMY_CLASS_INSTANCE.byteArrayWithValues));
CONSTANT_REFLECTION_PROVIDER.forObject(
DUMMY_CLASS_INSTANCE.byteArrayWithValues));
ARRAYS_MAP.put(getResolvedJavaField(DummyClass.class, "shortArrayWithValues"),
CONSTANT_REFLECTION_PROVIDER.forObject(
DUMMY_CLASS_INSTANCE.shortArrayWithValues));
CONSTANT_REFLECTION_PROVIDER.forObject(
DUMMY_CLASS_INSTANCE.shortArrayWithValues));
ARRAYS_MAP.put(getResolvedJavaField(DummyClass.class, "charArrayWithValues"),
CONSTANT_REFLECTION_PROVIDER.forObject(
DUMMY_CLASS_INSTANCE.charArrayWithValues));
CONSTANT_REFLECTION_PROVIDER.forObject(
DUMMY_CLASS_INSTANCE.charArrayWithValues));
ARRAYS_MAP.put(getResolvedJavaField(DummyClass.class, "intArrayWithValues"),
CONSTANT_REFLECTION_PROVIDER.forObject(
DUMMY_CLASS_INSTANCE.intArrayWithValues));
CONSTANT_REFLECTION_PROVIDER.forObject(
DUMMY_CLASS_INSTANCE.intArrayWithValues));
ARRAYS_MAP.put(getResolvedJavaField(DummyClass.class, "longArrayWithValues"),
CONSTANT_REFLECTION_PROVIDER.forObject(
DUMMY_CLASS_INSTANCE.longArrayWithValues));
CONSTANT_REFLECTION_PROVIDER.forObject(
DUMMY_CLASS_INSTANCE.longArrayWithValues));
ARRAYS_MAP.put(getResolvedJavaField(DummyClass.class, "floatArrayWithValues"),
CONSTANT_REFLECTION_PROVIDER.forObject(
DUMMY_CLASS_INSTANCE.floatArrayWithValues));
CONSTANT_REFLECTION_PROVIDER.forObject(
DUMMY_CLASS_INSTANCE.floatArrayWithValues));
ARRAYS_MAP.put(getResolvedJavaField(DummyClass.class, "doubleArrayWithValues"),
CONSTANT_REFLECTION_PROVIDER.forObject(
DUMMY_CLASS_INSTANCE.doubleArrayWithValues));
CONSTANT_REFLECTION_PROVIDER.forObject(
DUMMY_CLASS_INSTANCE.doubleArrayWithValues));
ARRAYS_MAP.put(getResolvedJavaField(DummyClass.class, "objectArrayWithValues"),
CONSTANT_REFLECTION_PROVIDER.forObject(
DUMMY_CLASS_INSTANCE.objectArrayWithValues));
CONSTANT_REFLECTION_PROVIDER.forObject(
DUMMY_CLASS_INSTANCE.objectArrayWithValues));
}
public static final Map<ResolvedJavaField, JavaConstant> STABLE_ARRAYS_MAP = new HashMap<>();
static {
STABLE_ARRAYS_MAP.put(
getResolvedJavaField(DummyClass.class, "stableBooleanArrayWithValues"),
CONSTANT_REFLECTION_PROVIDER.forObject(
DUMMY_CLASS_INSTANCE.stableBooleanArrayWithValues));
getResolvedJavaField(DummyClass.class, "stableBooleanArrayWithValues"),
CONSTANT_REFLECTION_PROVIDER.forObject(
DUMMY_CLASS_INSTANCE.stableBooleanArrayWithValues));
STABLE_ARRAYS_MAP.put(getResolvedJavaField(DummyClass.class, "stableByteArrayWithValues"),
CONSTANT_REFLECTION_PROVIDER.forObject(
DUMMY_CLASS_INSTANCE.stableByteArrayWithValues));
CONSTANT_REFLECTION_PROVIDER.forObject(
DUMMY_CLASS_INSTANCE.stableByteArrayWithValues));
STABLE_ARRAYS_MAP.put(getResolvedJavaField(DummyClass.class, "stableShortArrayWithValues"),
CONSTANT_REFLECTION_PROVIDER.forObject(
DUMMY_CLASS_INSTANCE.stableShortArrayWithValues));
CONSTANT_REFLECTION_PROVIDER.forObject(
DUMMY_CLASS_INSTANCE.stableShortArrayWithValues));
STABLE_ARRAYS_MAP.put(getResolvedJavaField(DummyClass.class, "stableCharArrayWithValues"),
CONSTANT_REFLECTION_PROVIDER.forObject(
DUMMY_CLASS_INSTANCE.stableCharArrayWithValues));
CONSTANT_REFLECTION_PROVIDER.forObject(
DUMMY_CLASS_INSTANCE.stableCharArrayWithValues));
STABLE_ARRAYS_MAP.put(getResolvedJavaField(DummyClass.class, "stableIntArrayWithValues"),
CONSTANT_REFLECTION_PROVIDER.forObject(
DUMMY_CLASS_INSTANCE.stableIntArrayWithValues));
CONSTANT_REFLECTION_PROVIDER.forObject(
DUMMY_CLASS_INSTANCE.stableIntArrayWithValues));
STABLE_ARRAYS_MAP.put(getResolvedJavaField(DummyClass.class, "stableLongArrayWithValues"),
CONSTANT_REFLECTION_PROVIDER.forObject(
DUMMY_CLASS_INSTANCE.stableLongArrayWithValues));
CONSTANT_REFLECTION_PROVIDER.forObject(
DUMMY_CLASS_INSTANCE.stableLongArrayWithValues));
STABLE_ARRAYS_MAP.put(getResolvedJavaField(DummyClass.class, "stableFloatArrayWithValues"),
CONSTANT_REFLECTION_PROVIDER.forObject(
DUMMY_CLASS_INSTANCE.stableFloatArrayWithValues));
CONSTANT_REFLECTION_PROVIDER.forObject(
DUMMY_CLASS_INSTANCE.stableFloatArrayWithValues));
STABLE_ARRAYS_MAP.put(getResolvedJavaField(DummyClass.class, "stableDoubleArrayWithValues"),
CONSTANT_REFLECTION_PROVIDER.forObject(
DUMMY_CLASS_INSTANCE.stableDoubleArrayWithValues));
CONSTANT_REFLECTION_PROVIDER.forObject(
DUMMY_CLASS_INSTANCE.stableDoubleArrayWithValues));
STABLE_ARRAYS_MAP.put(getResolvedJavaField(DummyClass.class, "stableObjectArrayWithValues"),
CONSTANT_REFLECTION_PROVIDER.forObject(
DUMMY_CLASS_INSTANCE.stableObjectArrayWithValues));
CONSTANT_REFLECTION_PROVIDER.forObject(
DUMMY_CLASS_INSTANCE.stableObjectArrayWithValues));
}
public static final Map<ResolvedJavaField, JavaConstant> ARRAY_ARRAYS_MAP = new HashMap<>();
static {
ARRAY_ARRAYS_MAP.put(getResolvedJavaField(DummyClass.class, "booleanArrayArrayWithValues"),
CONSTANT_REFLECTION_PROVIDER.forObject(
DUMMY_CLASS_INSTANCE.booleanArrayArrayWithValues));
CONSTANT_REFLECTION_PROVIDER.forObject(
DUMMY_CLASS_INSTANCE.booleanArrayArrayWithValues));
ARRAY_ARRAYS_MAP.put(getResolvedJavaField(DummyClass.class, "byteArrayArrayWithValues"),
CONSTANT_REFLECTION_PROVIDER.forObject(
DUMMY_CLASS_INSTANCE.byteArrayArrayWithValues));
CONSTANT_REFLECTION_PROVIDER.forObject(
DUMMY_CLASS_INSTANCE.byteArrayArrayWithValues));
ARRAY_ARRAYS_MAP.put(getResolvedJavaField(DummyClass.class, "shortArrayArrayWithValues"),
CONSTANT_REFLECTION_PROVIDER.forObject(
DUMMY_CLASS_INSTANCE.shortArrayArrayWithValues));
CONSTANT_REFLECTION_PROVIDER.forObject(
DUMMY_CLASS_INSTANCE.shortArrayArrayWithValues));
ARRAY_ARRAYS_MAP.put(getResolvedJavaField(DummyClass.class, "charArrayArrayWithValues"),
CONSTANT_REFLECTION_PROVIDER.forObject(
DUMMY_CLASS_INSTANCE.charArrayArrayWithValues));
CONSTANT_REFLECTION_PROVIDER.forObject(
DUMMY_CLASS_INSTANCE.charArrayArrayWithValues));
ARRAY_ARRAYS_MAP.put(getResolvedJavaField(DummyClass.class, "intArrayArrayWithValues"),
CONSTANT_REFLECTION_PROVIDER.forObject(
DUMMY_CLASS_INSTANCE.intArrayArrayWithValues));
CONSTANT_REFLECTION_PROVIDER.forObject(
DUMMY_CLASS_INSTANCE.intArrayArrayWithValues));
ARRAY_ARRAYS_MAP.put(getResolvedJavaField(DummyClass.class, "longArrayArrayWithValues"),
CONSTANT_REFLECTION_PROVIDER.forObject(
DUMMY_CLASS_INSTANCE.longArrayArrayWithValues));
CONSTANT_REFLECTION_PROVIDER.forObject(
DUMMY_CLASS_INSTANCE.longArrayArrayWithValues));
ARRAY_ARRAYS_MAP.put(getResolvedJavaField(DummyClass.class, "floatArrayArrayWithValues"),
CONSTANT_REFLECTION_PROVIDER.forObject(
DUMMY_CLASS_INSTANCE.floatArrayArrayWithValues));
CONSTANT_REFLECTION_PROVIDER.forObject(
DUMMY_CLASS_INSTANCE.floatArrayArrayWithValues));
ARRAY_ARRAYS_MAP.put(getResolvedJavaField(DummyClass.class, "doubleArrayArrayWithValues"),
CONSTANT_REFLECTION_PROVIDER.forObject(
DUMMY_CLASS_INSTANCE.doubleArrayArrayWithValues));
CONSTANT_REFLECTION_PROVIDER.forObject(
DUMMY_CLASS_INSTANCE.doubleArrayArrayWithValues));
ARRAY_ARRAYS_MAP.put(getResolvedJavaField(DummyClass.class, "objectArrayArrayWithValues"),
CONSTANT_REFLECTION_PROVIDER.forObject(
DUMMY_CLASS_INSTANCE.objectArrayArrayWithValues));
CONSTANT_REFLECTION_PROVIDER.forObject(
DUMMY_CLASS_INSTANCE.objectArrayArrayWithValues));
}
public static final Map<ResolvedJavaField, JavaConstant> STABLE_ARRAY_ARRAYS_MAP = new HashMap<>();
static {
STABLE_ARRAY_ARRAYS_MAP.put(
getResolvedJavaField(DummyClass.class, "stableBooleanArrayArrayWithValues"),
CONSTANT_REFLECTION_PROVIDER.forObject(
DUMMY_CLASS_INSTANCE.stableBooleanArrayArrayWithValues));
getResolvedJavaField(DummyClass.class, "stableBooleanArrayArrayWithValues"),
CONSTANT_REFLECTION_PROVIDER.forObject(
DUMMY_CLASS_INSTANCE.stableBooleanArrayArrayWithValues));
STABLE_ARRAY_ARRAYS_MAP.put(
getResolvedJavaField(DummyClass.class, "stableByteArrayArrayWithValues"),
CONSTANT_REFLECTION_PROVIDER.forObject(
DUMMY_CLASS_INSTANCE.stableByteArrayArrayWithValues));
getResolvedJavaField(DummyClass.class, "stableByteArrayArrayWithValues"),
CONSTANT_REFLECTION_PROVIDER.forObject(
DUMMY_CLASS_INSTANCE.stableByteArrayArrayWithValues));
STABLE_ARRAY_ARRAYS_MAP.put(
getResolvedJavaField(DummyClass.class, "stableShortArrayArrayWithValues"),
CONSTANT_REFLECTION_PROVIDER.forObject(
DUMMY_CLASS_INSTANCE.stableShortArrayArrayWithValues));
getResolvedJavaField(DummyClass.class, "stableShortArrayArrayWithValues"),
CONSTANT_REFLECTION_PROVIDER.forObject(
DUMMY_CLASS_INSTANCE.stableShortArrayArrayWithValues));
STABLE_ARRAY_ARRAYS_MAP.put(
getResolvedJavaField(DummyClass.class, "stableCharArrayArrayWithValues"),
CONSTANT_REFLECTION_PROVIDER.forObject(
DUMMY_CLASS_INSTANCE.stableCharArrayArrayWithValues));
getResolvedJavaField(DummyClass.class, "stableCharArrayArrayWithValues"),
CONSTANT_REFLECTION_PROVIDER.forObject(
DUMMY_CLASS_INSTANCE.stableCharArrayArrayWithValues));
STABLE_ARRAY_ARRAYS_MAP.put(
getResolvedJavaField(DummyClass.class, "stableIntArrayArrayWithValues"),
CONSTANT_REFLECTION_PROVIDER.forObject(
DUMMY_CLASS_INSTANCE.stableIntArrayArrayWithValues));
getResolvedJavaField(DummyClass.class, "stableIntArrayArrayWithValues"),
CONSTANT_REFLECTION_PROVIDER.forObject(
DUMMY_CLASS_INSTANCE.stableIntArrayArrayWithValues));
STABLE_ARRAY_ARRAYS_MAP.put(
getResolvedJavaField(DummyClass.class, "stableLongArrayArrayWithValues"),
CONSTANT_REFLECTION_PROVIDER.forObject(
DUMMY_CLASS_INSTANCE.stableLongArrayArrayWithValues));
getResolvedJavaField(DummyClass.class, "stableLongArrayArrayWithValues"),
CONSTANT_REFLECTION_PROVIDER.forObject(
DUMMY_CLASS_INSTANCE.stableLongArrayArrayWithValues));
STABLE_ARRAY_ARRAYS_MAP.put(
getResolvedJavaField(DummyClass.class, "stableFloatArrayArrayWithValues"),
CONSTANT_REFLECTION_PROVIDER.forObject(
DUMMY_CLASS_INSTANCE.stableFloatArrayArrayWithValues));
getResolvedJavaField(DummyClass.class, "stableFloatArrayArrayWithValues"),
CONSTANT_REFLECTION_PROVIDER.forObject(
DUMMY_CLASS_INSTANCE.stableFloatArrayArrayWithValues));
STABLE_ARRAY_ARRAYS_MAP.put(
getResolvedJavaField(DummyClass.class, "stableDoubleArrayArrayWithValues"),
CONSTANT_REFLECTION_PROVIDER.forObject(
DUMMY_CLASS_INSTANCE.stableDoubleArrayArrayWithValues));
getResolvedJavaField(DummyClass.class, "stableDoubleArrayArrayWithValues"),
CONSTANT_REFLECTION_PROVIDER.forObject(
DUMMY_CLASS_INSTANCE.stableDoubleArrayArrayWithValues));
STABLE_ARRAY_ARRAYS_MAP.put(
getResolvedJavaField(DummyClass.class, "stableObjectArrayArrayWithValues"),
CONSTANT_REFLECTION_PROVIDER.forObject(
DUMMY_CLASS_INSTANCE.stableObjectArrayArrayWithValues));
getResolvedJavaField(DummyClass.class, "stableObjectArrayArrayWithValues"),
CONSTANT_REFLECTION_PROVIDER.forObject(
DUMMY_CLASS_INSTANCE.stableObjectArrayArrayWithValues));
}
public static ResolvedJavaField getResolvedJavaField(Class<?> clazz, String fieldName) {

View File

@ -38,32 +38,32 @@ public class UnboxPrimitiveDataProvider {
LinkedList<Object[]> cfgSet = new LinkedList<>();
// Testing boolean
cfgSet.add(new Object[]{CONSTANT_REFLECTION_PROVIDER.forObject(
(Boolean) true), JavaConstant.forBoolean(true)});
(Boolean) true), JavaConstant.forBoolean(true)});
cfgSet.add(new Object[]{JavaConstant.forBoolean(true), null});
cfgSet.add(new Object[]{CONSTANT_REFLECTION_PROVIDER.forObject((Boolean) false),
JavaConstant.forBoolean(false)});
JavaConstant.forBoolean(false)});
cfgSet.add(new Object[]{JavaConstant.forBoolean(false), null});
for (byte number : new byte[]{-128, 0, 1, 127}) {
// Testing boxed primitives
cfgSet.add(new Object[]{CONSTANT_REFLECTION_PROVIDER.forObject(Byte.valueOf(number)),
JavaConstant.forByte(number)});
JavaConstant.forByte(number)});
cfgSet.add(new Object[]{CONSTANT_REFLECTION_PROVIDER.forObject(Short.valueOf(number)),
JavaConstant.forShort(number)});
JavaConstant.forShort(number)});
cfgSet.add(new Object[]{CONSTANT_REFLECTION_PROVIDER.forObject(Integer.valueOf(number)),
JavaConstant.forInt(number)});
JavaConstant.forInt(number)});
cfgSet.add(new Object[]{CONSTANT_REFLECTION_PROVIDER.forObject(Long.valueOf(number)),
JavaConstant.forLong(number)});
JavaConstant.forLong(number)});
if (number >= 0) {
cfgSet.add(new Object[]{CONSTANT_REFLECTION_PROVIDER.forObject(
Character.valueOf((char) number)),
JavaConstant.forChar((char) number)});
Character.valueOf((char) number)),
JavaConstant.forChar((char) number)});
}
cfgSet.add(new Object[]{CONSTANT_REFLECTION_PROVIDER.forObject(
Float.valueOf(number * 1.1f)),
JavaConstant.forFloat(number * 1.1f)});
Float.valueOf(number * 1.1f)),
JavaConstant.forFloat(number * 1.1f)});
cfgSet.add(new Object[]{CONSTANT_REFLECTION_PROVIDER.forObject(
Double.valueOf(number * 1.1)),
JavaConstant.forDouble(number * 1.1)});
Double.valueOf(number * 1.1)),
JavaConstant.forDouble(number * 1.1)});
// Testing non-boxed primitives (should result in returning of "null")
cfgSet.add(new Object[]{JavaConstant.forByte(number), null});
cfgSet.add(new Object[]{JavaConstant.forShort(number), null});
@ -75,23 +75,23 @@ public class UnboxPrimitiveDataProvider {
}
// Testing boxed primitives with max values
cfgSet.add(new Object[]{CONSTANT_REFLECTION_PROVIDER.forObject(Short.MAX_VALUE),
JavaConstant.forShort(Short.MAX_VALUE)});
JavaConstant.forShort(Short.MAX_VALUE)});
cfgSet.add(new Object[]{CONSTANT_REFLECTION_PROVIDER.forObject(Integer.MAX_VALUE),
JavaConstant.forInt(Integer.MAX_VALUE)});
JavaConstant.forInt(Integer.MAX_VALUE)});
cfgSet.add(new Object[]{CONSTANT_REFLECTION_PROVIDER.forObject(Long.MAX_VALUE),
JavaConstant.forLong(Long.MAX_VALUE)});
JavaConstant.forLong(Long.MAX_VALUE)});
cfgSet.add(new Object[]{CONSTANT_REFLECTION_PROVIDER.forObject(Character.MAX_VALUE),
JavaConstant.forChar(Character.MAX_VALUE)});
JavaConstant.forChar(Character.MAX_VALUE)});
cfgSet.add(new Object[]{CONSTANT_REFLECTION_PROVIDER.forObject(Float.MAX_VALUE),
JavaConstant.forFloat(Float.MAX_VALUE)});
JavaConstant.forFloat(Float.MAX_VALUE)});
cfgSet.add(new Object[]{CONSTANT_REFLECTION_PROVIDER.forObject(Double.MAX_VALUE),
JavaConstant.forDouble(Double.MAX_VALUE)});
JavaConstant.forDouble(Double.MAX_VALUE)});
// Non-primitives testing
cfgSet.add(new Object[]{CONSTANT_REFLECTION_PROVIDER.forObject(
DUMMY_CLASS_INSTANCE.objectField), null});
DUMMY_CLASS_INSTANCE.objectField), null});
cfgSet.add(new Object[]{CONSTANT_REFLECTION_PROVIDER.forObject(
DUMMY_CLASS_INSTANCE.booleanArrayWithValues),
null});
DUMMY_CLASS_INSTANCE.booleanArrayWithValues),
null});
// Null testing
cfgSet.add(new Object[]{JavaConstant.NULL_POINTER, null});
cfgSet.add(new Object[]{null, null});