|
View:
New views
3 Messages
—
Rating Filter:
Alert me
|
|
|
jmx-devI don't know if the JMX team or the JavaBeans maintainers are on the core-libs-dev mailing list. 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 -- Dipl.-Inform. (FH) Roman Kennke, Software Engineer, http://kennke.org aicas Allerton Interworks Computer Automated Systems GmbH Haid-und-Neu-Straße 18 * D-76131 Karlsruhe * Germany http://www.aicas.com * Tel: +49-721-663 968-0 USt-Id: DE216375633, Handelsregister HRB 109481, AG Karlsruhe Geschäftsführer: Dr. James J. Hunt [openjdk-compile.patch] # HG changeset patch # User Roman Kennke <kennke@...> # Date 1197988258 -3600 # Node ID 2b6c2ce8cd88445d9e3ea709069bf26d53039223 # Parent 37a05a11f281b4d238e2f9e7ebb67c63f64d0e77 Fix compiler problem. diff -r 37a05a11f281 -r 2b6c2ce8cd88 src/share/classes/com/sun/jmx/mbeanserver/OpenConverter.java --- a/src/share/classes/com/sun/jmx/mbeanserver/OpenConverter.java Sat Dec 01 00:00:00 2007 +0000 +++ b/src/share/classes/com/sun/jmx/mbeanserver/OpenConverter.java Tue Dec 18 15:30:58 2007 +0100 @@ -1152,7 +1152,7 @@ public abstract class OpenConverter { // Also remember the set of properties in that constructor // so we can test unambiguity. Set<BitSet> getterIndexSets = newSet(); - for (Constructor constr : annotatedConstrList) { + for (Constructor<?> constr : annotatedConstrList) { String[] propertyNames = constr.getAnnotation(propertyNamesClass).value(); diff -r 37a05a11f281 -r 2b6c2ce8cd88 src/share/classes/java/beans/MetaData.java --- a/src/share/classes/java/beans/MetaData.java Sat Dec 01 00:00:00 2007 +0000 +++ b/src/share/classes/java/beans/MetaData.java Tue Dec 18 15:30:58 2007 +0100 @@ -1563,7 +1563,7 @@ class MetaData { return names; } - private static String[] getAnnotationValue(Constructor constructor) { + private static String[] getAnnotationValue(Constructor<?> constructor) { ConstructorProperties annotation = constructor.getAnnotation(ConstructorProperties.class); return (annotation != null) ? annotation.value() |
|||||
|
|
Re: jmx-devThanks 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 Éamonn McManus JMX Spec Lead http://weblogs.java.net/blog/emcmanus/ Alan Bateman wrote:
|
|||||
|
|
Re: jmx-dev <Beans Dev>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@...> >> Date: >> Tue, 18 Dec 2007 15:32:06 +0100 >> To: >> Core-Libs-Dev <core-libs-dev@...> >> >> To: >> Core-Libs-Dev <core-libs-dev@...> >> >> >> 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 >> >> |
| Free embeddable forum powered by Nabble | Forum Help |