resources.report.rules.findbugs.DM_BOXED_PRIMITIVE_TOSTRING.html Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of sanity4j Show documentation
Show all versions of sanity4j Show documentation
Sanity4J was created to simplify running multiple static code
analysis tools on the Java projects. It provides a single entry
point to run all the selected tools and produce a consolidated
report, which presents all findings in an easily accessible
manner.
Bx: Method allocates a boxed primitive just to call toString (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)