On Tue, 21 Jul 2026 16:05:11 GMT, Jaikiran Pai <[email protected]> wrote:

> Can I please get a review of this change which proposes to address the issue 
> noted in https://bugs.openjdk.org/browse/JDK-8388553?
> 
> `java.lang.reflect.ProxyGenerator`, a JDK internal class that relates to 
> `java.lang.reflect.Proxy` API, has an (undocumented internal) system property 
> which can be set to `true` to write out the bytes of the `Proxy` class 
> generated dynamically by this code. Before Java 24, when SecurityManager was 
> around, this code of writing out to a file, was wrapped in a 
> `PrivilegedAction`.  When we updated this code during the removal of 
> SecurityManager in https://bugs.openjdk.org/browse/JDK-8344011, we 
> accidentally returned `null` from the `if` block after writing out the class 
> bytes. This effectively results in the 
> `ProxyGenerator.generateProxyClass(...)` method returning null for any 
> `Proxy` class it generates when that internal system property is set to true.
> 
> The commit in this PR fixes that oversight. The pre-existing 
> `test/jdk/java/lang/reflect/Proxy/Basic1.java` jtreg test has been updated to 
> have a `@run` with this system property value set to `true`. The test fails 
> (as expected) without the proposed source fix and passes (as expected) with 
> it.
> 
> tier testing is currently in progress but I don't expect any surprises there. 
> Tomorrow I will go through the original commit of JDK-8344011 just to check 
> if there are any other places that might need attention.
> 
> ---------
> - [x] I confirm that I make this contribution in accordance with the [OpenJDK 
> Interim AI Policy](https://openjdk.org/legal/ai).

This pull request has now been integrated.

Changeset: 0866799c
Author:    Jaikiran Pai <[email protected]>
URL:       
https://git.openjdk.org/jdk/commit/0866799ca8f9540de5b2eee2720960160995a10f
Stats:     13 lines in 2 files changed: 3 ins; 6 del; 4 mod

8388553: Proxy class generation fails when the 
jdk.proxy.ProxyGenerator.saveGeneratedFiles is set to true

Reviewed-by: liach, alanb

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

PR: https://git.openjdk.org/jdk/pull/31993

Reply via email to