I suppose, internal visibility is rarely used in projects because it’s wide and packages are shuffled often. But what could be useful is a visibility scope to be seen only between children and parents or composition variables. Like
class Foo() {
internal_private fun invisibleOutside() {}
}
class Bar(foo: Foo) {
init {
foo.invisibleOutside()
}
}
And it’s good to be available in interfaces as well.
If you’re using modules then internal should be pretty common.
The Gradle docs do a decent job of pointing in the right direction for structuring projects: Structuring Large Projects
^ The next few pages on that link talk about best practices, etc.
As I remember, custom visibility scope can be created, but I don’t remember if Java supports it.
Something like only close family can use it, between internal and protected. Maybe the visibility inside of a single package could be enough.