I am writing a Java program that is divided into packages.
How do I give permission to class in the scope that is defined in it, and to its sub-scopes.
For example, I have 3 packages app.A, app.A.Sub, app.B. And in packge A I have class GlobalA.
I want that only package app.A and app.A.Sub will be able to use GlobalA, but app.B cant use it.
How can I do it?
There is absolutely no hierarchy in java packages. There are just names.
So package
a.subaandahave no special relation. You have no way to give special rights to “sub packages”.