Bug 97902 - NPE on Open Declaration on reference to generic type
Summary: NPE on Open Declaration on reference to generic type
Status: CLOSED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.1   Edit
Hardware: PC Windows XP
: P3 major (vote)
Target Milestone: 3.1 RC2   Edit
Assignee: Jerome Lanneluc CLA
QA Contact:
URL:
Whiteboard:
Keywords:
: 87513 (view as bug list)
Depends on:
Blocks:
 
Reported: 2005-06-01 12:12 EDT by Markus Keller CLA
Modified: 2005-06-10 11:08 EDT (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Markus Keller CLA 2005-06-01 12:12:35 EDT
I20050527-1300

- xy/Other.java:
package xy;
public class Other {
	public interface Inner<T> { }
}

- xy/Try.java:
package xy;
import xy.Other.Inner;
public class Try {
	private <T> void failing(Inner<T> arg) {}
}

- set caret into 'Inner' in parameter of method failing(..)
- press F3

Error 2005-06-01 18:08:46.344 java.lang.NullPointerException
java.lang.NullPointerException
	at
org.eclipse.jdt.internal.compiler.lookup.MethodBinding.genericSignature(MethodBinding.java:356)
	at
org.eclipse.jdt.internal.compiler.lookup.MethodBinding.computeUniqueKey(MethodBinding.java:307)
	at
org.eclipse.jdt.internal.compiler.lookup.MethodBinding.computeUniqueKey(MethodBinding.java:296)
	at
org.eclipse.jdt.internal.compiler.lookup.TypeVariableBinding.computeUniqueKey(TypeVariableBinding.java:218)
	at
org.eclipse.jdt.internal.compiler.lookup.ParameterizedTypeBinding.computeUniqueKey(ParameterizedTypeBinding.java:203)
	at
org.eclipse.jdt.internal.compiler.lookup.Binding.computeUniqueKey(Binding.java:45)
	at
org.eclipse.jdt.internal.codeassist.SelectionEngine.selectFrom(SelectionEngine.java:807)
	at
org.eclipse.jdt.internal.codeassist.SelectionEngine.select(SelectionEngine.java:677)
	at org.eclipse.jdt.internal.core.Openable.codeSelect(Openable.java:165)
	at
org.eclipse.jdt.internal.core.CompilationUnit.codeSelect(CompilationUnit.java:314)
	at
org.eclipse.jdt.internal.core.CompilationUnit.codeSelect(CompilationUnit.java:308)
	at
org.eclipse.jdt.internal.ui.actions.SelectionConverter.codeResolve(SelectionConverter.java:219)
	at
org.eclipse.jdt.internal.ui.actions.SelectionConverter.codeResolve(SelectionConverter.java:153)
	at
org.eclipse.jdt.internal.ui.actions.SelectionConverter.codeResolve(SelectionConverter.java:162)
	at org.eclipse.jdt.ui.actions.OpenAction.run(OpenAction.java:128)
	at
org.eclipse.jdt.ui.actions.SelectionDispatchAction.dispatchRun(SelectionDispatchAction.java:226)
	at
org.eclipse.jdt.ui.actions.SelectionDispatchAction.run(SelectionDispatchAction.java:198)
	at org.eclipse.jface.action.Action.runWithEvent(Action.java:996)
	at org.eclipse.ui.commands.ActionHandler.execute(ActionHandler.java:182)
	at
org.eclipse.ui.internal.handlers.LegacyHandlerWrapper.execute(LegacyHandlerWrapper.java:108)
	at org.eclipse.core.commands.Command.execute(Command.java:311)
	at
org.eclipse.core.commands.ParameterizedCommand.execute(ParameterizedCommand.java:396)
	at
org.eclipse.ui.internal.keys.WorkbenchKeyboard.executeCommand(WorkbenchKeyboard.java:459)
	at org.eclipse.ui.internal.keys.WorkbenchKeyboard.press(WorkbenchKeyboard.java:781)
	at
org.eclipse.ui.internal.keys.WorkbenchKeyboard.processKeyEvent(WorkbenchKeyboard.java:828)
	at
org.eclipse.ui.internal.keys.WorkbenchKeyboard.filterKeySequenceBindings(WorkbenchKeyboard.java:550)
	at
org.eclipse.ui.internal.keys.WorkbenchKeyboard.access$3(WorkbenchKeyboard.java:493)
	at
org.eclipse.ui.internal.keys.WorkbenchKeyboard$KeyDownFilter.handleEvent(WorkbenchKeyboard.java:117)
	at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:66)
	at org.eclipse.swt.widgets.Display.filterEvent(Display.java:788)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:843)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:868)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:853)
	at org.eclipse.swt.widgets.Widget.sendKeyEvent(Widget.java:881)
	at org.eclipse.swt.widgets.Widget.sendKeyEvent(Widget.java:877)
	at org.eclipse.swt.widgets.Widget.wmKeyDown(Widget.java:1469)
	at org.eclipse.swt.widgets.Control.WM_KEYDOWN(Control.java:3348)
	at org.eclipse.swt.widgets.Control.windowProc(Control.java:3067)
	at org.eclipse.swt.widgets.Display.windowProc(Display.java:3553)
	at org.eclipse.swt.internal.win32.OS.CallWindowProcW(Native Method)
	at org.eclipse.swt.internal.win32.OS.CallWindowProc(OS.java:1574)
	at org.eclipse.swt.internal.BidiUtil.windowProc(BidiUtil.java:649)
	at org.eclipse.swt.internal.win32.OS.DispatchMessageW(Native Method)
	at org.eclipse.swt.internal.win32.OS.DispatchMessage(OS.java:1650)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:2560)
	at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:1694)
	at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:1658)
	at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:366)
	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:226)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:375)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:162)
	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:334)
	at org.eclipse.core.launcher.Main.basicRun(Main.java:278)
	at org.eclipse.core.launcher.Main.run(Main.java:973)
	at org.eclipse.core.launcher.Main.main(Main.java:948)
Comment 1 Markus Keller CLA 2005-06-01 12:19:46 EDT
Also fails when the referenced type is not an inner type:

- xy/Try.java:
package xy;
public class Try {
	private <T> void failing(IInterface<T> arg) {}
}
interface IInterface<T> { }

- set caret into 'IInterface' in parameter of method failing(..) and press F3
Comment 2 Philipe Mulet CLA 2005-06-02 08:43:58 EDT
+1 for RC2
Comment 3 Jerome Lanneluc CLA 2005-06-02 09:03:46 EDT
In this case we cannot use the method's key as it has not been completely
reolved (we found the selection node while processing the method's parameters).

Changed format of type variable key in the case it is not a leaf key to use the
declaring class + method source start.
Adapted BindingKeyParser and its subclasses to this new format.

Added regression tests BatchASTCreationTests#test065() and
BindingKeyTests#test043().
Comment 4 Jerome Lanneluc CLA 2005-06-03 09:53:41 EDT
*** Bug 87513 has been marked as a duplicate of this bug. ***
Comment 5 Olivier Thomann CLA 2005-06-06 21:13:11 EDT
Verified in N20050606-0010 + JDT/Core HEAD
Comment 6 Frederic Fusier CLA 2005-06-10 11:08:44 EDT
Verified for 3.1 RC2 using build I20050610-0010