Community
Participate
Working Groups
JDT/Core v_539 package xy; public enum Color { RED, GREEN(), BLUE(17), PINK(1) {/*anon*}; Color() {} Color(int i) {} } Error 2005-03-08 10:12:45.838 An internal error occurred during: "Requesting Java AST from selection". java.lang.IllegalArgumentException at org.eclipse.jdt.core.dom.ASTNode.setSourceRange(ASTNode.java:2586) at org.eclipse.jdt.core.dom.ASTConverter.convert(ASTConverter.java:1292) at org.eclipse.jdt.core.dom.ASTConverter.buildBodyDeclarations(ASTConverter.java:238) at org.eclipse.jdt.core.dom.ASTConverter.convertToEnumDeclaration(ASTConverter.java:2612) at org.eclipse.jdt.core.dom.ASTConverter.convert(ASTConverter.java:2369) at org.eclipse.jdt.core.dom.ASTConverter.convert(ASTConverter.java:1147) at org.eclipse.jdt.core.dom.CompilationUnitResolver.convert(CompilationUnitResolver.java:249) at org.eclipse.jdt.core.dom.ASTParser.internalCreateAST(ASTParser.java:787) at org.eclipse.jdt.core.dom.ASTParser.createAST(ASTParser.java:575) at org.eclipse.jdt.internal.ui.javaeditor.ASTProvider.createAST(ASTProvider.java:565) at org.eclipse.jdt.internal.ui.javaeditor.ASTProvider.getAST(ASTProvider.java:496) at org.eclipse.jdt.internal.ui.viewsupport.SelectionListenerWithASTManager$PartListenerGroup.calculateASTandInform(SelectionListenerWithASTManager.java:165) at org.eclipse.jdt.internal.ui.viewsupport.SelectionListenerWithASTManager$3.run(SelectionListenerWithASTManager.java:142) at org.eclipse.core.internal.jobs.Worker.run(Worker.java:67)
I am investigating.
The problem is in the recovery. The anonymous type for PINK is not closed.
Fixed. If the declarationSourceEnd of the last enum constant body is 0 then this declarationSourceEnd must be set to the value of the declarationSourceEnd of the enum constant.
Regression test added in ASTConverter15Test.test0145.
Reopen. If the test case is: package xy; public enum Color { RED, GREEN(), BLUE(17), PINK(1) {/*anon*}; Color() {} Color(int i) {} It doesn't work. I am investigating.
Fixed and released in HEAD. New test case added in ASTConverter15Test.test0148.
Verified in 20050330-0500