Accessing module internals from bytecode rewriting agent

Jeremy Manson jeremymanson at
Tue Apr 25 06:40:49 UTC 2017

Thanks, Alan.  I don't use byteman, and my agent wasn't working out of the
box to redefine JDK classes...  I guess I can keep digging.


On Mon, Apr 24, 2017 at 11:35 PM, Alan Bateman <Alan.Bateman at>

> On 25/04/2017 07:22, Jeremy Manson wrote:
> :
>> The instrument API specifically supports a Boot-Class-Path attribute in
>> the
>> MANIFEST, as well as Instrumentation.appendToBootStrapClassLoaderSearch.
>> I
>> had been using that as a way to make it possible to rewrite JDK internals
>> (add allocation instrumentation to them).
> I wouldn't expect any issues with that scenario as the VM adds the
> readability needed for this to work. From the javadoc:
> "As an aid to agents that deploy supporting classes on the search path of
> the bootstrap class loader, or the search path of the class loader that
> loads the main agent class, the Java virtual machine arranges for the
> module of transformed classes to read the unnamed module of both class
> loaders."
> Instead, I think the issue in Martin's mail is more to do with Byteman
> moving to java.lang.invoke and running into an issue getting full power
> lookups to fully privileged classes.
> -Alan.

More information about the jigsaw-dev mailing list