harmony-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Tim Ellison <t.p.elli...@gmail.com>
Subject Re: svn commit: r418844 - in /incubator/harmony/enhanced/classlib/trunk/modules/luni/src: main/java/java/util/HashMap.java test/java/tests/api/java/util/HashMapTest.java
Date Tue, 04 Jul 2006 09:35:18 GMT
Nathan,

I have rolled back this commit (in r418963) because it was causing lots
of test failures on Linux and Windows.

Please can you take another look at it?

Regards,
Tim


ndbeyer@apache.org wrote:
> Author: ndbeyer
> Date: Mon Jul  3 13:47:39 2006
> New Revision: 418844
> 
> URL: http://svn.apache.org/viewvc?rev=418844&view=rev
> Log:
> Apply patch and additional fixes for HARMONY-403: HashMap hashcode ignores values in
entries
> 
> Modified:
>     incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/HashMap.java
>     incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/util/HashMapTest.java
> 
> Modified: incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/HashMap.java
> URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/HashMap.java?rev=418844&r1=418843&r2=418844&view=diff
> ==============================================================================
> --- incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/HashMap.java
(original)
> +++ incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/HashMap.java
Mon Jul  3 13:47:39 2006
> @@ -47,7 +47,8 @@
>  
>          Entry(K theKey, V theValue) {
>              super(theKey, theValue);
> -            this.hash = (theKey == null) ? 0 : theKey.hashCode();
> +            this.hash = (theKey == null ? 0 : theKey.hashCode())
> +                    ^ (theValue == null ? 0 : theValue.hashCode());
>          }
>  
>          @Override
> @@ -523,8 +524,11 @@
>                  index = key == null ? 0 : (key.hashCode() & 0x7FFFFFFF)
>                          % elementData.length;
>              }
> -            entry = createEntry(key, index, null);
> +            entry = createEntry(key, index, value);
> +            //new entry, so nothing is replaced
> +            return null;
>          }
> +        
>          V result = entry.value;
>          entry.value = value;
>          return result;
> 
> Modified: incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/util/HashMapTest.java
> URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/util/HashMapTest.java?rev=418844&r1=418843&r2=418844&view=diff
> ==============================================================================
> --- incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/util/HashMapTest.java
(original)
> +++ incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/util/HashMapTest.java
Mon Jul  3 13:47:39 2006
> @@ -409,6 +409,20 @@
>  			return key == ((ReusableKey) o).key;
>  		}
>  	}
> +    
> +    public void test_hashCode() {
> +        HashMap map = new HashMap(10);
> +        Integer key = new Integer(1);
> +        Integer val = new Integer(2);
> +        map.put(key, val);
> +        int expected = key.hashCode() ^ val.hashCode();
> +        assertEquals(expected, map.hashCode());
> +        key = new Integer(4);
> +        val = new Integer(8);
> +        map.put(key, val);
> +        expected += key.hashCode() ^ val.hashCode();
> +        assertEquals(expected, map.hashCode());
> +    } 
>  	
>  	/**
>  	 * Sets up the fixture, for example, open a network connection. This method
> 
> 
> 

-- 

Tim Ellison (t.p.ellison@gmail.com)
IBM Java technology centre, UK.

---------------------------------------------------------------------
Terms of use : http://incubator.apache.org/harmony/mailing.html
To unsubscribe, e-mail: harmony-dev-unsubscribe@incubator.apache.org
For additional commands, e-mail: harmony-dev-help@incubator.apache.org


Mime
View raw message