It seems the JLine maintainers were concerned about depending on the internals of a separate project (jansi), because "to minimize the maintenance cost, Jansi has been merged into JLine 3.25." (https://github.com/jline/jline3).

That's a good step because it saves people who are not maintainers of JLine from trying to make it work by messing with the internals of a standalone jansi JAR.

Even better, JLine 3.24 started using its own providers to access the Windows API, rather than go through its bundled version of jansi. This means that on modern JDKs, JLine can use the FFM API to make native Windows calls. I expect that the performance and maintainability of this approach is light years ahead of the old clunky route through jansi.internal.Kernel32.

It's hard to see why anyone using JLine 3.28 (per the errors below) would want to use an external version of jansi when the JLine maintainers have done such great work to ensure no-one has to worry about jansi.

Alex

On 1/31/2025 5:18 AM, Code Ranger wrote:
Hello all.

I have a boot layer with `org.fusesource.jansi` module a child layer with jline3 module. Jline3 wants to use jansi:

Caused by: java.lang.IllegalAccessError: class org.jline.terminal.impl.jansi.JansiTerminalProvider (in module org.jline) cannot access class org.fusesource.jansi.internal.Kernel32 (in module org.fusesource.jansi) because module org.fusesource.jansi does not export org.fusesource.jansi.internal to module org.jline     at org.jline@3.28.0/ org.jline.terminal.impl.jansi.JansiTerminalProvider.verifyAtLeast(JansiTerminalProvider.java:85) ~[jline-3.28.0.jar:?]     at org.jline@3.28.0/ org.jline.terminal.impl.jansi.JansiTerminalProvider.<init>(JansiTerminalProvider.java:93) ~[jline-3.28.0.jar:?]     at java.base/ jdk.internal.reflect.DirectConstructorHandleAccessor.newInstance(DirectConstructorHandleAccessor.java:62) ~[?:?]     at java.base/ java.lang.reflect.Constructor.newInstanceWithCaller(Constructor.java:502) ~[?:?]     at java.base/ java.lang.reflect.Constructor.newInstance(Constructor.java:486) ~[?:?]     at org.jline@3.28.0/ org.jline.terminal.spi.TerminalProvider.load(TerminalProvider.java:69) ~[jline-3.28.0.jar:?]

If I do
    --add-exports org.fusesource.jansi/ org.fusesource.jansi.internal=org.jline \

I get WARNING: Unknown module: org.jline specified to --add-exports
(as I was already told if a module is not the boot layer it is just ignored)

if I do
    --add-exports org.fusesource.jansi/ org.fusesource.jansi.internal=ALL-UNNAMED \

I get the same exception.

Could anyone say how to fix it?

Best regards, CR


Reply via email to