Type_Resolution_Rules

e_Resolution_Rules">

Type Resolution Rules

  • LooseCoupling: Avoid using implementation types (i.e., HashSet); use the interface (i.e, Set) instead
  • CloneMethodMustImplementCloneable: The method clone() should only be implemented if the class implements the Cloneable interface with the exception of a final method that only throws CloneNotSupportedException. This version uses PMD's type resolution facilities, and can detect if the class implements or extends a Cloneable class
  • UnusedImports: Avoid unused import statements. This rule will find unused on demand imports, i.e. import com.foo.*.
  • SignatureDeclareThrowsException: It is unclear which exceptions that can be thrown from the methods. It might be difficult to document and understand the vague interfaces. Use either a class derived from RuntimeException or a checked exception. Junit classes are excluded.