Annotation Type ApiStatus.OverrideOnly


  • @Documented
    @Retention(CLASS)
    @Target({TYPE,METHOD})
    public static @interface ApiStatus.OverrideOnly

    Indicates that the annotated method is part of SPI (Service Provider Interface), which is intended to be only implemented or overridden but not called by clients of the declaring library. If a class or interface is marked with this annotation it means that all its methods can be only overridden.

    Although there is a standard mechanism of protected methods, it is not applicable to interface's methods. Also, API method may be made public to allow calls only from different parts of the declaring library but not outside it.

    Signatures of such methods may be changed in new versions of the library in the following steps. Firstly, a method with new signature is added to the library delegating to the old method by default. Secondly, all clients implement the new method and remove implementations of the old one. This leads to compatibility breakage with code that calls the methods directly.