Community
Participate
Working Groups
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.
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.
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.
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.
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.
Verified.