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

Remove unnecessary explicit initialization of volatile variables

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Unresolved
    • Icon: P4 P4
    • tbd
    • 9
    • core-libs
    • generic
    • generic

      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.

        There are no Sub-Tasks for this issue.

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

              Created:
              Updated:
              Imported:
              Indexed: