Bug 93695 NPE performing code assist
Build N20050504 I got the following exception after pressing ctrl+space and choosing a method from the presentation. The method I choose had a single parameter, which was an array of objects of a certain type. No objects of this type existed in my current context. java.lang.NullPointerException at org.eclipse.jdt.internal.ui.text.java.ParameterGuesser$Variable.computeFQN(ParameterGuesser.java:176) at org.eclipse.jdt.internal.ui.text.java.ParameterGuesser$Variable.getFQN(ParameterGuesser.java:170) at org.eclipse.jdt.internal.ui.text.java.ParameterGuesser$Variable.isArrayType(ParameterGuesser.java:198) at org.eclipse.jdt.internal.ui.text.java.ParameterGuesser.parameterProposals(ParameterGuesser.java:564) at org.eclipse.jdt.internal.ui.text.java.ParameterGuessingProposal.guessParameters(ParameterGuessingProposal.java:233) at org.eclipse.jdt.internal.ui.text.java.ParameterGuessingProposal.computeGuessingCompletion(ParameterGuessingProposal.java:276) at org.eclipse.jdt.internal.ui.text.java.ParameterGuessingProposal.apply(ParameterGuessingProposal.java:121) at org.eclipse.jdt.internal.ui.text.java.LazyJavaCompletionProposal.apply(LazyJavaCompletionProposal.java:319) at org.eclipse.jface.text.contentassist.CompletionProposalPopup.insertProposal(CompletionProposalPopup.java:452) at org.eclipse.jface.text.contentassist.CompletionProposalPopup.selectProposalWithMask(CompletionProposalPopup.java:399) at org.eclipse.jface.text.contentassist.CompletionProposalPopup.verifyKey(CompletionProposalPopup.java:822) at org.eclipse.jface.text.contentassist.ContentAssistant$InternalListener.verifyKey(ContentAssistant.java:630) at org.eclipse.jface.text.TextViewer$VerifyKeyListenersManager.verifyKey(TextViewer.java:415) at org.eclipse.swt.custom.StyledTextListener.handleEvent(StyledTextListener.java:55) at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:82) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1012) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1036) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1021) at org.eclipse.swt.widgets.Widget.notifyListeners(Widget.java:891) at org.eclipse.swt.custom.StyledText.handleKeyDown(StyledText.java:5135) at org.eclipse.swt.custom.StyledText$7.handleEvent(StyledText.java:4870) at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:82) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1012) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1036) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1021) at org.eclipse.swt.widgets.Widget.sendKeyEvent(Widget.java:1048) at org.eclipse.swt.widgets.Widget.gtk_key_press_event(Widget.java:612) at org.eclipse.swt.widgets.Control.gtk_key_press_event(Control.java:1961) at org.eclipse.swt.widgets.Composite.gtk_key_press_event(Composite.java:555) at org.eclipse.swt.widgets.Widget.windowProc(Widget.java:1348) at org.eclipse.swt.widgets.Display.windowProc(Display.java:3329) 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:4739) at org.eclipse.swt.widgets.Display.eventProc(Display.java:969) 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:1138) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:2473) at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:1572) at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:1536) at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:306) at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:143) at org.eclipse.ui.internal.ide.IDEApplication.run(IDEApplication.java:103) at org.eclipse.core.internal.runtime.PlatformActivator$1.run(PlatformActivator.java:230) at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:345) at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:158) 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:585) at org.eclipse.core.launcher.Main.invokeFramework(Main.java:328) at org.eclipse.core.launcher.Main.basicRun(Main.java:272) at org.eclipse.core.launcher.Main.run(Main.java:964) at org.eclipse.core.launcher.Main.main(Main.java:948)
org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/text/java/ParameterGuesser.java
* @param paramType - the qualified name of the parameter we are trying to match
	 * @param paramName - the name of the parameter (used to find similarly named matches)
	 * @param pos
	 * @param document
	 * @return returns the name of the best match, or <code>null</code> if no match found
	 * @throws JavaModelException
	 */
	public ICompletionProposal[] parameterProposals(String paramPackage, String paramType, String paramName, Position pos, IDocument document) throws JavaModelException {
		if (fVariables == null) {
			VariableCollector variableCollector= new VariableCollector();
			fVariables= variableCollector.collect(fCodeAssistOffset, fCompilationUnit);
		}
		fIsTemplateMatch= false;
		
		Variable parameter= new Variable(paramPackage, paramType, paramName, Variable.LOCAL, 0, null, null);
		List typeMatches= findProposalsMatchingType(fVariables, parameter);
		orderMatches(typeMatches, paramName);
		ICompletionProposal[] ret= new ICompletionProposal[typeMatches.size() + (fIsTemplateMatch ? 1 : 0)];
		int i= 0; int replacementLength= 0;
		for (Iterator it= typeMatches.iterator(); it.hasNext();) {
			Variable v= (Variable)it.next();
			if (i == 0) {
				v.alreadyMatched= true;
				replacementLength= v.name.length();
			}
			
			if (fIsTemplateMatch && !v.isArrayType()) {
				ret[i++]= createTemplateProposal(document, pos, paramType);
				fIsTemplateMatch= false;
			}