commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Henri Yandell (JIRA)" <j...@apache.org>
Subject [jira] Reopened: (LANG-76) [lang] EnumUtils.getEnum() doesn't work well in 1.5
Date Sun, 16 Aug 2009 07:16:14 GMT

     [ https://issues.apache.org/jira/browse/LANG-76?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Henri Yandell reopened LANG-76:
-------------------------------


Reopening issue based on Lew's diatribe. Fix version will be set to 2.x. I don't expect to
see such a release happen and this code has been removed from 3.0, however if a 2.x release
does happen then I want to make sure this is up for consideration along with the other Enum
issues.

Plus it will be easier to find the problem if it is in an open issue than a closed issue.

> [lang] EnumUtils.getEnum() doesn't work well in 1.5
> ---------------------------------------------------
>
>                 Key: LANG-76
>                 URL: https://issues.apache.org/jira/browse/LANG-76
>             Project: Commons Lang
>          Issue Type: Bug
>    Affects Versions: 2.1
>         Environment: Operating System: other
> Platform: Other
>            Reporter: Igor Laberov
>             Fix For: 2.x
>
>
> Hi,
> I encountered with problem using EnumUtils.getEnum() in 1.5. It appears that my
> Enum class should be accessed first so constructor will be called. In 1.4 it was
> enough to have myClass.class, so all static members were initialized. In 1.5 it
> doesn't work.
> I noticed that static members are not initialized anymore while acessing to
> class definition. See the code
> public class Test {
>     public static final class TT{
>         public static final TT one = new TT();
>         private TT(){
>             System.out.println("Called TT" );
>         }
>     }
>     
>     public static void main(String[] args) {
>      Class cl = TT.class;
>    // System.out.println( TT.one);
>   //  System.out.println(TT.class.isAssignableFrom(String.class));
>     }
> }
> In 1.4 constructor of TT is called, while in 1.5 is not. 
> Actually, according to the spec
> (http://java.sun.com/docs/books/jls/second_edition/html/execution.doc.html#57946),
> this is right behavior of Java. 
> Unfortunately, I didn't succeded to think about good solution..
> P.s. I know that in 1.5 we have enum built-in, but it is not the same, and we
> try to move to 1.5 without too much changes

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message