Define access restriction on plugin

In Eclipse it seems to be common practice to define interfaces and hide a concrete implementation in a package under *.internal.*. The actual hiding though is not result of the word „internal“ in the package name but must be specified in the MANIFEST.MF with the exported packages.
There are also further possibilities that can be engaged. For example you can define a package a friend to another package(es) so that only these can access the classes within.

Manifest.MF
Bundle-SymbolicName: example
Export-Package:
com.example.public, // Anyone can access com.example.public if imported
com.example.test;x-internal:=true, // This is marked as internal, but can be used
com.example.impl;x-friends:=com.example.other, // Only com.example.other should access it

This is not part of the OSGi Standard but the Equinox reference implementation.
For further reference see the Article at EclipseZone.

2 Gedanken zu „Define access restriction on plugin“

Schreibe einen Kommentar