Community
Participate
Working Groups
Created attachment 84627 [details] test case I am trying to compile OpenJDK using Eclipse. I get a compiler error on code that I think is correct (and javac compiles it without complaining). I'll attach an example.
It looks like the method Constructor.getAnnotation() returns a <T extends Annotation>, in this case ConstructorProperties, but the compiler treats it as Annotation instead.
If you change slightly the test to remove dependency onto 1.6 lib (ConstructorProperties), with following snippet: import java.lang.reflect.Constructor; public class X { public static void main(String[] args) { try { final Class<MyConstructorProperties> propertyNamesClass = MyConstructorProperties.class; Constructor constr = propertyNamesClass.getConstructor(); String[] propertyNames = constr.getAnnotation(propertyNamesClass).value(); } catch (Exception ex) { // Ignore. } } } @interface MyConstructorProperties {} You will get both compile errors with javac1.5 and java1.6 D:>javac X.java -d ..\bin -Xlint X.java:13: cannot find symbol symbol : method value() location: @interface MyConstructorProperties String[] propertyNames = constr.getAnnotation(propertyNamesClass).value(); ^ 1 error
This is a dup of bug 167952. Pls see javac bug at: http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6400189 *** This bug has been marked as a duplicate of bug 167952 ***
closing as invalid
Verified for 3.4M4 using build I20071210-1800.
I got confirmation that the javac bug really is a plain javac bug.
*** Bug 212175 has been marked as a duplicate of this bug. ***