Bug 90138 - [refactoring] [rename] Renaming method throws internal exception
Summary: [refactoring] [rename] Renaming method throws internal exception
Status: RESOLVED INVALID
Alias: None
Product: JDT
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 3.1   Edit
Hardware: PC Linux
: P3 normal with 1 vote (vote)
Target Milestone: ---   Edit
Assignee: JDT-UI-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords: needinfo
Depends on:
Blocks:
 
Reported: 2005-04-04 06:07 EDT by Max Gilead CLA
Modified: 2009-08-30 02:05 EDT (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Max Gilead CLA 2005-04-04 06:07:45 EDT
I renamed one method successfully, then tried renaming method with the same name
in another class which resulted in this exception:


!ENTRY org.eclipse.ltk.ui.refactoring 4 10000 2005-04-04 11:48:09.764
!MESSAGE Internal Error
!STACK 0
java.lang.reflect.InvocationTargetException
	at org.eclipse.jface.operation.ModalContext.run(ModalContext.java:327)
	at
org.eclipse.ltk.internal.ui.refactoring.RefactoringWizardDialog2.run(RefactoringWizardDialog2.java:282)
	at
org.eclipse.ltk.ui.refactoring.RefactoringWizard.internalPerformFinish(RefactoringWizard.java:544)
	at
org.eclipse.ltk.ui.refactoring.UserInputWizardPage.performFinish(UserInputWizardPage.java:153)
	at
org.eclipse.ltk.ui.refactoring.RefactoringWizard.performFinish(RefactoringWizard.java:610)
	at
org.eclipse.ltk.internal.ui.refactoring.RefactoringWizardDialog2.okPressed(RefactoringWizardDialog2.java:406)
	at org.eclipse.jface.dialogs.Dialog.buttonPressed(Dialog.java:409)
	at org.eclipse.jface.dialogs.Dialog$2.widgetSelected(Dialog.java:556)
	at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:89)
	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.Display.runDeferredEvents(Display.java:2778)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:2472)
	at org.eclipse.jface.window.Window.runEventLoop(Window.java:803)
	at org.eclipse.jface.window.Window.open(Window.java:781)
	at
org.eclipse.ltk.ui.refactoring.RefactoringWizardOpenOperation$1.run(RefactoringWizardOpenOperation.java:125)
	at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:69)
	at
org.eclipse.ltk.ui.refactoring.RefactoringWizardOpenOperation.run(RefactoringWizardOpenOperation.java:138)
	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.ui.refactoring.reorg.RenameUserInterfaceStarter.activate(RenameUserInterfaceStarter.java:113)
	at
org.eclipse.jdt.internal.ui.refactoring.reorg.RenameMethodUserInterfaceStarter.activate(RenameMethodUserInterfaceStarter.java:66)
	at org.eclipse.jdt.ui.refactoring.RenameSupport.openDialog(RenameSupport.java:114)
	at
org.eclipse.jdt.internal.ui.refactoring.actions.RenameJavaElementAction.run(RenameJavaElementAction.java:180)
	at
org.eclipse.jdt.internal.ui.refactoring.actions.RenameJavaElementAction.run(RenameJavaElementAction.java:133)
	at org.eclipse.jdt.ui.actions.RenameAction.run(RenameAction.java:116)
	at
org.eclipse.jdt.ui.actions.SelectionDispatchAction.dispatchRun(SelectionDispatchAction.java:216)
	at
org.eclipse.jdt.ui.actions.SelectionDispatchAction.run(SelectionDispatchAction.java:188)
	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:331)
	at
org.eclipse.core.commands.ParameterizedCommand.execute(ParameterizedCommand.java:396)
	at
org.eclipse.ui.internal.keys.WorkbenchKeyboard.executeCommand(WorkbenchKeyboard.java:452)
	at org.eclipse.ui.internal.keys.WorkbenchKeyboard.press(WorkbenchKeyboard.java:741)
	at
org.eclipse.ui.internal.keys.WorkbenchKeyboard.processKeyEvent(WorkbenchKeyboard.java:784)
	at
org.eclipse.ui.internal.keys.WorkbenchKeyboard.filterKeySequenceBindings(WorkbenchKeyboard.java:543)
	at
