Community
Participate
Working Groups
To see the bug: Create a new Java project Import the Sun JDK 6 src.zip into the source folder wait :-) Tried with 3.4M5, compiler compliance level 1.6 This doesn't work in 3.3.2 either. The errors: In java.beans.MetaData#isValid: Type mismatch: cannot convert from Annotation to ContructorProperties calling java.lang.reflect.Constructor.getAnnotation(ContructorProperties.class) In com.sun.jnx.mbeanserver.OpenConverter The method value() is undefined for type Annotation, also calling Constructor.getAnnotation It seems that the compiler does not fully realize that ConstructorProperties is derived from Annotation. A simple test case does not show this problem: // ------- package anno; public @interface Anno { public String getName(); } // ------- package bug; import java.lang.annotation.Annotation; import java.util.HashMap; import java.util.Map; import anno.Anno; public class Test { Map<Class, Annotation> annoMap = new HashMap<Class, Annotation>(); public <T extends Annotation> T getAnnotation(Class<T> annotationClass) { return (T) annoMap.get(annotationClass); } public static void main(String[] args) { Test test = new Test(); test.getAnnotation(Anno.class).getName(); } }
This is not our bug. Some bogus code is released in 1.6 source libs, due to a bug in javac. Also see bug 167952 *** This bug has been marked as a duplicate of bug 167952 ***