changeset 50301:2fc59e7f44cf lworld

8202861: [lworld] update jdk value type tests not to declare static field of its own value type Reviewed-by: psandoz
author mchung
date Tue, 22 May 2018 12:48:28 -0700
parents 555407c365d3
children 951b87a3f2c2
files test/jdk/java/lang/invoke/VarHandles/Value.java test/jdk/java/lang/invoke/VarHandles/VarHandleTestAccessBoolean.java test/jdk/java/lang/invoke/VarHandles/VarHandleTestAccessByte.java test/jdk/java/lang/invoke/VarHandles/VarHandleTestAccessChar.java test/jdk/java/lang/invoke/VarHandles/VarHandleTestAccessDouble.java test/jdk/java/lang/invoke/VarHandles/VarHandleTestAccessFloat.java test/jdk/java/lang/invoke/VarHandles/VarHandleTestAccessInt.java test/jdk/java/lang/invoke/VarHandles/VarHandleTestAccessLong.java test/jdk/java/lang/invoke/VarHandles/VarHandleTestAccessShort.java test/jdk/java/lang/invoke/VarHandles/VarHandleTestMethodHandleAccessBoolean.java test/jdk/java/lang/invoke/VarHandles/VarHandleTestMethodHandleAccessByte.java test/jdk/java/lang/invoke/VarHandles/VarHandleTestMethodHandleAccessChar.java test/jdk/java/lang/invoke/VarHandles/VarHandleTestMethodHandleAccessDouble.java test/jdk/java/lang/invoke/VarHandles/VarHandleTestMethodHandleAccessFloat.java test/jdk/java/lang/invoke/VarHandles/VarHandleTestMethodHandleAccessInt.java test/jdk/java/lang/invoke/VarHandles/VarHandleTestMethodHandleAccessLong.java test/jdk/java/lang/invoke/VarHandles/VarHandleTestMethodHandleAccessShort.java test/jdk/java/lang/invoke/VarHandles/X-VarHandleTestAccess.java.template test/jdk/java/lang/invoke/VarHandles/X-VarHandleTestMethodHandleAccess.java.template test/jdk/valhalla/valuetypes/Point.java test/jdk/valhalla/valuetypes/Reflection.java
diffstat 21 files changed, 45 insertions(+), 41 deletions(-) [+]
line wrap: on
line diff
--- a/test/jdk/java/lang/invoke/VarHandles/Value.java	Tue May 22 16:26:23 2018 +0200
+++ b/test/jdk/java/lang/invoke/VarHandles/Value.java	Tue May 22 12:48:28 2018 -0700
@@ -22,7 +22,6 @@
  */
 
 final __ByValue class Value {
-    static final Value VT = makeValue('\u0123', true, (byte)0x01, 0x01234567, (short)0x0123, 0x0123456789ABCDEFL, 1.0f, 1.0d);
     final char char_v;
     final byte byte_v;
     final boolean boolean_v;
@@ -53,4 +52,9 @@
         v = __WithField(v.double_v, d);
         return v;
     }
+
+    static Value getInstance() {
+        return makeValue('\u0123', true, (byte)0x01, 0x01234567, (short)0x0123, 0x0123456789ABCDEFL, 1.0f, 1.0d);
+    }
+
 }
--- a/test/jdk/java/lang/invoke/VarHandles/VarHandleTestAccessBoolean.java	Tue May 22 16:26:23 2018 +0200
+++ b/test/jdk/java/lang/invoke/VarHandles/VarHandleTestAccessBoolean.java	Tue May 22 12:48:28 2018 -0700
@@ -218,9 +218,9 @@
                                               vhArray, VarHandleTestAccessBoolean::testArrayIndexOutOfBounds,
                                               false));
         cases.add(new VarHandleAccessTestCase("Value type field",
-                                              vhValueTypeField, vh -> testValueTypeField(Value.VT, vh)));
+                                              vhValueTypeField, vh -> testValueTypeField(Value.getInstance(), vh)));
         cases.add(new VarHandleAccessTestCase("Value type field unsupported",
-                                              vhValueTypeField, vh -> testValueTypeFieldUnsupported(Value.VT, vh),
+                                              vhValueTypeField, vh -> testValueTypeFieldUnsupported(Value.getInstance(), vh),
                                               false));
 
         // Work around issue with jtreg summary reporting which truncates
