Defining API Restrictions

API Tools 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 Enum Annotation Method Constructor

Final Field

Non-Final Field
@noimplement
-
Supported
-
-
-
-
-
-
@noextend
Supported
Supported
-
-
-
-
-
-
@noinstantiate
Supported
-
-
-
-
-
-
-
@nooverride
-
-
-
-
Supported
-
-
-
@noreference
Supported
Supported
Supported
Supported
Supported
Supported
-
Supported

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 type (class, interface, enum, or annotation), 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.

When the tag is used on a type, it behaves as though the tag was added to any of the types members. For example, adding the tag to class will flag any references to any methods or non-final fields from that class.

Setting up a baseline Javadoc @since tag Management
API Baselines Preferences
API Errors and Warnings Preferences