Preview APIs in the Java Platform
Bill Shannon
bill.shannon at oracle.com
Thu Mar 5 21:27:28 UTC 2020
Remi Forax wrote on 3/5/20 12:18 AM:
> Hi Bill,
> I think you don't understand how preview APIs work,
> as a user, using a preview API requires --enable-preview at compile time so the generated bytecodes will be tagged with the minor version of the classfile being equals to 65 535 (in violation of semver BTW),
> so the only way to use a jar containing such classfiles is to use --enable-preview at runtime.
>
> So as a user it means once you use a preview API, you can not re-distribute your work, you can not by example upload such jar on Maven Central.
Why not? Doesn't it just mean that anyone who wants to use my preview
jar has to use --enable-preview at runtime?
> Why JakartaEE will want such restriction on their own APIs ?
For exactly the same reason the JDK wants such restriction.
Is that so hard to imagine?
> It's overly restrictive. It only makes sense for language features, not on APIs apart if they are required by a language feature.
My understanding of the proposed change was to handle API features like
language features and not isolate them in some incubator package but
instead mark them so that they're only usable at runtime if you "opt in"
to the preview-ness of the feature.
More information about the jdk-dev
mailing list