错误码:RCN_REDUNDANT_NULLCHECK_OF_NONNULL_VALUE
Bug: Redundant nullcheck of bean1, which is known to be non-null
Pattern id: RCN_REDUNDANT_NULLCHECK_OF_NONNULL_VALUE, type: RCN, category: STYLE
This method contains a redundant check of a known non-null value against the constant null.
解释:这种方法包含了一个称为非空对空值的不断重复检查。
修改为:
错误码:SS_SHOULD_BE_STATIC
Bug: Unread field: ADDRESS_KEY; should this field be static?
Pattern id: SS_SHOULD_BE_STATIC, type: SS, category: PERFORMANCE
This class contains an instance final field that is initialized to a compile-time static value. Consider making the field static.
解释:
final成员变量表示常量,只能被赋值一次,赋值后值不再改变。
这个类包含的一个final变量初始化为编译时静态值。考虑变成静态常量
解决方法:
增加static关键字
错误码:NM_METHOD_NAMING_CONVENTION
Bug: The method name MsmPlanDAOTest.TestViewMsmPlanList() doesn't start with a lower case letter
Pattern id: NM_METHOD_NAMING_CONVENTION, type: Nm, category: BAD_PRACTICE
Methods should be verbs, in mixed case with the first letter lowercase, with the first letter of each internal word capitalized.
解释:
方法应该是动词,与第一个字母小写混合的情况下,与每个单词的首字母大写的内部。
解决方法:
方法名称小写就通过了。我们写代码还是要规范啊,虽然是单元测试的代码!