harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ton...@apache.org
Subject svn commit: r572592 - in /harmony/enhanced/classlib/trunk/modules/luni/src: main/java/java/util/HugeEnumSet.java test/api/common/tests/api/java/util/EnumSetTest.java
Date Tue, 04 Sep 2007 09:36:24 GMT
Author: tonywu
Date: Tue Sep  4 02:36:19 2007
New Revision: 572592

URL: http://svn.apache.org/viewvc?rev=572592&view=rev
Log:
Apply patch Harmony-4728 ([classlib][luni] EnumSet will not properly handle elements of ordinal
bigger than 62)

Modified:
    harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/HugeEnumSet.java
    harmony/enhanced/classlib/trunk/modules/luni/src/test/api/common/tests/api/java/util/EnumSetTest.java

Modified: harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/HugeEnumSet.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/HugeEnumSet.java?rev=572592&r1=572591&r2=572592&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/HugeEnumSet.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/HugeEnumSet.java
Tue Sep  4 02:36:19 2007
@@ -83,6 +83,8 @@
             currentElementMask = unProcessedBits[bitsPosition]
                     & (-unProcessedBits[bitsPosition]);
             unProcessedBits[bitsPosition] -= currentElementMask;
+            int index = Long.numberOfTrailingZeros(currentElementMask)
+                    + bitsPosition * BIT_IN_LONG;
             if (0 == unProcessedBits[bitsPosition]) {
                 int oldBitsPosition = bitsPosition;
                 findNextNoneZeroPosition(bitsPosition + 1);
@@ -90,8 +92,7 @@
                     canProcess = false;
                 }
             }
-            return enums[Long.numberOfTrailingZeros(currentElementMask)
-                    + bitsPosition * BIT_IN_LONG];
+            return enums[index];
         }
 
         public void remove() {

Modified: harmony/enhanced/classlib/trunk/modules/luni/src/test/api/common/tests/api/java/util/EnumSetTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/luni/src/test/api/common/tests/api/java/util/EnumSetTest.java?rev=572592&r1=572591&r2=572592&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/luni/src/test/api/common/tests/api/java/util/EnumSetTest.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/luni/src/test/api/common/tests/api/java/util/EnumSetTest.java
Tue Sep  4 02:36:19 2007
@@ -1546,6 +1546,14 @@
         assertFalse(hugeSet.contains(HugeEnum.a));
         // RI's bug, EnumFoo.b should not exist at the moment.
         assertFalse("Should return false", set.contains(EnumFoo.b)); //$NON-NLS-1$
+        
+        // Regression for HARMONY-4728
+        hugeSet = EnumSet.allOf(HugeEnum.class);
+        hIterator = hugeSet.iterator();
+        for( int i = 0; i < 63; i++) {
+            hIterator.next();
+        }
+        assertSame(HugeEnum.ll, hIterator.next());
     }
     
     /**



Mime
View raw message