org.eclipse.ui.internal.keys.WorkbenchKeyboard.access$3(WorkbenchKeyboard.java:486)
	at
org.eclipse.ui.internal.keys.WorkbenchKeyboard$KeyDownFilter.handleEvent(WorkbenchKeyboard.java:110)
	at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:82)
	at org.eclipse.swt.widgets.Display.filterEvent(Display.java:1125)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1011)
	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:1960)
	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:3338)
	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:4703)
	at org.eclipse.swt.widgets.Display.eventProc(Display.java:942)
	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:1129)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:2470)
	at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:1570)
	at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:1534)
	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:228)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:344)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:156)
	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:315)
	at org.eclipse.core.launcher.Main.basicRun(Main.java:268)
	at org.eclipse.core.launcher.Main.run(Main.java:942)
	at org.eclipse.core.launcher.Main.main(Main.java:926)
Caused by: java.lang.NullPointerException
	at
org.eclipse.jdt.internal.core.search.matching.OrPattern.<init>(OrPattern.java:36)
	at
org.eclipse.jdt.core.search.SearchPattern.createOrPattern(SearchPattern.java:733)
	at
org.eclipse.jdt.internal.corext.refactoring.RefactoringSearchEngine.createOrPattern(RefactoringSearchEngine.java:191)
	at
org.eclipse.jdt.internal.corext.refactoring.rename.RenameMethodProcessor.searchForOuterTypesOfReferences(RenameMethodProcessor.java:282)
	at
org.eclipse.jdt.internal.corext.refactoring.rename.RenameMethodProcessor.checkFinalConditions(RenameMethodProcessor.java:216)
	at
org.eclipse.jdt.internal.corext.refactoring.rename.RenameNonVirtualMethodProcessor.checkFinalConditions(RenameNonVirtualMethodProcessor.java:61)
	at
org.eclipse.ltk.core.refactoring.participants.ProcessorBasedRefactoring.checkFinalConditions(ProcessorBasedRefactoring.java:165)
	at
org.eclipse.ltk.core.refactoring.CheckConditionsOperation.run(CheckConditionsOperation.java:84)
	at
org.eclipse.ltk.core.refactoring.CreateChangeOperation.run(CreateChangeOperation.java:114)
	at
org.eclipse.ltk.core.refactoring.PerformChangeOperation.run(PerformChangeOperation.java:189)
	at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:1714)
	at
org.eclipse.ltk.internal.ui.refactoring.WorkbenchRunnableAdapter.run(WorkbenchRunnableAdapter.java:86)
	at
org.eclipse.jface.operation.ModalContext$ModalContextThread.run(ModalContext.java:113)
Root exception:
java.lang.NullPointerException
	at
org.eclipse.jdt.internal.core.search.matching.OrPattern.<init>(OrPattern.java:36)
	at
org.eclipse.jdt.core.search.SearchPattern.createOrPattern(SearchPattern.java:733)
	at
org.eclipse.jdt.internal.corext.refactoring.RefactoringSearchEngine.createOrPattern(RefactoringSearchEngine.java:191)
	at
org.eclipse.jdt.internal.corext.refactoring.rename.RenameMethodProcessor.searchForOuterTypesOfReferences(RenameMethodProcessor.java:282)
	at
org.eclipse.jdt.internal.corext.refactoring.rename.RenameMethodProcessor.checkFinalConditions(RenameMethodProcessor.java:216)
	at
org.eclipse.jdt.internal.corext.refactoring.rename.RenameNonVirtualMethodProcessor.checkFinalConditions(RenameNonVirtualMethodProcessor.java:61)
	at
org.eclipse.ltk.core.refactoring.participants.ProcessorBasedRefactoring.checkFinalConditions(ProcessorBasedRefactoring.java:165)
	at
org.eclipse.ltk.core.refactoring.CheckConditionsOperation.run(CheckConditionsOperation.java:84)
	at
org.eclipse.ltk.core.refactoring.CreateChangeOperation.run(CreateChangeOperation.java:114)
	at
org.eclipse.ltk.core.refactoring.PerformChangeOperation.run(PerformChangeOperation.java:189)
	at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:1714)
	at
org.eclipse.ltk.internal.ui.refactoring.WorkbenchRunnableAdapter.run(WorkbenchRunnableAdapter.java:86)
	at
org.eclipse.jface.operation.ModalContext$ModalContextThread.run(ModalContext.java:113)


3.1M6 Linux/GTK
Comment 1 Frederic Fusier CLA 2005-04-04 06:29:22 EDT
Can you provide detailed test case to help me to reproduce?
Thanks
Comment 2 Max Gilead CLA 2005-04-04 08:25:38 EDT
I'm sorry but unfortunately it's not possible. I tried to zip the project and
then reproduce but everything went fine after closing and opening again.
Comment 3 Frederic Fusier CLA 2005-04-04 09:14:27 EDT
So, I close it as REMIND for the while.
Reopen it as soon as you get it again and provide corresponding test case.
Thanks
Comment 4 Frederic Fusier CLA 2005-04-04 09:18:21 EDT
Looking at stack trace the NPE can occur only if one of the two parameters
leftPattern or rightPattern is null.
That means there's a problem while calling SearchPattern.createOrPattern(...)
method in RefactoringSearchEngine.createOrPattern(RefactoringSearchEngine.java:191)

So, reopen to change bug component...
Comment 5 Frederic Fusier CLA 2005-04-04 09:19:00 EDT
Move to JDT/UI (see previous comment)
Comment 6 Dirk Baeumer CLA 2005-04-04 09:58:30 EDT
Markus, any idea what happens here ?
Comment 7 Markus Keller CLA 2005-04-04 10:34:47 EDT
Max, do you remember what the new method name was? The problem depends on the
new name of the renamed method. It's in the code that searches for existing
declarations of the newly renamed method (in order to find clashes).

In this search for method declarations, the search engine is reporting a
SearchMatch whose getElement() is null, and I have no idea under what
circumstances that could happen.
Comment 8 Max Gilead CLA 2005-04-05 17:59:17 EDT
yes, I renamed method "private String toString(Map m)" to "private String
valuesToString(Map m)" in two classes, and problem occured in second one.

I don't remember if it was still the same Eclipse session but I renamed them to
toString a while before and was reverting back to original names.
Comment 9 sunfish CLA 2005-12-01 20:00:20 EST
Hi,

Looks like this hasn't been worked on in awhile, but I get it a lot in my code using eclipse 3.1, 3.2M2 and 3.2M3. I haven't been able to create a test case, but I noticed something odd.

Below is a code snippet. When I try to rename getVarName to getName, it give me the exception. But, I can rename it to any other name - for instance, hello() - and it works fine. Note that I renamed setVarName -> setName with no problems.

I'm using all java 5.0 compiler options, and jdk 1.5.0_05.

Thanks!
--------
public class GlobalVar implements Comparable<GlobalVar>
{
    private String _varName;
    private VarType _varType;
    private Object _defaultValue;
    private String _description;

    public GlobalVar(String varName, VarType varType, Object defValue)
    {
        super();
        _varName = varName;
        _varType = varType;
        _defaultValue = defValue;
        _description = "";

        if (_defaultValue == null)
            _defaultValue = varType.createDefaultValue();

        assert (_varName != null);
        assert (_varType == VarType.STRING || _varType == VarType.INTEGER
                || _varType == VarType.FLOAT || _varType == VarType.BOOLEAN);
        assert (_defaultValue != null);
    }

    public int compareTo(GlobalVar other)
    {
        return _varName.compareToIgnoreCase(other._varName);
    }

    public final String getVarName()
    {
        return _varName;
    }

    public final void setName(String name)
    {
        _varName = name;
    }

     // ...
}
Comment 10 Markus Keller CLA 2005-12-02 06:53:35 EST
sunfish, I just released more diagnostics to HEAD to get a better error message in this case. Could you please try to reproduce with one of the next integration builds and add the new error message to this bug? Thanks.
Comment 11 Markus Keller CLA 2006-05-30 11:51:09 EDT
Setting to REMIND, please reopen if you you have steps to reproduce or see this with a recent 3.2 build.
Comment 12 Denis Roy CLA 2009-08-30 02:05:19 EDT
As of now 'LATER' and 'REMIND' resolutions are no longer supported.
Please reopen this bug if it is still valid for you.