RFR: 6246: Making the agent stop using Unsafe
Marcus Hirt
hirt at openjdk.java.net
Fri Jan 17 20:03:56 UTC 2020
On Fri, 17 Jan 2020 19:34:16 GMT, Kangcheng Xu <kxu at openjdk.org> wrote:
> This patch addresses [JMC-6246](https://bugs.openjdk.java.net/browse/JMC-6246).
>
> The usage of `Unsafe.defineClass()` is replaced with:
> - for pre-Java 9, reflective access on `ClassLoader.getSystemClassLoader().defineClass()`
> - for Java 9 and later, `MethodHandles.Lookup.defineClass()`
>
> Please note that `LookUp.defineClass()` can only define classes within the same package of the lookup. Therefore generated events classes will be in the dedicated package `org.openjdk.jmc.agent.generated_events`, instead of being in the same package of the instrumented class.
Doesn't this affect in which class loader the event classes are defined, and especially their unload behaviour?
-------------
PR: https://git.openjdk.java.net/jmc/pull/35
More information about the jmc-dev
mailing list