--- a/test/jdk/java/lang/invoke/VarHandles/VarHandleTestAccessByte.java	Tue May 22 16:26:23 2018 +0200
+++ b/test/jdk/java/lang/invoke/VarHandles/VarHandleTestAccessByte.java	Tue May 22 12:48:28 2018 -0700
@@ -218,9 +218,9 @@
                                               vhArray, VarHandleTestAccessByte::testArrayIndexOutOfBounds,
                                               false));
         cases.add(new VarHandleAccessTestCase("Value type field",
-                                              vhValueTypeField, vh -> testValueTypeField(Value.VT, vh)));
+                                              vhValueTypeField, vh -> testValueTypeField(Value.getInstance(), vh)));
         cases.add(new VarHandleAccessTestCase("Value type field unsupported",
-                                              vhValueTypeField, vh -> testValueTypeFieldUnsupported(Value.VT, vh),
+                                              vhValueTypeField, vh -> testValueTypeFieldUnsupported(Value.getInstance(), vh),
                                               false));
 
         // Work around issue with jtreg summary reporting which truncates
--- a/test/jdk/java/lang/invoke/VarHandles/VarHandleTestAccessChar.java	Tue May 22 16:26:23 2018 +0200
+++ b/test/jdk/java/lang/invoke/VarHandles/VarHandleTestAccessChar.java	Tue May 22 12:48:28 2018 -0700
@@ -218,9 +218,9 @@
                                               vhArray, VarHandleTestAccessChar::testArrayIndexOutOfBounds,
                                               false));
         cases.add(new VarHandleAccessTestCase("Value type field",
-                                              vhValueTypeField, vh -> testValueTypeField(Value.VT, vh)));
+                                              vhValueTypeField, vh -> testValueTypeField(Value.getInstance(), vh)));
         cases.add(new VarHandleAccessTestCase("Value type field unsupported",
-                                              vhValueTypeField, vh -> testValueTypeFieldUnsupported(Value.VT, vh),
+                                              vhValueTypeField, vh -> testValueTypeFieldUnsupported(Value.getInstance(), vh),
                                               false));
 
         // Work around issue with jtreg summary reporting which truncates
--- a/test/jdk/java/lang/invoke/VarHandles/VarHandleTestAccessDouble.java	Tue May 22 16:26:23 2018 +0200
+++ b/test/jdk/java/lang/invoke/VarHandles/VarHandleTestAccessDouble.java	Tue May 22 12:48:28 2018 -0700
@@ -218,9 +218,9 @@
                                               vhArray, VarHandleTestAccessDouble::testArrayIndexOutOfBounds,
                                               false));
         cases.add(new VarHandleAccessTestCase("Value type field",
-                                              vhValueTypeField, vh -> testValueTypeField(Value.VT, vh)));
+                                              vhValueTypeField, vh -> testValueTypeField(Value.getInstance(), vh)));
         cases.add(new VarHandleAccessTestCase("Value type field unsupported",
-                                              vhValueTypeField, vh -> testValueTypeFieldUnsupported(Value.VT, vh),
+                                              vhValueTypeField, vh -> testValueTypeFieldUnsupported(Value.getInstance(), vh),
                                               false));
 
         // Work around issue with jtreg summary reporting which truncates
--- a/test/jdk/java/lang/invoke/VarHandles/VarHandleTestAccessFloat.java	Tue May 22 16:26:23 2018 +0200
+++ b/test/jdk/java/lang/invoke/VarHandles/VarHandleTestAccessFloat.java	Tue May 22 12:48:28 2018 -0700
@@ -218,9 +218,9 @@
                                               vhArray, VarHandleTestAccessFloat::testArrayIndexOutOfBounds,
                                               false));
         cases.add(new VarHandleAccessTestCase("Value type field",
-                                              vhValueTypeField, vh -> testValueTypeField(Value.VT, vh)));
+                                              vhValueTypeField, vh -> testValueTypeField(Value.getInstance(), vh)));
         cases.add(new VarHandleAccessTestCase("Value type field unsupported",
-                                              vhValueTypeField, vh -> testValueTypeFieldUnsupported(Value.VT, vh),
+                                              vhValueTypeField, vh -> testValueTypeFieldUnsupported(Value.getInstance(), vh),
                                               false));
 
         // Work around issue with jtreg summary reporting which truncates
