On Mon, 30 Mar 2026 14:28:24 GMT, Axel Boldt-Christmas <[email protected]> wrote:
>> I agree if someone can confirm that the static final field >> `jdk.internal.misc.PreviewFeatures.ENABLED` is constant folded. My guess is >> that it should be because we have had a lot of JEPs restricting access to >> our internals, and there is JEP-500, however I do not know the details. >> >> The only reason this was in my original patch is because I know that >> `@stable` with an `@stable` sentinel check will be constant folded (unless >> changing the diagnostic flag `FoldStableValues`) . > >> Axel says `PreviewFeatures.isEnabled` can already reliably constant fold > > What I am trying to say is that I do not know if that is the case, but if > that was the case we should just use it directly. > > My original patch was just defensive with what I know works. >From my original PR: > Also I am not sure if it is the case that we always trust the internal final > values and do fold them, but I changed it to use `@stable` checks vs a > sentinel, which I know are trusted as final. However maybe this is > unnecessary, and some core library / compiler person has some input. ------------- PR Review Comment: https://git.openjdk.org/valhalla/pull/2249#discussion_r3010196089
