Bug 42299 - IllegalStateException when initializing static members
Summary: IllegalStateException when initializing static members
Status: RESOLVED DUPLICATE of bug 37565
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.0   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 3.0 M4   Edit
Assignee: Philipe Mulet CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2003-08-30 14:48 EDT by Christian Nelson CLA
Modified: 2003-09-02 07:55 EDT (History)
0 users

See Also:


Attachments
Code (and details) that fails to execute on 3.0. (501.35 KB, application/octet-stream)
2003-08-30 14:52 EDT, Christian Nelson CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Christian Nelson CLA 2003-08-30 14:48:36 EDT
When I switch from version 2.1 to 3.0 M1 (M2 and M3 as well), two of my 
projects stopped running from within Eclipse.  Versiosn 2.1 and 2.1.1 still 
work fine however.

This is the error I'm getting, and it's got something to do with static 
initialization, I think.  Seems like the order that things are initialized 
might be different (why I can't fathom).  Error message when executing:

<<<
java.lang.IllegalStateException: Class not found in enumLookup class 
com.aaw.common.enum.ProductType
at com.aaw.common.enum.infrastructure.EnumBean.getEnums(EnumBean.java:77)
at com.aaw.producttool.ProductTool.main(ProductTool.java:23)
Exception in thread "main" 
>>>

I can't pinpoint the problem exactly.  I stripped down my two projects to the 
smallest set of code I could find that still reproduced the problem (and also 
work using 2.1.1).  I've placed a zip on a public server containing the two 
projects, as well as my preferences file.

The file can be found at: http://www.slac.com/cnelson/eclipse-bug.zip

There are two projects, one called aaw_common and another called 
aaw_product_tool (which depends on aaw_common).  In the top-level of 
aaw_product_tool, my preferences and config details for 2.1.1 and 3.0 M3 can be 
found.

Please let me know what I can do to help with this... I'm a bit stumped, but 
given some guidance, would like to help figure out what's going on exactly.

Best regards,
Christian
Comment 1 Christian Nelson CLA 2003-08-30 14:52:22 EDT
Created attachment 5915 [details]
Code (and details) that fails to execute on 3.0.

There are two projects... aaw_common and aaw_product_tool (depending on
aaw_common).  Under 3.0, ProductTool.main() throws an IllegalStateException
when run, under 2.1.1 it runs fine.

Preferences and configuration details may be found in the top-level
aaw_product_tool directory.

This file is also available at: http://www.slac.com/cnelson/eclipse-bug.zip
Comment 2 Philipe Mulet CLA 2003-09-02 07:55:04 EDT
Problem reproduced. It comes from the fact the class literal is no longer 
supposed to initialize the referenced class, which your code relies upon.

For instance, the following works fine:
        try {
            DefaultComboBoxModel cbm = new DefaultComboBoxModel
(EnumBean.getEnums(Class.forName("com.aaw.common.enum.ProductType")).toArray());
        }
        catch (ClassNotFoundException e) {
        }


Also see bug 37565 for further details.


*** This bug has been marked as a duplicate of 37565 ***