-
Bug
-
Resolution: Fixed
-
P3
-
6
-
None
-
b53
-
generic
-
generic
An attempt to create an MXBean that has an attribute of type Map<K,V>, where K is a type that is not Comparable, produces an exception when reconstructing the value of that attribute. The code incorrectly tries to make a TreeMap. The particular case that fails is when implementing java.lang.management.ThreadMXBean with the generic MXBean framework. It gets an exception like this:
java.lang.ClassCastException: java.lang.management.ThreadInfo cannot be cast to java.lang.Comparable
at java.util.TreeMap.compare(TreeMap.java:1093)
at java.util.TreeMap.put(TreeMap.java:465)
at com.sun.jmx.mbeanserver.OpenConverter$TabularConverter.fromOpenValue(OpenConverter.java:728)
at com.sun.jmx.mbeanserver.ConvertingMethod.fromOpenReturnValue(ConvertingMethod.java:117)
at com.sun.jmx.mbeanserver.MXBeanProxy.invoke(MXBeanProxy.java:149)
at javax.management.MBeanServerInvocationHandler.invoke(MBeanServerInvocationHandler.java:307)
at $Proxy0.getAllLockedMonitors(Unknown Source)
The type of the getAllLockedMonitors method is Map<ThreadInfo,MonitorInfo[]>.
java.lang.ClassCastException: java.lang.management.ThreadInfo cannot be cast to java.lang.Comparable
at java.util.TreeMap.compare(TreeMap.java:1093)
at java.util.TreeMap.put(TreeMap.java:465)
at com.sun.jmx.mbeanserver.OpenConverter$TabularConverter.fromOpenValue(OpenConverter.java:728)
at com.sun.jmx.mbeanserver.ConvertingMethod.fromOpenReturnValue(ConvertingMethod.java:117)
at com.sun.jmx.mbeanserver.MXBeanProxy.invoke(MXBeanProxy.java:149)
at javax.management.MBeanServerInvocationHandler.invoke(MBeanServerInvocationHandler.java:307)
at $Proxy0.getAllLockedMonitors(Unknown Source)
The type of the getAllLockedMonitors method is Map<ThreadInfo,MonitorInfo[]>.