[jdk21u-dev] RFR: 8327476: Upgrade JLine to 3.26.1

Goetz Lindenmaier goetz at openjdk.org
Fri Feb 21 16:04:54 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...

Thanks for looking at this change!
GetConsoleOutputCP was removed in the original lib from .../win/Kernel32.java
So I removed it from Kernel32Impl.java and Kernel32.cpp.

-------------

PR Comment: https://git.openjdk.org/jdk21u-dev/pull/1413#issuecomment-2674932891


More information about the jdk-updates-dev mailing list