On 14/09/2015 09:22, Peter Levart wrote:
:
Gives the following runtime error:
Exception in thread "main" java.lang.IllegalAccessError: class
pkgA.TestA (in module: modA) cannot access class pkgC.TypeC (in
module: modC), modA cannot read modC
at pkgA.TestA.main(modA@/TestA.java:8)
Which is expected. What I didn't expect is that javac did not figure
this out correctly. Am I missing something and not using javac in the
right way?
The API exported by modB has a method that returns an instance of
pkgC.TypeC so I would have expected modB to be a good citizen and
"requires public modC". Similarly, with the API exported by modC where
is returns an instance of pkgD.TypeD, I would have expected modC to
"requires public modD". I will guess that you've set it up this way to
probe more into implied readability.
The javac command looks right, I see that it also doesn't fail when the
modules are compiled separately (D, C, B, A).
-Alan.