Locally enabled preview features
David Alayachew
davidalayachew at gmail.com
Tue Jul 8 11:47:51 UTC 2025
To add onto that, having the option as a commandline makes it 100%
unavoidable for the person running the code to know that they are running
preview code. That's the entire point of making it a CLI option vs an
annotation -- so that the person running the code can be made aware of the
risk.
On Tue, Jul 8, 2025, 5:06 AM Remi Forax <forax at univ-mlv.fr> wrote:
>
>
> ------------------------------
>
> *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/6cb17146/attachment-0001.htm>
More information about the amber-dev
mailing list