JEP 442: Foreign Function & Memory API => why is it again preview API?

Uwe Schindler uschindler at apache.org
Tue May 16 15:38:32 UTC 2023


Hi,

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.

Is it really needed to have a next round of preview API? Why not have 
Java 21 with Foreign API finalized in the same way like virtual threads? 
To me it is strange that an API like virtual threads was thrown to 
end-users (it caused problems at many places including slowdowns we have 
seen when preview was enabled in Java 19 and 20) in very short time (I 
never noticed a incubation period). In contrast the foreign memory API 
is very stable already since Java 19 and the changes were minimal in 21. 
It exists now since Java 14, where it first appeared as incubation. I 
know theres still work on the foreign linker, but why aren't the stable 
classes like MemorySegment, ValueLayout not public now?

This is really annoying to us. We were really planning to switch 
Lucene's main development to Java 21 LTS and ship it with modern memory 
mapping to our downstream projects.

Please do something and remove the @PreviewFeature from FileChannel#map 
and java.lang.foreign! Please, please, please!

Uwe

P.S.: Vector API is still in incubation, when will it go to preview?

-- 
Uwe Schindler
uschindler at 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/



More information about the core-libs-dev mailing list