< prev index next >

test/jdk/java/lang/invoke/VarHandles/X-VarHandleTestAccess.java.template

Print this page
rev 55900 : 8207257: Add VarHandle access test for value type declared in ref type
Reviewed-by: tbd

@@ -19,10 +19,12 @@
  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  * or visit www.oracle.com if you need additional information or have any
  * questions.
  */
 
+#warn
+
 #if[Value]
 /*
  * @test
  * @run testng/othervm -Diters=10    -XX:+EnableValhalla -Xint                   VarHandleTestAccess$Type$
  * @run testng/othervm -Diters=20000 -XX:+EnableValhalla -XX:TieredStopAtLevel=1 VarHandleTestAccess$Type$

@@ -76,13 +78,13 @@
 
     VarHandle vhStaticFinalField;
 
     VarHandle vhArray;
 
-#if[String]
+#if[Class]]
     VarHandle vhArrayObject;
-#end[String]
+#end[Class]]
 #if[Value]
     VarHandle vhValueTypeField;
 #end[Value]
 
     VarHandle[] allocate(boolean same) {

@@ -137,13 +139,13 @@
 
         vhStaticField = MethodHandles.lookup().findStaticVarHandle(
             VarHandleTestAccess$Type$.class, "static_v", $type$.class);
 
         vhArray = MethodHandles.arrayElementVarHandle($type$[].class);
-#if[String]
+#if[Class]]
         vhArrayObject = MethodHandles.arrayElementVarHandle(Object[].class);
-#end[String]
+#end[Class]]
 
 #if[Value]
         vhValueTypeField = MethodHandles.lookup().findVarHandle(
                     Value.class, "$type$_v", $type$.class);
 #end[Value]

@@ -326,25 +328,25 @@
                                               vhStaticField, VarHandleTestAccess$Type$::testStaticFieldUnsupported,
                                               false));
 
         cases.add(new VarHandleAccessTestCase("Array",
                                               vhArray, VarHandleTestAccess$Type$::testArray));
-#if[String]
+#if[Class]]
         cases.add(new VarHandleAccessTestCase("Array Object[]",
                                               vhArrayObject, VarHandleTestAccess$Type$::testArray));
-#end[String]
+#end[Class]]
         cases.add(new VarHandleAccessTestCase("Array unsupported",
                                               vhArray, VarHandleTestAccess$Type$::testArrayUnsupported,
                                               false));
         cases.add(new VarHandleAccessTestCase("Array index out of bounds",
                                               vhArray, VarHandleTestAccess$Type$::testArrayIndexOutOfBounds,
                                               false));
-#if[String]
+#if[Class]]
         cases.add(new VarHandleAccessTestCase("Array store exception",
                                               vhArrayObject, VarHandleTestAccess$Type$::testArrayStoreException,
                                               false));
-#end[String]
+#end[Class]]
 #if[Value]
         cases.add(new VarHandleAccessTestCase("Value type field",
                                               vhValueTypeField, vh -> testValueTypeField(Value.getInstance(), vh)));
         cases.add(new VarHandleAccessTestCase("Value type field unsupported",
                                               vhValueTypeField, vh -> testValueTypeFieldUnsupported(Value.getInstance(), vh),

@@ -1944,11 +1946,11 @@
             });
 #end[Bitwise]
         }
     }
 
-#if[String]
+#if[Class]]
     static void testArrayStoreException(VarHandle vh) throws Throwable {
         Object[] array = new $type$[10];
         Arrays.fill(array, $value1$);
         Object value = new Object();
 

@@ -2025,8 +2027,8 @@
         // GetAndSetRelease
         checkASE(() -> { // receiver reference class
             $type$ x = ($type$) vh.getAndSetRelease(array, 0, value);
         });
     }
-#end[String]
+#end[Class]]
 }
 
< prev index next >