Summary
-------
This RFE proposes to update the MXBean specification to define a mapping for records
Problem
-------
[JEP 395: Records][1] defines *Record classes*, a new kind of class in the Java language, which help model plain data aggregates. The [Open MBean specification][2] defines the notion of `CompositeType` and `CompositeData` to model generic data aggregates. The [CompositeData][3] interface specifies the behavior of a specific type of complex open data objects which represent composite data structures. The MXBean framework defines rules to map plain java aggregates to `CompositeData` (and `CompositeType`). Record classes also represent composite data structures (aggregates), but are not currently supported out-of-the-box by the `MXBean` framework.
The `MXBean` framework currently relies on the presence of *getter methods* and *annotated constructors* to map `CompositeData` instances to plain java aggregates. The specification and implementation of MXBeans could be extended to define a mapping to record classes. The record component accessors can be used as getters, and a record can be easily reconstructed from a CompositeData through the record canonical constructor. A clear advantage of records over plain java objects is that the canonical constructor will not need to be annotated in order to map composite data property names to constructor parameter names.
Solution
--------
Update the MXBean specification and implementation to recognize record classes, and use the information provided by the record components to implement the mapping to `CompositeData`.
Specification
-------------
The `@javax.management.MXBean` class level API documentation is updated to define a mapping to records.
See the sdiff and the generated API documentation in the attached zip file (the full webrev is also included)
[1]: https://openjdk.java.net/jeps/395
[2]: https://docs.oracle.com/en/java/javase/16/docs/api/java.management/javax/management/openmbean/package-summary.html
[3]: https://docs.oracle.com/en/java/javase/16/docs/api/java.management/javax/management/openmbean/CompositeData.html