相关文章推荐
求醉的枕头  ·  Visual Studio ...·  2 月前    · 

Variables that are final and static should be all capitals, 'logger' is not all capitals.

final修饰的变量名称需要全部大写

Only variables that are final should contain capitals (except for underscores in standard prefix/suffix), '_tar' is not final.

只有final修饰的变量名称中才可以有下划线,要么去掉下划线,要么加上final修饰符,Map,List和java对象加上final修饰符后,代表这个对象指向的内存地址不可变,但内容和值都是可以改变的

Variables should start with a lowercase character, 'SUSPEND_MAP' starts with uppercase character.

普通变量(即没有final修饰)需要驼峰式命名,首字母为小写

Replace the synchronized class "StringBuffer" by an unsynchronized one such as "StringBuilder".

StringBuffer需要换成StringBuilder

Update this method so that its implementation is not identical to "getDvStatus" on line 149.

两个方法的内容完全一致,不用写两遍,在其中一个方法中调用另一个方法即可。或者删掉一个,全部使用另一个方法

Add a nested comment explaining why this method is empty, throw an UnsupportedOperationException or complete the implementation.

空的方法体内部需要写一个注释

new com.model.CatalogInfo() invokes inefficient new Integer(int) constructor; use Integer.valueOf(int) instead

不要使用new Integer来初始化变量的值,使用Integer.valueOf

Change this "try" to a try-with-resources. (sonar.java.source not set. Assuming 7 or greater.)

使用try(FileInputStream inFile = new FileInputStream(file)){System.out.println("...")}catch{}且不需要finally代码块来关闭,这是jdk1.7的新写法,可以将一些可自动关闭的资源写在try()中,就可以直接实现自动关闭

Make this anonymous inner class a lambda (sonar.java.source not set. Assuming 8 or greater.)

jdk1.8之后推荐使用兰布达表达式。请参考:https://blog.csdn.net/qq_33865313/article/details/81203412