harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From zhouke...@apache.org
Subject svn commit: r790471 - in /harmony/enhanced/classlib/trunk/modules/awt/src: main/java/common/java/awt/SystemColor.java test/impl/boot/java/awt/SystemColorRTest.java
Date Thu, 02 Jul 2009 06:36:48 GMT
Author: zhoukevin
Date: Thu Jul  2 06:36:48 2009
New Revision: 790471

URL: http://svn.apache.org/viewvc?rev=790471&view=rev
Log:
Applied patch for HARMONY-6244, SystemColor.activeCaption and SystemColor.textHighlight have
the same hash value

Modified:
    harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/SystemColor.java
    harmony/enhanced/classlib/trunk/modules/awt/src/test/impl/boot/java/awt/SystemColorRTest.java

Modified: harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/SystemColor.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/SystemColor.java?rev=790471&r1=790470&r2=790471&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/SystemColor.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/SystemColor.java
Thu Jul  2 06:36:48 2009
@@ -235,6 +235,11 @@
         return value = getARGB();
     }
 
+    @Override
+    public int hashCode() {
+        return (index * 37) + value;
+    }
+
     private SystemColor(int index) {
         super(0, 0, 0);
         this.index = index;

Modified: harmony/enhanced/classlib/trunk/modules/awt/src/test/impl/boot/java/awt/SystemColorRTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/awt/src/test/impl/boot/java/awt/SystemColorRTest.java?rev=790471&r1=790470&r2=790471&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/awt/src/test/impl/boot/java/awt/SystemColorRTest.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/awt/src/test/impl/boot/java/awt/SystemColorRTest.java
Thu Jul  2 06:36:48 2009
@@ -20,6 +20,8 @@
  */
 package java.awt;
 
+import java.util.HashMap;
+
 import junit.framework.TestCase;
 
 public class SystemColorRTest extends TestCase {
@@ -39,4 +41,17 @@
         assertEquals(color.getGreen(), g);
         assertEquals(color.getBlue(), b);
     }
+
+    public void testHashCode() {
+        // Regression test for HARMONY-6244
+        assertTrue(SystemColor.activeCaption.hashCode() != SystemColor.textHighlight
+                .hashCode());
+        HashMap<Object, String> hashMap = new HashMap<Object, String>();
+        hashMap.put(SystemColor.activeCaption, "activeCaption");
+        hashMap.put(SystemColor.textHighlight, "textHighlight");
+        assertEquals(2, hashMap.size());
+        assertEquals("activeCaption", hashMap.get(SystemColor.activeCaption));
+        assertEquals("textHighlight", hashMap.get(SystemColor.textHighlight));
+    }
+
 }



Mime
View raw message