Does opens/exports moduleA.X to moduleB work when moduleB is in other layer?
Code Ranger
coderanger2025 at outlook.com
Thu Jan 16 00:28:34 UTC 2025
Please, consider the following situation:
The boot layer contains moduleA, which has the following line in module-info: "opens com.company.a.foo to com.google.gson;"
The child layer contains gson.
And this is what I get:
java.lang.reflect.InaccessibleObjectException: Unable to make field private ... com.company.a.foo.Bar accessible: moduleA does not "opens com.company.a.foo" to module com.google.gson
If I do "opens com.company.a.foo;" then everything works fine, but it is not what I would like to do.
Can someone confirm if this is expected behavior? Is this a bug, or does opens/exports moduleA.X to moduleB only work when moduleA and moduleB are in the same layer?
Best regards, CR
More information about the jigsaw-dev
mailing list