Class InterfaceIsTypeCheck

  • All Implemented Interfaces:
    Configurable, Contextualizable

    public final class InterfaceIsTypeCheck
    extends AbstractCheck

    Implements Joshua Bloch, Effective Java, Item 17 - Use Interfaces only to define types.

    According to Bloch, an interface should describe a type. It is therefore inappropriate to define an interface that does not contain any methods but only constants. The Standard interface javax.swing.SwingConstants is an example of an interface that would be flagged by this check.

    The check can be configured to also disallow marker interfaces like, that do not contain methods or constants at all.

    • Property allowMarkerInterfaces - Control whether marker interfaces like Serializable are allowed. Type is boolean. Default value is true.

    Parent is

    Violation Message Keys:

    • interface.type