[jdk21u-dev] RFR: 8327476: Upgrade JLine to 3.26.1
Martin Doerr
mdoerr at openjdk.org
Fri Feb 21 16:20:51 UTC 2025
On Wed, 19 Feb 2025 09:37:11 GMT, Goetz Lindenmaier <goetz at openjdk.org> wrote:
> I backport this change for parity with 21.0.7-oracle.
>
> It brings updates of upstream library jline 3.26.1 to jdk21.
> Jdk21 currently includes jline 3.22.0, see [JDK-8297587](https://bugs.openjdk.org/browse/JDK-8297587).
> The original sources of jline 3.26.1 can be found here:
> https://github.com/jline/jline3/archive/refs/tags/jline-parent-3.26.1.tar.gz
>
> The backport of this change needed larger adaptions.
>
> The original jline library dynamically selects how to access
> the operating system in two means:
> * Which operating system? linux, windows, mac?
> * JDK functionality to do native calls: JNI, jna, ffm?
>
> The implementation in OpenJDK does this selection at JDK build time.
> The code is split into more subdirectories for the operating systems.
> One of the methods to call native is picked, the code for the others
> is removed. Unfortunately this differs for the JDK releases:
> * jdk21 uses jna.
> * jdk23 uses ffm.
> The original patch of this change includes all the edits to
> replace jna by ffm.
>
> Further changes that fell into the eye during the backport
> * jline changed the format of its Copyright header
> * jline changed sorting of imports
> * jline changed a lot of formatting, especially how
> arguments to methods are listed.
> * jline removed the `Stream` enum from `TerminalProvider.java` and moved it
> into a class of its own: `SystemStream.java`. This makes changes to
> import statements and argument lists necessary.
> * OpenJDK added a new parameter `inputStreamWrapper` to the
> functions which are also affected by the `Stream` enum change.
> This also made changes to import statements and argument lists
> necessary.
>
> OpenJDK 23 added jline to the list of modules needed for a jre.
> I don't think we should do that in 21, so I omitted that change.
>
> jline 3.26.1 and OpenJDK 23 added a new method `systemStreamWidth() `to `TerminalProvider`.
> I don't think we should extend the functionlaity of jline in 21,
> so I omitted this. Also, I would need additional parts of the
> jline windows files that are not yet included in OpenJDK to
> implement this.
>
> For the backport, I dropped the following files from the patch:
> ```
> src/jdk.internal.le/share/classes/jdk/internal/org/jline/terminal/impl/ffm/CLibrary.java
> src/jdk.internal.le/share/classes/jdk/internal/org/jline/terminal/impl/ffm/FfmNativePty.java
> src/jdk.internal.le/share/classes/jdk/internal/org/jline/terminal/impl/ffm/FfmTerminalProvider.java
> src/jdk.internal.le/share/classes/jdk/internal/org/jline/termina...
Marked as reviewed by mdoerr (Reviewer).
Ah, I see it only in
jline3-jline-parent-3.26.1/native/src/main/java/org/jline/nativ/Kernel32.java: public static native int GetConsoleOutputCP();
jline3-jline-parent-3.26.1/native/src/main/native/kernel32.c:JNIEXPORT jint JNICALL Kernel32_NATIVE(GetConsoleOutputCP)
jline3-jline-parent-3.26.1/native/src/main/native/kernel32.c: rc = (jint)GetConsoleOutputCP();
So, it seems to be no longer in the windows files.
-------------
PR Review: https://git.openjdk.org/jdk21u-dev/pull/1413#pullrequestreview-2633580839
PR Comment: https://git.openjdk.org/jdk21u-dev/pull/1413#issuecomment-2674980888
More information about the jdk-updates-dev
mailing list