harmony-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Spark Shen <smallsmallor...@gmail.com>
Subject [classlib][luni] On RI, constructor of EnumMap -- EnumMap(Class<K> keyType) throws unspecified NullPointerException
Date Tue, 15 Aug 2006 03:50:09 GMT
Hi All:
Constructor of EnumMap -- EnumMap(Class<K> keyType) behaves a little odd:

I first synthesis an enum type with class body as below:
enum color {

Then constructs java.util.EnumMap(Class<K>) using this Enum type:

import java.util.EnumMap;

public class ConstructEnumMap {
    enum color {
    enum fruit {
    public static void main(String[] args) {
        new EnumMap(fruit.apple.getClass());
        *new EnumMap(color.blue.getClass());*


NullPointerException will be thrown out from the bolded line. While 
using enum type without a class body, no such exception
will be thrown out. This behavior is unspecified on spec. IMO, this is a 
bug of RI.

What is your opinion about this behavior?

Best regards

Spark Shen
China Software Development Lab, IBM

Terms of use : http://incubator.apache.org/harmony/mailing.html
To unsubscribe, e-mail: harmony-dev-unsubscribe@incubator.apache.org
For additional commands, e-mail: harmony-dev-help@incubator.apache.org

View raw message