Hacker News new | ask | show | jobs
by rowland66 1905 days ago
I agree, and packages and package private access is such a powerful tool in Java, that so many developers completely ignore.
1 comments

Largely because it's not that powerful. It's got several shortcomings, but the main one is that Java doesn't actually understand Java package organization conventions. To Java, "com.mycompany.stuff" and "com.mycompany.stuff.specialized" are two completely unrelated packages, and so stuff that's package-private to "com.mycompany.stuff" is inaccessible from "com.mycompany.stuff.specialized".

That and a few other details make the feature annoying enough to use in practice that most people just find it's better to just stop using it.

Fortunately, if you're on Java 9 or later, there are modules, which are a much better fit for what kinds of access control tooling programmers actually need.