This would seem to be a potential candidate for a multi-release jar, if you can figure out a reasonable way to get a build system to generate one.
The 4 uses I found of comparing byte could be refactored to call a new utility class to do the comparison. The "regular" implementation could be java 7 compatible, and the jdk 9 version would be in the META_INF folder. Even for the java 7 compatible version, it might be worth exploring how much improvement would come from using Unsafe to read int or long values from the byte and compare those. For Hash234, I would think the whole class could be handled for the MR jar.  - https://openjdk.java.net/jeps/238 Thanks, Brett On Fri, Jan 8, 2021 at 1:36 PM Lasse Collin <lasse.col...@tukaani.org> wrote: > > On 2021-01-08 Brett Okken wrote: > > Are there any plans to update xz-java to take advantage of newer > > features in jdk 9+? > > There aren't much plans at all. Adding module-info.java is likely to > happen in the next release, whenever that will be. > > Apache Commons Compress 1.20 requires Java 7. It depends on XZ for > Java. I think it wouldn't be good to make XZ for Java require a newer > Java version than Commons Compress but it could be discussed with > Commons Compress developers. There's a bug with .7z files that requires > changing both XZ for Java and Commons Compress so I could ask about the > Java version too. > > > For example, Arrays.mismatch leverages vectorized comparisons of 2 > > byte. This could be leveraged in the getMatches methods of BT4 and > > HC4 as well as the 2 getMatchLen methods in LZEncoder. > > > > Another example would be to use a VarHandle to read int values out of > > a byte, which would be useful for the calcHashes method in > > Hash234. > > Thanks! These sound interesting. If they make big enough difference, it > could be a good reason to require Java 9. > > I will need to check out the LZDecoder improvement from the other > message too, and perhaps a few variations of it. Thanks! > > There are multiple things in XZ Utils that I try to look at in the near > future so it will be a while until I will play with the Java code. > > -- > Lasse Collin | IRC: Larhzu @ IRCnet & Freenode >