< prev index next >
hotspot/test/runtime/valhalla/valuetypes/MVTCombo.java
Print this page
@@ -29,17 +29,14 @@
import jdk.test.lib.combo.ComboInstance;
import jdk.test.lib.combo.ComboParameter;
import jdk.test.lib.combo.ComboTask.Result;
import jdk.test.lib.combo.ComboTestHelper;
import jdk.test.lib.combo.ComboTestHelper.ArrayDimensionKind;
-import jdk.experimental.value.ValueType;
+import jdk.incubator.mvt.ValueType;
-import java.io.File;
-import java.io.FileInputStream;
import java.lang.invoke.MethodHandle;
import java.lang.invoke.MethodHandles;
-import java.lang.invoke.MethodType;
import static java.lang.invoke.MethodType.methodType;
import java.lang.reflect.Field;
import java.lang.reflect.Modifier;
import java.net.URL;
import java.net.URLClassLoader;
@@ -195,11 +192,11 @@
return buf.toString();
}
}
public static final String VCC_TEMPLATE =
- "@jvm.internal.value.ValueCapableClass\n" +
+ "@jdk.incubator.mvt.ValueCapableClass\n" +
"public final class Test {\n\n" +
" // Declare fields...\n" +
" #{ARITY.FIELD_DECL}\n" +
" // Private Constructor...\n" +
" private Test(#{ARITY.CONSTR_FORMALS}) {\n" +
@@ -296,10 +293,11 @@
@Override
public void doWork() throws Throwable {
Result<Iterable<? extends JavaFileObject>> result = newCompilationTask()
.withSourceFromTemplate(VCC_TEMPLATE)
+ .withOption("--add-modules=jdk.incubator.mvt")
.generate();
//System.out.println("COMP: " + result.compilationInfo()); // Print the generated source
if (result.hasErrors()) {
fail("ERROR " + result.compilationInfo());
}
@@ -320,20 +318,16 @@
if (!ValueType.classHasValueType(testSubject)) {
throw new IllegalArgumentException("Not a VCC: " + testSubject);
}
ValueType<?> vt = ValueType.forClass(testSubject);
Class<?> boxClass = vt.boxClass();
- Class<?> sourceClass = vt.sourceClass();
Class<?> vtClass = vt.valueClass();
Class<?> arrayClass = vt.arrayValueClass();
Class<?> mArrayClass = vt.arrayValueClass(4);
if (boxClass != testSubject) {
throw new RuntimeException("Box class != VCC");
}
- if (sourceClass != testSubject) {
- throw new RuntimeException("Source class != VCC");
- }
if (vt.toString() == null) {
throw new RuntimeException("No toString() return");
}
}
@@ -365,11 +359,11 @@
if (!isEqual) {
System.out.println("PROBLEM:");
printFieldValues(MethodHandles.filterReturnValue(vt.defaultValueConstant(), box));
System.out.println("VERSUS value from array:");
printFieldValues(MethodHandles.filterReturnValue(arrayGetter, box).invoke(array, i));
- throw new IllegalStateException("Failed equality test for class: " + vt.sourceClass().getName() + " at index: " + i);
+ throw new IllegalStateException("Failed equality test for class: " + vt.boxClass().getName() + " at index: " + i);
}
}
// populate the last element with some values...
int testIndex = testArrayLen - 1;
< prev index next >