RFR: 8333854: IllegalAccessError with proxies after JDK-8332457 [v4]

Claes Redestad redestad at openjdk.org
Thu Jun 13 08:36:13 UTC 2024


On Wed, 12 Jun 2024 22:00:45 GMT, Chen Liang <liach at openjdk.org> wrote:

>> Please review this patch that fixes a critical issue that breaks some Proxy usages.
>> 
>> Since the problematic patch from before cannot be backed out, this patch aims to emulate the old behavior before. A diff between before the problematic patch and this patch is available at https://gist.github.com/7565b2091008f561eb0ada019bc5e517, generated by running `git diff 326dbb1b139dd1ec1b8605339b91697cdf49da9a -- src/java.base/share/classes/java/lang/reflect/ProxyGenerator.java`.
>
> Chen Liang has updated the pull request incrementally with one additional commit since the last revision:
> 
>   More rename and code style cleanup

I think this looks better as you're reverting the problematic changes while retaining most of the benefits of JDK-8332457.

src/java.base/share/classes/java/lang/reflect/ProxyGenerator.java line 676:

> 674:          * @param method          The method for which to create a proxy
> 675:          */
> 676:         private ProxyMethod(Method method, String methodFieldName) {

Could we pass the `FieldRefEntry` directly? I don't see when we'd create a `ProxyMethod` without later calling `methodField()`. I think this would also remove the need to make `ProxyMethod` non-static.

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

Marked as reviewed by redestad (Reviewer).

PR Review: https://git.openjdk.org/jdk/pull/19615#pullrequestreview-2115128124
PR Review Comment: https://git.openjdk.org/jdk/pull/19615#discussion_r1637805452


More information about the core-libs-dev mailing list