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

Remove unnecessary explicit initialization of volatile variables

    XMLWordPrintable

    Details

    • Type: Enhancement
    • Status: Open
    • Priority: P4
    • Resolution: Unresolved
    • Affects Version/s: 9
    • Fix Version/s: tbd
    • Component/s: core-libs
    • Labels:
    • CPU:
      generic
    • OS:
      generic

      Description

      An explicit initialization of a volatile class instance variable, such as private volatile Object = null; or private volatile int scale = 0; is unnecessary since the Java spec automatically initializes objects to null and primitive type short, int, long, float and double to 0 and boolean to false. Explicit initialization of volatile variable to a value the same as the default implicit initialized value results in an unnecessary store and membar operation.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              huntch Charlie Hunt
              Reporter:
              huntch Charlie Hunt
              Votes:
              0 Vote for this issue
              Watchers:
              6 Start watching this issue

                Dates

                Created:
                Updated:
                Imported:
                Indexed: