Annotation Type ForOverride


  • @Documented
    @IncompatibleModifiers(modifier={PUBLIC,PRIVATE,STATIC,FINAL})
    @Retention(CLASS)
    @Target(METHOD)
    public @interface ForOverride
    Indicates that the annotated method is provided only to be overridden: it should not be invoked from outside its declaring source file (as if it is private), and overriding methods should not be directly invoked at all. Such a method represents a contract between a class and its subclasses only, and is not to be considered part of the caller-facing API of either class.

    The annotated method must have protected or package-private visibility, and must not be static, final or declared in a final class. Overriding methods must have either protected or package-private visibility, although their effective visibility is actually "none".