Hiding certain methods from other packages

java, package

Solution

You can't. In Java there is no concept of a subpackage, so `odp.proj` and `odp.proj.test` are completely separate packages.

Problem

I have two packages in my project: `odp.proj` and `odp.proj.test`. There are certain methods that I want to be visible only to the classes in these two packages. How can I do this? If there is no concept of a subpackage in Java, is there any way around this? I have certain methods that I want to be available only to testers and other members of that package. Should I just throw everything into the same package? Use extensive reflection?

Original source

Related problems