目录
FindBugs 使用 及 错误解决方法
idea 安装findbugs,我这里已经安装过了
使用findbugs检查代码
常见错误
1、Private method is never called
This private method is never called. Although it is possible that the method will be invoked through reflection, it is more likely that the method is never used, and should be removed.(私人方法永远不会被调用这种私人方法永远不会被调用。虽然这是可能的,通过反射的方法将被调用,它是更可能的方法是从未使用过,并且应该被删除。)
2、Comparison of String parameter using == or !=
This code compares a java.lang.String parameter for reference equality using the == or != operators. Requiring callers to pass only String constants or interned strings to a method is unnecessarily fragile, and rarely leads to measurable performance gains. Consider using the equals(Object) method instead.(使用=或字符串参数的比较!=这个代码比较java.lang.string参数使用= =或引用相等!=运算符。要求调用方通过只有字符串常量或拘留一种字符串是不必要的脆弱,很少获得显著的性能提升。考虑使用等于(对象)方法。)