Skip to content

Files

Latest commit

 

History

History
24 lines (13 loc) · 873 Bytes

InterfaceIsType.md

File metadata and controls

24 lines (13 loc) · 873 Bytes

Pattern: Interface without methods

Issue: -

Description

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 class javax.swing.SwingConstants is an example of a class that would be flagged by this check.

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

Examples

To configure the check:

<module name="InterfaceIsType"/>

Further Reading