--- a/test/jdk/java/lang/invoke/VarHandles/VarHandleTestAccessInt.java	Tue May 22 16:26:23 2018 +0200
+++ b/test/jdk/java/lang/invoke/VarHandles/VarHandleTestAccessInt.java	Tue May 22 12:48:28 2018 -0700
@@ -218,9 +218,9 @@
                                               vhArray, VarHandleTestAccessInt::testArrayIndexOutOfBounds,
                                               false));
         cases.add(new VarHandleAccessTestCase("Value type field",
-                                              vhValueTypeField, vh -> testValueTypeField(Value.VT, vh)));
+                                              vhValueTypeField, vh -> testValueTypeField(Value.getInstance(), vh)));
         cases.add(new VarHandleAccessTestCase("Value type field unsupported",
-                                              vhValueTypeField, vh -> testValueTypeFieldUnsupported(Value.VT, vh),
+                                              vhValueTypeField, vh -> testValueTypeFieldUnsupported(Value.getInstance(), vh),
                                               false));
 
         // Work around issue with jtreg summary reporting which truncates
--- a/test/jdk/java/lang/invoke/VarHandles/VarHandleTestAccessLong.java	Tue May 22 16:26:23 2018 +0200
+++ b/test/jdk/java/lang/invoke/VarHandles/VarHandleTestAccessLong.java	Tue May 22 12:48:28 2018 -0700
@@ -218,9 +218,9 @@
                                               vhArray, VarHandleTestAccessLong::testArrayIndexOutOfBounds,
                                               false));
         cases.add(new VarHandleAccessTestCase("Value type field",
-                                              vhValueTypeField, vh -> testValueTypeField(Value.VT, vh)));
+                                              vhValueTypeField, vh -> testValueTypeField(Value.getInstance(), vh)));
         cases.add(new VarHandleAccessTestCase("Value type field unsupported",
-                                              vhValueTypeField, vh -> testValueTypeFieldUnsupported(Value.VT, vh),
+                                              vhValueTypeField, vh -> testValueTypeFieldUnsupported(Value.getInstance(), vh),
                                               false));
 
         // Work around issue with jtreg summary reporting which truncates
--- a/test/jdk/java/lang/invoke/VarHandles/VarHandleTestAccessShort.java	Tue May 22 16:26:23 2018 +0200
+++ b/test/jdk/java/lang/invoke/VarHandles/VarHandleTestAccessShort.java	Tue May 22 12:48:28 2018 -0700
@@ -218,9 +218,9 @@
                                               vhArray, VarHandleTestAccessShort::testArrayIndexOutOfBounds,
                                               false));
         cases.add(new VarHandleAccessTestCase("Value type field",
-                                              vhValueTypeField, vh -> testValueTypeField(Value.VT, vh)));
+                                              vhValueTypeField, vh -> testValueTypeField(Value.getInstance(), vh)));
         cases.add(new VarHandleAccessTestCase("Value type field unsupported",
-                                              vhValueTypeField, vh -> testValueTypeFieldUnsupported(Value.VT, vh),
+                                              vhValueTypeField, vh -> testValueTypeFieldUnsupported(Value.getInstance(), vh),
                                               false));
 
         // Work around issue with jtreg summary reporting which truncates
