JDK-6832557 : TEST_BUG: java/lang/Class/getEnclosingConstructor/EnclosingConstructorTests.java fails to compile
  • Type: Bug
  • Component: core-libs
  • Sub-Component: java.lang:reflect
  • Affected Version: 7
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • OS: generic
  • CPU: generic
  • Submitted: 2009-04-21
  • Updated: 2012-09-28
  • Resolved: 2009-05-07
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 7
7 b58Fixed
Related Reports
Relates :  
Description
The following regression test

   java/lang/Class/getEnclosingConstructor/EnclosingConstructorTests.java

fails to compile since jdk7 b55 because of the changes in the javac (see 6400189):

$ /java/re/jdk/7/promoted/all/b55/binaries/solaris-sparc/bin/javac EnclosingConstructorTests.java 
EnclosingConstructorTests.java:66: cannot find symbol
            c.getAnnotation(ConstructorDescriptor.class).value().equals(constructorSig))
                                                        ^
  symbol:   method value()
  location: interface java.lang.annotation.Annotation
Note: EnclosingConstructorTests.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
1 error

The test needs to be fixed.

Comments
SUGGESTED FIX diff -r e281812be4ce test/java/lang/Class/getEnclosingConstructor/EnclosingConstructorTests.java --- a/test/java/lang/Class/getEnclosingConstructor/EnclosingConstructorTests.java Mon Apr 20 13:27:23 2009 +0100 +++ b/test/java/lang/Class/getEnclosingConstructor/EnclosingConstructorTests.java Tue Apr 21 21:19:12 2009 +0100 @@ -23,7 +23,7 @@ /* * @test - * @bug 4962341 + * @bug 4962341 6832557 * @summary Check getEnclosingMethod method * @author Joseph D. Darcy */ @@ -57,8 +57,8 @@ public class EnclosingConstructorTests { } - static int examine(Class enclosedClass, String constructorSig) { - Constructor c = enclosedClass.getEnclosingConstructor(); + static int examine(Class<?> enclosedClass, String constructorSig) { + Constructor<?> c = enclosedClass.getEnclosingConstructor(); if (c == null && constructorSig == null) return 0;
21-04-2009

EVALUATION Original code should not have compiled.
21-04-2009