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

java.util.HashMap.Entry.setValue() returns new value (as opposed to old)

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P3 P3
    • 1.4.1
    • 1.4.0
    • core-libs
    • hopper
    • x86
    • windows_xp
    • Verified



        Name: jl125535 Date: 01/23/2002


        FULL PRODUCT VERSION :
        java version "1.4.0-rc"
        Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.0-rc-b91)
        Java HotSpot(TM) Client VM (build 1.4.0-rc-b91, mixed mode)

        FULL OPERATING SYSTEM VERSION : Bug in java code, will
        occur in any OS.


        ADDITIONAL OPERATING SYSTEMS : Any



        EXTRA RELEVANT SYSTEM CONFIGURATION :
        None needed.

        A DESCRIPTION OF THE PROBLEM :
          Bug is obvious by looking at the source code for
        java.util.HashMap.Entry.setValue() (note that line numbers
        included below correspond to the HashMap.java file
        distributed with J2SDK 1.4.0-rc):

            653 public Object setValue(Object newValue) {
            654 Object oldValue = newValue;
            655 value = newValue;
            656 return oldValue;
            657 }

        Whereas the documentation for java.util.Map.Entry.setValue
        () states that the previous value should be returned
        instead:

        Returns:
        old value corresponding to the entry.



        This bug can be reproduced always.
        (Review ID: 138639)
        ======================================================================

              jjb Josh Bloch (Inactive)
              jleesunw Jon Lee (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: