JVMTI question about Deep Reflection #ReflectiveAccessByInstrumentationAgents
David Chestnutt
David.Chestnutt at riverbed.com
Fri Nov 11 16:15:37 UTC 2016
Our profiler product, like Byteman, needs to access private methods and fields in unexported packages.
There hasn't been much discussion recently about #ReflectiveAccessByInstrumentationAgents, although I see it as the last issue on the issue list[1].
As an example, I've found that adding this command line option works as expected to expose things in jdk.internal.loader to our Java code, so that we can use setAccessible() and the core reflection API:
--add-exports=java.base/jdk.internal.loader=ALL-UNNAMED
However, we cannot ask our customers to add this to their command line - so is there a way to effectively specify the same thing at run time from JVMTI? Also, once customers and frameworks start using Modules, we will need occasional access to unexported packages in their code - so being able to do this from JVMTI on the fly is really important to us. We do not use lava.lang.instrument as ours is a native profiling agent.
The JVMTI v9 spec [2] specified a method AddModuleExports, but it didn't seem to export to an unnamed module. Plus, AddModuleExports seems to have gone away in build 143.
Perhaps this is still in the air and being discussed. But if it's already been resolved, I'd sure appreciate a hint on how to get this working. I've been working with 9-ea+142 & 143.
Thanks,
Dave Chestnutt
------------------------
SteelCentral AppInternals
Riverbed Technology
[1] http://openjdk.java.net/projects/jigsaw/spec/issues/#ReflectiveAccessByInstrumentationAgents
[2] http://download.java.net/java/jigsaw/docs/platform/jvmti/jvmti.html
More information about the jpms-spec-comments
mailing list