Kotlin to support package protected visibility

The motivation for not having package protected access is very simple: it does not provide any real encapsulation. Any other module in the system can define classes in the same package as your complex independent component and get full access to its internals. On the other hand, classes with internal visibility cannot be accessed from any module other than the one where they are defined.

And you definitely can test methods/classes that have internal access: the tests of a module have full access to internal declarations of that module.

18 Likes