Name: skR10005 Date: 11/28/2003
The following new api test fails on JDK1.5.0-b29:
api/java_util/EnumMap/index.html#EntrySet[EntrySet006]
api/java_util/EnumMap/index.html#KeySet[KeySet006]
api/java_util/EnumMap/index.html#Methods[Methods001]
api/java_util/EnumMap/index.html#Values[Values006]
The API specification of the method EnumMap.clear reads:
"Removes all mappings from this map."
However RI does not remove mappings.
The following simple test can be used to reproduce the failure:
===============================test.java=======================
import java.util.EnumMap;
public class test {
public static void main(String[] argv) {
EnumMap map = new EnumMap(simpleEnum.class);
map.clear();
System.out.println("Value: " + map.get(simpleEnum.FIRST));
if(map.get(simpleEnum.FIRST) != null) {
System.out.println("Class: " + map.get(simpleEnum.FIRST).getClass());
}
}
}
===========================simpleEnum.java=====================
public enum simpleEnum { FIRST, LAST }
===============================================================
$ javac -d . -source 1.5 test.java simpleEnum.java
Note: test.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
$ java -version
java version "1.5.0-beta"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0-beta-b29)
Java HotSpot(TM) Server VM (build 1.5.0-beta-b29, mixed mode)
$ java -cp . test
Value: 0
Class: class java.lang.Integer
$
======================================================================