changeset 54151:26ecda724028

8218461: test/jdk/java/lang/invoke/VarHandles should be generated rather than manually edited Reviewed-by: bpb, vromero
author mchung
date Wed, 06 Feb 2019 15:09:05 -0800
parents 021917019cda
children 7870ecf291cc
files 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/VarHandleTestAccessString.java test/jdk/java/lang/invoke/VarHandles/VarHandleTestByteArrayAsChar.java test/jdk/java/lang/invoke/VarHandles/VarHandleTestByteArrayAsDouble.java test/jdk/java/lang/invoke/VarHandles/VarHandleTestByteArrayAsFloat.java test/jdk/java/lang/invoke/VarHandles/VarHandleTestByteArrayAsInt.java test/jdk/java/lang/invoke/VarHandles/VarHandleTestByteArrayAsLong.java test/jdk/java/lang/invoke/VarHandles/VarHandleTestByteArrayAsShort.java test/jdk/java/lang/invoke/VarHandles/X-VarHandleTestAccess.java.template test/jdk/java/lang/invoke/VarHandles/X-VarHandleTestByteArrayView.java.template
diffstat 17 files changed, 36 insertions(+), 91 deletions(-) [+]
line wrap: on
line diff
--- a/test/jdk/java/lang/invoke/VarHandles/VarHandleTestAccessBoolean.java	Wed Feb 06 15:11:59 2019 -0500
+++ b/test/jdk/java/lang/invoke/VarHandles/VarHandleTestAccessBoolean.java	Wed Feb 06 15:09:05 2019 -0800
@@ -133,16 +133,13 @@
     }
 
     @Test
