JDK-6372375 : MXBean spec does not explicitly specify what the "typeName" is for a TabularType or CompositeType
  • Type: Bug
  • Component: core-svc
  • Sub-Component: javax.management
  • Affected Version: 6
  • Priority: P3
  • Status: Closed
  • Resolution: Duplicate
  • OS: generic
  • CPU: generic
  • Submitted: 2006-01-13
  • Updated: 2011-01-22
  • Resolved: 2006-03-15
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
6Resolved
Related Reports
Duplicate :  
Description
The "Type mapping rules" section in MXBean specification describes cases of mapping when the Open Type is TabularType or CompositeType.

However it is not specified what typeName parameter is used for constructing both TabularType and CompositeType - it can be whatever the implementor wants. The problem is that the value of this field participates in comparison of 2 TabularType/CompositeType objects.

The only place in spec, which marginally says about the typeName value is:

<excerpt>
For example, the TabularType for a Map<String,ObjectName> might be constructed with code like this:

String typeName =
    "java.util.Map<java.lang.String,javax.management.ObjectName>";
String[] keyValue =
    new String[] {"key", "value"};
OpenType[] openTypes =
    new OpenType[] {SimpleType.STRING, SimpleType.OBJECTNAME};
CompositeType rowType =
    new CompositeType(typeName, typeName, keyValue, keyValue, openTypes);
TabularType tabularType =
    new TabularType(typeName, typeName, rowType, new String[] {"key"}); 

</excerpt>

Comments
EVALUATION We'll address this along with 6367912.
15-03-2006

EVALUATION The existing behavior of the code when building the typeName for a TabularType and its associated CompositeType is for the generic Java types (Map<K,V> and SortedMap<K,V>) to call the corresponding ParameterizedTypeImpl.toString() which recursively calls the ParameterizedTypeImpl.toString() and/or GenericArrayTypeImpl.toString() for the parameterized types inside the angle brackets. For example, for Map<String,ObjectName> the typeName string would be java.util.Map<java.lang.String, javax.management.ObjectName> The problem is that these ParameterizedTypeImpl and GenericArrayTypeImpl classes are sun.reflect.generics.* internal classes whose toString() methods are not specified by the ParameterizedType and GenericArrayType public interfaces. For the "Mappings for other types" when the CompositeData is built by the MXBean framework the associated CompositeType's typeName defaults to Class.getName() where Class identifies the Java class or interface that we are trying to map. The same problem appears also in the definition of the originalType in the Descriptor. Here again for a generic Java type, the originalType is the string returned by ParameterizedTypeImpl.toString(). For a class or primitive type, the originalType is the string returned by Class.getName(). For example, Set<String> ---> originalType is java.util.Set<java.lang.String> Map<String,ObjectName[]> ---> originalType is java.util.Map<java.lang.String, javax.management.ObjectName[]> Summing up, it would be much easier for us to have the toString methods specified in the *Type public interfaces than having to specify them in the MXBean specification by copying what the *TypeImpl.toString() methods currently return (and that could change in the future in which case our toString() methods would unfortunately be no longer in synch with the *TypeImpl.toString() methods).
17-01-2006

EVALUATION We should specify the existing behaviour of the code.
13-01-2006