Bug 44293

Summary: DOMFactory.createInitializer() always creates a static intializer
Product: [Eclipse Project] JDT Reporter: Vijayan <kvijayan>
Component: CoreAssignee: Olivier Thomann <Olivier_Thomann>
Status: VERIFIED FIXED QA Contact:
Severity: critical    
Priority: P3    
Version: 2.1   
Target Milestone: 3.0 M4   
Hardware: PC   
OS: Windows 2000   
Whiteboard:

Description Vijayan CLA 2003-10-07 08:01:50 EDT
DOMFactory.createInitializer() always creates a static intializer instead of 
instance initializer.

Even calling the 
IDOMInitializer.setFlags(org.eclipse.jdt.core.dom.Modifier.NONE) 

method has no effect on this.
Comment 1 Olivier Thomann CLA 2003-10-07 10:30:27 EDT
IDOMFactory.createInitializer() always creates a static initializer with no body.
This is the correct behavior. However there is a bug. The static modifier should
be removed when IDOMInitializer.setFlags(org.eclipse.jdt.core.Flags.AccDefault)
is called.
Use org.eclipse.jdt.core.Flags.AccDefault and not
org.eclipse.jdt.core.dom.Modifier.NONE. One is for the JDOM API and the other
for the DOM API. The JDOM will be deprecated soon.
Fixed and released in HEAD.
Regression test added.
Comment 2 Vijayan CLA 2003-10-07 23:31:35 EDT
org.eclipse.jdt.core.Flags.AccDefault flag is not defined in the documentation 
as well as in the source code of Eclipse version 2.1.0. And I have even tried 
IDOMInitializer.setFlags(0). But still the static modifier persists.
 
Comment 3 Olivier Thomann CLA 2003-10-08 07:52:32 EDT
I didn't say we had not a bug. The setFlags doesn't work for an initializer.
Now it is fixed in the 3.0 stream.
Comment 4 Vijayan CLA 2003-10-08 22:58:42 EDT
I am sorry that my statement has mislead. What I wanted to say was that :

1. org.eclipse.jdt.core.Flags.AccDefault flag is not present in the class Flag  
in version 2.1.0. As there is no description of it in the documentation as well 
as in the source code of version 2.1.0. Has it been introduced in post 2.1.0 ?

2. I used org.eclipse.jdt.core.dom.Modifier.NONE flag because no flag existed 
for default or none in JDOM APIs. I agree with you that this should not be used 
for JDOM API.

I agree with you that setFlags doesn't work for an initializer in version 2.1.0.
Comment 5 David Audel CLA 2003-10-09 07:40:16 EDT
Verified.