Skip to content

fix: eliminate Thread.stop() deprecation warning and enforce -Werror on server/client#1003

Open
He-Pin wants to merge 1 commit into
databricks:masterfrom
He-Pin:fix/all-compilation-warnings
Open

fix: eliminate Thread.stop() deprecation warning and enforce -Werror on server/client#1003
He-Pin wants to merge 1 commit into
databricks:masterfrom
He-Pin:fix/all-compilation-warnings

Conversation

@He-Pin

@He-Pin He-Pin commented Jun 19, 2026

Copy link
Copy Markdown
Contributor

Motivation

Thread.stop() has been deprecated since Java 1.2 (unsafe) and was
finally removed in JDK 21+. sjsonnet was also not enforcing -Werror
uniformly across the server (Scala) and client (Java) modules, allowing
warnings to accumulate silently.

Modification

  • Replace Thread.stop() calls with safe alternatives:
    System.exit(0), Thread.interrupt(), and socket close(),
    depending on the exit path in SjsonnetServerMain.scala.
  • Enable -Werror (scalac) on the server modules and -Werror
    (javac) on the client module via build.sc / build.mill config.
  • Fix residual warnings (unused imports, sun.misc usage).

Result

Clean compilation across Scala 3.3.7, 2.13.18, 2.12.21 with zero
warnings. All 5 CI build targets (JVM / JS / Wasm / Native / Graal
Native) green.

References

  • JDK 21 release notes: Thread.stop() removal
  • Scala -Werror flag documentation

@He-Pin He-Pin force-pushed the fix/all-compilation-warnings branch from 0895127 to 05912f5 Compare June 19, 2026 20:07
…ient

Motivation:
The server module had a deprecation warning from Thread.stop() across all
Scala versions (3.3.7, 2.13.18, 2.12.21). The server and client modules
also lacked -Werror/-deprecation flags, allowing future warnings to slip
through undetected.

Modification:
- Remove Thread.stop() call entirely. It was redundant because:
  - When client disconnects: interruptServer() calls System.exit(0),
    terminating the JVM and all threads
  - When thread completes normally: interrupt() on a finished thread
    is a no-op
- Add -deprecation -Werror to server module scalacOptions
- Add -Xlint:deprecation -Werror to client module javacOptions

Result:
All modules compile with zero warnings across all Scala versions (3.3.7,
2.13.18, 2.12.21) and all platforms (JVM, JS, WASM, Native). Future
deprecation warnings will be caught as compilation errors.
@He-Pin He-Pin force-pushed the fix/all-compilation-warnings branch from 05912f5 to cbd0239 Compare June 19, 2026 20:33
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