Replace unmaintained lz4-java with Apache Commons Compress LZ4
org.lz4:lz4-java (1.8.0) has been unmaintained for years and triggers JDK 17 + startup warnings:
WARNING: A restricted method in java.lang.System has been called WARNING: java.lang.System::loadLibrary has been called by net.jpountz.util.Native in an unnamed module (file:/home/X/.gradle/caches/modules-2/files-2.1/org.lz4/lz4-java/1.8.0/4b986a99445e49ea5fbf5d149c4b63f6ed6c6780/lz4-java-1.8.0.jar) WARNING: Use --enable-native-access=ALL-UNNAMED to avoid a warning for callers in this module WARNING: Restricted methods will be blocked in a future release unless native access is enabled
This native-loading path can also hurt performance.
Proposed fix
- Drop org.lz4:lz4-java.
- Add org.apache.commons:commons-compress (current release).
- Switch to its LZ4 APIs (org.apache.commons.compress.compressors.lz4.*).
Apache Commons Compress is actively maintained and JDK-compatible: https://commons.apache.org/proper/commons-compress/apidocs/org/apache/commons/compress/compressors/lz4/package-summary.html
@laurentpellegrino thank you for pointing out! What dependencies of java client do you use?
@laurentpellegrino Currently we may not easily switch the compressor as it is very tight coupled with transport code. We are using org.lz4 because it provides JNI version of the LZ4 what we would like to keep as an option.
So we will keep this change for later may be this year.
I'm not sure about the answer to https://github.com/ClickHouse/clickhouse-java/issues/2126 . But if the minimum JDK runtime for the ClickHouse JDK driver is JDK 11, why not modularize the relevant code with JPMS? Using ALL-UNNAMED for --enable-native-access makes it hard to see how this is relevant to ClickHouse JDBC Driver.
Good day, @linghengqian !
Unfortunately we have to keep JDK 8 for a while :-(
However we are discussing is it better to move codebase on min 11 or even 17.