Community
Participate
Working Groups
Build ID: I20070621-1340 Steps To Reproduce: 1.I edited attached source java file. Accidentally I typed the following text: main(new String0]) As a result I got bunch of traces in the log. More information: (Error descriptions were different, but the line of code exception occured was one and the same) java.lang.IllegalArgumentException at org.eclipse.jdt.core.dom.ASTNode.setSourceRange(ASTNode.java:2609) at org.eclipse.jdt.core.dom.ASTConverter.convert(ASTConverter.java:838) at org.eclipse.jdt.core.dom.ASTConverter.convert(ASTConverter.java:1534) at org.eclipse.jdt.core.dom.ASTConverter.convert(ASTConverter.java:1998) at org.eclipse.jdt.core.dom.ASTConverter.convert(ASTConverter.java:1621) at org.eclipse.jdt.core.dom.ASTConverter.convert(ASTConverter.java:2476) at org.eclipse.jdt.core.dom.ASTConverter.convert(ASTConverter.java:511) at org.eclipse.jdt.core.dom.ASTConverter.buildBodyDeclarations(ASTConverter.java:179) at org.eclipse.jdt.core.dom.ASTConverter.convert(ASTConverter.java:2661) at org.eclipse.jdt.core.dom.ASTConverter.convert(ASTConverter.java:1248) at org.eclipse.jdt.core.dom.AST.convertCompilationUnit(AST.java:278) at org.eclipse.jdt.internal.core.ReconcileWorkingCopyOperation.makeConsistent(ReconcileWorkingCopyOperation.java:207) at org.eclipse.jdt.internal.core.ReconcileWorkingCopyOperation.executeOperation(ReconcileWorkingCopyOperation.java:89) at org.eclipse.jdt.internal.core.JavaModelOperation.run(JavaModelOperation.java:720) at org.eclipse.jdt.internal.core.JavaModelOperation.runOperation(JavaModelOperation.java:780) at org.eclipse.jdt.internal.core.CompilationUnit.reconcile(CompilationUnit.java:1169) at org.eclipse.jdt.internal.ui.text.java.JavaReconcilingStrategy$1.run(JavaReconcilingStrategy.java:101) at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:37) at org.eclipse.jdt.internal.ui.text.java.JavaReconcilingStrategy.reconcile(JavaReconcilingStrategy.java:82) at org.eclipse.jdt.internal.ui.text.java.JavaReconcilingStrategy.reconcile(JavaReconcilingStrategy.java:149) at org.eclipse.jdt.internal.ui.text.CompositeReconcilingStrategy.reconcile(CompositeReconcilingStrategy.java:86) at org.eclipse.jdt.internal.ui.text.JavaCompositeReconcilingStrategy.reconcile(JavaCompositeReconcilingStrategy.java:96) at org.eclipse.jface.text.reconciler.MonoReconciler.process(MonoReconciler.java:75) at org.eclipse.jdt.internal.ui.text.JavaReconciler.process(JavaReconciler.java:378) at org.eclipse.jface.text.reconciler.AbstractReconciler$BackgroundThread.run(AbstractReconciler.java:204)
Created attachment 73778 [details] This is a file I edited when got the described error
David, the error seems to come from statement recovery.
Created attachment 74117 [details] Proposed fix The ASTConverter try to retrieve the right bracket position. The converter search this bracket one character after the left bracket and in this case the right bracket is a recovered token with the same location as left bracket. On other side the converter doesn't take into account interlinked bracket (eg a[b[0]]. The fix is to count brackets and to start the search at the left bracket location.
Released for 3.4M1. Tests added ASTConverterTestAST3_2#test0682() -> test0683()
Verified for 3.4M1 using build I20070802-0800.
It might be worth backporting to 3.3.1. David, what do you think ?
+1 for 3.3.1.