-    public void testEqualsAndHashCode() {
+    public void testEquals() {
         VarHandle[] vhs1 = allocate(true);
         VarHandle[] vhs2 = allocate(true);
 
         for (int i = 0; i < vhs1.length; i++) {
             for (int j = 0; j < vhs1.length; j++) {
-                if (i == j) {
-                    assertEquals(vhs1[i], vhs1[i]);
-                }
-                else {
+                if (i != j) {
                     assertNotEquals(vhs1[i], vhs1[j]);
                     assertNotEquals(vhs1[i], vhs2[j]);
                 }
--- a/test/jdk/java/lang/invoke/VarHandles/VarHandleTestAccessByte.java	Wed Feb 06 15:11:59 2019 -0500
+++ b/test/jdk/java/lang/invoke/VarHandles/VarHandleTestAccessByte.java	Wed Feb 06 15:09:05 2019 -0800
@@ -133,16 +133,13 @@
     }
 
     @Test
-    public void testEqualsAndHashCode() {
+    public void testEquals() {
         VarHandle[] vhs1 = allocate(true);
         VarHandle[] vhs2 = allocate(true);
 
         for (int i = 0; i < vhs1.length; i++) {
             for (int j = 0; j < vhs1.length; j++) {
-                if (i == j) {
-                    assertEquals(vhs1[i], vhs1[i]);
-                }
-                else {
+                if (i != j) {
                     assertNotEquals(vhs1[i], vhs1[j]);
                     assertNotEquals(vhs1[i], vhs2[j]);
                 }
--- a/test/jdk/java/lang/invoke/VarHandles/VarHandleTestAccessChar.java	Wed Feb 06 15:11:59 2019 -0500
+++ b/test/jdk/java/lang/invoke/VarHandles/VarHandleTestAccessChar.java	Wed Feb 06 15:09:05 2019 -0800
@@ -133,16 +133,13 @@
     }
 
     @Test
-    public void testEqualsAndHashCode() {
+    public void testEquals() {
         VarHandle[] vhs1 = allocate(true);
         VarHandle[] vhs2 = allocate(true);
 
         for (int i = 0; i < vhs1.length; i++) {
             for (int j = 0; j < vhs1.length; j++) {
-                if (i == j) {
-                    assertEquals(vhs1[i], vhs1[i]);
-                }
-                else {
+                if (i != j) {
                     assertNotEquals(vhs1[i], vhs1[j]);
                     assertNotEquals(vhs1[i], vhs2[j]);
                 }
--- a/test/jdk/java/lang/invoke/VarHandles/VarHandleTestAccessDouble.java	Wed Feb 06 15:11:59 2019 -0500
+++ b/test/jdk/java/lang/invoke/VarHandles/VarHandleTestAccessDouble.java	Wed Feb 06 15:09:05 2019 -0800
@@ -133,16 +133,13 @@
     }
 
     @Test
-    public void testEqualsAndHashCode() {
+    public void testEquals() {
         VarHandle[] vhs1 = allocate(true);
         VarHandle[] vhs2 = allocate(true);
 
         for (int i = 0; i < vhs1.length; i++) {
             for (int j = 0; j < vhs1.length; j++) {
-                if (i == j) {
-                    assertEquals(vhs1[i], vhs1[i]);
-                }
-                else {
+                if (i != j) {
                     assertNotEquals(vhs1[i], vhs1[j]);
                     assertNotEquals(vhs1[i], vhs2[j]);
                 }
--- a/test/jdk/java/lang/invoke/VarHandles/VarHandleTestAccessFloat.java	Wed Feb 06 15:11:59 2019 -0500
+++ b/test/jdk/java/lang/invoke/VarHandles/VarHandleTestAccessFloat.java	Wed Feb 06 15:09:05 2019 -0800
@@ -133,16 +133,13 @@
     }
 
     @Test
-    public void testEqualsAndHashCode() {
+    public void testEquals() {
         VarHandle[] vhs1 = allocate(true);
         VarHandle[] vhs2 = allocate(true);
 
         for (int i = 0; i < vhs1.length; i++) {
             for (int j = 0; j < vhs1.length; j++) {
-                if (i == j) {
-                    assertEquals(vhs1[i], vhs1[i]);
-                }
-                else {
+                if (i != j) {
                     assertNotEquals(vhs1[i], vhs1[j]);
                     assertNotEquals(vhs1[i], vhs2[j]);
                 }
--- a/test/jdk/java/lang/invoke/VarHandles/VarHandleTestAccessInt.java	Wed Feb 06 15:11:59 2019 -0500
+++ b/test/jdk/java/lang/invoke/VarHandles/VarHandleTestAccessInt.java	Wed Feb 06 15:09:05 2019 -0800
@@ -133,16 +133,13 @@
     }
 
     @Test
-    public void testEqualsAndHashCode() {
+    public void testEquals() {
         VarHandle[] vhs1 = allocate(true);
         VarHandle[] vhs2 = allocate(true);
 
         for (int i = 0; i < vhs1.length; i++) {
             for (int j = 0; j < vhs1.length; j++) {
-                if (i == j) {
-                    assertEquals(vhs1[i], vhs1[i]);
-                }
-                else {
+                if (i != j) {
                     assertNotEquals(vhs1[i], vhs1[j]);
                     assertNotEquals(vhs1[i], vhs2[j]);
                 }
--- a/test/jdk/java/lang/invoke/VarHandles/VarHandleTestAccessLong.java	Wed Feb 06 15:11:59 2019 -0500
+++ b/test/jdk/java/lang/invoke/VarHandles/VarHandleTestAccessLong.java	Wed Feb 06 15:09:05 2019 -0800
@@ -133,16 +133,13 @@
     }
 
     @Test
-    public void testEqualsAndHashCode() {
+    public void testEquals() {
         VarHandle[] vhs1 = allocate(true);
         VarHandle[] vhs2 = allocate(true);
 
         for (int i = 0; i < vhs1.length; i++) {
             for (int j = 0; j < vhs1.length; j++) {
-                if (i == j) {
-                    assertEquals(vhs1[i], vhs1[i]);
-                }
-                else {
+                if (i != j) {
                     assertNotEquals(vhs1[i], vhs1[j]);
                     assertNotEquals(vhs1[i], vhs2[j]);
                 }
--- a/test/jdk/java/lang/invoke/VarHandles/VarHandleTestAccessShort.java	Wed Feb 06 15:11:59 2019 -0500
+++ b/test/jdk/java/lang/invoke/VarHandles/VarHandleTestAccessShort.java	Wed Feb 06 15:09:05 2019 -0800
@@ -133,16 +133,13 @@
     }
 
     @Test
-    public void testEqualsAndHashCode() {
+    public void testEquals() {
         VarHandle[] vhs1 = allocate(true);
         VarHandle[] vhs2 = allocate(true);
 
         for (int i = 0; i < vhs1.length; i++) {
             for (int j = 0; j < vhs1.length; j++) {
-                if (i == j) {
-                    assertEquals(vhs1[i], vhs1[i]);
-                }
-                else {
+                if (i != j) {
                     assertNotEquals(vhs1[i], vhs1[j]);
                     assertNotEquals(vhs1[i], vhs2[j]);
                 }
--- a/test/jdk/java/lang/invoke/VarHandles/VarHandleTestAccessString.java	Wed Feb 06 15:11:59 2019 -0500
+++ b/test/jdk/java/lang/invoke/VarHandles/VarHandleTestAccessString.java	Wed Feb 06 15:09:05 2019 -0800
@@ -135,16 +135,13 @@
     }
 
     @Test
-    public void testEqualsAndHashCode() {
+    public void testEquals() {
         VarHandle[] vhs1 = allocate(true);
         VarHandle[] vhs2 = allocate(true);
 
         for (int i = 0; i < vhs1.length; i++) {
             for (int j = 0; j < vhs1.length; j++) {
-                if (i == j) {
-                    assertEquals(vhs1[i], vhs1[i]);
-                }
-                else {
+                if (i != j) {
                     assertNotEquals(vhs1[i], vhs1[j]);
                     assertNotEquals(vhs1[i], vhs2[j]);
                 }
--- a/test/jdk/java/lang/invoke/VarHandles/VarHandleTestByteArrayAsChar.java	Wed Feb 06 15:11:59 2019 -0500
+++ b/test/jdk/java/lang/invoke/VarHandles/VarHandleTestByteArrayAsChar.java	Wed Feb 06 15:09:05 2019 -0800
@@ -83,7 +83,7 @@
     }
 
     @Test
-    public void testEqualsAndHashCode() {
+    public void testEquals() {
         VarHandle[] vhs1 = setupVarHandleSources(true).stream().
             map(vhs -> vhs.s).toArray(VarHandle[]::new);
         VarHandle[] vhs2 = setupVarHandleSources(true).stream().
@@ -91,10 +91,7 @@
 
         for (int i = 0; i < vhs1.length; i++) {
             for (int j = 0; j < vhs1.length; j++) {
-                if (i == j) {
-                    assertEquals(vhs1[i], vhs1[i]);
-                }
-                else {
+                if (i != j) {
                     assertNotEquals(vhs1[i], vhs1[j]);
                     assertNotEquals(vhs1[i], vhs2[j]);
                 }
--- a/test/jdk/java/lang/invoke/VarHandles/VarHandleTestByteArrayAsDouble.java	Wed Feb 06 15:11:59 2019 -0500
+++ b/test/jdk/java/lang/invoke/VarHandles/VarHandleTestByteArrayAsDouble.java	Wed Feb 06 15:09:05 2019 -0800
@@ -83,7 +83,7 @@
     }
 
     @Test
-    public void testEqualsAndHashCode() {
+    public void testEquals() {
         VarHandle[] vhs1 = setupVarHandleSources(true).stream().
             map(vhs -> vhs.s).toArray(VarHandle[]::new);
         VarHandle[] vhs2 = setupVarHandleSources(true).stream().
@@ -91,10 +91,7 @@
 
         for (int i = 0; i < vhs1.length; i++) {
             for (int j = 0; j < vhs1.length; j++) {
-                if (i == j) {
-                    assertEquals(vhs1[i], vhs1[i]);
-                }
-                else {
+                if (i != j) {
                     assertNotEquals(vhs1[i], vhs1[j]);
                     assertNotEquals(vhs1[i], vhs2[j]);
                 }
--- a/test/jdk/java/lang/invoke/VarHandles/VarHandleTestByteArrayAsFloat.java	Wed Feb 06 15:11:59 2019 -0500
+++ b/test/jdk/java/lang/invoke/VarHandles/VarHandleTestByteArrayAsFloat.java	Wed Feb 06 15:09:05 2019 -0800
@@ -83,7 +83,7 @@
     }
 
     @Test
-    public void testEqualsAndHashCode() {
+    public void testEquals() {
         VarHandle[] vhs1 = setupVarHandleSources(true).stream().
             map(vhs -> vhs.s).toArray(VarHandle[]::new);
         VarHandle[] vhs2 = setupVarHandleSources(true).stream().
@@ -91,10 +91,7 @@
 
         for (int i = 0; i < vhs1.length; i++) {
             for (int j = 0; j < vhs1.length; j++) {
-                if (i == j) {
-                    assertEquals(vhs1[i], vhs1[i]);
-                }
-                else {
+                if (i != j) {
                     assertNotEquals(vhs1[i], vhs1[j]);
                     assertNotEquals(vhs1[i], vhs2[j]);
                 }
--- a/test/jdk/java/lang/invoke/VarHandles/VarHandleTestByteArrayAsInt.java	Wed Feb 06 15:11:59 2019 -0500
+++ b/test/jdk/java/lang/invoke/VarHandles/VarHandleTestByteArrayAsInt.java	Wed Feb 06 15:09:05 2019 -0800
@@ -83,7 +83,7 @@
     }
 
     @Test
-    public void testEqualsAndHashCode() {
+    public void testEquals() {
         VarHandle[] vhs1 = setupVarHandleSources(true).stream().
             map(vhs -> vhs.s).toArray(VarHandle[]::new);
         VarHandle[] vhs2 = setupVarHandleSources(true).stream().
@@ -91,10 +91,7 @@
 
         for (int i = 0; i < vhs1.length; i++) {
             for (int j = 0; j < vhs1.length; j++) {
-                if (i == j) {
-                    assertEquals(vhs1[i], vhs1[i]);
-                }
-                else {
+                if (i != j) {
                     assertNotEquals(vhs1[i], vhs1[j]);
                     assertNotEquals(vhs1[i], vhs2[j]);
                 }
--- a/test/jdk/java/lang/invoke/VarHandles/VarHandleTestByteArrayAsLong.java	Wed Feb 06 15:11:59 2019 -0500
+++ b/test/jdk/java/lang/invoke/VarHandles/VarHandleTestByteArrayAsLong.java	Wed Feb 06 15:09:05 2019 -0800
@@ -83,7 +83,7 @@
     }
 
     @Test
-    public void testEqualsAndHashCode() {
+    public void testEquals() {
         VarHandle[] vhs1 = setupVarHandleSources(true).stream().
             map(vhs -> vhs.s).toArray(VarHandle[]::new);
         VarHandle[] vhs2 = setupVarHandleSources(true).stream().
@@ -91,10 +91,7 @@
 
         for (int i = 0; i < vhs1.length; i++) {
             for (int j = 0; j < vhs1.length; j++) {
-                if (i == j) {
-                    assertEquals(vhs1[i], vhs1[i]);
-                }
-                else {
+                if (i != j) {
                     assertNotEquals(vhs1[i], vhs1[j]);
                     assertNotEquals(vhs1[i], vhs2[j]);
                 }
--- a/test/jdk/java/lang/invoke/VarHandles/VarHandleTestByteArrayAsShort.java	Wed Feb 06 15:11:59 2019 -0500
+++ b/test/jdk/java/lang/invoke/VarHandles/VarHandleTestByteArrayAsShort.java	Wed Feb 06 15:09:05 2019 -0800
@@ -83,7 +83,7 @@
     }
 
     @Test
-    public void testEqualsAndHashCode() {
+    public void testEquals() {
         VarHandle[] vhs1 = setupVarHandleSources(true).stream().
             map(vhs -> vhs.s).toArray(VarHandle[]::new);
         VarHandle[] vhs2 = setupVarHandleSources(true).stream().
@@ -91,10 +91,7 @@
 
         for (int i = 0; i < vhs1.length; i++) {
             for (int j = 0; j < vhs1.length; j++) {
-                if (i == j) {
-                    assertEquals(vhs1[i], vhs1[i]);
-                }
-                else {
+                if (i != j) {
                     assertNotEquals(vhs1[i], vhs1[j]);
                     assertNotEquals(vhs1[i], vhs2[j]);
                 }
--- a/test/jdk/java/lang/invoke/VarHandles/X-VarHandleTestAccess.java.template	Wed Feb 06 15:11:59 2019 -0500
+++ b/test/jdk/java/lang/invoke/VarHandles/X-VarHandleTestAccess.java.template	Wed Feb 06 15:09:05 2019 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -143,18 +143,13 @@
     }
 
     @Test
-    public void testEqualsAndHashCode() {
+    public void testEquals() {
         VarHandle[] vhs1 = allocate(true);
         VarHandle[] vhs2 = allocate(true);
 
         for (int i = 0; i < vhs1.length; i++) {
             for (int j = 0; j < vhs1.length; j++) {
-                if (i == j) {
-                    assertEquals(vhs1[i], vhs1[i]);
-                    assertEquals(vhs1[i], vhs2[i]);
-                    assertEquals(vhs1[i].hashCode(), vhs2[i].hashCode());
-                }
-                else {
+                if (i != j) {
                     assertNotEquals(vhs1[i], vhs1[j]);
                     assertNotEquals(vhs1[i], vhs2[j]);
                 }
--- a/test/jdk/java/lang/invoke/VarHandles/X-VarHandleTestByteArrayView.java.template	Wed Feb 06 15:11:59 2019 -0500
+++ b/test/jdk/java/lang/invoke/VarHandles/X-VarHandleTestByteArrayView.java.template	Wed Feb 06 15:09:05 2019 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -87,7 +87,7 @@
     }
 
     @Test
-    public void testEqualsAndHashCode() {
+    public void testEquals() {
         VarHandle[] vhs1 = setupVarHandleSources(true).stream().
             map(vhs -> vhs.s).toArray(VarHandle[]::new);
         VarHandle[] vhs2 = setupVarHandleSources(true).stream().
@@ -95,12 +95,7 @@
 
         for (int i = 0; i < vhs1.length; i++) {
             for (int j = 0; j < vhs1.length; j++) {
-                if (i == j) {
-                    assertEquals(vhs1[i], vhs1[i]);
-                    assertEquals(vhs1[i], vhs2[i]);
-                    assertEquals(vhs1[i].hashCode(), vhs2[i].hashCode());
-                }
-                else {
+                if (i != j) {
                     assertNotEquals(vhs1[i], vhs1[j]);
                     assertNotEquals(vhs1[i], vhs2[j]);
                 }