fix: eliminate Thread.stop() deprecation warning and enforce -Werror on server/client#1003
Open
He-Pin wants to merge 1 commit into
Open
fix: eliminate Thread.stop() deprecation warning and enforce -Werror on server/client#1003He-Pin wants to merge 1 commit into
He-Pin wants to merge 1 commit into
Conversation
0895127 to
05912f5
Compare
…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.
05912f5 to
cbd0239
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation
Thread.stop()has been deprecated since Java 1.2 (unsafe) and wasfinally removed in JDK 21+. sjsonnet was also not enforcing
-Werroruniformly across the server (Scala) and client (Java) modules, allowing
warnings to accumulate silently.
Modification
Thread.stop()calls with safe alternatives:System.exit(0),Thread.interrupt(), and socketclose(),depending on the exit path in
SjsonnetServerMain.scala.-Werror(scalac) on the server modules and-Werror(javac) on the client module via
build.sc/build.millconfig.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
Thread.stop()removal-Werrorflag documentation