Locally enabled preview features
Remi Forax
forax at univ-mlv.fr
Tue Jul 8 09:05:55 UTC 2025
> From: "Goldmensch" <pm at goldmensch.dev>
> To: "amber-dev" <amber-dev at openjdk.org>
> Sent: Tuesday, July 8, 2025 5:30:35 AM
> Subject: Locally enabled preview features
> 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?
It was considered and rejected.
The preview mechanism has to be rough / raw, so it conveys the fact that there is no guarantee of backward compatibility from a release to the next one.
Also, the implementation of a feature may change from one version to the next, a feature can be implemented as only a javac change in one version and as a bytecode change in the next version, so the notion of "scope" of a feature does not really exist.
> Best regards,
> Nick Hensel
regards,
Rémi
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.org/pipermail/amber-dev/attachments/20250708/edd4b160/attachment.htm>
More information about the amber-dev
mailing list