--- a/test/jdk/java/lang/invoke/VarHandles/VarHandleTestMethodHandleAccessBoolean.java	Tue May 22 16:26:23 2018 +0200
+++ b/test/jdk/java/lang/invoke/VarHandles/VarHandleTestMethodHandleAccessBoolean.java	Tue May 22 12:48:28 2018 -0700
@@ -106,9 +106,9 @@
                                                      vhArray, f, VarHandleTestMethodHandleAccessBoolean::testArrayIndexOutOfBounds,
                                                      false));
         cases.add(new MethodHandleAccessTestCase("Value type field",
-                                                 vhValueTypeField, f, hs -> testValueTypeField(Value.VT, hs)));
+                                                 vhValueTypeField, f, hs -> testValueTypeField(Value.getInstance(), hs)));
         cases.add(new MethodHandleAccessTestCase("Value type field unsupported",
-                                                 vhValueTypeField, f, hs -> testValueTypeFieldUnsupported(Value.VT, hs),
+                                                 vhValueTypeField, f, hs -> testValueTypeFieldUnsupported(Value.getInstance(), hs),
                                                  false));
         }
 
--- a/test/jdk/java/lang/invoke/VarHandles/VarHandleTestMethodHandleAccessByte.java	Tue May 22 16:26:23 2018 +0200
+++ b/test/jdk/java/lang/invoke/VarHandles/VarHandleTestMethodHandleAccessByte.java	Tue May 22 12:48:28 2018 -0700
@@ -106,9 +106,9 @@
                                                      vhArray, f, VarHandleTestMethodHandleAccessByte::testArrayIndexOutOfBounds,
                                                      false));
         cases.add(new MethodHandleAccessTestCase("Value type field",
-                                                 vhValueTypeField, f, hs -> testValueTypeField(Value.VT, hs)));
+                                                 vhValueTypeField, f, hs -> testValueTypeField(Value.getInstance(), hs)));
         cases.add(new MethodHandleAccessTestCase("Value type field unsupported",
-                                                 vhValueTypeField, f, hs -> testValueTypeFieldUnsupported(Value.VT, hs),
+                                                 vhValueTypeField, f, hs -> testValueTypeFieldUnsupported(Value.getInstance(), hs),
                                                  false));
         }
 
--- a/test/jdk/java/lang/invoke/VarHandles/VarHandleTestMethodHandleAccessChar.java	Tue May 22 16:26:23 2018 +0200
+++ b/test/jdk/java/lang/invoke/VarHandles/VarHandleTestMethodHandleAccessChar.java	Tue May 22 12:48:28 2018 -0700
@@ -106,9 +106,9 @@
                                                      vhArray, f, VarHandleTestMethodHandleAccessChar::testArrayIndexOutOfBounds,
                                                      false));
         cases.add(new MethodHandleAccessTestCase("Value type field",
-                                                 vhValueTypeField, f, hs -> testValueTypeField(Value.VT, hs)));
+                                                 vhValueTypeField, f, hs -> testValueTypeField(Value.getInstance(), hs)));
         cases.add(new MethodHandleAccessTestCase("Value type field unsupported",
-                                                 vhValueTypeField, f, hs -> testValueTypeFieldUnsupported(Value.VT, hs),
+                                                 vhValueTypeField, f, hs -> testValueTypeFieldUnsupported(Value.getInstance(), hs),
                                                  false));
         }
 
--- a/test/jdk/java/lang/invoke/VarHandles/VarHandleTestMethodHandleAccessDouble.java	Tue May 22 16:26:23 2018 +0200
+++ b/test/jdk/java/lang/invoke/VarHandles/VarHandleTestMethodHandleAccessDouble.java	Tue May 22 12:48:28 2018 -0700
@@ -106,9 +106,9 @@
                                                      vhArray, f, VarHandleTestMethodHandleAccessDouble::testArrayIndexOutOfBounds,
                                                      false));
         cases.add(new MethodHandleAccessTestCase("Value type field",
-                                                 vhValueTypeField, f, hs -> testValueTypeField(Value.VT, hs)));
+                                                 vhValueTypeField, f, hs -> testValueTypeField(Value.getInstance(), hs)));
         cases.add(new MethodHandleAccessTestCase("Value type field unsupported",
-                                                 vhValueTypeField, f, hs -> testValueTypeFieldUnsupported(Value.VT, hs),
+                                                 vhValueTypeField, f, hs -> testValueTypeFieldUnsupported(Value.getInstance(), hs),
                                                  false));
         }
 
