On Fri, 26 Jan 2024 09:12:53 GMT, Alan Bateman <al...@openjdk.org> wrote:

> The target class is transformed in such a way to call the auxiliary class, 
> which necessitates the the aux-class to be in the same classloader as the 
> target class. But because the aux-class is defined while the target class is 
> still being transformed during class-loading, we cannot have any look-up 
> instance pointinmg to it yet.

It seems like you could lazily define the aux class when the target class first 
needs it, instead of eagerly while the target class is being defined. e.g. 
generate the class bytes for the aux class up front, and embed them in the 
target class (For instance as a Base64 encoded string, which fits well into the 
constant pool). Then, have the transformed code in the target class define the 
the aux class when it is first needed, at which point you do have access to a 
lookup.

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

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

Reply via email to