sjsonnet icon indicating copy to clipboard operation
sjsonnet copied to clipboard

sjsonnet-0.4.14 has a Warning message about a java.lang.System::loadLibrary call

Open polarnik opened this issue 10 months ago • 0 comments

Download a version 0.4.14

  curl --output ./tools/sjsonnet.jar \
  -L https://github.com/databricks/sjsonnet/releases/download/0.4.14/sjsonnet-0.4.14.jar

and start a tool

./tools/sjsonnet.jar \
--strict --strict-import-syntax --fatal-warnings --throw-error-for-invalid-sets \
--indent 4 --no-duplicate-keys-in-comprehension \
--output-file ./dashboards/generated/workflow.json \
-J vendor \
wokflow.jsonnet

We will see warn messages:

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:/tools/sjsonnet.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

The source of the problem is:

  • https://github.com/databricks/sjsonnet/blob/0.4.14/sjsonnet/src-jvm/sjsonnet/Platform.scala#L92
  • https://github.com/lz4/lz4-java?tab=readme-ov-file#xxhash-java
  • https://github.com/lz4/lz4-java/blob/master/src/java/net/jpountz/util/Native.java#L107

What do you think is about using

  • https://lz4.github.io/lz4-java/1.8.0/docs/net/jpountz/xxhash/XXHashFactory.html#safeInstance-- ?

polarnik avatar Mar 22 '25 16:03 polarnik