Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8267844

Replace Integer/Long.valueOf() with Integer/Long.parse*() where applicable

    XMLWordPrintable

    Details

    • Type: Enhancement
    • Status: Resolved
    • Priority: P4
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 18
    • Component/s: core-libs
    • Labels:
      None
    • Resolved In Build:
      b11

      Description

      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 parseInt() method. Same for Long.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              stsypanov Sergey Tsypanov
              Reporter:
              stsypanov Sergey Tsypanov
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: