United StatesChange Country, Oracle Worldwide Web Sites Communities I am a... I want to...
Bug ID: JDK-6704655 Test test/java/lang/reflect/Generics/Probe.java fails under OpenJDK
JDK-6704655 : Test test/java/lang/reflect/Generics/Probe.java fails under OpenJDK

Details
Type:
Bug
Submit Date:
2008-05-19
Status:
Resolved
Updated Date:
2012-09-28
Project Name:
JDK
Resolved Date:
2008-05-20
Component:
core-libs
OS:
generic
Sub-Component:
java.lang:reflect
CPU:
generic
Priority:
P3
Resolution:
Fixed
Affected Versions:
OpenJDK6
Fixed Versions:
OpenJDK6 (b10)

Related Reports
Backport:
Relates:
Relates:
Relates:

Sub Tasks

Description
The regression test 

test/java/lang/reflect/Generics/Probe.java

fails under OpenJDK, but passes under the production JDK, because the test reflectively accesses class files only available in the production JDK.  The test should be updated to pass under OpenJDK too.

                                    

Comments
EVALUATION

The test should be updated to pass under OpenJDK too.  While simply removing references to the problematic class files would be one solution, a better solution would be to test for OpenJDK vs production JDK and only probe for the production-only classes in the latter case.
                                     
2008-05-19
SUGGESTED FIX

test/java/lang/reflect/Generics>sccs sccsdiff -r1.7 -r1.8 Probe.java 

------- Probe.java -------
26c26
<  * @bug 5003916
---
>  * @bug 5003916 6704655
34a35,36
> import java.util.*;
> import static java.util.Arrays.*;
36c38
< @Classes({
---
> @Classes(value={
59c61,63
<         "java.util.LinkedHashMap$ValueIterator",
---
>         "java.util.LinkedHashMap$ValueIterator"
>         },
>         sunClasses={
69c73,75
<         String [] names = (Probe.class).getAnnotation(Classes.class).value();
---
>         Classes classesAnnotation = (Probe.class).getAnnotation(Classes.class);
>         List<String> names =
>             new ArrayList<String>(asList(classesAnnotation.value()));
70a77,82
>         if (System.getProperty("java.runtime.name").startsWith("Java(TM)")) {
>             // Sun production JDK; test crypto classes too
>             for(String name: classesAnnotation.sunClasses())
>                 names.add(name);
>         }
> 
142a155
>     String [] sunClasses(); // list of Sun-production JDK specific classes to probe
                                     
2008-05-20



Hardware and Software, Engineered to Work Together