[cal10n-dev] Trivial problem about Enum#getClass()

Ceki Gulcu ceki at qos.ch
Wed Sep 2 10:32:55 CEST 2009


Hello Takeshi,

Thanks for the information. I have corrected the bug you describe in the GIT repo.

Takeshi Kondo wrote:
 >
 >  I found a trivial bug.
 >
 > MessageConveyor #68
 > String resouceBundleName = AnnotationExtractor.getResourceBundleName(key
 >        .getClass());
 >
 > Enum#getClass() is specific as follows.
 > ---
 > public enum MSG{
 >  A,
 >   B{ }
 > }
 > 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().


 >  Takeshi Kondo

-- 
Ceki Gülcü
Logback: The reliable, generic, fast and flexible logging framework for Java.
http://logback.qos.ch


More information about the cal10n-dev mailing list