· LooseCoupling: Avoid using implementation types (i.e., HashSet); use the interface (i.e, Set) instead
翻译 松散耦合:避免使用实现类(如 HashSet),使用接口(如 Set)代替
· 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
翻译 存在克隆方法类必须实现Cloneable接口: clone()方法只有在类实现了cloneable接口且伴随一个final方法只抛出CloneNotSupportedException异常的情况下才要被实现。这个版本使用了PMD的类型分析工具,能够检测类是否实现或继承了一个可克隆的类
· UnusedImports: Avoid unused import statements. This rule will find unused on demand imports, i.e. import com.foo.*.
翻译 无用的import:避免无用的import语句。这个规则按需查找无用的import语句。
· 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.
翻译 具体声明抛出的异常:不确定方法中能够抛出什么样的具体异常。为模糊的接口提供证明并理解它是很困难的。抛出的异常类要么从RuntimeException中继承或者抛出一个被检查的异常。