Preview APIs in the Java Platform

Alex Buckley alex.buckley at oracle.com
Thu Mar 5 21:12:04 UTC 2020


On 3/5/2020 12:54 PM, Remi Forax wrote:
>>> yes, but there is a difference between the VM refusing to read the
>>> bytecode and the VM throwing a NoSuchMethodError because the API has
>>> changed.
>>
>> Yes. Literally, you are correct. Conceptually, this means that neither a
>> program which uses an incubating API of JDK N, nor a program which uses
>> a preview API of JDK N, can expect to run successfully on JDK N+1.
> 
> No, because with an incubating module, there is a subset of the API that works for JDK N and JDK N+1.

There is no such promise stated or implied in JEP 11. Incubating APIs 
are the experimental, anything-can-change artifact that you're always 
assuming preview features are. If Panama stayed with incubation, then 
jdk.incubator.foreign in JDK 15 could be completely different than in 
JDK 14. Programs that program against jdk.incubator.foreign on 14 have 
no guarantee of running on 15, end of story.

Alex


More information about the jdk-dev mailing list