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 正确 public static final String ROOT 5.Avoid appending charcutars as Strings in StringBuffer append (避免在 StringBuffer 里附加单个字符时附加成 String 类型) 错误 例子: buf.append(“)”)或者 buf.append(“a”) 正确 buf.append(')')或者 buf.append('a') 6.use ArrayList instanded of vector(使用ArrayList 替换 vector 后还是会报错,所以直接改成是以它的接口形式替换) 错误 例子: vector keys = new vector(ELE); 正确 List keys = new ArrayList(ELE); 7. Variables that are not final should not contain underscores (except for underscores in standard prefix/suffix) (变量不是 final 类型的不能包含下划线) 错误 例子: private int DEAULT_PORT = 8001; 正确 private int DEAULTPORT = 8001;(调用它的所有类都需要改动) 8. Variables should start with a lowercase character(参数必须要以小写开始) 错误 例子: private static int HANDLE_MAX = 200; 正确 private static int ha...