Defining API Restrictions
API tooling provides Javadoc tags to explicitly document and restrict the use of API. The following tables summarizes the Javadoc tags supported by each member and the semantics of each tag.
A client refers to a plug-in or bundle that requires the bundle where the associated API is defined. Restrictions are not applied in the same bundle where API is defined. For example, a bundle that defines an interface as @noimplement is also allowed to provide an implementation of that interface.
Supported Restriction Tags
|
Class |
Interface |
Method |
Constructor |
Final Field |
Non-Final Field |
@noimplement
|
-
|
|
-
|
-
|
-
|
-
|
@noextend
|
|
|
-
|
-
|
-
|
-
|
@noinstantiate
|
|
-
|
-
|
-
|
-
|
-
|
@nooverride
|
-
|
-
|
|
-
|
-
|
-
|
@noreference
|
-
|
-
|
|
|
-
|
|
Restriction Semantics
@noimplement
|
Indicates that clients must not implement this interface. Any class using the implements keyword for the associated interface or parent of the associated interface where there is no implementing superclass will be flagged with problem. |
@noextend
|
Indicates that clients must not extend this class or interface. Any class or interface using the extends keyword for the associated type will be flagged with a problem.
|
@noinstantiate
|
Indicates that clients must not instantiate this class. Any code that instantiates the associated class with any constructor will be flagged with a problem.
|
@nooverride
|
Indicates that clients must not redeclare this method. Any subclass that defines a method that overrides the associated method will be flagged with a problem.
|
@noreference
|
Indicates that clients must not reference this method, constructor, or non-final field. Any code that directly invokes the associated method or constructor or references the associated non-final field will be flagged with a problem. |
Setting up a baseline
Javadoc @since tag Management
API Baselines Preferences
API Errors and Warnings Preferences