Community
Participate
Working Groups
20020409 1. create this code (project contains JUnit source) 2. do Quick Fix on 'fActiveTestDeathCount1', wait for the hover on 'Create field...' ----- package junit.extensions; import junit.framework.*; public class ActiveTestSuite { public void run(TestResult result) { fActiveTestDeathCount1= 0; } public void runTest(final Test test, final TestResult result) {} Thread t= new Thread() { public void run() { try { // inlined due to limitation in VA/Java //ActiveTestSuite.super.runTest(test, result); test.run(result); } finally { ActiveTestSuite.this.runFinished(test); } } }; t.start(); } } java.lang.IllegalArgumentException at org.eclipse.jdt.core.dom.ASTNode.setSourceRange(ASTNode.java:1034) at org.eclipse.jdt.core.dom.ASTConverter.convertToFieldDeclaration (ASTConverter.java:2365) at org.eclipse.jdt.core.dom.ASTConverter.checkAndAddMultipleFieldDeclaration (ASTConverter.java:243) at org.eclipse.jdt.core.dom.ASTConverter.buildBodyDeclarations (ASTConverter.java:209) at org.eclipse.jdt.core.dom.ASTConverter.convert(ASTConverter.java:155) at org.eclipse.jdt.core.dom.ASTConverter.convert(ASTConverter.java:73) at org.eclipse.jdt.core.dom.AST.parseCompilationUnit(AST.java:234) at org.eclipse.jdt.internal.ui.text.correction.NewVariableCompletionProposal.addEdi ts(NewVariableCompletionProposal.java:186) at org.eclipse.jdt.internal.ui.text.correction.CUCorrectionProposal.getChange (CUCorrectionProposal.java:56) at org.eclipse.jdt.internal.ui.text.correction.CUCorrectionProposal.getCompilationU nitChange(CUCorrectionProposal.java:130) at org.eclipse.jdt.internal.ui.text.correction.CUCorrectionProposal.getAdditionalPr oposalInfo(CUCorrectionProposal.java:72) at org.eclipse.jface.text.contentassist.AdditionalInfoController.computeInformation (AdditionalInfoController.java:185) at org.eclipse.jface.text.AbstractInformationControlManager.showInformation (AbstractInformationControlManager.java:536) at org.eclipse.jface.text.contentassist.AdditionalInfoController$1.run (AdditionalInfoController.java:145) at org.eclipse.swt.widgets.RunnableLock.run(RunnableLock.java(Compiled Code)) at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages (Synchronizer.java(Compiled Code)) at org.eclipse.swt.widgets.Display.runAsyncMessages(Display.java (Compiled Code)) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java (Compiled Code)) at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java (Compiled Code)) at org.eclipse.ui.internal.Workbench.run(Workbench.java:819) at org.eclipse.core.internal.boot.InternalBootLoader.run (InternalBootLoader.java:777) at org.eclipse.core.boot.BootLoader.run(BootLoader.java:319) at java.lang.reflect.Method.invoke(Native Method) at org.eclipse.core.launcher.Main.basicRun(Main.java:190) at org.eclipse.core.launcher.Main.run(Main.java:549) at org.eclipse.core.launcher.UIMain.main(UIMain.java:52)
Using a fresh new workspace with build 0409, I could not reproduce this exception. The field is created properly. However I had to change the test case for : package junit.extensions; import junit.framework.*; public class ActiveTestSuite { public void run(TestResult result) { fActiveTestDeathCount1= 0; } public void runTest(final Test test, final TestResult result) { Thread t= new Thread() { public void run() { try { // inlined due to limitation in VA/Java //ActiveTestSuite.super.runTest(test, result); test.run(result); } finally { ActiveTestSuite.this.runFinished(test); } } }; t.start(); } } If you can reproduce it in your workspace, please try again with a fresh new workspace containing only this test case. If it works, please provide the whole workspace.
I can reproduce it with an empty workspace: Only the one CU. There are many build errors, but the result is the same. Send you the zipped workspace.
I reproduced the bug now. Thanks for the workspace. The problem is located in the recovery in the Parser. The field declaration has an invalid declarationEnd and then the ASTConverter is trying to create a field for which the length is negative. That is not possible and explains the IllegalArgumentException. The ASTConverter assumes that the CompilationUnit retrieved from the Parser is properly initialized.
Ok, I located the bug. It was in updateTypeDeclaration() in the class RecoveredType. The field declaration source end was set, but not the field declaration end. Setting the field declaration end with the same value than the field declaration source end fixed the problem. I will release as soon as all tests are passed.
Fixed and released in HEAD.
Set the milestone.