Reputation: 225
I have public packages/classes which should not be part of the public API. However I guess I can't make a new API-maven bundle because the core-project also uses the public API.
It should be a common case, but I think that's a Java problem of not allowing fine grained access.
Do you have any hints of how to "protect" from accessing public classes which should not be part of the public API? However it really seems to be a common case most developers haven't thought about or at least haven't done anything to protect these classes from being accessed from the outside.
Upvotes: 3
Views: 116
Reputation: 2020
Normally, the classes that are should not be accessed are put into another package named "internal". So you would have com.company.application for the api classes, and com.company.application.internal for the implementation classes. But there is no enforcement of this. In the OSGI model, there is more fine-grained control over what packages are exported from a bundle, but not in plain Java.
Upvotes: 2