On Fri, 16 Apr 2021 20:30:15 GMT, Rafael Winterhalter 
<winterhal...@openjdk.org> wrote:

>> To allow agents the definition of auxiliary classes, an API is needed to 
>> allow this. Currently, this is often achieved by using `sun.misc.Unsafe` or 
>> `jdk.internal.misc.Unsafe` ever since the `defineClass` method was removed 
>> from `sun.misc.Unsafe`.
>
> Rafael Winterhalter has refreshed the contents of this pull request, and 
> previous commits have been removed. Incremental views are not available. The 
> pull request now contains one commit:
> 
>   8200559: Java agents doing instrumentation need a means to define auxiliary 
> classes

Requiring such an API opens the module to anybody, though, punching a hole into 
the module boundary.

BB currently opens the jdk.internal.misc.Unsafe class to a module on a seperate 
class loader that is not reachable outside an agent, using Instrumentation. 
This also caters the need to inject utility classes from an agent before any 
class file transformer is triggered, to maintain a well-defined life-cycle.

Of course I'd prefer if there was a way to resolve a lookup from 
Instrumentation for a given class loader and for example a package-info class, 
however rendering the issue that packages might not exist (yet).

-------------

PR Comment: https://git.openjdk.org/jdk/pull/3546#issuecomment-1910087337

Reply via email to