On Mon, 30 Mar 2026 14:26:58 GMT, Axel Boldt-Christmas <[email protected]> 
wrote:

>> I don't see how that comment relates to my suggestion. Axel says 
>> `PreviewFeatures.isEnabled` can already reliably constant fold, so there is 
>> no cost restoring the old calls.
>
> 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.

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

PR Review Comment: 
https://git.openjdk.org/valhalla/pull/2249#discussion_r3010189310

Reply via email to