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
EDIT: 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.
It probably depends a bit on your motives for not displaying them but if the only reason is that you don't want to pollute the public interface with the things intended only for testing (or some other internal thing) I would put the methods in a separate public interface and have the consumers of the "hidden" methods use that interface. It will not stop others from using the interface but I see no reason why you should.
For unit tests, and if it is possible without rewriting the lot, follow the suggestions to use the same package.