Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 178441

Summary: [change method signature] NPE in ConstructorReferenceFinder
Product: [Eclipse Project] JDT Reporter: garry star <gstar42>
Component: UIAssignee: Markus Keller <markus.kell.r>
Status: CLOSED WONTFIX QA Contact:
Severity: normal    
Priority: P3 CC: markus.kell.r, martinae
Version: 3.2.2   
Target Milestone: ---   
Hardware: PC   
OS: Windows XP   
Whiteboard: stalebug

Description garry star CLA 2007-03-20 17:56:12 EDT
Build ID: M20070212-1330

Steps To Reproduce:
1.Attempt to refactor - change method signature (param2 int -> string)

2.
3.


More information:
I've been refactoring all day and suddenly I got this...

Here is the error log:

!ENTRY org.eclipse.ltk.ui.refactoring 4 10000 2007-03-20 14:44:19.777
!MESSAGE Internal Error
!STACK 0
java.lang.reflect.InvocationTargetException
	at org.eclipse.jface.operation.ModalContext.run(ModalContext.java:350)
	at org.eclipse.ltk.internal.ui.refactoring.RefactoringWizardDialog2.run(RefactoringWizardDialog2.java:304)
	at org.eclipse.ltk.ui.refactoring.RefactoringWizard.createChange(RefactoringWizard.java:571)
	at org.eclipse.ltk.ui.refactoring.RefactoringWizard.computeUserInputSuccessorPage(RefactoringWizard.java:414)
	at org.eclipse.ltk.ui.refactoring.UserInputWizardPage.computeSuccessorPage(UserInputWizardPage.java:75)
	at org.eclipse.ltk.ui.refactoring.UserInputWizardPage.getNextPage(UserInputWizardPage.java:115)
	at org.eclipse.ltk.internal.ui.refactoring.RefactoringWizardDialog2.nextOrPreviewPressed(RefactoringWizardDialog2.java:475)
	at org.eclipse.ltk.internal.ui.refactoring.RefactoringWizardDialog2.access$0(RefactoringWizardDialog2.java:472)
	at org.eclipse.ltk.internal.ui.refactoring.RefactoringWizardDialog2$1.widgetSelected(RefactoringWizardDialog2.java:660)
	at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:90)
	at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:66)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:928)
	at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3348)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:2968)
	at org.eclipse.jface.window.Window.runEventLoop(Window.java:820)
	at org.eclipse.jface.window.Window.open(Window.java:796)
	at org.eclipse.ltk.ui.refactoring.RefactoringWizardOpenOperation$1.run(RefactoringWizardOpenOperation.java:132)
	at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:67)
	at org.eclipse.ltk.ui.refactoring.RefactoringWizardOpenOperation.run(RefactoringWizardOpenOperation.java:145)
	at org.eclipse.jdt.internal.ui.refactoring.actions.RefactoringStarter.activate(RefactoringStarter.java:40)
	at org.eclipse.jdt.internal.ui.refactoring.UserInterfaceStarter.activate(UserInterfaceStarter.java:56)
	at org.eclipse.jdt.internal.corext.refactoring.RefactoringExecutionStarter$1.activate(RefactoringExecutionStarter.java:199)
	at org.eclipse.jdt.internal.corext.refactoring.RefactoringExecutionStarter.startChangeSignatureRefactoring(RefactoringExecutionStarter.java:204)
	at org.eclipse.jdt.ui.actions.ModifyParametersAction.run(ModifyParametersAction.java:132)
	at org.eclipse.jdt.ui.actions.SelectionDispatchAction.dispatchRun(SelectionDispatchAction.java:271)
	at org.eclipse.jdt.ui.actions.SelectionDispatchAction.run(SelectionDispatchAction.java:243)
	at org.eclipse.jface.action.Action.runWithEvent(Action.java:499)
	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:461)
	at org.eclipse.core.commands.ParameterizedCommand.executeWithChecks(ParameterizedCommand.java:424)
	at org.eclipse.ui.internal.handlers.HandlerService.executeCommand(HandlerService.java:160)
	at org.eclipse.ui.internal.keys.WorkbenchKeyboard.executeCommand(WorkbenchKeyboard.java:466)
	at org.eclipse.ui.internal.keys.WorkbenchKeyboard.press(WorkbenchKeyboard.java:799)
	at org.eclipse.ui.internal.keys.WorkbenchKeyboard.processKeyEvent(WorkbenchKeyboard.java:846)
	at org.eclipse.ui.internal.keys.WorkbenchKeyboard.filterKeySequenceBindings(WorkbenchKeyboard.java:564)
	at org.eclipse.ui.internal.keys.WorkbenchKeyboard.access$3(WorkbenchKeyboard.java:506)
	at org.eclipse.ui.internal.keys.WorkbenchKeyboard$KeyDownFilter.handleEvent(WorkbenchKeyboard.java:122)
	at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:66)
	at org.eclipse.swt.widgets.Display.filterEvent(Display.java:982)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:927)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:952)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:937)
	at org.eclipse.swt.widgets.Control.traverse(Control.java:2965)
	at org.eclipse.swt.widgets.Control.translateMnemonic(Control.java:2809)
	at org.eclipse.swt.widgets.Composite.translateMnemonic(Composite.java:924)
	at org.eclipse.swt.widgets.Control.translateMnemonic(Control.java:2827)
	at org.eclipse.swt.widgets.Display.translateMnemonic(Display.java:3852)
	at org.eclipse.swt.widgets.Display.filterMessage(Display.java:996)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:2964)
	at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:1930)
	at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:1894)
	at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:422)
	at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
	at org.eclipse.ui.internal.ide.IDEApplication.run(IDEApplication.java:95)
	at org.eclipse.core.internal.runtime.PlatformActivator$1.run(PlatformActivator.java:78)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:92)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:68)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:400)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:177)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
	at java.lang.reflect.Method.invoke(Unknown Source)
	at org.eclipse.core.launcher.Main.invokeFramework(Main.java:336)
	at org.eclipse.core.launcher.Main.basicRun(Main.java:280)
	at org.eclipse.core.launcher.Main.run(Main.java:977)
	at org.eclipse.core.launcher.Main.main(Main.java:952)
