Change in ovirt-engine[master]: webadmin: Use Integer.valueOf instead of new
juan.hernandez at redhat.com
juan.hernandez at redhat.com
Wed Sep 23 18:56:23 UTC 2015
Juan Hernandez has submitted this change and it was merged.
Change subject: webadmin: Use Integer.valueOf instead of new
......................................................................
webadmin: Use Integer.valueOf instead of new
This is needed in order to avoid the following findbugs warning:
Method invokes inefficient Number constructor; use static valueOf instead
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.
Values between -128 and 127 are guaranteed to have corresponding cached
instances and using valueOf is approximately 3.5 times faster than using
constructor. For values outside the constant range the performance of
both styles is the same.
Unless the class must be compatible with JVMs predating Java 1.5, use
either autoboxing or the valueOf() method when creating instances of
Long, Integer, Short, Character, and Byte.
Bug kind and pattern: Bx - DM_NUMBER_CTOR
Change-Id: I7c5d961e05cc6e85972559cf039169440cd92041
Signed-off-by: Juan Hernandez <juan.hernandez at redhat.com>
---
M frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/quota/QuotaModel.java
1 file changed, 1 insertion(+), 1 deletion(-)
Approvals:
Juan Hernandez: Verified; Passed CI tests
Alexander Wels: Looks good to me, approved
--
To view, visit https://gerrit.ovirt.org/46550
To unsubscribe, visit https://gerrit.ovirt.org/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I7c5d961e05cc6e85972559cf039169440cd92041
Gerrit-PatchSet: 2
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: Juan Hernandez <juan.hernandez at redhat.com>
Gerrit-Reviewer: Alexander Wels <awels at redhat.com>
Gerrit-Reviewer: Jenkins CI
Gerrit-Reviewer: Juan Hernandez <juan.hernandez at redhat.com>
Gerrit-Reviewer: automation at ovirt.org
More information about the Engine-commits
mailing list