1.Merge this if statement with the enclosing onejava
应该合并可折叠的语句this
2.String a = null;日志
须要初始化 String a;排序
3.捕捉到的异常 用日志打印ci
} catch (Exception e) {
Log logger.info(e);
//或者 Logger logger.info("",e);
}get
4.判断是否大于0(是否为空)string
不用orderMainBeanList.size() > 0it
使用 !orderMainBeanList.isEmpty()io
5.case 1ast
...
这里的业务不能大于5行,若是大于5行,另写一个private的方法去写这里的业务,而后这里调用。
6.public static final String GET_VIEW_ROWS
不是public final static String GET_VIEW_ROWS
7.Replace the type specification in this constructor call with the diamond operator ("<>"). (sonar.java.source not set. Assuming 7 or greater.)
Map<String, String> M_FILETYPES= new HashMap<String, String>();
改为
Map<String, String> M_FILETYPES= new HashMap<>();
8.方法名称排序
先构造
再有参构造
再其余方法
9.return null改为 Collections.emptyList();
10.NullPointerException might be thrown as 'dt2' is nullable here
先判断是否为空再去操做
11.Introduce a new variable instead of reusing the parameter "prefixKey"
不要用传递过来的参数去从新赋值作判断等
能够新建一个参数 等于传递过来的参数 用新的参数去操做
private String getBatchSaveKey(Map<String, String> map, String prefixKey, String... keys) {
//建立一个newPrefixKey
String newPrefixKey;
newPrefixKey = prefixKey.endsWith(RedisKeys.DELIMITER) ? prefixKey.substring(0, prefixKey.length() - 1) : prefixKey;
if (keys.length == 0) {
return newPrefixKey;
}
不直接用prefixKey = prefixKey.endsWith(RedisKeys.DELIMITER) ? prefi。。。
也不直接用return prefixKey;而是去建立newPrefixKey
12.Cast one of the operands of this division operation to a "double"
使用int pageSize=(int) Math.ceil(count/3);
须要转double int pageSize=(int) Math.ceil((double) count/3);
13.Add a nested comment explaining why this method is empty, throw an UnsupportedOperationException or complete the implementation
对于bean里面的类 手写构造 public CodeBean(){}