--- a/test/jdk/java/lang/invoke/VarHandles/VarHandleTestMethodHandleAccessFloat.java	Tue May 22 16:26:23 2018 +0200
+++ b/test/jdk/java/lang/invoke/VarHandles/VarHandleTestMethodHandleAccessFloat.java	Tue May 22 12:48:28 2018 -0700
@@ -106,9 +106,9 @@
                                                      vhArray, f, VarHandleTestMethodHandleAccessFloat::testArrayIndexOutOfBounds,
                                                      false));
         cases.add(new MethodHandleAccessTestCase("Value type field",
-                                                 vhValueTypeField, f, hs -> testValueTypeField(Value.VT, hs)));
+                                                 vhValueTypeField, f, hs -> testValueTypeField(Value.getInstance(), hs)));
         cases.add(new MethodHandleAccessTestCase("Value type field unsupported",
-                                                 vhValueTypeField, f, hs -> testValueTypeFieldUnsupported(Value.VT, hs),
+                                                 vhValueTypeField, f, hs -> testValueTypeFieldUnsupported(Value.getInstance(), hs),
                                                  false));
         }
 
--- a/test/jdk/java/lang/invoke/VarHandles/VarHandleTestMethodHandleAccessInt.java	Tue May 22 16:26:23 2018 +0200
+++ b/test/jdk/java/lang/invoke/VarHandles/VarHandleTestMethodHandleAccessInt.java	Tue May 22 12:48:28 2018 -0700
@@ -106,9 +106,9 @@
                                                      vhArray, f, VarHandleTestMethodHandleAccessInt::testArrayIndexOutOfBounds,
                                                      false));
         cases.add(new MethodHandleAccessTestCase("Value type field",
-                                                 vhValueTypeField, f, hs -> testValueTypeField(Value.VT, hs)));
+                                                 vhValueTypeField, f, hs -> testValueTypeField(Value.getInstance(), hs)));
         cases.add(new MethodHandleAccessTestCase("Value type field unsupported",
-                                                 vhValueTypeField, f, hs -> testValueTypeFieldUnsupported(Value.VT, hs),
+                                                 vhValueTypeField, f, hs -> testValueTypeFieldUnsupported(Value.getInstance(), hs),
                                                  false));
         }
 
--- a/test/jdk/java/lang/invoke/VarHandles/VarHandleTestMethodHandleAccessLong.java	Tue May 22 16:26:23 2018 +0200
+++ b/test/jdk/java/lang/invoke/VarHandles/VarHandleTestMethodHandleAccessLong.java	Tue May 22 12:48:28 2018 -0700
@@ -106,9 +106,9 @@
                                                      vhArray, f, VarHandleTestMethodHandleAccessLong::testArrayIndexOutOfBounds,
                                                      false));
         cases.add(new MethodHandleAccessTestCase("Value type field",
-                                                 vhValueTypeField, f, hs -> testValueTypeField(Value.VT, hs)));
+                                                 vhValueTypeField, f, hs -> testValueTypeField(Value.getInstance(), hs)));
         cases.add(new MethodHandleAccessTestCase("Value type field unsupported",
-                                                 vhValueTypeField, f, hs -> testValueTypeFieldUnsupported(Value.VT, hs),
+                                                 vhValueTypeField, f, hs -> testValueTypeFieldUnsupported(Value.getInstance(), hs),
                                                  false));
         }
 
--- a/test/jdk/java/lang/invoke/VarHandles/VarHandleTestMethodHandleAccessShort.java	Tue May 22 16:26:23 2018 +0200
+++ b/test/jdk/java/lang/invoke/VarHandles/VarHandleTestMethodHandleAccessShort.java	Tue May 22 12:48:28 2018 -0700
@@ -106,9 +106,9 @@
                                                      vhArray, f, VarHandleTestMethodHandleAccessShort::testArrayIndexOutOfBounds,
                                                      false));
         cases.add(new MethodHandleAccessTestCase("Value type field",
-                                                 vhValueTypeField, f, hs -> testValueTypeField(Value.VT, hs)));
+                                                 vhValueTypeField, f, hs -> testValueTypeField(Value.getInstance(), hs)));
         cases.add(new MethodHandleAccessTestCase("Value type field unsupported",
-                                                 vhValueTypeField, f, hs -> testValueTypeFieldUnsupported(Value.VT, hs),
+                                                 vhValueTypeField, f, hs -> testValueTypeFieldUnsupported(Value.getInstance(), hs),
                                                  false));
         }
 
