Community
Participate
Working Groups
Using 3.4M5, copy/paste the following code into a java editor: public class A { public void takeParam(int i) { // do something } void test() { char c = 'a'; public void takeParam(int i) { // do something } void test() { char c = 'a'; takeParam((int) c); }takeParam((int) c); } } I got it by doing a paste operation at the wrong location. On the next reconcile, an IAE is thrown. java.lang.IllegalArgumentException at org.eclipse.jdt.core.dom.ASTNode.setSourceRange(ASTNode.java:2611) at org.eclipse.jdt.core.dom.ASTConverter.convert(ASTConverter.java:493) at org.eclipse.jdt.core.dom.ASTConverter.buildBodyDeclarations(ASTConverter.java:317) at org.eclipse.jdt.core.dom.ASTConverter.convert(ASTConverter.java:2297) at org.eclipse.jdt.core.dom.ASTConverter.convert(ASTConverter.java:1549) at org.eclipse.jdt.core.dom.ASTConverter.convert(ASTConverter.java:2491) at org.eclipse.jdt.core.dom.ASTConverter.convert(ASTConverter.java:522) at org.eclipse.jdt.core.dom.ASTConverter.buildBodyDeclarations(ASTConverter.java:178) at org.eclipse.jdt.core.dom.ASTConverter.convert(ASTConverter.java:2676) at org.eclipse.jdt.core.dom.ASTConverter.convert(ASTConverter.java:1260) at org.eclipse.jdt.core.dom.CompilationUnitResolver.convert(CompilationUnitResolver.java:256) at org.eclipse.jdt.core.dom.ASTParser.internalCreateAST(ASTParser.java:894) at org.eclipse.jdt.core.dom.ASTParser.createAST(ASTParser.java:653) at org.eclipse.jdt.internal.ui.javaeditor.ASTProvider$1.run(ASTProvider.java:540) at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:37) at org.eclipse.jdt.internal.ui.javaeditor.ASTProvider.createAST(ASTProvider.java:533) at org.eclipse.jdt.internal.ui.javaeditor.ASTProvider.getAST(ASTProvider.java:474) at org.eclipse.jdt.internal.ui.javaeditor.ASTProvider.getAST(ASTProvider.java:462) at org.eclipse.jdt.ui.SharedASTProvider.getAST(SharedASTProvider.java:126) at org.eclipse.jdt.internal.ui.viewsupport.SelectionListenerWithASTManager$PartListenerGroup.calculateASTandInform(SelectionListenerWithASTManager.java:168) at org.eclipse.jdt.internal.ui.viewsupport.SelectionListenerWithASTManager$3.run(SelectionListenerWithASTManager.java:153) at org.eclipse.core.internal.jobs.Worker.run(Worker.java:55) The problem must be due to invalid positions inside the recovery.
Created attachment 92877 [details] Proposed patch
Released for 3.4M6. Test added ASTConverterBugsTest#testBug218824a() During recovery the declarationSourceEnd of a method declaration was not set when this method had no body.
Verified for 3.4M6 using I20080325-0100