Bug 102497

Summary: [model] Static initializer not listed for binary class with source.
Product: [Eclipse Project] JDT Reporter: Brian Miller <bmiller>
Component: CoreAssignee: Jerome Lanneluc <jerome_lanneluc>
Status: RESOLVED WONTFIX QA Contact:
Severity: minor    
Priority: P3 CC: daniel_megert, frederic_fusier, martinae
Version: 3.1   
Target Milestone: 3.3 RC4   
Hardware: PC   
OS: Windows XP   
Whiteboard:

Description Brian Miller CLA 2005-07-01 11:45:22 EDT
Open class java.lang.System in the Java Browsing perspective and see that the 
static initializer isn't listed in the Members tab.
Comment 1 Dirk Baeumer CLA 2005-07-02 13:43:20 EDT
Martin, can you please comment. It isn't listed in Outliner, package explorer
either.
Comment 2 Martin Aeschlimann CLA 2005-07-04 05:58:35 EDT
It isn't returned by the Java model. Suggest to move it to core if this is
important.
Comment 3 Jerome Lanneluc CLA 2006-09-28 04:44:29 EDT
What is shown in the Outline view is not the outline of the attached source, but the outline of the .class file. However the .class file doesn't contain any information about the static initializer.

To solve this issue, one possibility would be to create a working copy on the .class file (using IClassFile#getWorkingCopy(...)) and have the Outline view show the outline of the working copy. 

Martin, what do you think ?
Comment 4 Martin Aeschlimann CLA 2006-09-28 06:47:16 EDT
Couldn't jdt.core automatically use the source if available?
Using the working copy in the editor would introduce new elements that don't exist at other places.
We will have to able to handle them everywhery else (in all actions) and even have to update all other tooling to not use classfile children but go through the working copy. That's not somthing we should start.
Comment 5 Dominik Goepel CLA 2007-04-24 07:04:26 EDT
i just experienced this bug using 3.3m6 (looking at java.io.Console).

From looking at rt.jar it seems that static initializers are defined in Foo$i.class, just like anonymous inner classes (which are also not shown in the outline of a .class with source attached).

Maybe its possible to include Foo$i.class when creating the model? That way, it would even work without source attachment.
Comment 6 Jerome Lanneluc CLA 2007-06-19 10:40:53 EDT
Foo$i.class is present in the model. It is filtered out by default in the Package Explorer. You can disable this filtering using the Package Explorer filter.

No action planned on JDT/Core side.