Why package-private classes are not accessible from nested packages?

56 views Asked by At

I was planning a testing strategy for one of the projects I'm working for and my plan was to create some package-private annotations and make them available only down the package structure. For instance:

- com.myproject.test.it.BaseIT.class (annotation)
- com.myproject.test.it.foo.FooIT (one test class)

- com.myproject.test.component.BaseComponentTest.class (annotation)
- com.myproject.test.component.bar.BarComponentTest.class (another test class)

BaseIT.class and BaseComponentTest.class are my annotations. BaseIT.class would be available inside .it and any other nested packaged like .it.foo.

The same would happen with BaseComponentTest.class.

0

There are 0 answers