changeset 14046:4aa612ffd864

Arrayish related test fixes
author dsimms
date Mon, 30 May 2016 15:09:26 +0200
parents 836efde938c1
children b0f73e4de9d6
files src/java.base/share/classes/java/lang/Arrayish.java test/java/lang/Class/ArrayMethods.java test/java/lang/Class/getDeclaredField/FieldSetAccessibleTest.java
diffstat 3 files changed, 20 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/src/java.base/share/classes/java/lang/Arrayish.java	Fri May 27 14:18:22 2016 +0100
+++ b/src/java.base/share/classes/java/lang/Arrayish.java	Mon May 30 15:09:26 2016 +0200
@@ -30,10 +30,9 @@
  *
  * @author Brian Goetz
  */
+@SuppressWarnings("serial")
 public interface Arrayish<any T> extends Cloneable, java.io.Serializable {
 
-    static final long serialVersionUID = 292L + 4711L;
-
     default int arraySize() {
         @SuppressWarnings("unchecked")
         T[] array = (T[]) (Object) this;
--- a/test/java/lang/Class/ArrayMethods.java	Fri May 27 14:18:22 2016 +0100
+++ b/test/java/lang/Class/ArrayMethods.java	Mon May 30 15:09:26 2016 +0200
@@ -31,6 +31,9 @@
 import java.util.Arrays;
 
 public class ArrayMethods {
+
+    static final boolean USE_ARRAYISH = true;
+
     public int failed = 0;
 
     public static void main(String[] args) throws Exception {
@@ -89,8 +92,9 @@
     public void testGetInterfaces() {
         Class<?>[] is = new Integer[0].getClass().getInterfaces();
         boolean thisFailed = false;
+        int expectedLen = USE_ARRAYISH ? 3 : 2;
 
-        if (is.length != 2)
+        if (is.length != expectedLen)
             thisFailed = true;
 
         if (!is[0].getCanonicalName().equals("java.lang.Cloneable"))
@@ -99,10 +103,21 @@
         if (!is[1].getCanonicalName().equals("java.io.Serializable"))
             thisFailed = true;
 
+        if (USE_ARRAYISH) {
+            if (!is[2].getCanonicalName().equals("java.lang.Arrayish")) {
+                thisFailed = true;
+            }
+        }
+
         if (thisFailed) {
             failed++;
             System.out.println(Arrays.asList(is));
-            System.out.println("Should contain exactly Cloneable, Serializable in that order.");
+            if (USE_ARRAYISH) {
+                System.out.println("Should contain exactly Cloneable, Serializable, Arrayish in that order.");
+            }
+            else {
+                System.out.println("Should contain exactly Cloneable, Serializable in that order.");
+            }
         }
     }
 }
--- a/test/java/lang/Class/getDeclaredField/FieldSetAccessibleTest.java	Fri May 27 14:18:22 2016 +0100
+++ b/test/java/lang/Class/getDeclaredField/FieldSetAccessibleTest.java	Mon May 30 15:09:26 2016 +0200
@@ -223,8 +223,8 @@
             return roots.stream().flatMap(this::toStream)
                     .filter(x -> x.getNameCount() > 2)
                     .map( x-> x.subpath(2, x.getNameCount()))
-                    .map( x -> x.toString())
-                    .filter(s -> s.endsWith(".class"));
+                    .map( x -> x.toString()) // Skip "__Value" (temp proto class, only partial VM suport)
+                    .filter(s -> s.endsWith(".class") && (!s.endsWith("__Value.class")));
         }
 
         @Override