The code in `Integer.decode()` and `Long.decode()` might allocate two instances 
of Integer/Long for the negative values less than -127:

Integer result;

result = Integer.valueOf(nm.substring(index), radix);
result = negative ? Integer.valueOf(-result.intValue()) : result;

To avoid this we can declare 'result' as `int` and use `Integer.parseInt()` 
method. Same applicable for `Long` and some other classes.

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

Commit messages:
 - Merge branch 'master' into 8267844
 - 8267844: Replace Integer/Long.valueOf() with Integer/Long.parse*() where 
applicable

Changes: https://git.openjdk.java.net/jdk/pull/5068/files
 Webrev: https://webrevs.openjdk.java.net/?repo=jdk&pr=5068&range=00
  Issue: https://bugs.openjdk.java.net/browse/JDK-8267844
  Stats: 12 lines in 4 files changed: 0 ins; 1 del; 11 mod
  Patch: https://git.openjdk.java.net/jdk/pull/5068.diff
  Fetch: git fetch https://git.openjdk.java.net/jdk pull/5068/head:pull/5068

PR: https://git.openjdk.java.net/jdk/pull/5068

Reply via email to