Skip to content

fix: add synchronized to fillInStackTrace override (S3551)#2019

Merged
gnodet merged 1 commit into
jline:masterfrom
gnodet:quick-fix/sonar-s3551
Jun 30, 2026
Merged

fix: add synchronized to fillInStackTrace override (S3551)#2019
gnodet merged 1 commit into
jline:masterfrom
gnodet:quick-fix/sonar-s3551

Conversation

@gnodet

@gnodet gnodet commented Jun 30, 2026

Copy link
Copy Markdown
Member

Summary

  • Add synchronized modifier to ExitShellException.fillInStackTrace() to match the parent Throwable.fillInStackTrace() contract.

Fixes SonarCloud S3551 which is causing the Quality Gate to fail on master (C Reliability Rating on New Code).

Summary by CodeRabbit

  • Bug Fixes
    • Improved shell exit handling to be more reliable under concurrent use, reducing the chance of unexpected behavior when leaving the shell.

Throwable.fillInStackTrace() is synchronized in the JDK; the
override must match to satisfy the method contract.
@gnodet gnodet added the bug label Jun 30, 2026
@coderabbitai

coderabbitai Bot commented Jun 30, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 5dd455e3-54d5-4256-ac6d-db78003d30f2

📥 Commits

Reviewing files that changed from the base of the PR and between 1d5fc30 and 896f217.

📒 Files selected for processing (1)
  • shell/src/main/java/org/jline/shell/ExitShellException.java

📝 Walkthrough

Walkthrough

The fillInStackTrace() method in ExitShellException is modified to add the synchronized keyword to its method signature, controlling concurrent access during stack trace filling. No other behavioral changes are made.

Changes

Exception thread-safety fix

Layer / File(s) Summary
Synchronize fillInStackTrace override
shell/src/main/java/org/jline/shell/ExitShellException.java
The fillInStackTrace() override gains the synchronized modifier; return behavior is unchanged.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~2 minutes

Poem

A single word, "synchronized," I add,
To guard the trace when threads run mad.
Hop, hop, through the code so neat,
One line changed, my work complete! 🐇

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the single code change: adding synchronized to the fillInStackTrace override.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@sonarqubecloud

Copy link
Copy Markdown

@gnodet gnodet merged commit 6b83c24 into jline:master Jun 30, 2026
15 checks passed
@gnodet gnodet deleted the quick-fix/sonar-s3551 branch June 30, 2026 19:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant