----- Original Message ----- > From: "Uwe Schindler" <uschind...@apache.org> > To: "Remi Forax" <fo...@univ-mlv.fr> > Cc: "core-libs-dev" <core-libs-dev@openjdk.org> > Sent: Wednesday, May 17, 2023 9:13:35 AM > Subject: Re: JEP 442: Foreign Function & Memory API => why is it again > preview API?
> Hi Remi, > > thanks for the reponse! > >>> yesterday Apache Lucene got the information that JDK 21 got the project >>> panama JEP 442 update and I implemented it already in our source tree. >>> >>> Unfortunately the API is again marked "preview", but JDK 21 is "LTS >>> release". Many of our users (Elasticserach, Solr) will be switching to >>> this version. We were really hoping that the java.lang.foreign API is >>> finished at that time. I checked the changes in our code: just a rename >>> of a method and FileChannel#map now takes Arena instead of Scope. >> I see that Alan and Maurizio have already answer to your other points. >> >> Having preview features and being a LTS are to separate concerns. >> Being a LTS is about support, having preview features is about having >> feedback >> before finalizing an API. >> >> Java 17 was released with preview features, Java 21 will be. > > Yes that's the case. But Java 17 did not have any "runtime visible" > preview features, only compiler had preview features. For public > libraries out there (open source on Maven central like Lucene), people > don't care how they are produced by a compiler. So enhanced switch > statements or similar stuff is a bit different than the current problem > where the preview features are visible at runtime. Not true, most of the language changes in preview also have a corresponding runtime visible API marked as preview API. In case of jdk17, the SwitchBootstraps API is marked as preview API https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/lang/runtime/SwitchBootstraps.html > > Some related note: I don't understand why classes compiled with preview > SYNTAX features of the Java compiler need to be marked with the preview > bit; IMHO compiler outputs should only be marked as preview if they use > preview APIs. There should be no risk in running the compiler output of > preview switch or instanceof statements without preview features enabled. Because a syntax feature usually also requires a support API, either at runtime or at compile time :) Records has java.lang.Record, Text blocks has String.stripIndent, etc > > Uwe Rémi > > -- > Uwe Schindler > uschind...@apache.org > ASF Member, Member of PMC and Committer of Apache Lucene and Apache Solr > Bremen, Germany > https://lucene.apache.org/ > https://solr.apache.org/