RFR: 8353835: Implement JEP 500: Prepare to Make Final Mean Final [v7]
Alan Bateman
alanb at openjdk.org
Tue Oct 7 15:17:52 UTC 2025
On Tue, 7 Oct 2025 15:04:47 GMT, Chen Liang <liach at openjdk.org> wrote:
>> 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.
Right, and capturing fa/obj/b vs. this/obj/b is also not a concern because this is the slow case for final fields.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/25115#discussion_r2410998983
More information about the hotspot-dev
mailing list