Issue Details (XML | Word | Printable)

Key: LANG-76
Type: Bug Bug
Status: Reopened Reopened
Priority: Major Major
Assignee: Unassigned
Reporter: Igor Laberov
Votes: 3
Watchers: 2
Operations

If you were logged in you would be able to see more operations.
Commons Lang

[lang] EnumUtils.getEnum() doesn't work well in 1.5

Created: 15/Sep/05 06:20 PM   Updated: 16/Aug/09 07:15 AM
Return to search
Component/s: None
Affects Version/s: 2.1
Fix Version/s: 2.x

Time Tracking:
Not Specified

Environment:
Operating System: other
Platform: Other
Issue Links:
Duplicate
 

Bugzilla Id: 36666


 Description  « Hide
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



 All   Comments   Work Log   Change History   Subversion Commits      Sort Order: Ascending order - Click to sort in descending order
Henri Yandell made changes - 16/May/06 10:00 AM
Field Original Value New Value
issue.field.bugzillaimportkey 36666 12342556
Henri Yandell made changes - 16/May/06 11:41 AM
Assignee Jakarta Commons Developers Mailing List [ commons-dev@jakarta.apache.org ]
Affects Version/s 2.1 Final [ 12311659 ]
Key COM-2404 LANG-76
Fix Version/s 2.2 [ 12311686 ]
Project Commons [ 12310458 ] Commons Lang [ 12310481 ]
Component/s Lang [ 12311121 ]
Henri Yandell made changes - 16/May/06 12:09 PM
Affects Version/s 2.1 Final [ 12311701 ]
Henri Yandell made changes - 16/May/06 12:09 PM
Fix Version/s 2.2 [ 12311702 ]
Henri Yandell made changes - 08/Jun/06 03:42 PM
Fix Version/s 2.2 [ 12311702 ]
Fix Version/s 2.3 [ 12311948 ]
Henri Yandell made changes - 19/Sep/06 09:43 PM
Link This issue is duplicated by LANG-153 [ LANG-153 ]
Henri Yandell made changes - 06/Dec/06 09:02 AM
Bugzilla Id 36666
Fix Version/s 3.0 [ 12311714 ]
Fix Version/s 2.3 [ 12311948 ]
Henri Yandell made changes - 03/Nov/07 08:09 AM
Fix Version/s 3.0 [ 12311714 ]
Fix Version/s 2.4 [ 12312481 ]
Henri Yandell made changes - 12/Nov/07 08:30 PM
Status Open [ 1 ] Closed [ 6 ]
Resolution Won't Fix [ 2 ]
Henri Yandell made changes - 16/Aug/09 07:15 AM
Status Closed [ 6 ] Reopened [ 4 ]
Resolution Won't Fix [ 2 ]
Henri Yandell made changes - 16/Aug/09 07:15 AM
Fix Version/s 2.4 [ 12312481 ]
Fix Version/s 2.x [ 12313695 ]