Bug 10663 - ast: exception in AST converter
Summary: ast: exception in AST converter
Status: RESOLVED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 2.0   Edit
Hardware: PC Windows 2000
: P3 normal (vote)
Target Milestone: 2.0 M4   Edit
Assignee: Olivier Thomann CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2002-03-04 05:01 EST by Adam Kiezun CLA
Modified: 2002-03-05 13:05 EST (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Adam Kiezun CLA 2002-03-04 05:01:46 EST
given the source:
-----------start----------
//cannot rename to i, i
package p;
class A{
	int m(){
		int i, /*[*/int j/*]*/;
		return 0;
	};
}
-----------end----------
AST.parseCompilationUnit(cu, true)
results in an exception:

java.lang.IllegalArgumentException
	at org.eclipse.jdt.core.dom.ASTNode.setSourceRange(ASTNode.java:1018)
	at org.eclipse.jdt.core.dom.ASTConverter.convertPackage
(ASTConverter.java:98)
	at org.eclipse.jdt.core.dom.ASTConverter.convert(ASTConverter.java:57)
	at org.eclipse.jdt.core.dom.AST.parseCompilationUnit(AST.java:230)
	at 
org.eclipse.jdt.internal.corext.refactoring.rename.RenameTempRefactoring.initial
izeAst(RenameTempRefactoring.java:151)
	at 
org.eclipse.jdt.internal.corext.refactoring.rename.RenameTempRefactoring.checkAc
tivation(RenameTempRefactoring.java:123)
	at 
org.eclipse.jdt.internal.corext.refactoring.base.Refactoring.checkPreconditions
(Refactoring.java:80)
	at 
org.eclipse.jdt.ui.tests.refactoring.RefactoringTest.performRefactoring
(RefactoringTest.java:107)
	at org.eclipse.jdt.ui.tests.refactoring.RenameTempTests.helper2
(RenameTempTests.java:97)
	at org.eclipse.jdt.ui.tests.refactoring.RenameTempTests.helper2
(RenameTempTests.java:102)
	at org.eclipse.jdt.ui.tests.refactoring.RenameTempTests.testFail2
(RenameTempTests.java:272)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke
(NativeMethodAccessorImpl.java:42)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke
(DelegatingMethodAccessorImpl.java:28)
	at java.lang.reflect.Method.invoke(Method.java:327)
	at junit.framework.TestCase.runTest(TestCase.java:166)
	at junit.framework.TestCase.runBare(TestCase.java:140)
	at junit.framework.TestResult$1.protect(TestResult.java:106)
	at junit.framework.TestResult.runProtected(TestResult.java:124)
	at junit.framework.TestResult.run(TestResult.java:109)
	at junit.framework.TestCase.run(TestCase.java:131)
	at junit.framework.TestSuite.runTest(TestSuite.java:173)
	at junit.framework.TestSuite.run(TestSuite.java:168)
	at junit.extensions.TestDecorator.basicRun(TestDecorator.java:22)
	at junit.extensions.TestSetup$1.protect(TestSetup.java:19)
	at junit.framework.TestResult.runProtected(TestResult.java:124)
	at junit.extensions.TestSetup.run(TestSetup.java:23)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests
(RemoteTestRunner.java:319)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run
(RemoteTestRunner.java:215)
	at org.eclipse.pde.internal.junit.ui.RemotePluginTestRunner.main
(RemotePluginTestRunner.java:30)
	at org.eclipse.pde.internal.junit.ui.UITestApplication.runEventLoop
(UITestApplication.java:34)
	at org.eclipse.ui.internal.Workbench.run(Workbench.java:771)
	at org.eclipse.core.internal.boot.InternalBootLoader.run
(InternalBootLoader.java:777)
	at org.eclipse.core.boot.BootLoader.run(BootLoader.java:319)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke
(NativeMethodAccessorImpl.java:42)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke
(DelegatingMethodAccessorImpl.java:28)
	at java.lang.reflect.Method.invoke(Method.java:327)
	at org.eclipse.core.launcher.Main.basicRun(Main.java:151)
	at org.eclipse.core.launcher.Main.run(Main.java:502)
	at org.eclipse.core.launcher.UIMain.main(UIMain.java:52)
Comment 1 Olivier Thomann CLA 2002-03-04 09:04:27 EST
Did you use the code I released on Friday to get this error? I could not 
reproduce with latest code.
Comment 2 Olivier Thomann CLA 2002-03-04 09:15:17 EST
I cannot reproduce with latest code. I found a problem in the given code. This 
code is syntaxically incorrect.

It should be:
package p;
class A{
	int m(){
		int i, /*[*/j/*]*/;
		return 0;
	};
}

otherwise you have a syntax error on the second 'int'. You get "identifier 
expected". I close this PR.
Comment 3 Olivier Thomann CLA 2002-03-05 12:38:06 EST
The problem comes from the comment line at the beginning of the code. In this case the import 
declarationEnd is not set (equals to 0) and then the settings of the source range for the package 
declaration fails.
Comment 4 Olivier Thomann CLA 2002-03-05 13:05:09 EST
This is fixed now. The problem was due to the syntax error. In the recovery mode, one of the 
positions stored in the import reference (package declaration) was missing.
Fixed and 
released in HEAD.