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.

`useLegacyProxyImpl && !useOldSerializableConstructor` would always be `false` 
when `useOldSerializableConstructor` is `true`, which is the opposite of what’s 
described in the CSR.

src/java.base/share/classes/jdk/internal/reflect/ReflectionFactory.java line 
557:

> 555:     public static boolean useLegacyProxyImpl() {
> 556:         var config = config();
> 557:         return config.useLegacyProxyImpl && 
> !config.useOldSerializableConstructor;

Suggestion:

        return config.useLegacyProxyImpl || 
config.useOldSerializableConstructor;

src/java.base/share/classes/jdk/internal/reflect/ReflectionFactory.java line 
624:

> 622:             
> "true".equals(props.getProperty("jdk.disableSerialConstructorChecks"));
> 623: 
> 624:         useLegacyProxyImpl &= !useOldSerializableConstructor;

Suggestion:

        useLegacyProxyImpl |= useOldSerializableConstructor;

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

PR Review: https://git.openjdk.org/jdk/pull/19356#pullrequestreview-2079825251
PR Review Comment: https://git.openjdk.org/jdk/pull/19356#discussion_r1615362157
PR Review Comment: https://git.openjdk.org/jdk/pull/19356#discussion_r1615362271

Reply via email to