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

clean up uses of boxed primitive constructors in the java.desktop module

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: P3
    • Resolution: Fixed
    • Affects Version/s: 9
    • Fix Version/s: 9
    • Component/s: client-libs
    • Labels:
    • Resolved In Build:
      b117

      Description

      JDK-8145468 will deprecate the boxed primitive constructors. There are currently over 100 uses of these constructors in the java.desktop module; these will generate warnings at compile time. The changeset for JDK-8145468 will temporarily disable deprecation warnings for java.desktop.

      This bug covers cleanup of these warnings. As part of this cleanup, the deprecation warnings should be re-enabled.

      For the most part, changing a call to a constructor can straightforwardly be replaced by a call to the corresponding valueOf() method. For example,

          new Double(dval)

      can be replaced with

          Double.valueOf(dval)

      It's possible to use 'dval' itself in some contexts, and rely on autoboxing, but this can be a bit dangerous. I only recommend converting to autoboxing if it's clear from context that relying on it is safe.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                prr Philip Race
                Reporter:
                smarks Stuart Marks
              • Votes:
                0 Vote for this issue
                Watchers:
                4 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: