[cal10n-dev] [JIRA] Created: (CAL-1) Enum#getClass() not always correct

Ceki Gulcu (JIRA) noreply-jira at qos.ch
Tue Sep 1 21:02:36 CEST 2009


Enum#getClass() not always correct
----------------------------------

                 Key: CAL-1
                 URL: http://jira.qos.ch/browse/CAL-1
             Project: CAL10N
          Issue Type: Bug
            Reporter: Ceki Gulcu
            Assignee: Ceki Gulcu


As reported by Takeshi Kondo in http://www.qos.ch/pipermail/cal10n-dev/2009-September/000280.html

Quoting Takeshi:

I found a trivial bug.

 >> MessageConveyor #68
 > String resouceBundleName =  
AnnotationExtractor.getResourceBundleName(key
 >        .getClass());

Enum#getClass() is specific as follows.

----
public enum MSG{
   A,
   B{
     // override method
   }
}

public static void main(String[] args){
       System.out.println(MSG.A.getClass()); // -> $MSG
       System.out.println(MSG.B.getClass()); // -> $MSG$1
       System.out.println(MSG.B.getDeclaringClass()); // $MSG
}

----
If we need to get enum class form instance, we have to call  
Enum#getDeclaringClass().



-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.qos.ch/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        


More information about the cal10n-dev mailing list