Project: JDT
Bug 27849 Organize Imports not working in Type with compilation errors
Reported: 2002-12-06 11:53:50 | Status: resolved fixed

affected build: I20020412 "Orginze Imports" doesn't work with I have a bigger source file with some or more compilation errors _AND_ the cursor is position behind more or less compilation errors. If the cursor is in before the fist few compilation error, Organize Imports works as expected, if not the following exception is thrown. java.lang.ArrayIndexOutOfBoundsException: -1335 at org.eclipse.jdt.internal.corext.codemanipulation.OrganizeImportsOperation$TypeRe ferenceProcessor.findTypeRefs(OrganizeImportsOperation.java:452) at org.eclipse.jdt.internal.corext.codemanipulation.OrganizeImportsOperation$TypeRe ferenceProcessor.process(OrganizeImportsOperation.java:373) at org.eclipse.jdt.internal.corext.codemanipulation.OrganizeImportsOperation.run (OrganizeImportsOperation.java:529) at org.eclipse.jdt.internal.core.BatchOperation.executeOperation (BatchOperation.java:34) at org.eclipse.jdt.internal.core.JavaModelOperation.execute (JavaModelOperation.java:326) at org.eclipse.jdt.internal.core.JavaModelOperation.run (JavaModelOperation.java:626) at org.eclipse.core.internal.resources.Workspace.run (Workspace.java:1578) at org.eclipse.jdt.core.JavaCore.run(JavaCore.java:2383) at org.eclipse.jdt.internal.ui.actions.WorkbenchRunnableAdapter.run (WorkbenchRunnableAdapter.java:32) at org.eclipse.jdt.internal.ui.util.BusyIndicatorRunnableContext$BusyRunnable.inter nalRun(BusyIndicatorRunnableContext.java:107) at org.eclipse.jdt.internal.ui.util.BusyIndicatorRunnableContext$BusyRunnable.run (BusyIndicatorRunnableContext.java:74) at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:65) at org.eclipse.jdt.internal.ui.util.BusyIndicatorRunnableContext.run (BusyIndicatorRunnableContext.java:120) at org.eclipse.jdt.ui.actions.OrganizeImportsAction.runOnSingle (OrganizeImportsAction.java:363) at org.eclipse.jdt.ui.actions.OrganizeImportsAction.run (OrganizeImportsAction.java:245) at org.eclipse.jdt.ui.actions.SelectionDispatchAction.dispatchRun (SelectionDispatchAction.java:193) at org.eclipse.jdt.ui.actions.SelectionDispatchAction.run (SelectionDispatchAction.java:169) at org.eclipse.jface.action.Action.runWithEvent(Action.java:769) at org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection (ActionContributionItem.java:411) at org.eclipse.jface.action.ActionContributionItem.handleWidgetEvent (ActionContributionItem.java:365) at org.eclipse.jface.action.ActionContributionItem.access$0 (ActionContributionItem.java:356) at org.eclipse.jface.action.ActionContributionItem$ActionListener.handleEvent (ActionContributionItem.java:48) at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:77) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:825) at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:1692) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:1410) at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:1405) at org.eclipse.ui.internal.Workbench.run(Workbench.java:1388) at org.eclipse.core.internal.boot.InternalBootLoader.run (InternalBootLoader.java:841) at org.eclipse.core.boot.BootLoader.run(BootLoader.java:462) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:324) at org.eclipse.core.launcher.Main.basicRun(Main.java:247) at org.eclipse.core.launcher.Main.run(Main.java:703) at org.eclipse.core.launcher.Main.main(Main.java:539)

Files changed in fix:
org.eclipse.jdt.ui/core extension/org/eclipse/jdt/internal/corext/codemanipulation/OrganizeImportsOperation.java