Change in ovirt-engine[master]: core: Use "Long.valueOf" in "StorageHandlingCommandBase"
juan.hernandez at redhat.com
juan.hernandez at redhat.com
Fri Sep 25 08:22:40 UTC 2015
Juan Hernandez has submitted this change and it was merged.
Change subject: core: Use "Long.valueOf" in "StorageHandlingCommandBase"
......................................................................
core: Use "Long.valueOf" in "StorageHandlingCommandBase"
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: I59e2c93b6e9ad26e3ca345483e9cc0b863a0ecbf
Signed-off-by: Juan Hernandez <juan.hernandez at redhat.com>
---
M backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/storage/StorageHandlingCommandBase.java
1 file changed, 1 insertion(+), 1 deletion(-)
Approvals:
Juan Hernandez: Verified; Looks good to me, approved; Passed CI tests
--
To view, visit https://gerrit.ovirt.org/46572
To unsubscribe, visit https://gerrit.ovirt.org/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I59e2c93b6e9ad26e3ca345483e9cc0b863a0ecbf
Gerrit-PatchSet: 2
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: Juan Hernandez <juan.hernandez at redhat.com>
Gerrit-Reviewer: Jenkins CI
Gerrit-Reviewer: Juan Hernandez <juan.hernandez at redhat.com>
Gerrit-Reviewer: Maor Lipchuk <mlipchuk at redhat.com>
Gerrit-Reviewer: automation at ovirt.org
More information about the Engine-commits
mailing list