Community
Participate
Working Groups
1) Begin with a plugin project with a java annotated emf model that can be successfully reloaded. 2) Add a non-emf model class in any package such as: public class EmfReloadBug { public void buggyMethod() { Object o = new Object() { { System.out.println("EMF reload does not like this method local subtype instance init"); } } } } 3) Try to reload the genmodel. the package selection page for the reload wizard is empty and throws the following exception: org.eclipse.jdt.core.jdom.DOMException: Attempt to add child to node that cannot have children
This is a problem in JDOM. It looks familiar. It think last time this came up they said they wouldn't fix it and that we should use AST, which we plan to do but haven't done yet: https://bugs.eclipse.org/bugs/show_bug.cgi?id=78076 org.eclipse.jdt.core.jdom.DOMException: Attempt to add child to node that cannot have children at org.eclipse.jdt.internal.core.jdom.DOMNode.basicAddChild(DOMNode.java:344) at org.eclipse.jdt.internal.core.jdom.AbstractDOMBuilder.addChild(AbstractDOMBuilder.java:129) at org.eclipse.jdt.internal.core.jdom.DOMBuilder.addChild(DOMBuilder.java:139) at org.eclipse.jdt.internal.core.jdom.DOMBuilder.acceptInitializer(DOMBuilder.java:99) at org.eclipse.jdt.internal.compiler.DocumentElementParser.consumeClassBodyDeclaration(DocumentElementParser.java:116) at org.eclipse.jdt.internal.compiler.parser.Parser.consumeRule(Parser.java:4743) at org.eclipse.jdt.internal.compiler.parser.Parser.parse(Parser.java:8490) at org.eclipse.jdt.internal.compiler.DocumentElementParser.parseType(DocumentElementParser.java:1285) at org.eclipse.jdt.internal.core.jdom.DOMBuilder.createType(DOMBuilder.java:266) at org.eclipse.jdt.core.jdom.DOMFactory.createType(DOMFactory.java:158) at org.eclipse.jdt.internal.core.jdom.DOMType.getDetailedNode(DOMType.java:392) at org.eclipse.jdt.internal.core.jdom.DOMNode.becomeDetailed(DOMNode.java:390) at org.eclipse.jdt.internal.core.jdom.DOMMember.getComment(DOMMember.java:218) at org.eclipse.emf.importer.java.builder.JavaEcoreBuilder.analyzeType(JavaEcoreBuilder.java:692)
Assigning bug to owner of component...
*** Bug 103336 has been marked as a duplicate of this bug. ***
I am unfamiliar with EMF. Could you please provide steps to reach step 1? Thanks.
The problem doesn't need EMF to reproduce. You should be able to reproduce it just building the JDOM for the sample code below and then calling getComment on the type.
Reproduced. The problem comes from the fact that the DOMBuilder has no support for anonymous type. It tries to add the initializer inside the anonymous in the enclosing method and this is illegal. The fix would be to ignore initializers inside methods.
I believe the fix is to run the DocumentElementParser only in diet mode. There is no need to look into method bodies since it is illegal to add a child to a method node.
Do you need a fix for 3.1.1 or will you update to DOM/AST before that?
We won't move to AST until Eclipse 3.2, and even at that point, the old code will remain and be deprecated...
+1 for 3.1.1 then.
Fixed and released in both HEAD and 3.1 maintenance stream. Regression tests added in internal JDOM tests packages.
Thanks so much for fixing this and so quickly too! It's much appreciated!!
No problem. As soon as we provide a new preview of 3.1.1 branch, you should give it a try.
Verified using M20050923-1430 for 3.1.1