Project: JDT
Bug 99358 [code assist] NPE in AnonymousTypeCompletionProposal
Reported: 2005-06-10 09:53:04 | Status: resolved fixed

I20050610-0010 public class Local { public void bar() { class LocalClass { } LocalClass l= new LocalClass(<code assist>) } } - open <code assist> and select anonymous class observe: NPE This is also in 3.0.2. The porblem in the fDeclaringType is null since the method getDeclaringType doesn't consider local types. Not critical for 3.1 since anonymous class of method local types are very unlikely. Only problem is a log entry. Thread [main] (Suspended (exception NullPointerException)) AnonymousTypeCompletionProposal.updateReplacementString(IDocument, char, int, ImportsStructure) line: 270 AnonymousTypeCompletionProposal(JavaTypeCompletionProposal).apply(IDocument, char, int) line: 95 AnonymousTypeCompletionProposal(JavaCompletionProposal).apply(ITextViewer, char, int, int) line: 554 CompletionProposalPopup.insertProposal(ICompletionProposal, char, int, int) line: 452 CompletionProposalPopup.selectProposalWithMask(int) line: 399 CompletionProposalPopup.verifyKey(VerifyEvent) line: 822 ContentAssistant$InternalListener.verifyKey(VerifyEvent) line: 630 TextViewer$VerifyKeyListenersManager.verifyKey(VerifyEvent) line: 415 StyledTextListener.handleEvent(Event) line: 55 EventTable.sendEvent(Event) line: 66 StyledText(Widget).sendEvent(Event) line: 844 StyledText(Widget).sendEvent(int, Event, boolean) line: 868 StyledText(Widget).sendEvent(int, Event) line: 853 StyledText(Widget).notifyListeners(int, Event) line: 661 StyledText.handleKeyDown(Event) line: 5133 StyledText$7.handleEvent(Event) line: 4868 EventTable.sendEvent(Event) line: 66 StyledText(Widget).sendEvent(Event) line: 844 StyledText(Widget).sendEvent(int, Event, boolean) line: 868 StyledText(Widget).sendEvent(int, Event) line: 853 StyledText(Widget).sendKeyEvent(int, int, int, int, Event) line: 881 StyledText(Widget).sendKeyEvent(int, int, int, int) line: 877 StyledText(Widget).wmChar(int, int, int) line: 1184 StyledText(Control).WM_CHAR(int, int) line: 3134 StyledText(Control).windowProc(int, int, int, int) line: 3037 Display.windowProc(int, int, int, int) line: 3682 OS.DispatchMessageW(MSG) line: not available [native method] OS.DispatchMessage(MSG) line: 1654 Display.readAndDispatch() line: 2689 Workbench.runEventLoop(Window$IExceptionHandler, Display) line: 1716 Workbench.runUI() line: 1680 Workbench.createAndRunWorkbench(Display, WorkbenchAdvisor) line: 365 PlatformUI.createAndRunWorkbench(Display, WorkbenchAdvisor) line: 143 IDEApplication.run(Object) line: 103 PlatformActivator$1.run(Object) line: 226 EclipseStarter.run(Object) line: 376 EclipseStarter.run(String[], Runnable) line: 163 NativeMethodAccessorImpl.invoke0(Method, Object, Object[]) line: not available [native method] NativeMethodAccessorImpl.invoke(Object, Object[]) line: 39 DelegatingMethodAccessorImpl.invoke(Object, Object[]) line: 25 Method.invoke(Object, Object...) line: 585 Main.invokeFramework(String[], URL[]) line: 334 Main.basicRun(String[]) line: 278 Main.run(String[]) line: 973 Main.main(String[]) line: 948

Files changed in fix:
org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/text/java/AnonymousTypeCompletionProposal.java org.eclipse.jdt.ui/ui/org/eclipse/jdt/ui/text/java/CompletionProposalCollector.java