On 3/25/2014 12:04 PM, Alan Bateman wrote:
Currently the introspection code in the JMX monitor API uses core
reflection to access the JavaBeans Introspector. This came about when
we had to eliminate this dependency - for example in the subset
Profiles of Java SE then compact3 defines the JMX API but doesn't have
java.beans.
I'd like to clean this up further and replace the reflection hack with
a solution that uses the SharedSecrets mechanism. The reason is to
avoid needing to suppress the access check when we move to modules in
the future. The webrev with the proposed changes is here:
http://cr.openjdk.java.net/~alanb/8038343/webrev/
The changes are very simple and the only non-obvious thing is that the
JMX introspector needs to ensure that the beans Introspector is
initialized so this is the reason for the Class.forName. I've tried a
number of other approaches to this but this one seems to simplest.
This looks good. Using the SharedSecrets mechanism is a better
solution. I generally prefer to use the 3-arg Class.forName to
explicitly pass the class loader but it's really minor.
Mandy