On Wed, 2 Apr 2025 11:37:56 GMT, Maurizio Cimadamore <mcimadam...@openjdk.org> wrote:
>> I've used `static` fields now to get out of the muddy waters of trusted >> final fields, records etc. > > I didn't mean to say "this is not true, so use a `static final` instead". > What I meant was more "let's not dive into VM-specific details now" (see my > other comment on the topic), and just focus on semantics instead. Then let's > put all the constant-folding related stuff somewhere else. I liked using > non-static final fields! Basically: drop all references to "performance" and "constant folding" everywhere. And then introduce a section dedicated to that topic which talks a bit about how the content of a SV is trusted not to change by the JVM, which enables constant-folding optimizations. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/23972#discussion_r2024654143