On Thu, 23 May 2024 03:28:30 GMT, Chen Liang <li...@openjdk.org> wrote:

> Please review this change that convert dynamic proxies implementations to 
> hidden classes, intended to target JDK 24.
> 
> Summary:
> 1. Adds new implementation while preserving the old implementation behind 
> `-Djdk.reflect.useLegacyProxyImpl=true` in case there are compatibility 
> issues.
> 2. ClassLoader.defineClass0 takes a ClassLoader instance but discards it in 
> native code; I updated native code to reuse that ClassLoader for Proxy 
> support.
> 3. ProxyGenerator changes mainly involve using Class data to pass Method list 
> (accessed in a single condy) and removal of obsolete setup code generation.
> 
> Testing: tier1 and tier2 have no related failures.
> 
> Comment: Since #8278, Proxy has been converted to ClassFile API, and 
> infrastructure has changed; now, the migration to hidden classes is much 
> cleaner and has less impact, such as preserving ProtectionDomain and dynamic 
> module without "anchor classes", and avoiding java.lang.invoke package.

Hmm, actually, looking at the specs of the method again, does it imply that 
Proxy classes are never unloaded once defined in a ClassLoader, as seen in 
`Proxy::getProxyClass`:

> If a proxy class for the same permutation of interfaces has already been 
> defined by the class loader, then the existing proxy class will be returned

If that's the case, Remi's suggestion on passing classdata to a non-hidden 
class might be better, and it seems to accomplish that in hotspot isn't too 
hard too.

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

PR Comment: https://git.openjdk.org/jdk/pull/19356#issuecomment-2128186405

Reply via email to