Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-5045358

Open MBeans cannot reference primitive data types or arrays thereof

XMLWordPrintable

    • b37
    • generic
    • generic

      The set of types that can be referenced by an Open MBean is by design
      limited. It includes the primitive wrapper types such as java.lang.Integer
      and java.lang.Boolean. However, it does not include the primitive types
      such as int and boolean. When the type is just Integer or Boolean there
      is no great difference to a client, because reflection treats this the
      same as int or boolean anyway. But when it is Integer[] or Boolean[] it
      is inconvenient and inefficient.

      The suggested change is to define new constants in the SimpleType class
      called PRIMITIVE_INT, PRIMITIVE_BOOLEAN, etc, to complement the existing
      constants INTEGER, BOOLEAN, etc.

      The serial form of these classes will set a new serializable boolean field
      "primitive" to true and will have a type name that is the corresponding
      wrapper class, e.g. java.lang.Integer for int. This will mean that interoperation with JMX API implementations that predate this change will be possible. Such implementations will ignore this field, so they will see a
      java.lang.Integer instead of an int. This will potentially cause problems
      for int[] etc (seen as Integer[]) but not for plain int.

            lmalvent Luis-Miguel Alventosa (Inactive)
            emcmanus Eamonn McManus
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: