Skip to content

fix: backport bugfixes from master to 3.30.x#1841

Merged
gnodet merged 13 commits into
3.30.xfrom
backport/3.30.x/bugfixes
Apr 27, 2026
Merged

fix: backport bugfixes from master to 3.30.x#1841
gnodet merged 13 commits into
3.30.xfrom
backport/3.30.x/bugfixes

Conversation

@gnodet
Copy link
Copy Markdown
Member

@gnodet gnodet commented Apr 27, 2026

Summary

Backport of bugfixes from master to the 3.30.x release branch:

Test plan

  • Build passes for affected modules (./mvnw install -DskipTests)
  • All tests pass for affected modules
  • Conflicts resolved manually where 3.30.x API differs from master

gnodet and others added 12 commits April 27, 2026 14:36
When running on JDK 21, loading the FFM terminal provider (compiled for
Java 22) throws UnsupportedClassVersionError, which is a LinkageError
(an Error, not an Exception). The catch clause only caught Exception,
letting the error escape. Catch LinkageError as well so provider loading
failures are properly wrapped in IOException and handled gracefully by
the fallback logic.
…ixes #1766)

Only call TerminalBuilder.providers() when the jansi.providers system
property is actually set. Passing null was a no-op anyway, and the
unconditional call causes NoSuchMethodError when an older jline-terminal
jar without the providers() method is loaded first on the classpath.
Object.wait(timeout) can return due to spurious wakeups, so it must
be called inside a while loop that re-checks the condition. Use a
deadline-based loop to correctly handle the remaining timeout.
The Size fields are int but setColumns()/setRows() silently truncated
values via (short) casts since the class was created in 2016. This
served no purpose — the truncated value was stored back into an int
field, so there was no memory saving, only silent data loss for values
above 32767.
* Fix AttributedStyle color chaining

* Update terminal/src/test/java/org/jline/utils/AttributedStyleTest.java

* Update terminal/src/test/java/org/jline/utils/AttributedStyleTest.java

---------

Co-authored-by: Guillaume Nodet <gnodet@gmail.com>
…1813)

When a LineDisciplineTerminal is created with a null masterOutput
(e.g. via TerminalBuilder.builder().system(false).build()), closing
the terminal triggers a NullPointerException in FilteringOutputStream's
flush() and close() methods. Add null guards for masterOutput in all
code paths.
…#1808) (#1817)

On macOS, closing a file descriptor from one thread does not reliably
unblock a read() blocked on the same fd in another thread. The pumpOut
thread in PosixPtyTerminal blocks on masterInput.read(), and pty.close()
was unable to unblock it.

Fix by closing the slave output first, which signals EOF on the master
side via the kernel's PTY layer, reliably unblocking pumpOut on all
platforms. Also close masterInput directly before pty.close().

Restore try-with-resources in FfmTest now that terminals close cleanly.
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Apr 27, 2026

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 48513d94-baaf-48de-bc98-783403130ac2

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch backport/3.30.x/bugfixes

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 and usage tips.

@sonarqubecloud
Copy link
Copy Markdown

@gnodet gnodet merged commit 70af627 into 3.30.x Apr 27, 2026
13 checks passed
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.

2 participants