JVMTI GetModuleByPackageName -- plans for Instrumentation API equivalent?
Michael Rasmussen
michael.rasmussen at zeroturnaround.com
Wed Jun 22 10:16:33 UTC 2016
Hi
With the addition of GetModuleByPackageName added to JVMTI ([1], [2]),
are there any plans to add similar functionality to the
Instrumentation API (or somewhere else)?
>From ClassFileTransformer we now get the Module for the class that is
currently being transformed, but a very common scenario when
transforming a class that is being loaded, is the need to get
information about other classes used by that class; classes which
might not have been loaded yet, meaning we need to get the bytes
somehow.
A common approach to this pre-jigsaw, was simply to translate the
classname to a filename and ClassLoader::getResourceAsStream; but with
named modules, this is no longer the case, we now have to know which
Module that class is in in order to get the bytes
(#ClassFilesAsResources, #ResourceEncapsulation etc).
Adding a GetModuleByPackageName equivalent method would go some way to
help with this issue.
Regards
Michael Rasmussen
ZeroTurnaround
[1] https://bugs.openjdk.java.net/browse/JDK-8159145
[2] http://mail.openjdk.java.net/pipermail/hotspot-dev/2016-June/023480.html
More information about the jigsaw-dev
mailing list