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

(reflect) Potential concurrency issues with generic reflection methods

XMLWordPrintable

      A DESCRIPTION OF THE FIX :
        Bug Description : NullPointerException and inconsistent results in generic reflection methods.
      If multiple threads seek generic reflection information about the same class, only the first
      is guaranteed to get valid results. The others may get incorrect results, or get NullPointerException
      exceptions.
      Subset of Releases affected : 1.5.0, Mustang b74
      Platforms affected : Windows XP 64 bit
        Evaluation: The lack of the volatile qualifier on the genericInfo field means that access to
      this field is not data race free.
      Diff baseline : Mustang b74
      Diff :
       Class.java.old Wed Mar 8 11:40:24 2006
      +++ Class.java Wed Mar 8 11:42:01 2006
      @@ -553,6 +553,8 @@
           }
       
           // cache the name to reduce the number of calls into the VM
      + // Note: Does not need to be volatile, because String is safe for
      + // reference via data races.
           private transient String name;
           private native String getName0();
       
      @@ -2211,7 +2213,7 @@
           private native String getGenericSignature();
       
           // Generic info repository; lazily initialized
      - private transient ClassRepository genericInfo;
      + private volatile transient ClassRepository genericInfo;
       
           // accessor for factory
           private GenericsFactory getFactory() {


      JUnit TESTCASE :
      This would be amost impossible to show in a test case.

            darcy Joe Darcy
            tbell Tim Bell
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: