<Beans Dev> jmx-dev [Fwd: Fix compiler problem]

Sergey Malenkov Sergey.Malenkov at Sun.COM
Wed Dec 19 09:34:16 PST 2007


Hi,

Thank you for explanation.
I'll fix it soon.

Thanks,
SAM

Eamonn McManus wrote:
> Thanks for bringing this to our attention, Alan. Roman is right - the 
> code in question should not compile and we should change it as he 
> suggests so that it is correct.
> 
> (For people interested in the gory details, the method
> <T extends Annotation> T getAnnotation 
> <http://java.sun.com/javase/6/docs/api/java/lang/reflect/Constructor.html#getAnnotation%28java.lang.Class%29>(Class<T> 
> annotationClass)
> returns T only if it is called on a properly generic variable, such as a 
> Constructor<?> or Constructor<? extends Foo> or Constructor<E>. If it is 
> called on a plain Constructor with no type parameter, then that is a 
> "raw type", and the return type is "erased" to Annotation. So something like
> ConstructorProperties annotation = 
> constructor.getAnnotation(ConstructorProperties.class)
> should not compile if constructor is declared as Constructor rather than 
> Constructor<?> or whatever.)
> 
> Éamonn McManus   JMX Spec Lead   http://weblogs.java.net/blog/emcmanus/
> 
> 
> 
> Alan Bateman wrote:
>>
>> I don't know if the JMX  team or the JavaBeans maintainers are on the 
>> core-libs-dev mailing list.
>>
>>
>> ------------------------------------------------------------------------
>>
>> Subject:
>> Fix compiler problem
>> From:
>> Roman Kennke <roman.kennke at aicas.com>
>> Date:
>> Tue, 18 Dec 2007 15:32:06 +0100
>> To:
>> Core-Libs-Dev <core-libs-dev at openjdk.java.net>
>>
>> To:
>> Core-Libs-Dev <core-libs-dev at openjdk.java.net>
>>
>>
>> When trying to compile OpenJDK with the Eclipse compiler, I noticed two
>> compiler errors related to generics. It turned out that the code there
>> is invalid and only javac (incorrectly) accepts it. See the following
>> bug reports for details:
>>
>> https://bugs.eclipse.org/bugs/show_bug.cgi?id=212147
>> http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6400189
>>
>> The attached changeset fixes the problem. Could this be included?
>>
>> /Roman
>>
>>   




More information about the beans-dev mailing list