jmx-dev [PATCH] Fix some compilation problems

View: New views
2 Messages — Rating Filter:   Alert me  

jmx-dev [PATCH] Fix some compilation problems

by Roman Kennke-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I think I posted some of this a while ago already, but it seems like
this kind of problems sneaks in every now and then. The JMX code has
some generics code that is not valid Java code but is accepted by javac
anyway (which is a bug in javac, which should be fixed IMO). Other (Java
compatible) compilers (like the Eclipse compiler) reject this code,
which is the correct thing to do. The attached patch fixes the (current)
problems in JMX.

/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-48
USt-Id: DE216375633, Handelsregister HRB 109481, AG Karlsruhe
Geschäftsführer: Dr. James J. Hunt

[patch.txt]

diff -r 213263e6dec4 -r 20f1a33a7460 src/share/classes/com/sun/jmx/mbeanserver/DefaultMXBeanMappingFactory.java
--- a/src/share/classes/com/sun/jmx/mbeanserver/DefaultMXBeanMappingFactory.java Thu Jul 31 16:49:31 2008 +0200
+++ b/src/share/classes/com/sun/jmx/mbeanserver/DefaultMXBeanMappingFactory.java Fri Aug 01 14:34:36 2008 +0200
@@ -1206,7 +1206,7 @@
             // 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 00a6f1f4a0e2 src/share/classes/com/sun/jmx/mbeanserver/MBeanIntrospector.java
--- a/src/share/classes/com/sun/jmx/mbeanserver/MBeanIntrospector.java Fri Sep 05 16:16:59 2008 +0200
+++ b/src/share/classes/com/sun/jmx/mbeanserver/MBeanIntrospector.java Tue Sep 09 13:15:32 2008 +0200
@@ -623,7 +623,7 @@
     }
 
     private static MBeanConstructorInfo[] findConstructors(Class<?> c) {
-        Constructor[] cons = c.getConstructors();
+        Constructor<?>[] cons = c.getConstructors();
         MBeanConstructorInfo[] mbc = new MBeanConstructorInfo[cons.length];
         for (int i = 0; i < cons.length; i++) {
             String descr = "Public constructor of the MBean";


Re: jmx-dev [PATCH] Fix some compilation problems

by eamonn.mcmanus :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Roman,

Thanks for letting us know. I have logged bug 6746196 to track this, and it will be fixed in a forthcoming JDK 7 build.

I agree that it would be good if javac followed the language specification (see bug 6400189). There might be a fear of causing programs that previously compiled to stop doing so, but in that case the right answer is probably a compiler flag, so that we could at least ask for strictness and avoid the conflicts with the Eclipse compiler.

Regards,
Éamonn McManus · JMX Spec Lead · http://weblogs.java.net/blog/emcmanus/


Roman Kennke wrote:
I think I posted some of this a while ago already, but it seems like
this kind of problems sneaks in every now and then. The JMX code has
some generics code that is not valid Java code but is accepted by javac
anyway (which is a bug in javac, which should be fixed IMO). Other (Java
compatible) compilers (like the Eclipse compiler) reject this code,
which is the correct thing to do. The attached patch fixes the (current)
problems in JMX.

/Roman