RFR: 8353835: Implement JEP 500: Prepare to Make Final Mean Final [v7]

Chen Liang liach at openjdk.org
Tue Oct 7 15:07:40 UTC 2025


On Tue, 7 Oct 2025 13:59:43 GMT, Shaojin Wen <swen at openjdk.org> wrote:

>> Alan Bateman has updated the pull request with a new target base due to a merge or a rebase. The pull request now contains 34 commits:
>> 
>>  - Merge branch 'master' into JDK-8353835
>>  - Add test for -Xlog:jni=debug
>>  - Merge branch 'master' into JDK-8353835
>>  - Merge branch 'master' into JDK-8353835
>>  - Improve CommandLineTest.testWarn
>>  - More test cleanup
>>  - Merge branch 'master' into JDK-8353835
>>  - Expand jni/JNIAttachMutatorTest to final fields in named modules
>>  - Merge branch 'master' into JDK-8353835
>>  - Test updates based on reviewer feedback
>>  - ... and 24 more: https://git.openjdk.org/jdk/compare/72319167...eed7ec4a
>
> src/java.base/share/classes/java/lang/reflect/Field.java line 982:
> 
>> 980:         } else {
>> 981:             setFinal(Reflection.getCallerClass(), obj, () -> fa.setByte(obj, b));
>> 982:         }
> 
> Suggestion:
> 
>         if (!Modifier.isFinal(modifiers)) {
>             fa.setByte(obj, b);
>         } else {
>             setFinal(Reflection.getCallerClass(), obj, () -> getOverrideFieldAccessor().setByte(obj, b));
>         }

We still need to capture `b` here so this doesn't really improve anything. Same for others.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/25115#discussion_r2410965404


More information about the hotspot-dev mailing list