https://bz.apache.org/bugzilla/show_bug.cgi?id=58547

            Bug ID: 58547
           Summary: Avoid new Integer and new Long instances when doing
                    conversions
           Product: Tomcat 8
           Version: trunk
          Hardware: Macintosh
                OS: Mac OS X 10.1
            Status: NEW
          Severity: trivial
          Priority: P2
         Component: Util
          Assignee: dev@tomcat.apache.org
          Reporter: anth...@whitford.com

Created attachment 33219
  --> https://bz.apache.org/bugzilla/attachment.cgi?id=33219&action=edit
Replaced new Integer/Long with valueOf calls

Discovered cases where an inefficient Number constructor is being called
instead of the static valueOf.

Using new Integer(int) is guaranteed to always result in a new object whereas
Integer.valueOf(int) allows caching of values to be done by the compiler, class
library, or JVM. Using of cached values avoids object allocation and the code
will be faster.

See http://findbugs.sourceforge.net/bugDescriptions.html#DM_NUMBER_CTOR

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org

Reply via email to