JDK-8038343 : Eliminate use of reflection to access JavaBeans Introspector
  • Type: Bug
  • Component: core-svc
  • Sub-Component: java.lang.management
  • Affected Version: 9
  • Priority: P3
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2014-03-25
  • Updated: 2014-10-01
  • Resolved: 2014-03-26
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 b08Fixed
Related Reports
Relates :  
Relates :  
Description
In JDK-6888171 we changed the introspector in the JMX monitor API implementation to access the JavaBeans Introspector via core reflection. This was good enough for our modularity efforts at the time and also good enough for the Compact Profiles effort in JDK 8.

It is time to re-visit this code with a view to it working with modules and without needing to resort to setAccessible(true). Here is an example of how this code fails with an early build of modules:

java.lang.IllegalAccessException: Class com.sun.jmx.mbeanserver.Introspector$BeansHelper (module java.management) can not access a member of class java.beans.Introspector (module java.desktop) with modifiers "public static"
	at sun.reflect.Reflection.ensureMemberAccess(Reflection.java:142)
	at java.lang.reflect.AccessibleObject.slowCheckMemberAccess(AccessibleObject.java:295)
	at java.lang.reflect.AccessibleObject.checkAccess(AccessibleObject.java:287)
	at java.lang.reflect.Method.invoke(Method.java:477)
	at com.sun.jmx.mbeanserver.Introspector$BeansHelper.getBeanInfo(Introspector.java:757)
	at com.sun.jmx.mbeanserver.Introspector.elementFromComplex(Introspector.java:554)
	at javax.management.monitor.Monitor.getComparableFromAttribute(Monitor.java:872)
	at javax.management.monitor.Monitor.monitor(Monitor.java:1286)
	at javax.management.monitor.Monitor.access$600(Monitor.java:75)
	at javax.management.monitor.Monitor$MonitorTask$1.run(Monitor.java:1579)
	at javax.management.monitor.Monitor$MonitorTask$1.run(Monitor.java:1572)
	at java.security.AccessController.doPrivileged(Native Method)
	at javax.management.monitor.Monitor$MonitorTask.run(Monitor.java:1589)
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
	at java.lang.Thread.run(Thread.java:744)