Hiding classes in a jar file

前端 未结 8 1598
渐次进展
渐次进展 2020-12-06 02:20

Is it really impossible to hide some classes in a jar file?

I wanted not to allow direct instantiation of the classes to keep it more flexible. Only the factory (or

8条回答
  •  不思量自难忘°
    2020-12-06 02:59

    With standard classloaders and plain old jar files, this is not possible. OSGi has this concept of making visible only some packages to another bundle(i.e. separation of public api and internal implementation).

    If you are using eclipse, you may enforce such rules with this

提交回复
热议问题