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. * Constants and intrinsic definition for memory barriers.
* *
* The documentation for each constant is taken from Doug Lea's <a * The documentation for each constant is taken from Doug Lea's
* href="http://gee.cs.oswego.edu/dl/jmm/cookbook.html">The JSR-133 Cookbook for Compiler * <a href="http://gee.cs.oswego.edu/dl/jmm/cookbook.html">The JSR-133 Cookbook for Compiler
* Writers</a>. * Writers</a>.
* <p> * <p>
* The {@code JMM_*} constants capture the memory barriers necessary to implement the Java Memory * 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; public final JavaKind wordJavaKind;
/** /**
* The stack alignment requirement of the platform. For example, from Appendix D of <a * The stack alignment requirement of the platform. For example, from Appendix D of
* href="http://www.intel.com/Assets/PDF/manual/248966.pdf">Intel 64 and IA-32 Architectures * <a href="http://www.intel.com/Assets/PDF/manual/248966.pdf">Intel 64 and IA-32 Architectures
* Optimization Reference Manual</a>: * Optimization Reference Manual</a>:
* *
* <pre> * <pre>

View File

@ -21,10 +21,10 @@
* questions. * questions.
*/ */
/** /**
* Package that defines the interface between a Java application that wants to install code and the runtime. * Package that defines the interface between a Java application that wants to install code and the
* The runtime provides in implementation of the {@link jdk.vm.ci.code.CodeCacheProvider} interface. * runtime. The runtime provides in implementation of the {@link jdk.vm.ci.code.CodeCacheProvider}
* The method {@link jdk.vm.ci.code.CodeCacheProvider#addCode(jdk.vm.ci.meta.ResolvedJavaMethod, CompiledCode, jdk.vm.ci.meta.SpeculationLog, InstalledCode)} * 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. * can be used to install code.
*/ */
package jdk.vm.ci.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); 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); return new JVMCIBackend(metaAccess, codeCache, constantReflection, stackIntrospection);
} }
} }

View File

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

View File

@ -152,7 +152,8 @@ public class HotSpotMetaAccessProvider implements MetaAccessProvider, HotSpotPro
int actionValue = convertDeoptAction(action); int actionValue = convertDeoptAction(action);
int reasonValue = convertDeoptReason(reason); int reasonValue = convertDeoptReason(reason);
int debugValue = debugId & intMaskRight(config.deoptimizationDebugIdBits); 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; assert c.asInt() < 0;
return c; return c;
} }

View File

