refactor(java): clear the SDK's unused-variable warnings - #573
Merged
Conversation
The java22 source set puts the IDE's compiler at source 22, where an unread resource variable is flagged; hoisting makes the header read it.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (38)
📝 WalkthroughWalkthroughThe PR removes an unused native error constant and refactors Java tests to start ChangesJava lifecycle and native status updates
Estimated code review effort: 2 (Simple) | ~15 minutes Possibly related PRs
Suggested labels: Suggested reviewers: 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
kartikeya-27
approved these changes
Jul 28, 2026
Merged
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.
The Java SDK builds at
--release 17, but thejava22source set (the Panama FFMtransport, packaged into
META-INF/versions/22) pushes IDE tooling to resolve thewhole Gradle project at source 22. At that level an unread try-with-resources
variable is a warning — Java 22 could write
_there — so the editor reported 83problems that
javacnever sees.Rather than pin the IDE, this drops the unused variables:
91 test sites hoist the resource out of the header, so the spec reads the
variable and close-on-exit semantics are unchanged:
ResourceTesthad two workers in one header. They are nested rather than bothhoisted, so a failing second
start()still closes the first.FfmTransportdrops the unusedSTATUS_ERRconstant; the wire codes are notedin a comment instead.
No rewritten
tryhad acatch/finally, so moving the initializer out of theheader cannot change exception routing.
Verified:
./gradlew test spotlessCheck checkstyleMain checkstyleTestgreen(466 + 21 tests, 0 failures), and a source-22
ecjsweep oversrc/main/java,src/main/java22,src/test/javaandtest-supportnow reports zero unusedlocals, fields and imports.
Summary by CodeRabbit
Bug Fixes
Tests