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

ResourceBundle lookup fields not completely thread-safe

    XMLWordPrintable

Details

    • b137
    • generic
    • generic
    • Not verified

    Description

      Here's a change to make "lookup" fields be more memory-model-correct:

      diff --git a/src/java.base/share/classes/java/util/ListResourceBundle.java b/src/java.base/share/classes/java/util/ListResourceBundle.java
      --- a/src/java.base/share/classes/java/util/ListResourceBundle.java
      +++ b/src/java.base/share/classes/java/util/ListResourceBundle.java
      @@ -206,5 +206,5 @@
               lookup = temp;
           }
       
      - private Map<String,Object> lookup = null;
      + private volatile Map<String,Object> lookup = null;
       }
      diff --git a/src/java.base/share/classes/java/util/PropertyResourceBundle.java b/src/java.base/share/classes/java/util/PropertyResourceBundle.java
      --- a/src/java.base/share/classes/java/util/PropertyResourceBundle.java
      +++ b/src/java.base/share/classes/java/util/PropertyResourceBundle.java
      @@ -236,5 +236,5 @@
       
           // ==================privates====================
       
      - private Map<String,Object> lookup;
      + private final Map<String,Object> lookup;
       }

      Attachments

        Activity

          People

            nishjain Nishit Jain
            martin Martin Buchholz
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: