Great news: Lucene 9.4 (optionally) uses mapped MemorySegments when JDK 19 is detected
Alan Bateman
Alan.Bateman at oracle.com
Sun Oct 2 15:04:56 UTC 2022
On 02/10/2022 11:37, Uwe Schindler wrote:
> At moment there's nothing that ensures the resources are loaded from
> same folder or are consistent with the classes at runtime. So in my
> opinion, I would have reduced the whole MR-JAR classloading to "go
> through the feature version folders backwards starting from current
> Java version and pick the first class found that is no preview or "has
> correct major version and is marked as preview".
Class files are located in MR-JARs as resources, e.g. loading p.C will
attempt to the resource "p/C.class". You can't have a class loader
loading the class file bytes from one section and the equivalent
resource lookup locating the class file resource in another section. I
don't think it feasible to do what you want without updating the MR JAR
support, e.g. META/versions/19.preview.
> :
>
> Thanks for this feedback. We see it exactly as you described it.
> Lucene is a library and developers out there should be able to test
> new JDK preview features with it. After reading the Preview Spec I was
> able to implement this (the notes at end of the preview spec about
> reflection were very useful to get it running).
>
> For Lucene, a downstream developer does not need to compile his own
> classes with --enable-preview (never gets in touch with JDK classes
> marked as preview), but a downstream developer or a user of
> Elasticsearch and/or Solr can test our new implementation. This allows
> users and developers to test the new implementation. To me this is
> already a success of preview APIs. With the previous incubation this
> was not "easy doable".
It's good you got it working, a blog post as you mentioned could be
useful read for others that want to do the same.
-Alan.
More information about the panama-dev
mailing list