Harmony
  1. Harmony
  2. HARMONY-6419

[classlib][luni] Changes to IdentityHashMap entrySet doesn't reflect underlying map

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 5.0M12
    • Fix Version/s: 5.0M16
    • Component/s: Classlib
    • Labels:
      None

      Description

      The following test fails on Harmony.
      (With thanks to http://blogs.oracle.com/charlesLamb/2010/01/harmonydavlik_identityhashmap.html)

      import java.util.IdentityHashMap;
      import java.util.Set;
      import java.util.Map.Entry;

      import junit.framework.TestCase;

      public class IHMTest extends TestCase {

      public void testEntrySet()

      { IdentityHashMap<String, String> ihm = new IdentityHashMap<String, String>(); String key = "key"; String value = "value"; ihm.put(key, value); Set<Entry<String, String>> set = ihm.entrySet(); assertEquals(1, set.size()); Entry<String, String> entry = set.iterator().next(); String newValue = "newvalue"; entry.setValue(newValue); assertSame(newValue, ihm.get(key)); }

      }

      1. HARMONY-6419v2.diff
        4 kB
        Kevin Zhou
      2. 6419.patch
        3 kB
        Catherine Hope

        Activity

        Hide
        Catherine Hope added a comment -

        A simple fix is to store a reference to the IdentityHashMap in the IdentityHashMapEntry and override the MapEntry.setValue method to additionally put the new value in the hash map.

        Show
        Catherine Hope added a comment - A simple fix is to store a reference to the IdentityHashMap in the IdentityHashMapEntry and override the MapEntry.setValue method to additionally put the new value in the hash map.
        Hide
        Stuart McCulloch added a comment -

        FYI, this bug is the reason why recent Maven3 release candidates fail on IBM JDKs, so it would be good to know if this will be fixed in the near term.
        In the meantime we'll attempt to workaround this bug, but I'm really surprised this fundamentally broken behavior has remained unfixed for so long.

        Show
        Stuart McCulloch added a comment - FYI, this bug is the reason why recent Maven3 release candidates fail on IBM JDKs, so it would be good to know if this will be fixed in the near term. In the meantime we'll attempt to workaround this bug, but I'm really surprised this fundamentally broken behavior has remained unfixed for so long.
        Hide
        Kevin Zhou added a comment -

        Hi Tim,

        I make a new patch for this problem. It passes the tests, would you please help to review it?

        Show
        Kevin Zhou added a comment - Hi Tim, I make a new patch for this problem. It passes the tests, would you please help to review it?
        Hide
        Kevin Zhou added a comment -

        Would anyone like to help to review the HARMONY-6419v2.diff patch ? Thank you very much

        Show
        Kevin Zhou added a comment - Would anyone like to help to review the HARMONY-6419 v2.diff patch ? Thank you very much
        Hide
        Tim Ellison added a comment -

        Thanks Kevin. Patch applied to LUNI module, along with a testcase, at repo revision r1043880.

        Please verify it was applied as you expected.

        Show
        Tim Ellison added a comment - Thanks Kevin. Patch applied to LUNI module, along with a testcase, at repo revision r1043880. Please verify it was applied as you expected.
        Hide
        Hudson added a comment -

        Integrated in Harmony-1.5-head-linux-x86_64 #1024 (See https://hudson.apache.org/hudson/job/Harmony-1.5-head-linux-x86_64/1024/)

        Show
        Hudson added a comment - Integrated in Harmony-1.5-head-linux-x86_64 #1024 (See https://hudson.apache.org/hudson/job/Harmony-1.5-head-linux-x86_64/1024/ )
        Hide
        Hudson added a comment -

        Integrated in Harmony-select-1.5-head-linux-x86_64 #166 (See https://builds.apache.org/job/Harmony-select-1.5-head-linux-x86_64/166/)

        Show
        Hudson added a comment - Integrated in Harmony-select-1.5-head-linux-x86_64 #166 (See https://builds.apache.org/job/Harmony-select-1.5-head-linux-x86_64/166/ )

          People

          • Assignee:
            Tim Ellison
            Reporter:
            Tim Ellison
          • Votes:
            4 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development