Eclipse 3.5 Plug-in Migration FAQ
-
Why is the @noextend API restriction supported on interfaces?
In release 3.4, API tooling supported one restriction for API interfaces - @noimplement
. This restriction specified an interface was not to be implemented or extended by clients. To enrich API specifications, Eclipse 3.5 separates these concerns into two restrictions - @noimplement
and @noextend
. This allows an interface to be extended when it is not to be implemented directly. For example, a clients may be permitted to subclass an existing implementation of a @noimplement
interface and extend the base interface with extra function.
Component owners need to decide where to add @noextend
tags on existing interfaces. To maintain exactly the same API contract as specified in 3.4, @noextend
tags can be added to all interfaces specified as @noimplement
. This can be decided on a case by case basis. Generally, the @noextend
restriction can be omitted, as clients that extend and implement a @noimplement
interface will still be flagged with errors. However, if you would like to reserve the right to add constants (public static final fields) to an API interface in the future, you must add the @noextend
tag. This is because adding a field to an interface is binary incompatible if clients can extend or implement an interface (see
Evolving API Interfaces). Adding an API restriction to a class/interface is usually an error - however, API tooling allows you to add @noextend
tags without penalty in the 3.5 release, since this specifies the same contract that 3.4 tooling provided. If you were to wait until a later release to add the additional tag, and error would be generated to indicate a restriction has been added to an API interface.