DESCRIPTION

Bug 522043 - Prefer to use valueOf to create Number instances

Change-Id: I5d0dd49bdc88dce7a1ec480f7ef0c94632e3b749
Signed-off-by: Armani Hurst xxx@xxx.xxx


COMMENTS

author: Isis Velasquez
date: 2017-09-12 06:46:37.000000000

Patch Set 3: Patch Set 2 was rebased

-------------------------------------
author: Brenden Conley
date: 2017-09-12 07:05:53.000000000

Patch Set 3:

Build Started https://hudson.eclipse.org/platform/job/eclipse.platform.ui-Gerrit/13475/

-------------------------------------
author: Isis Velasquez
date: 2017-09-12 07:15:30.000000000

Patch Set 3: Code-Review+2

-------------------------------------
author: Brenden Conley
date: 2017-09-12 07:33:22.000000000

Patch Set 3: Verified+1

Build Successful 

https://hudson.eclipse.org/platform/job/eclipse.platform.ui-Gerrit/13475/ : SUCCESS

-------------------------------------
author: Isis Velasquez
date: 2017-09-12 07:40:42.000000000

Patch Set 3:

I believe it can also remove the cause of potential bug.

  new Integer(2) != new Integer(2)
  Integer.valueOf(2) == Integer.valueOf(2)

People dealing with numbers, even with boxed types, are very likely to use '==' instead of equals and to just expect 2==2. Using the `new` constructor breaks this assumption made by many users.
As the boxed number classes are final and immutable, there is no risk of this change having some nasty side effect because of changing state.
It's even better to let auto-boxing do its work that to use the `new` constructors for Numbers, they're really evil!
This kind of change, despite seeming trivial, is very profitable and can really prevent many downstream code from having bugs and can even drastically improve performances in the nastiest cases.

-------------------------------------
