PMD 报错原因修改总结 1
Avoid unnecessary Comparisons in Boolean exception
(Boolean 类型重复判断) 错误 例子: if(null
= a && a
size>0) 正确 if(null
= a && false == a
IsEmpay()) 2
Avoid Using implementation types like (ArrayList HashMap/ LinkedHashMap) ,use the interface instand
(用数组的接口类型) 错误 例子:ArrayList arraylist=new ArrayList(); 正确 List list=new ArrayList(); 错误 例子: private static HashMap map=new HashMap(); 正确 private static Map map=new HashMap(); 错误 例子: private static LinkedHashMap map=new LinkedHashMap(); 正确 private static Map map=new LinkedHashMap(); 3
Method names should not start with capital letters(方法名不能以大写开头)
错误 例子: public class Start() 正确 public class start() 可以用快捷键 Alt+shift+R 全部替 4
varivable that are final and static should be in all caps
(定义的参数必须大写) 错误 例子:public static final String root 正确 pu