chore: use jline ffm terminal implementation#1441
Merged
Merged
Conversation
…3 into nightly-jdk22
0utplay
approved these changes
Jul 9, 2024
derklaro
added a commit
that referenced
this pull request
Jul 12, 2024
### Motivation JLine includes a FFM terminal implementation, which became a permantent feature in JDK 22. As we're now requring java 22, we can use the FFM terminal instead of some jni-based implementation. ### Modification * Replaced the usages of `org.jline:jline`: that is a complete bundle containing all jline dependencies, which is not nessacary at all. We're now including only the line reader and terminal dependencies. * Enable native access: while java itself has no requirement for this *yet*, some steps were already made into that direction coming to java 24 (see JEP 472). JLine has an explicit check that verifies that native access is enabled, so setting the flag is mandatory in order to use the FFM terminal implementation. * Replaced usages of `AnsiConsole.systemInstall/systemUninstall`: the ansi handling is already baked into JLine itself, these methods are only overriding the systems streams nowadays. No native lib is required for ansi anymore, so the color support detection becomes useless as well. If I understood the code correctly, ansi color codes are stripped from the output by JLine if it detects a terminal without color support. This change was tested on Debian 12 and Windows using cmd and PowerShell 5 & 7. All animations, tab completion & typing works as expected. ### Result We're now using the FFM-based terminal implementaton of JLine and are no longer relying on JNI libraries to do the job.
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
JLine includes a FFM terminal implementation, which became a permantent feature in JDK 22. As we're now requring java 22, we can use the FFM terminal instead of some jni-based implementation.
Modification
org.jline:jline: that is a complete bundle containing all jline dependencies, which is not nessacary at all. We're now including only the line reader and terminal dependencies.AnsiConsole.systemInstall/systemUninstall: the ansi handling is already baked into JLine itself, these methods are only overriding the systems streams nowadays. No native lib is required for ansi anymore, so the color support detection becomes useless as well. If I understood the code correctly, ansi color codes are stripped from the output by JLine if it detects a terminal without color support.This change was tested on Debian 12 and Windows using cmd and PowerShell 5 & 7. All animations, tab completion & typing works as expected.
Result
We're now using the FFM-based terminal implementaton of JLine and are no longer relying on JNI libraries to do the job.