Java Solaris Communities Sun Store Join SDN My Profile Why Join?
 
Bug Database
Bug Detail
Quick Lists
Top 25 Bugs
Top 25 RFE's
Recently Closed Bugs
Printable Page Printable Page


Bug Database
Bug ID: 5020490
Votes 0
Synopsis (reflect) Class.isEnum should return false for specialized enum constants
Category java:classes_lang
Reported Against tiger-beta2
Release Fixed 1.5(tiger-b46)
State 10-Fix Delivered, bug
Priority: 3-Medium
Related Bugs 6708424
Submit Date 25-MAR-2004
Description
the following program should print "false", as the classof a is an anonymous
class that was not declared as an enumeration type.

The proper implementation of isEnum should check both the ACC_ENUM bit on
the class AND that the direct supertype is java.lang.Enum.  Only when both
conditions are true should the method return true.

enum E {
    a {};
    public static void main(String[] args) {
        System.out.println(a.getClass().isEnum());
    }
}
Work Around
N/A
Evaluation
Yes; should be fixed.

  xxxxx@xxxxx   2004-03-26
Comments
  
  Include a link with my name & email   

Submitted On 15-OCT-2007
This does not seems correct, otherwise the following assertion fails:

enum MySpecializedEnum {
...}

MySpecializedEnum e = MySpecializedEnum.SOMECONSTANT;

assert e.getClass().isEnum()



PLEASE NOTE: JDK6 is formerly known as Project Mustang