Hi,
If I compile lucene with a java 9 compiler (using -source 1.8 -target
1.8 like our build does), then the resulting jar file cannot actually
be used with a java 8 JVM.
The reason is, in java 9 ByteBuffer.class got some new covariant overrides:
e.g. ByteBuffer.java has position(int) that returns ByteBuffer, but
this does not exist on java 8 (the position method is only in
Buffer.java returning Buffer).
This leads to an exception like this (I am sure there are other
problems, its just the first one you will hit):
Exception in thread "main" java.lang.NoSuchMethodError:
java.nio.ByteBuffer.position(I)Ljava/nio/ByteBuffer;
at
org.apache.lucene.store.ByteBufferIndexInput$SingleBufferImpl.<init>(ByteBufferIndexInput.java:414)
at
org.apache.lucene.store.ByteBufferIndexInput.newInstance(ByteBufferIndexInput.java:55)
at org.apache.lucene.store.MMapDirectory.openInput(MMapDirectory.java:216)
at org.apache.lucene.store.Directory.openChecksumInput(Directory.java:110)
at org.apache.lucene.index.SegmentInfos.readCommit(SegmentInfos.java:268)
at org.apache.lucene.index.SegmentInfos$1.doBody(SegmentInfos.java:359)
at org.apache.lucene.index.SegmentInfos$1.doBody(SegmentInfos.java:356)
at
org.apache.lucene.index.SegmentInfos$FindSegmentsFile.run(SegmentInfos.java:574)
at
org.apache.lucene.index.SegmentInfos$FindSegmentsFile.run(SegmentInfos.java:526)
at
org.apache.lucene.index.SegmentInfos.readLatestCommit(SegmentInfos.java:361)
at
org.apache.lucene.index.DirectoryReader.listCommits(DirectoryReader.java:228)
Is this expected behavior? Do we need to fix our build to also require
a java 8 JDK on the developers machine, and set bootclasspath, or is
-source/-target 1.8 supposed to "just work" without it like it did
before?
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]