Caused by: java.lang.NullPointerException
	at org.eclipse.jdt.internal.corext.refactoring.structure.ConstructorReferenceFinder.isRealConstructorReferenceNode(ConstructorReferenceFinder.java:124)
	at org.eclipse.jdt.internal.corext.refactoring.structure.ConstructorReferenceFinder.removeUnrealReferences(ConstructorReferenceFinder.java:112)
	at org.eclipse.jdt.internal.corext.refactoring.structure.ConstructorReferenceFinder.getConstructorReferences(ConstructorReferenceFinder.java:96)
	at org.eclipse.jdt.internal.corext.refactoring.structure.ConstructorReferenceFinder.getConstructorOccurrences(ConstructorReferenceFinder.java:85)
	at org.eclipse.jdt.internal.corext.refactoring.structure.ChangeSignatureRefactoring.findOccurrences(ChangeSignatureRefactoring.java:1431)
	at org.eclipse.jdt.internal.corext.refactoring.structure.ChangeSignatureRefactoring.checkFinalConditions(ChangeSignatureRefactoring.java:785)
	at org.eclipse.ltk.core.refactoring.CheckConditionsOperation.run(CheckConditionsOperation.java:83)
	at org.eclipse.ltk.core.refactoring.CreateChangeOperation.run(CreateChangeOperation.java:118)
	at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:1737)
	at org.eclipse.ltk.internal.ui.refactoring.WorkbenchRunnableAdapter.run(WorkbenchRunnableAdapter.java:87)
	at org.eclipse.jface.operation.ModalContext$ModalContextThread.run(ModalContext.java:113)
Root exception:
java.lang.NullPointerException
	at org.eclipse.jdt.internal.corext.refactoring.structure.ConstructorReferenceFinder.isRealConstructorReferenceNode(ConstructorReferenceFinder.java:124)
	at org.eclipse.jdt.internal.corext.refactoring.structure.ConstructorReferenceFinder.removeUnrealReferences(ConstructorReferenceFinder.java:112)
	at org.eclipse.jdt.internal.corext.refactoring.structure.ConstructorReferenceFinder.getConstructorReferences(ConstructorReferenceFinder.java:96)
	at org.eclipse.jdt.internal.corext.refactoring.structure.ConstructorReferenceFinder.getConstructorOccurrences(ConstructorReferenceFinder.java:85)
	at org.eclipse.jdt.internal.corext.refactoring.structure.ChangeSignatureRefactoring.findOccurrences(ChangeSignatureRefactoring.java:1431)
	at org.eclipse.jdt.internal.corext.refactoring.structure.ChangeSignatureRefactoring.checkFinalConditions(ChangeSignatureRefactoring.java:785)
	at org.eclipse.ltk.core.refactoring.CheckConditionsOperation.run(CheckConditionsOperation.java:83)
	at org.eclipse.ltk.core.refactoring.CreateChangeOperation.run(CreateChangeOperation.java:118)
	at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:1737)
	at org.eclipse.ltk.internal.ui.refactoring.WorkbenchRunnableAdapter.run(WorkbenchRunnableAdapter.java:87)
	at org.eclipse.jface.operation.ModalContext$ModalContextThread.run(ModalContext.java:113)
Comment 1 Olivier Thomann CLA 2007-03-20 19:48:40 EDT
Move to JDT/UI
Comment 2 Martin Aeschlimann CLA 2007-03-21 07:55:47 EDT
This is a very strange stack trace.			

NPE on this line ((AbstractTypeDeclaration) node.getParent()).getNameProperty().equals(node.getLocationInParent())) {
but node and node.getParent are guaranteed to be not null. And getNameProperty can also never return null.

We need some code example that can reproduce this. Markus, any ideas?
Comment 3 Markus Keller CLA 2007-03-21 11:19:44 EDT
Garry, can you reproduce this problem? It looks like you were trying to change the signature of a constructor, but I could not come up with a test case that fails. Any hints about the circumstances would be helpful.

(In reply to comment #2)
This is against 3.2.2, not HEAD. In 3.2.2, the NPE is one line up, at
		if (node.getParent() instanceof AbstractTypeDeclaration

The node from ASTNodeSearchUtil.getAstNode(searchResult, cuNode) seems to be null, which indicates a problem with search result ranges.
Comment 4 Eclipse Genie CLA 2019-09-06 16:53:11 EDT
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet.

If you have further information on the current state of the bug, please add it. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant.

--
The automated Eclipse Genie.