Think of a module being a walled garden by default. By default, any Java type in a module is accessible only to the types inside the same module. Previously, the SortUtil class was in the packt.addressbook module and was thus accessible to other types in that module. Move it to a different module however, and it is not accessible to types in the original module anymore.
Given two modules, A and B, for any type in module A to access a type in module B, two conditions need to be satisfied:
- Module A needs to declare its dependency on module B
- Module B needs to declare that it's okay with that type being accessed externally by other modules
If either of these conditions isn't met, the type being accessed in module ...