Community
Participate
Working Groups
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)
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.
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.
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.
Fixed and released in HEAD.
Fixed.