--- a/test/jdk/java/lang/invoke/VarHandles/X-VarHandleTestAccess.java.template	Tue May 22 16:26:23 2018 +0200
+++ b/test/jdk/java/lang/invoke/VarHandles/X-VarHandleTestAccess.java.template	Tue May 22 12:48:28 2018 -0700
@@ -265,9 +265,9 @@
                                               false));
 #if[Value]
         cases.add(new VarHandleAccessTestCase("Value type field",
-                                              vhValueTypeField, vh -> testValueTypeField(Value.VT, vh)));
+                                              vhValueTypeField, vh -> testValueTypeField(Value.getInstance(), vh)));
         cases.add(new VarHandleAccessTestCase("Value type field unsupported",
-                                              vhValueTypeField, vh -> testValueTypeFieldUnsupported(Value.VT, vh),
+                                              vhValueTypeField, vh -> testValueTypeFieldUnsupported(Value.getInstance(), vh),
                                               false));
 #end[Value]
 
--- a/test/jdk/java/lang/invoke/VarHandles/X-VarHandleTestMethodHandleAccess.java.template	Tue May 22 16:26:23 2018 +0200
+++ b/test/jdk/java/lang/invoke/VarHandles/X-VarHandleTestMethodHandleAccess.java.template	Tue May 22 12:48:28 2018 -0700
@@ -115,9 +115,9 @@
                                                      false));
 #if[Value]
         cases.add(new MethodHandleAccessTestCase("Value type field",
-                                                 vhValueTypeField, f, hs -> testValueTypeField(Value.VT, hs)));
+                                                 vhValueTypeField, f, hs -> testValueTypeField(Value.getInstance(), hs)));
         cases.add(new MethodHandleAccessTestCase("Value type field unsupported",
-                                                 vhValueTypeField, f, hs -> testValueTypeFieldUnsupported(Value.VT, hs),
+                                                 vhValueTypeField, f, hs -> testValueTypeFieldUnsupported(Value.getInstance(), hs),
                                                  false));
 #end[Value]
         }
--- a/test/jdk/valhalla/valuetypes/Point.java	Tue May 22 16:26:23 2018 +0200
+++ b/test/jdk/valhalla/valuetypes/Point.java	Tue May 22 12:48:28 2018 -0700
@@ -22,14 +22,14 @@
  */
 
 public final __ByValue class Point {
-    static final Point origin = makePoint(10, 20);
+    static final Object STATIC_FIELD = new Object();
     public final int x;
     public final int y;
     Point () {
         x = 10;
         y = 20;
     }
-    static Point makePoint(int x, int y) {
+    public static Point makePoint(int x, int y) {
         Point p = __MakeDefault Point();
         p = __WithField(p.x, x);
         p = __WithField(p.y, y);
--- a/test/jdk/valhalla/valuetypes/Reflection.java	Tue May 22 16:26:23 2018 +0200
+++ b/test/jdk/valhalla/valuetypes/Reflection.java	Tue May 22 12:48:28 2018 -0700
@@ -56,7 +56,7 @@
     }
 
     void accessField() throws Exception {
-        Point o = Point.origin;
+        Point o = Point.makePoint(10, 20);
         if (field.getInt(o) != o.x) {
             throw new RuntimeException("Unexpected Point.x value: " +  field.getInt(o));
         }
@@ -102,7 +102,7 @@
     }
 
     void staticField() throws Exception {
-        Field f = Point.class.getDeclaredField("origin");
+        Field f = Point.class.getDeclaredField("STATIC_FIELD");
         if (f.trySetAccessible()) {
             throw new RuntimeException("trySetAccessible should not succeed");
         }