JDK-6746196 : Some JMX classes do not compile with Eclipse compiler
  • Type: Bug
  • Component: core-svc
  • Sub-Component: javax.management
  • Affected Version: 7
  • Priority: P3
  • Status: Closed
  • Resolution: Fixed
  • OS: generic
  • CPU: generic
  • Submitted: 2008-09-09
  • Updated: 2011-03-08
  • Resolved: 2011-03-08
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 7
7 b37Fixed
Related Reports
Relates :  
Relates :  
Description
Roman Kennke writes:
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.

Comments
EVALUATION Will apply fix as suggested. It would be nice to fix the javac bug that prevents us from seeing problems such as this, even if a compiler option is needed to enable the stricter checking.
09-09-2008

SUGGESTED FIX From Roman Kennke: 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";
09-09-2008