The tests on java.util.EnumMap use the following code pattern:
---------------------------------------------------------
Object [] array = {
Suit.CLUBS, null,
Suit.DIAMONDS, "val1",
Suit.HEARTS, "val2",
Suit.SPADES, new Integer(1)
};
...
EnumMap map = new EnumMap(Suit.class);
...
for (int j = 0; j < i; j += 2) {
map.put(array[j], array[j + 1]); // *
}
---------------------------------------------------------
The line marked (*) cause compilation error since JDK7 b55 with the output:
---------------------------------------------------------
minitest.java:15: cannot find symbol
map.put(array[0], array[1]);
^
symbol: method put(java.lang.Object,java.lang.Object)
location: class java.util.EnumMap
---------------------------------------------------------
---------------------------------------------------------
Object [] array = {
Suit.CLUBS, null,
Suit.DIAMONDS, "val1",
Suit.HEARTS, "val2",
Suit.SPADES, new Integer(1)
};
...
EnumMap map = new EnumMap(Suit.class);
...
for (int j = 0; j < i; j += 2) {
map.put(array[j], array[j + 1]); // *
}
---------------------------------------------------------
The line marked (*) cause compilation error since JDK7 b55 with the output:
---------------------------------------------------------
minitest.java:15: cannot find symbol
map.put(array[0], array[1]);
^
symbol: method put(java.lang.Object,java.lang.Object)
location: class java.util.EnumMap
---------------------------------------------------------
- duplicates
-
JDK-6846972 cannot access member of raw type when erasure change overriding into overloading
- Closed
- relates to
-
JDK-6400189 raw types and inference
- Closed