resources.report.rules.findbugs.DM_BOXED_PRIMITIVE_TOSTRING.html Maven / Gradle / Ivy
DM_BOXED_PRIMITIVE_TOSTRING
Bx: Method allocates a boxed primitive just to call toString (DM_BOXED_PRIMITIVE_TOSTRING)
A boxed primitive is allocated just to call toString(). It is more effective to just use the static
form of toString which takes the primitive value. So,
Replace... With this...
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 Boolean(true).toString() Boolean.toString(true)