Project: JDT
Bug 292903 [quick fix] NPE for quick fix on array fields
Reported: 2009-10-21 10:53:02 | Status: resolved fixed

I20091020-0931 Use the following snippet and hit Ctrl+1 while the cursor is on "length". public class A { public int f() { String[] foo = new String[] {}; return foo.length; } } -- Error Details -- Date: Wed Oct 21 16:50:03 CEST 2009 Message: Exception while processing quick fixes or quick assists Severity: Error Product: Eclipse SDK 3.6.0.v200910200931 (org.eclipse.sdk.ide) Plugin: org.eclipse.jdt.ui Exception Stack Trace: java.lang.NullPointerException at org.eclipse.jdt.internal.corext.dom.Bindings.findMethodInType(Bindings.java:345) at org.eclipse.jdt.internal.corext.dom.Bindings.findMethodInHierarchy(Bindings.java:371) at org.eclipse.jdt.internal.ui.text.correction.GetterSetterCorrectionSubProcessor.findGetter(GetterSetterCorrectionSubProcessor.java:301) at org.eclipse.jdt.internal.ui.text.correction.GetterSetterCorrectionSubProcessor.addGetterProposal(GetterSetterCorrectionSubProcessor.java:273) at org.eclipse.jdt.internal.ui.text.correction.GetterSetterCorrectionSubProcessor.getProposal(GetterSetterCorrectionSubProcessor.java:262) at org.eclipse.jdt.internal.ui.text.correction.GetterSetterCorrectionSubProcessor.addGetterSetterProposal(GetterSetterCorrectionSubProcessor.java:234) at org.eclipse.jdt.internal.ui.text.correction.GetterSetterCorrectionSubProcessor.addGetterSetterProposal(GetterSetterCorrectionSubProcessor.java:211) at org.eclipse.jdt.internal.ui.text.correction.AdvancedQuickAssistProcessor.getAssists(AdvancedQuickAssistProcessor.java:165) at org.eclipse.jdt.internal.ui.text.correction.JavaCorrectionProcessor$SafeAssistCollector.safeRun(JavaCorrectionProcessor.java:399) at org.eclipse.jdt.internal.ui.text.correction.JavaCorrectionProcessor$SafeCorrectionProcessorAccess.run(JavaCorrectionProcessor.java:337) at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42) at org.eclipse.jdt.internal.ui.text.correction.JavaCorrectionProcessor$SafeCorrectionProcessorAccess.process(JavaCorrectionProcessor.java:327) at org.eclipse.jdt.internal.ui.text.correction.JavaCorrectionProcessor.collectAssists(JavaCorrectionProcessor.java:503) at org.eclipse.jdt.internal.ui.text.correction.JavaCorrectionProcessor.collectProposals(JavaCorrectionProcessor.java:285) at org.eclipse.jdt.internal.ui.text.correction.JavaCorrectionProcessor.computeQuickAssistProposals(JavaCorrectionProcessor.java:240) at org.eclipse.jface.text.quickassist.QuickAssistAssistant$ContentAssistProcessor.computeCompletionProposals(QuickAssistAssistant.java:73) at org.eclipse.jface.text.contentassist.ContentAssistant.computeCompletionProposals(ContentAssistant.java:1834) at org.eclipse.jface.text.contentassist.CompletionProposalPopup.computeProposals(CompletionProposalPopup.java:557) at org.eclipse.jface.text.contentassist.CompletionProposalPopup.access$16(CompletionProposalPopup.java:554) at org.eclipse.jface.text.contentassist.CompletionProposalPopup$2.run(CompletionProposalPopup.java:489) at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:70) at org.eclipse.jface.text.contentassist.CompletionProposalPopup.showProposals(CompletionProposalPopup.java:483) at org.eclipse.jface.text.contentassist.ContentAssistant.showPossibleCompletions(ContentAssistant.java:1660) at org.eclipse.jface.text.quickassist.QuickAssistAssistant.showPossibleQuickAssists(QuickAssistAssistant.java:126) at org.eclipse.jdt.internal.ui.text.correction.JavaCorrectionAssistant.showPossibleQuickAssists(JavaCorrectionAssistant.java:190) at org.eclipse.jdt.internal.ui.javaeditor.CompilationUnitEditor$AdaptedSourceViewer.doOperation(CompilationUnitEditor.java:194) at org.eclipse.ui.texteditor.TextOperationAction$1.run(TextOperationAction.java:131) at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:70) at org.eclipse.ui.texteditor.TextOperationAction.run(TextOperationAction.java:129) at org.eclipse.jface.action.Action.runWithEvent(Action.java:498) at org.eclipse.ui.commands.ActionHandler.execute(ActionHandler.java:185) at org.eclipse.ui.internal.handlers.LegacyHandlerWrapper.execute(LegacyHandlerWrapper.java:109) at org.eclipse.core.commands.Command.executeWithChecks(Command.java:476) at org.eclipse.core.commands.ParameterizedCommand.executeWithChecks(ParameterizedCommand.java:508) at org.eclipse.ui.internal.handlers.HandlerService.executeCommand(HandlerService.java:169) at org.eclipse.ui.internal.keys.WorkbenchKeyboard.executeCommand(WorkbenchKeyboard.java:470) at org.eclipse.ui.internal.keys.WorkbenchKeyboard.press(WorkbenchKeyboard.java:824) at org.eclipse.ui.internal.keys.WorkbenchKeyboard.processKeyEvent(WorkbenchKeyboard.java:880) at org.eclipse.ui.internal.keys.WorkbenchKeyboard.filterKeySequenceBindings(WorkbenchKeyboard.java:569) at org.eclipse.ui.internal.keys.WorkbenchKeyboard.access$3(WorkbenchKeyboard.java:510) at org.eclipse.ui.internal.keys.WorkbenchKeyboard$KeyDownFilter.handleEvent(WorkbenchKeyboard.java:125) at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84) at org.eclipse.swt.widgets.Display.filterEvent(Display.java:1472) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1185) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1210) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1195) at org.eclipse.swt.widgets.Widget.sendKeyEvent(Widget.java:1222) at org.eclipse.swt.widgets.Widget.gtk_key_press_event(Widget.java:712) at org.eclipse.swt.widgets.Control.gtk_key_press_event(Control.java:2824) at org.eclipse.swt.widgets.Composite.gtk_key_press_event(Composite.java:703) at org.eclipse.swt.widgets.Widget.windowProc(Widget.java:1627) at org.eclipse.swt.widgets.Control.windowProc(Control.java:4573) at org.eclipse.swt.widgets.Display.windowProc(Display.java:4176) at org.eclipse.swt.internal.gtk.OS._gtk_main_do_event(Native Method) at org.eclipse.swt.internal.gtk.OS.gtk_main_do_event(OS.java:7643) at org.eclipse.swt.widgets.Display.eventProc(Display.java:1190) at org.eclipse.swt.internal.gtk.OS._g_main_context_iteration(Native Method) at org.eclipse.swt.internal.gtk.OS.g_main_context_iteration(OS.java:1871) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3095) at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2404) at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2368) at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2220) at org.eclipse.ui.internal.Workbench$5.run(Workbench.java:500) at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332) at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:493) at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149) at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:113) at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:194) at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110) at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79) at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:367) at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179) 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:597) at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:611) at org.eclipse.equinox.launcher.Main.basicRun(Main.java:566) at org.eclipse.equinox.launcher.Main.run(Main.java:1363)

Files changed in fix:
org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/text/correction/GetterSetterCorrectionSubProcessor.java