PMD规则之Type Resolution Rules

·  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中继承或者抛出一个被检查的异常。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值