JDK-6486655 : REGRESSION: Standard MBean attributes and operations lose original interface order
  • Type: Bug
  • Component: core-svc
  • Sub-Component: javax.management
  • Affected Version: 6
  • Priority: P2
  • Status: Resolved
  • Resolution: Fixed
  • OS: generic
  • CPU: generic
  • Submitted: 2006-10-26
  • Updated: 2010-07-29
  • Resolved: 2007-03-24
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 6 JDK 7
6u2 b01Fixed 7Fixed
Description
My server side uses JDK6, my client side JDK5.
I call getMBeanInfo localy and remotely on the same standard MBean,
then check for equality calling MBeanInfo.equals
This call return false because the two MBeanInfo objects return the same values 
in their MBeanFeatureInfo arrays but in a different order.

With JDK6, the alphabetic order seems to be used while in JDK5,
it's the declaration order that is used.

Comments
SUGGESTED FIX Use a LinkedHashMap instead of a TreeMap in com.sun.jmx.mbeanserver.MBeanAnalyzer for attrMap and opMap.
26-10-2006

EVALUATION It appears indeed that attributes and operations in a Standard MBean are now sorted, whereas in JDK 5.0 they appeared in the same order as the corresponding methods in the MBean interface. This does not violate the specification, but could surprise existing code. We should restore the JDK 5.0 behaviour. Notice that the method eliminateCovariantMethods in this class has a comment about preserving order, which it does, but to no avail because the order is lost elsewhere.
26-10-2006