JDK-7199353 : Define ConstructorProperties annotation type for MXBeans
  • Type: Enhancement
  • Component: core-svc
  • Sub-Component: javax.management
  • Affected Version: 8
  • Priority: P2
  • Status: Resolved
  • Resolution: Fixed
  • OS: generic
  • CPU: generic
  • Submitted: 2012-09-18
  • Updated: 2017-07-20
  • Resolved: 2015-10-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 9
9 b89Fixed
Related Reports
Cloners :  
Relates :  
Relates :  
Relates :  
Description
MXBean currently supports model-specific types annotated with 
java.beans.ConstructorProperties that is tightly coupled with
the client API.  A MXBean developer will likely want to avoid
using java.beans.ConstructorProperties if it ends up in the
desktop module that their code doesn't want to pull in.  In
that case, the code has to write to achieve the same effort
by defining the from(CompositeData) method.

Suggestion from Eamonn McManus [1]:
Allow ConstructorProperties annotations from any package

[1] http://mail.openjdk.java.net/pipermail/jmx-dev/2012-September/000077.html

Comments
My proposal is: a/ to add a new annotation @javax.management.annotations.ConstructorProperties (1:1 copy of @java.beans.ConstructorProperties) b/ to modify the JMX logic to look primarily for this new annotation but still accept also @java.beans.ConstructorProperties - only printing warning when it is encountered A proper way would be extracting the beans annotations to a separate barebone (no dependencies on the desktop modules) API module (eg. java.beans.annotations) but this is most probably not going to happen. With my proposed change we will achieve decoupling JMX from the desktop while keeping the work with composite data comfortable.
18-09-2015

I've removed the "ana" label from this issue as what we have in jigsaw/jake is sufficient for the initial push of the module system to JDK 9 (esp. with the changes for JDK-8080663 going into JDK 9 now).
26-05-2015

Here's an example test failure using an early/prototype modules build: java.lang.InternalError: java.lang.IllegalAccessException: Class com.sun.jmx.mbeanserver.DefaultMXBeanMappingFactory$CompositeBuilderViaConstructor$AnnotationHelper (module java.management) can not access a member of class java.beans.ConstructorProperties (module java.desktop) with modifiers "public abstract" at com.sun.jmx.mbeanserver.DefaultMXBeanMappingFactory$CompositeBuilderViaConstructor$AnnotationHelper.getPropertyNames(DefaultMXBeanMappingFactory.java:1177) at com.sun.jmx.mbeanserver.DefaultMXBeanMappingFactory$CompositeBuilderViaConstructor.applicable(DefaultMXBeanMappingFactory.java:1197) at com.sun.jmx.mbeanserver.DefaultMXBeanMappingFactory$CompositeMapping.makeCompositeBuilder(DefaultMXBeanMappingFactory.java:882) at com.sun.jmx.mbeanserver.DefaultMXBeanMappingFactory$CompositeMapping.checkReconstructible(DefaultMXBeanMappingFactory.java:912) at com.sun.jmx.mbeanserver.ConvertingMethod.checkCallFromOpen(ConvertingMethod.java:92) at com.sun.jmx.mbeanserver.MXBeanIntrospector.checkMethod(MXBeanIntrospector.java:109) at com.sun.jmx.mbeanserver.MXBeanIntrospector.checkMethod(MXBeanIntrospector.java:54) at com.sun.jmx.mbeanserver.PerInterface$InitMaps.visitAttribute(PerInterface.java:244) at com.sun.jmx.mbeanserver.MBeanAnalyzer.visit(MBeanAnalyzer.java:68) at com.sun.jmx.mbeanserver.PerInterface.<init>(PerInterface.java:54) at com.sun.jmx.mbeanserver.MBeanIntrospector.getPerInterface(MBeanIntrospector.java:195) at com.sun.jmx.mbeanserver.MBeanSupport.<init>(MBeanSupport.java:138) at com.sun.jmx.mbeanserver.MXBeanSupport.<init>(MXBeanSupport.java:66) at com.sun.jmx.mbeanserver.Introspector.makeDynamicMBean(Introspector.java:202) at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.registerObject(DefaultMBeanServerInterceptor.java:898) at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.registerMBean(DefaultMBeanServerInterceptor.java:324) at com.sun.jmx.mbeanserver.JmxMBeanServer.registerMBean(JmxMBeanServer.java:522)
12-04-2014

This issue is important to examine in JDK 9 due to the reflective dependency on java.beans.ConstructorProperties com.sun.jmx.mbeanserver.DefaultMXBeanMappingFactory ->java.beans.ConstructorProperties
21-03-2014