changeset 842:c2d2185a79dd

6704655: Test test/java/lang/reflect/Generics/Probe.java fails under OpenJDK Reviewed-by: ksrini
author darcy
date Wed, 28 Jan 2009 10:30:33 -0800
parents 6eac3829cb41
children 1ebbc958f06a
files test/java/lang/reflect/Generics/Probe.java
diffstat 1 files changed, 17 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/test/java/lang/reflect/Generics/Probe.java	Tue Jan 27 15:04:30 2009 -0800
+++ b/test/java/lang/reflect/Generics/Probe.java	Wed Jan 28 10:30:33 2009 -0800
@@ -23,7 +23,7 @@
 
 /*
  * @test
- * @bug 5003916
+ * @bug 5003916 6704655
  * @summary Testing parsing of signatures attributes of nested classes
  * @author Joseph D. Darcy
  * @compile -source 1.5 Probe.java
@@ -32,8 +32,10 @@
 
 import java.lang.reflect.*;
 import java.lang.annotation.*;
+import java.util.*;
+import static java.util.Arrays.*;
 
-@Classes({
+@Classes(value={
         "java.util.concurrent.FutureTask",
         "java.util.concurrent.ConcurrentHashMap$EntryIterator",
         "java.util.concurrent.ConcurrentHashMap$KeyIterator",
@@ -56,7 +58,9 @@
         "java.util.HashMap$ValueIterator",
         "java.util.LinkedHashMap$EntryIterator",
         "java.util.LinkedHashMap$KeyIterator",
-        "java.util.LinkedHashMap$ValueIterator",
+        "java.util.LinkedHashMap$ValueIterator"
+        },
+        sunClasses={
         "javax.crypto.SunJCE_c",
         "javax.crypto.SunJCE_e",
         "javax.crypto.SunJCE_f",
@@ -66,7 +70,15 @@
         })
 public class Probe {
     public static void main (String[] args) throws Throwable {
-        String [] names = (Probe.class).getAnnotation(Classes.class).value();
+        Classes classesAnnotation = (Probe.class).getAnnotation(Classes.class);
+        List<String> names =
+            new ArrayList<String>(asList(classesAnnotation.value()));
+
+        if (System.getProperty("java.runtime.name").startsWith("Java(TM)")) {
+            // Sun production JDK; test crypto classes too
+            for(String name: classesAnnotation.sunClasses())
+                names.add(name);
+        }
 
         int errs = 0;
         for(String name: names) {
@@ -140,4 +152,5 @@
 @Retention(RetentionPolicy.RUNTIME)
 @interface Classes {
     String [] value(); // list of classes to probe
+    String [] sunClasses(); // list of Sun-production JDK specific classes to probe
 }