Locally enabled preview features

Goldmensch pm at goldmensch.dev
Tue Jul 8 03:30:35 UTC 2025


Hi folks!
I’m wondering if the idea of “locally” enabled preview features came up yet. It would make it possible to enable certain preview features for a class, package or module by annotating it for example. Doing so would allow to use preview features much easier in production to test them, while keeping the usage “scope” small so that changes can be easily integrated without risking the integrity of the codebase. Of course some feature like virtual threads (by the time they were in preview) could not be enabled in such way due to the consequences to “non preview enabled code” but flexible constructor bodies, module import declarations, perhaps even scoped values and much more could be.

Was this idea ever considered yet and if yes, what are the points against it?

Best regards,
Nick Hensel
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.org/pipermail/amber-dev/attachments/20250708/ad7be066/attachment.htm>


More information about the amber-dev mailing list