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

entrySetView field is never updated in NavigableSubMap

XMLWordPrintable

    • b68
    • x86
    • windows_7
    • Not verified

      FULL PRODUCT VERSION :


      A DESCRIPTION OF THE PROBLEM :
      The field "entrySetView" in java.util.TreeMap$NavigableSubMap is initialized to null. It is never updated to non-null value.

      The method entrySet() in AscendingSubMap and DescendingSubMap look like this:

              public Set<Map.Entry<K,V>> entrySet() {
                  EntrySetView es = entrySetView;
                  return (es != null) ? es : new AscendingEntrySetView();
              }

              public Set<Map.Entry<K,V>> entrySet() {
                  EntrySetView es = entrySetView;
                  return (es != null) ? es : new DescendingEntrySetView();
              }

      Is this an intention or should it be the following:

              public Set<Map.Entry<K,V>> entrySet() {
                  EntrySetView es = entrySetView;
                  return (es != null) ? es : (entrySetView = new AscendingEntrySetView());
              }

              public Set<Map.Entry<K,V>> entrySet() {
                  EntrySetView es = entrySetView;
                  return (es != null) ? es : (entrySetView = new DescendingEntrySetView());
              }


      REPRODUCIBILITY :
      This bug can be reproduced always.

            mduigou Mike Duigou
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: