EnumSet fix

Andrew John Hughes gnu_andrew@member.fsf.org
Thu Aug 30 00:17:00 GMT 2007


This fixes a bug just fixed in Classpath where the complement of
an EnumSet is calculated incorrectly.  Because this works via flipping
the bits in the bitset, flipping those bits unused by the enumset
results in a incorrect output.  For example, the complement of an enumset
for a 5 element enum with 2 of the elements present, prior to this bug fix,
is an enumset with the three remaining elements (correct) plus an additional
59 entries resulting from the inversion of the entire 64 bits in the bitset.
This then leads to an IndexOutOfBoundsException on iteration.

I've attached the fix patched against GCC trunk. Okay to commit?

Thanks,
-- 
Andrew :-)

Escape the Java Trap with GNU Classpath!
http://www.gnu.org/philosophy/java-trap.html
public class gcj extends Freedom implements Java { ... }
-------------- next part --------------
A non-text attachment was scrubbed...
Name: enumset.diff
Type: text/x-diff
Size: 10552 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/java-patches/attachments/20070830/395f8234/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://gcc.gnu.org/pipermail/java-patches/attachments/20070830/395f8234/attachment.sig>


More information about the Java-patches mailing list