You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by bu...@apache.org on 2015/10/26 00:22:01 UTC
[Bug 58547] New: Avoid new Integer and new Long instances when doing
conversions
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: anthony@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-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org
[Bug 58547] Avoid new Integer and new Long instances when doing
conversions
Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=58547
Violeta Georgieva <vi...@apache.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution|--- |FIXED
--- Comment #1 from Violeta Georgieva <vi...@apache.org> ---
Hi,
Thanks for the report and the patch.
I applied the same fix on other places in the code also.
The fix is available in trunk, 8.0.x (for 8.0.29 onwards) and 7.0.x (for 7.0.66
onwards)
Regards,
Violeta
--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org