admin管理员组文章数量:1565357
BX_BOXING_IMMEDIATELY_UNBOXED
Primitive value is boxed and then immediately unboxed
对原始值进行装箱,然后立即取消装箱。这可能是在一个未要求装箱的地方进行了手动装箱,从而迫使编译器进行立即撤消装箱的操作
BX_BOXING_IMMEDIATELY_UNBOXED_TO_PERFORM_COERCION
Primitive value is boxed then unboxed to perform primitive coercion
对原始值进行装箱然后立即把它强制转换为另外一种原始类型。例如:
new Double(d).intValue()应该直接进行强制转换例如:(int) d
DM_BOXED_PRIMITIVE_TOSTRING
Method allocates a boxed primitive just to call toString
仅仅为了调用封装类的toString()而对原始类型进行封装操作。比这种方法更有效的是调用封装类的toString(…)方法例如:
new Integer(1).toString() 替换为 Integer.toString(1)
new Long(1).toString() 替换为 Long.toString(1)
new Float(1.0).toString() 替换为 Float.toString(1.0)
new Double(1.0).toString() 替换为 Double.toString(1.0)
new Byte(1).toString() 替换为 Byte.toString(1)
new Short(1).toString() 替换为 Short.toString(1)
new Boolea
本文标签: 规则自定义JavafindbugsPerformance
版权声明:本文标题:java自定义findbugs规则,FindBugs 规则整理:Performance 内容由热心网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:https://www.elefans.com/dianzi/1725429364a1022721.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论