Java access modifier priority
<p>Java access modifiers implicitly gives access priority to packages over subclasses since the <strong>default</strong> modifier gives access to packages but not to subclasses, <strong>protected</strong> permits access to both, but there is no modifiers which permits access to subclasses but not to packages. This has always felt weird to me, because I naturally tend to consider subclasses "closer" to the parent (even because they are their own variables after all) then the classes in the same package, and often I find myself in the situation where I would like to have the modifier for sub but not for the package.
This probably means I use packages in a "wrong" way, but can someone explain me the logic behind this decision?</p>