How to export a package from a module in a boot layer to module in a child layer.
David Lloyd
david.lloyd at redhat.com
Fri Jan 31 15:30:10 UTC 2025
AFAIK it cannot be done with `jansi` in your boot layer. One solution would
be to put it into a child layer, which will allow you to access the
`Controller` for it, which you can then use to add the export manually
after defining the `jline3` module in its sub-layer. Otherwise, `jansi`
would have to cooperatively call `Module.addExports` for your module, which
seems unlikely to me.
On Fri, Jan 31, 2025 at 7:19 AM Code Ranger <coderanger2025 at outlook.com>
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 at 3.28.0/org.jline.terminal.impl.jansi.JansiTerminalProvider.verifyAtLeast(JansiTerminalProvider.java:85)
> ~[jline-3.28.0.jar:?]
> at org.jline at 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 at 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
>
>
--
- DML • he/him
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.org/pipermail/jigsaw-dev/attachments/20250131/86acf583/attachment.htm>
More information about the jigsaw-dev
mailing list