Skip to content

docs: fix Java and Scala library invocation examples - #1122

Open
dajiaohuang wants to merge 1 commit into
databricks:masterfrom
dajiaohuang:repostew/readme-jvm-api-20261016
Open

dajiaohuang wants to merge 1 commit into
databricks:masterfrom
dajiaohuang:repostew/readme-jvm-api-20261016

Conversation

@dajiaohuang

@dajiaohuang dajiaohuang commented Oct 16, 2026 •

Copy link
Copy Markdown

Summary

The Java and Scala examples under Usage as a library cannot compile against the current JVM API: main0 is on SjsonnetMainBase, not SjsonnetMain. The Java example also omits constructor parentheses and the explicit importer/stdlib arguments required by the overload.

Use the existing SjsonnetMainBase.main0 API in both examples, construct the parse cache correctly, and supply the Java options and default stdlib explicitly. Separate the two language code fences.

Validation

  • Built JVM assemblies for Scala 3.3.8, 2.13.18 and 2.12.21 with Mill 1.1.6 on isolated WSL/JDK 21.
  • Original Scala snippet fails compilation (main0 is not a member); original Java snippet fails compilation at the parse-cache constructor. Corrected snippets compile and evaluate a small local foo.jsonnet successfully against all three builds.
  • For compilation, repacked the executable assemblies into plain classpath JARs (the shell-prefixed executable archive is rejected by javac); the CLI checks use the original executable JARs.
  • Bounded CLI smoke checks passed for objects, arrays, functions, local imports, selected stdlib calls, extvars/TLAs, string/JSON/YAML output and multi-file output. A direct Interpreter API fixture also passed for each Scala build.
  • git diff --check passed.
  • __.checkFormat reports existing misformatted Scala sources (57 in the reported wasm module and 11 in bench); this change touches only README examples. No source formatting changes made.
  • Full conformance/platform test matrix and performance benchmarks not run for this documentation-only change.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant