Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 351713 - [refactoring] Change Function Signature broken. Cannot use at all.
Summary: [refactoring] Change Function Signature broken. Cannot use at all.
Status: RESOLVED FIXED
Alias: None
Product: JSDT
Classification: WebTools
Component: General (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows 7
: P3 normal (vote)
Target Milestone: 3.5.2   Edit
Assignee: Victor Rubezhny CLA
QA Contact: Chris Jaun CLA
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-07-11 10:35 EDT by Arin Lipman CLA
Modified: 2013-12-19 17:10 EST (History)
3 users (show)

See Also:
cmjaun: review+


Attachments
Patch that fixes the NPE in Change Function Signature dialog (1.80 KB, patch)
2013-10-21 09:18 EDT, Victor Rubezhny CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Arin Lipman CLA 2011-07-11 10:35:44 EDT
Build Identifier: 20110301-1815

I just saw this function and wanted to start using it in some of my refactoring, but when I attempt to use the Change Function Signature function, it is never possible to click on Ok nor Preview.  I've changed the name of the function and variables with no change.  I've also attempted to give input parameters "types" and that dialog doesn't register anything as valid (I tested int & Function).

Here is the version & build id for the JSDT I'm using:
Version: 1.2.3.v201102160540-7C78FGUF9JgLWNO2UCNqfa
Build id: 20110217010641

Reproducible: Always

Steps to Reproduce:
1. In a .js file, right click on a function and select Refactor --> Change Funciton signature
2. Make some changes
3. Note that OK and Preview cannot be selected.
Comment 1 Lalit Somavarapha CLA 2011-08-12 11:09:31 EDT
Kindly provide us with a sample code to reproduce the bug.
Comment 2 Arin Lipman CLA 2011-08-16 09:10:31 EDT
I'm using a simple stub of a function:
function test(one, two, thre)
{
   return one + two + three;
}

I try to change the name of the function to myTestFunction within the Change Function Signature dialog, and the Preview and Ok buttons become disabled.  Also, if you attempt to use the Edit dialog for the parameters, you cannot change the type.

I've also upgraded to the following:
Version: Indigo Release
Build id: 20110615-0604
Comment 3 Victor Rubezhny CLA 2013-10-21 09:17:33 EDT
I see the following NPE while trying to use Refactoring->Change Function Signature dialog:

!ENTRY org.eclipse.ui 4 0 2013-10-21 17:15:25.678
!MESSAGE Unhandled event loop exception
!STACK 0
java.lang.NullPointerException
	at org.eclipse.wst.jsdt.internal.corext.refactoring.structure.ChangeSignatureRefactoring.checkMethodName(ChangeSignatureRefactoring.java:488)
	at org.eclipse.wst.jsdt.internal.corext.refactoring.structure.ChangeSignatureRefactoring.checkSignature(ChangeSignatureRefactoring.java:348)
	at org.eclipse.wst.jsdt.internal.corext.refactoring.structure.ChangeSignatureRefactoring.checkSignature(ChangeSignatureRefactoring.java:343)
	at org.eclipse.wst.jsdt.internal.ui.refactoring.ChangeSignatureWizard$ChangeSignatureInputPage.updateStatus(ChangeSignatureWizard.java:372)
	at org.eclipse.wst.jsdt.internal.ui.refactoring.ChangeSignatureWizard$ChangeSignatureInputPage.update(ChangeSignatureWizard.java:358)
	at org.eclipse.wst.jsdt.internal.ui.refactoring.ChangeSignatureWizard$ChangeSignatureInputPage.access$3(ChangeSignatureWizard.java:357)
	at org.eclipse.wst.jsdt.internal.ui.refactoring.ChangeSignatureWizard$5.modifyText(ChangeSignatureWizard.java:252)
	at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:179)
	at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1392)
	at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3742)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3363)
	at org.eclipse.jface.window.Window.runEventLoop(Window.java:826)
	at org.eclipse.jface.window.Window.open(Window.java:802)
	at org.eclipse.ltk.ui.refactoring.RefactoringWizardOpenOperation$1.run(RefactoringWizardOpenOperation.java:187)
	at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:70)
	at org.eclipse.ltk.ui.refactoring.RefactoringWizardOpenOperation.run(RefactoringWizardOpenOperation.java:202)
	at org.eclipse.ltk.ui.refactoring.RefactoringWizardOpenOperation.run(RefactoringWizardOpenOperation.java:122)
	at org.eclipse.wst.jsdt.internal.ui.refactoring.actions.RefactoringStarter.activate(RefactoringStarter.java:45)
	at org.eclipse.wst.jsdt.internal.ui.refactoring.UserInterfaceStarter.activate(UserInterfaceStarter.java:57)
	at org.eclipse.wst.jsdt.internal.corext.refactoring.RefactoringExecutionStarter$1.activate(RefactoringExecutionStarter.java:197)
	at org.eclipse.wst.jsdt.internal.corext.refactoring.RefactoringExecutionStarter.startChangeSignatureRefactoring(RefactoringExecutionStarter.java:202)
	at org.eclipse.wst.jsdt.ui.actions.ModifyParametersAction.run(ModifyParametersAction.java:135)
	at org.eclipse.wst.jsdt.ui.actions.SelectionDispatchAction.dispatchRun(SelectionDispatchAction.java:249)
	at org.eclipse.wst.jsdt.ui.actions.SelectionDispatchAction.run(SelectionDispatchAction.java:221)
	at org.eclipse.jface.action.Action.runWithEvent(Action.java:499)
	at org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection(ActionContributionItem.java:584)
	at org.eclipse.jface.action.ActionContributionItem.access$2(ActionContributionItem.java:501)
	at org.eclipse.jface.action.ActionContributionItem$5.handleEvent(ActionContributionItem.java:411)
	at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
Comment 4 Victor Rubezhny CLA 2013-10-21 09:18:55 EDT
Created attachment 236706 [details]
Patch that fixes the NPE in Change Function Signature dialog
Comment 5 Victor Rubezhny CLA 2013-10-21 09:23:03 EDT
Tha patch fixes the NPE, but I found another issue with refactoring here: Bug #419970 - the refactoring works correctly only when all the files are saved.