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

Martin Doerr mdoerr at openjdk.org
Thu Feb 20 15:23:58 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...

Indentation looks bad in some commented lines:

+            //            state = State.INTERRUPT;
+        //        addBuiltinWidget(widgets, QUIT, this::quit);
+        //        bind(vicmd, INSERT_COMMENT,                         alt('#'));
+        //        bind(vicmd, INSERT_COMPLETIONS,                     alt('*'));
+        //        if (attributes.getLocalFlag(Attributes.LocalFlag.ECHO)) {
+        //            processOutputByte(c);
+        //            masterOutput.flush();
+        //        }
+                                //                        case 'l':
+                                //                            rawPrint('\l');
+                                //                            break;
+                    //                    if (charRead < 0) {
+                    //                        continue;
+                    //                    }
+                    //                    charRead = -1;

(The PR is too large to review it in the GUI.)

The 4th Commit is from https://github.com/jline/jline3/archive/refs/tags/jline-parent-3.26.1.tar.gz ?

Thanks for splitting the PR into the individual commits!

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

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


More information about the jdk-updates-dev mailing list