@ -32,7 +32,7 @@ import java.util.Formatter;
import jdk.vm.ci.meta.JavaMethod; import jdk.vm.ci.meta.JavaMethod;
import jdk.vm.ci.meta.ResolvedJavaMethod; 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) { public static String applyFormattingFlagsAndWidth(String s, int flags, int width) {
if (flags == 0 && width < 0) { if (flags == 0 && width < 0) {

View File

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

View File

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

View File

@ -81,8 +81,8 @@ public interface MetaAccessProvider {
long getMemorySize(JavaConstant constant); long getMemorySize(JavaConstant constant);
/** /**
* Parses a <a * Parses a
* href="http://docs.oracle.com/javase/specs/jvms/se7/html/jvms-4.html#jvms-4.3.3">method * <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 * descriptor</a> into a {@link Signature}. The behavior of this method is undefined if the
* method descriptor is not well formed. * 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 * Checks that the method is a
* href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-4.html#jvms-4.6">varargs</a> * <a href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-4.html#jvms-4.6">varargs</a>
* method. * method.
* *
* @return whether the method is a varargs 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 * Checks that the method is a
* href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-4.html#jvms-4.6">bridge</a> * <a href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-4.html#jvms-4.6">bridge</a>
* method. * method.
* *
* @return whether the method is a bridge method * @return whether the method is a bridge method
@ -332,8 +332,8 @@ public interface ResolvedJavaMethod extends JavaMethod, InvokeTarget, ModifiersP
SpeculationLog getSpeculationLog(); SpeculationLog getSpeculationLog();
/** /**
* Determines if the method identified by its holder and name is a <a * Determines if the method identified by its holder and name is a
* href="https://docs.oracle.com/javase/specs/jvms/se8/html/jvms-2.html#jvms-2.9">signature * <a href="https://docs.oracle.com/javase/specs/jvms/se8/html/jvms-2.html#jvms-2.9">signature
* polymorphic</a> method. * polymorphic</a> method.
*/ */
static boolean isSignaturePolymorphic(JavaType holder, String name, MetaAccessProvider metaAccess) { 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); ResolvedJavaField[] getInstanceFields(boolean includeSuperclasses);
/** /**
* Returns the static fields of this class, including * Returns the static fields of this class, including {@linkplain ResolvedJavaField#isInternal()
* {@linkplain ResolvedJavaField#isInternal() internal} fields. A zero-length array is returned * internal} fields. A zero-length array is returned for array and primitive types. The order of
* for array and primitive types. The order of fields returned by this method is stable. That * fields returned by this method is stable. That is, for a single JVM execution the same order
* is, for a single JVM execution the same order is returned each time this method is called. * is returned each time this method is called.
*/ */
ResolvedJavaField[] getStaticFields(); ResolvedJavaField[] getStaticFields();

View File

@ -84,8 +84,8 @@ public interface Signature {
} }
/** /**
* Gets the <a * Gets the
* href="http://docs.oracle.com/javase/specs/jvms/se7/html/jvms-4.html#jvms-4.3.3">method * <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: * descriptor</a> corresponding to this signature. For example:
* *
* <pre> * <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 * Package that defines the interface between a runtime and a Java application that wants to access
* provides an implementation of the {@link jdk.vm.ci.meta.MetaAccessProvider} interface. * meta information. The runtime provides an implementation of the
* {@link jdk.vm.ci.meta.MetaAccessProvider} interface.
*/ */
package jdk.vm.ci.meta; package jdk.vm.ci.meta;

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -58,7 +58,7 @@ public class HotSpotConstantReflectionProviderTest {
public void testForObject(Object obj, String expected) { public void testForObject(Object obj, String expected) {
JavaConstant jConst = TestHelper.CONSTANT_REFLECTION_PROVIDER.forObject(obj); JavaConstant jConst = TestHelper.CONSTANT_REFLECTION_PROVIDER.forObject(obj);
Assert.assertNotNull(jConst, 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:"); Assert.assertEquals(jConst.toString(), expected, "Unexpected result:");
} }
@ -66,67 +66,63 @@ public class HotSpotConstantReflectionProviderTest {
public void testForString(String string, String expected) { public void testForString(String string, String expected) {
JavaConstant jConst = CONSTANT_REFLECTION_PROVIDER.forString(string); JavaConstant jConst = CONSTANT_REFLECTION_PROVIDER.forString(string);
Assert.assertNotNull(jConst, 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:"); Assert.assertEquals(jConst.toString(), expected, "Unexpected result:");
} }
@Test(dataProvider = "constantEqualsDataProvider", dataProviderClass = ConstantEqualsDataProvider.class) @Test(dataProvider = "constantEqualsDataProvider", dataProviderClass = ConstantEqualsDataProvider.class)
public void testConstantEquals(Constant const1, Constant const2, Boolean expected) { public void testConstantEquals(Constant const1, Constant const2, Boolean expected) {
Assert.assertEquals(CONSTANT_REFLECTION_PROVIDER.constantEquals(const1, const2), expected, Assert.assertEquals(CONSTANT_REFLECTION_PROVIDER.constantEquals(const1, const2), expected,
"Unexpected result:"); "Unexpected result:");
} }
@Test(dataProvider = "readArrayLengthDataProvider", dataProviderClass = ReadArrayLengthDataProvider.class) @Test(dataProvider = "readArrayLengthDataProvider", dataProviderClass = ReadArrayLengthDataProvider.class)
public void testReadArrayLength(JavaConstant array, Integer expected) { public void testReadArrayLength(JavaConstant array, Integer expected) {
Assert.assertEquals(CONSTANT_REFLECTION_PROVIDER.readArrayLength(array), expected, Assert.assertEquals(CONSTANT_REFLECTION_PROVIDER.readArrayLength(array), expected,
"Unexpected result:"); "Unexpected result:");
} }
@Test(dataProvider = "readArrayElementDataProvider", dataProviderClass = ReadArrayElementDataProvider.class) @Test(dataProvider = "readArrayElementDataProvider", dataProviderClass = ReadArrayElementDataProvider.class)
public void testReadArrayElement(JavaConstant array, int index, Object expected) { public void testReadArrayElement(JavaConstant array, int index, Object expected) {
Assert.assertEquals(CONSTANT_REFLECTION_PROVIDER.readArrayElement(array, index), expected, Assert.assertEquals(CONSTANT_REFLECTION_PROVIDER.readArrayElement(array, index), expected,
"Unexpected result:"); "Unexpected result:");
} }
@Test(dataProvider = "readFieldValueDataProvider", dataProviderClass = ReadFieldValueDataProvider.class) @Test(dataProvider = "readFieldValueDataProvider", dataProviderClass = ReadFieldValueDataProvider.class)
public void testReadFieldValue(ResolvedJavaField field, JavaConstant receiver, JavaConstant expected) { public void testReadFieldValue(ResolvedJavaField field, JavaConstant receiver, JavaConstant expected) {
JavaConstant actual = CONSTANT_REFLECTION_PROVIDER.readFieldValue(field, receiver); JavaConstant actual = CONSTANT_REFLECTION_PROVIDER.readFieldValue(field, receiver);
Assert.assertEquals(actual == null ? "null" : actual.toString(), Assert.assertEquals(actual == null ? "null" : actual.toString(),
expected == null ? "null" : expected.toString(), "Unexpected result:"); expected == null ? "null" : expected.toString(), "Unexpected result:");
} }
@Test(dataProvider = "readFieldValueNegativeDataProvider", @Test(dataProvider = "readFieldValueNegativeDataProvider", dataProviderClass = ReadFieldValueDataProvider.class, expectedExceptions = {NullPointerException.class})
dataProviderClass = ReadFieldValueDataProvider.class,
expectedExceptions = {NullPointerException.class})
public void testNegativeReadFieldValue(ResolvedJavaField field, JavaConstant receiver) { public void testNegativeReadFieldValue(ResolvedJavaField field, JavaConstant receiver) {
CONSTANT_REFLECTION_PROVIDER.readFieldValue(field, receiver); CONSTANT_REFLECTION_PROVIDER.readFieldValue(field, receiver);
} }
@Test(dataProvider = "readStableFieldValueDataProvider", @Test(dataProvider = "readStableFieldValueDataProvider", dataProviderClass = ReadStableFieldValueDataProvider.class)
dataProviderClass = ReadStableFieldValueDataProvider.class)
public void testReadStableFieldValue(ResolvedJavaField field, JavaConstant receiver, boolean isDefStab, public void testReadStableFieldValue(ResolvedJavaField field, JavaConstant receiver, boolean isDefStab,
JavaConstant expected) { JavaConstant expected) {
Assert.assertEquals( Assert.assertEquals(
CONSTANT_REFLECTION_PROVIDER.readStableFieldValue(field, receiver, isDefStab), CONSTANT_REFLECTION_PROVIDER.readStableFieldValue(field, receiver, isDefStab),
expected, expected,
"Unexpected result:"); "Unexpected result:");
} }
@Test(dataProvider = "readStableFieldValueArrayDataProvider", @Test(dataProvider = "readStableFieldValueArrayDataProvider", dataProviderClass = ReadStableFieldValueDataProvider.class)
dataProviderClass = ReadStableFieldValueDataProvider.class)
public void testReadStableFieldValueForArray(ResolvedJavaField field, JavaConstant receiver, boolean isDefStab, 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, JavaConstant result = CONSTANT_REFLECTION_PROVIDER.readStableFieldValue(field, receiver,
isDefStab); isDefStab);
boolean resultDefStab = false; boolean resultDefStab = false;
int resultStableDim = -1; int resultStableDim = -1;
try { try {
Class<?> hotSpotObjectConstantImplClass = Class.forName( Class<?> hotSpotObjectConstantImplClass = Class.forName(
"jdk.vm.ci.hotspot.HotSpotObjectConstantImpl"); "jdk.vm.ci.hotspot.HotSpotObjectConstantImpl");
Method getStableDimensionMethod = hotSpotObjectConstantImplClass.getDeclaredMethod( Method getStableDimensionMethod = hotSpotObjectConstantImplClass.getDeclaredMethod(
"getStableDimension"); "getStableDimension");
Method isDefaultStableMethod = hotSpotObjectConstantImplClass.getDeclaredMethod( Method isDefaultStableMethod = hotSpotObjectConstantImplClass.getDeclaredMethod(
"isDefaultStable"); "isDefaultStable");
getStableDimensionMethod.setAccessible(true); getStableDimensionMethod.setAccessible(true);
isDefaultStableMethod.setAccessible(true); isDefaultStableMethod.setAccessible(true);
resultDefStab = (boolean) isDefaultStableMethod.invoke(result); resultDefStab = (boolean) isDefaultStableMethod.invoke(result);
@ -135,62 +131,55 @@ public class HotSpotConstantReflectionProviderTest {
throw new Error("Unexpected error: " + e, e); throw new Error("Unexpected error: " + e, e);
} }
Assert.assertEquals(resultDefStab, isDefStab, Assert.assertEquals(resultDefStab, isDefStab,
"Wrong default stable value for " + result.toString()); "Wrong default stable value for " + result.toString());
Assert.assertEquals(resultStableDim, arrayDim, Assert.assertEquals(resultStableDim, arrayDim,
"Wrong array dimension for " + result.toString()); "Wrong array dimension for " + result.toString());
Assert.assertEquals(result.toString(), expected.toString(), "Unexpected result:"); Assert.assertEquals(result.toString(), expected.toString(), "Unexpected result:");
} }
@Test(dataProvider = "readStableFieldValueNegativeDataProvider", @Test(dataProvider = "readStableFieldValueNegativeDataProvider", dataProviderClass = ReadStableFieldValueDataProvider.class, expectedExceptions = {NullPointerException.class})
dataProviderClass = ReadStableFieldValueDataProvider.class,
expectedExceptions = {NullPointerException.class})
public void testNegativeReadStableFieldValue(ResolvedJavaField field, JavaConstant receiver, boolean isDefStab) { public void testNegativeReadStableFieldValue(ResolvedJavaField field, JavaConstant receiver, boolean isDefStab) {
CONSTANT_REFLECTION_PROVIDER.readStableFieldValue(field, receiver, isDefStab); CONSTANT_REFLECTION_PROVIDER.readStableFieldValue(field, receiver, isDefStab);
} }
@Test(dataProvider = "readConstantFieldValueDataProvider", @Test(dataProvider = "readConstantFieldValueDataProvider", dataProviderClass = ReadConstantFieldValueDataProvider.class)
dataProviderClass = ReadConstantFieldValueDataProvider.class)
public void testReadConstantFieldValue(ResolvedJavaField field, JavaConstant receiver, JavaConstant expected, 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, 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), Assert.assertEquals(CONSTANT_REFLECTION_PROVIDER.readConstantFieldValue(field, receiver),
expected, msg); expected, msg);
} }
@Test(dataProvider = "readConstantFieldValueNegativeDataProvider", @Test(dataProvider = "readConstantFieldValueNegativeDataProvider", dataProviderClass = ReadConstantFieldValueDataProvider.class, expectedExceptions = {NullPointerException.class})
dataProviderClass = ReadConstantFieldValueDataProvider.class,
expectedExceptions = {NullPointerException.class})
public void testNegativeReadConstantFieldValue(ResolvedJavaField field, JavaConstant receiver) { public void testNegativeReadConstantFieldValue(ResolvedJavaField field, JavaConstant receiver) {
CONSTANT_REFLECTION_PROVIDER.readConstantFieldValue(field, receiver); CONSTANT_REFLECTION_PROVIDER.readConstantFieldValue(field, receiver);
} }
@Test(dataProvider = "readConstantArrayElementDataProvider", @Test(dataProvider = "readConstantArrayElementDataProvider", dataProviderClass = ReadConstantArrayElementDataProvider.class)
dataProviderClass = ReadConstantArrayElementDataProvider.class)
public void testReadConstantArrayElement(JavaConstant array, int index, JavaConstant expected, String testInfo) { public void testReadConstantArrayElement(JavaConstant array, int index, JavaConstant expected, String testInfo) {
JavaConstant actual = CONSTANT_REFLECTION_PROVIDER.readConstantArrayElement(array, index); JavaConstant actual = CONSTANT_REFLECTION_PROVIDER.readConstantArrayElement(array, index);
Assert.assertEquals(actual == null ? "null" : actual.toString(), Assert.assertEquals(actual == null ? "null" : actual.toString(),
expected == null ? "null" : expected.toString(), expected == null ? "null" : expected.toString(),
String.format("Unexpected result while testing %s:", testInfo)); String.format("Unexpected result while testing %s:", testInfo));
} }
@Test(dataProvider = "readConstantArrayElementForOffsetDataProvider", @Test(dataProvider = "readConstantArrayElementForOffsetDataProvider", dataProviderClass = ReadConstantArrayElementDataProvider.class)
dataProviderClass = ReadConstantArrayElementDataProvider.class)
public void testReadConstantArrayElementForOffset(JavaConstant array, long offset, JavaConstant expected, public void testReadConstantArrayElementForOffset(JavaConstant array, long offset, JavaConstant expected,
String testInfo) { String testInfo) {
JavaConstant actual = CONSTANT_REFLECTION_PROVIDER.readConstantArrayElementForOffset(array, JavaConstant actual = CONSTANT_REFLECTION_PROVIDER.readConstantArrayElementForOffset(array,
offset); offset);
Assert.assertEquals(actual == null ? "null" : actual.toString(), Assert.assertEquals(actual == null ? "null" : actual.toString(),
expected == null ? "null" : expected.toString(), expected == null ? "null" : expected.toString(),
String.format("Unexpected result while testing %s:", testInfo)); String.format("Unexpected result while testing %s:", testInfo));
} }
@Test(dataProvider = "asJavaTypeDataProvider", dataProviderClass = AsJavaTypeDataProvider.class) @Test(dataProvider = "asJavaTypeDataProvider", dataProviderClass = AsJavaTypeDataProvider.class)
public void testAsJavaType(JavaConstant constant, String expected) { public void testAsJavaType(JavaConstant constant, String expected) {
ResolvedJavaType actual = CONSTANT_REFLECTION_PROVIDER.asJavaType(constant); ResolvedJavaType actual = CONSTANT_REFLECTION_PROVIDER.asJavaType(constant);
Assert.assertEquals(actual == null ? "null" : actual.toJavaName(), Assert.assertEquals(actual == null ? "null" : actual.toJavaName(),
expected == null ? "null" : expected, expected == null ? "null" : expected,
"Unexpected result, wrong type returned:"); "Unexpected result, wrong type returned:");
} }
@Test(dataProvider = "boxPrimitiveDataProvider", dataProviderClass = BoxPrimitiveDataProvider.class) @Test(dataProvider = "boxPrimitiveDataProvider", dataProviderClass = BoxPrimitiveDataProvider.class)
@ -221,6 +210,6 @@ public class HotSpotConstantReflectionProviderTest {
public void testGetMethodHandleAccess() { public void testGetMethodHandleAccess() {
MethodHandleAccessProvider actual = CONSTANT_REFLECTION_PROVIDER.getMethodHandleAccess(); MethodHandleAccessProvider actual = CONSTANT_REFLECTION_PROVIDER.getMethodHandleAccess();
Assert.assertNotNull(actual, 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") @DataProvider(name = "isEmbeddableDataProvider")
public static Object[][] isEmbeddableDataProvider() { public static Object[][] isEmbeddableDataProvider() {
return new Object[][]{{JavaConstant.forBoolean(DUMMY_CLASS_INSTANCE.booleanField), true}, return new Object[][]{{JavaConstant.forBoolean(DUMMY_CLASS_INSTANCE.booleanField), true},
{JavaConstant.forByte(DUMMY_CLASS_INSTANCE.byteField), true}, {JavaConstant.forByte(DUMMY_CLASS_INSTANCE.byteField), true},
{JavaConstant.forShort(DUMMY_CLASS_INSTANCE.shortField), true}, {JavaConstant.forShort(DUMMY_CLASS_INSTANCE.shortField), true},
{JavaConstant.forInt(DUMMY_CLASS_INSTANCE.intField), true}, {JavaConstant.forInt(DUMMY_CLASS_INSTANCE.intField), true},
{JavaConstant.forLong(DUMMY_CLASS_INSTANCE.longField), true}, {JavaConstant.forLong(DUMMY_CLASS_INSTANCE.longField), true},
{JavaConstant.forChar(DUMMY_CLASS_INSTANCE.charField), true}, {JavaConstant.forChar(DUMMY_CLASS_INSTANCE.charField), true},
{JavaConstant.forFloat(DUMMY_CLASS_INSTANCE.floatField), true}, {JavaConstant.forFloat(DUMMY_CLASS_INSTANCE.floatField), true},
{JavaConstant.forDouble(DUMMY_CLASS_INSTANCE.doubleField), true}, {JavaConstant.forDouble(DUMMY_CLASS_INSTANCE.doubleField), true},
{CONSTANT_REFLECTION_PROVIDER.forObject(DUMMY_CLASS_INSTANCE.objectField), true}, {CONSTANT_REFLECTION_PROVIDER.forObject(DUMMY_CLASS_INSTANCE.objectField), true},
{JavaConstant.NULL_POINTER, true}, {null, true}}; {JavaConstant.NULL_POINTER, true}, {null, true}};
} }
} }

View File

@ -42,50 +42,50 @@ public class ReadArrayElementDataProvider {
LinkedList<Object[]> cfgSet = new LinkedList<>(); LinkedList<Object[]> cfgSet = new LinkedList<>();
for (int i : new int[]{0, 1}) { for (int i : new int[]{0, 1}) {
cfgSet.add(new Object[]{CONSTANT_REFLECTION_PROVIDER.forObject(DUMMY_CLASS_INSTANCE.booleanArrayWithValues), 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), 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), 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), 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), 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), 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), 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), 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), 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[]{ 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[]{ 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[]{ 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[]{ 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[]{ 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[]{ 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[]{ 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[]{ 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[]{ 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) -> { Stream.concat(ARRAYS_MAP.values().stream(), ARRAY_ARRAYS_MAP.values().stream()).forEach((array) -> {
for (int i : new int[]{-1, 2}) { for (int i : new int[]{-1, 2}) {

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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