Hi,
I cannot confirm this. Apache Lucene (just released today in version
10.0.0, but also previous veersion 9.12.0) can open indexes just fine,
both with preview enabled or not. I modified the start script of the
"Luke" GUI to use classpath mode and add the "--enable-preview" flag.
All variants work (SPI from declared module-info.class SPIs or using
META-INF/services).
If ServiceLoader won't work, Lucene would fails to open any indexes.
To test, just download Apache Lucene, put JDK 23 as first entry on your
$PATH and start bin/luke.sh. To test other variants change the script
file by changing to use classpath mode (by invoking
"org.apache.lucene.luke.app.desktop.LukeMain" class directly and change
module-path to classpath with "/*").
Uwe
Am 13.10.2024 um 13:53 schrieb Robert Scholte:
Hi,
It seems there’s a change in the ServiceLoader, and it looks like
regression to me.
I’ve created a small project to reproduce it (I can provide it if
wanted and confirmed this is indeed a bug).
What it basically does is just:
ServiceLoader.load(Car.class).findFirst().orElseThrow();
This succeeds with OpenJDK 22 (with and without preview enabled flag)
It also succeeds with OpenJDK 23 without the preview flag.
However, when adding the preview flag I get:
java.util.NoSuchElementException: No value present
at java.base/java.util.Optional.orElseThrow(Optional.java:377)
at
nl.sourcegrounds.serviceloader.tck.CarTest.<init>(CarTest.java:16)
Anyone who can already explain this with this small amount of information?
Thanks,
Robert Scholte
These are the details for both versions (Windows OS)
openjdk version "22" 2024-03-19
OpenJDK Runtime Environment (build 22+36-2370)
OpenJDK 64-Bit Server VM (build 22+36-2370, mixed mode, sharing)
openjdk version "23" 2024-09-17
OpenJDK Runtime Environment (build 23+37-2369)
OpenJDK 64-Bit Server VM (build 23+37-2369, mixed mode, sharing)
--
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/