On Thu, 27 Nov 2025 19:08:40 GMT, Chen Liang <[email protected]> wrote:

>> src/hotspot/share/ci/ciField.cpp line 220:
>> 
>>> 218:     return false;
>>> 219:   // Explicit opt-in from system classes
>>> 220:   if (holder->trust_final_fields())
>> 
>> This is definitely nicer than listing specific classes. It would be nicer 
>> again once we can make this exceptions go away.
>
> True, this occupies one of the 16 precious instance klass bits in runtime. I 
> wish we can derive this from our final means final restrictions, but their 
> setup is to permit use-sites to migrate more easily, and is harder for 
> declaration sites to deduce if a declaration is easier to be permitted. We 
> can consider blanket-trust when the JVM uses 
> `--illegal-final-field-mutation=deny` without additional 
> `--enable-final-field-mutation`.

This would be the equivalent of running with -XX:+TrustFinalNonStaticFields, 
which would be nice, but there would be performance surprises as soon as you 
enable final field mutation for any module (and likely ALL-UNNAMED).

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

PR Review Comment: https://git.openjdk.org/jdk/pull/28540#discussion_r2571272623

Reply via email to