Bug 11151 - ast: IllegalArgumentException on AST creation
Summary: ast: IllegalArgumentException on AST creation
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-12 06:04 EST by Adam Kiezun CLA
Modified: 2002-03-12 10:28 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-12 06:04:55 EST
file is named A_test21.java
<source>
package p;
interface A{
	public void foo(int arg);
}
</source>

calling AST.parseCompilationUnit(source, false)
results in:
4 org.eclipse.ui 0 java.lang.IllegalArgumentException
java.lang.IllegalArgumentException
	at org.eclipse.jdt.core.dom.ASTNode.setSourceRange(ASTNode.java:1021)
	at org.eclipse.jdt.core.dom.ASTConverter.convert(ASTConverter.java:611)
	at org.eclipse.jdt.core.dom.ASTConverter.buildBodyDeclarations
(ASTConverter.java:214)
	at org.eclipse.jdt.core.dom.ASTConverter.convert(ASTConverter.java:158)
	at org.eclipse.jdt.core.dom.ASTConverter.convert(ASTConverter.java:72)
	at org.eclipse.jdt.core.dom.AST.parseCompilationUnit(AST.java:279)
	at org.eclipse.jdt.core.dom.AST.parseCompilationUnit(AST.java:247)
	at 
org.eclipse.jdt.internal.ui.refactoring.actions.structureselection.StructureSele
ctionAction.getNewSelectionRange(StructureSelectionAction.java:46)
	at 
org.eclipse.jdt.internal.ui.refactoring.actions.structureselection.StructureSele
ctionAction.run(StructureSelectionAction.java:38)
	at org.eclipse.jface.action.Action.runWithEvent(Action.java:452)
	at org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection
(ActionContributionItem.java:407)
	at org.eclipse.jface.action.ActionContributionItem.handleWidgetEvent
(ActionContributionItem.java:361)
	at org.eclipse.jface.action.ActionContributionItem.access$0
(ActionContributionItem.java:352)
	at 
org.eclipse.jface.action.ActionContributionItem$ActionListener.handleEvent
(ActionContributionItem.java:47)
	at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:74)
	at org.eclipse.swt.widgets.Widget.notifyListeners(Widget.java:637)
	at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:1420)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:1208)
	at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:700)
	at org.eclipse.ui.internal.Workbench.run(Workbench.java:683)
	at org.eclipse.core.internal.boot.InternalBootLoader.run
(InternalBootLoader.java:777)
	at org.eclipse.core.boot.BootLoader.run(BootLoader.java:319)
	at SlimLauncher.main(SlimLauncher.java:14)
Comment 1 Olivier Thomann CLA 2002-03-12 10:08:13 EST
I could not reproduce it in latest. Here is my test case. Tell me if you think this is close enough 
from your test:
<source>
package test0304;

interface Test {
	public void foo(int 
arg);
}
</source>
I will try again with your test case, but I think this is an old problem.
Comment 2 Olivier Thomann CLA 2002-03-12 10:11:59 EST
Forgot my previous note. I reproduce it. I did the initial parsing 
with:
AST.parseCompilationUnit(source, true) instead of 
AST.parseCompilationUnit(source, false). Big difference!
I am looking at it.
Comment 3 Olivier Thomann CLA 2002-03-12 10:14:24 EST
The bug comes from the fact that the interface method is not tagged as abstract. Therefore I am 
trying to retrieve the position of the closing brace. And of course I don't find any. When I try to 
set the source range with invalid positions, I got the exception.
Comment 4 Olivier Thomann CLA 2002-03-12 10:28:21 EST
Fixed and released in HEAD.
Comment 5 Olivier Thomann CLA 2002-03-12 10:28:29 EST
Fixed.