Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IntelliJ IDE error when renaming extension methods #81

Closed
elshimone opened this issue May 9, 2019 · 1 comment

Comments

Projects
None yet
2 participants
@elshimone
Copy link

commented May 9, 2019

Describe the bug
An error is generated in IntelliJ when renaming extension methods which not annotated with @ This.

To Reproduce
Steps to reproduce the behavior:

  1. Add the following extension class definition to the sample rest application
package abc.extensions.java.lang.String;

import manifold.ext.api.*;

@Extension
public class MyStringExtension {

  public static void print(@This String thiz) {
    System.out.println(thiz);
  }

  @Extension // required for static extension methods
  public static String lineSeparator() {
    return System.lineSeparator();
  }
}
  1. Add some code which uses the lineSeparator() extension method, e.g.
"borked".lineSeparator();
  1. Right click on the lineSeparator() method call and choose refactor rename.
  2. An error is generated in the IDE, and the dialog box prompts to Rename file 'String.java' and all its usages.

Expected behavior
I would expect it to prompt me to enter a new name for the lineSeparator method.

Screenshots
Screen Shot 2019-05-09 at 19 40 56

Desktop (please complete the following information):

  • OS Type & Version: Mac OSX 10.13.6 (17G6030)
  • Java/JDK version: Java HotSpot(TM) 64-Bit Server VM (build 25.144-b01, mixed mode)
  • IntelliJ IDEA version: IntelliJ IDEA 2019.1.1 (Community Edition) Build #IC-191.6707.61, built on April 16, 2019
  • Manifold version: 0.65-alpha
  • Manifold IntelliJ plugin version: 0.65-alpha

Additional context
Refactoring extension methods annotated with @ This works as expected.

Stack trace
java.lang.NullPointerException
at manifold.ij.fs.IjResource.(IjResource.java:29)
at manifold.ij.fs.IjFile.(IjFile.java:29)
at manifold.ij.fs.IjFileSystem.getIFile(IjFileSystem.java:120)
at manifold.ij.util.FileUtil.toIFile(FileUtil.java:32)
at manifold.ij.extensions.RenameTypeManifoldFileProcessor.findPsiClass(RenameTypeManifoldFileProcessor.java:239)
at manifold.ij.extensions.RenameTypeManifoldFileProcessor.access$000(RenameTypeManifoldFileProcessor.java:54)
at manifold.ij.extensions.RenameTypeManifoldFileProcessor$1.lambda$selectNameWithoutExtension$0(RenameTypeManifoldFileProcessor.java:123)
at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:311)
at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:764)
at java.awt.EventQueue.access$500(EventQueue.java:98)
at java.awt.EventQueue$3.run(EventQueue.java:715)
at java.awt.EventQueue$3.run(EventQueue.java:709)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:74)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:734)
at com.intellij.ide.IdeEventQueue.defaultDispatchEvent(IdeEventQueue.java:741)
at com.intellij.ide.IdeEventQueue._dispatchEvent(IdeEventQueue.java:690)
at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.java:385)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:205)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:109)
at java.awt.WaitDispatchSupport$2.run(WaitDispatchSupport.java:190)
at java.awt.WaitDispatchSupport$4.run(WaitDispatchSupport.java:235)
at java.awt.WaitDispatchSupport$4.run(WaitDispatchSupport.java:233)
at java.security.AccessController.doPrivileged(Native Method)
at java.awt.WaitDispatchSupport.enter(WaitDispatchSupport.java:233)
at java.awt.Dialog.show(Dialog.java:1077)
at com.intellij.openapi.ui.impl.DialogWrapperPeerImpl$MyDialog.show(DialogWrapperPeerImpl.java:688)
at com.intellij.openapi.ui.impl.DialogWrapperPeerImpl.show(DialogWrapperPeerImpl.java:427)
at com.intellij.openapi.ui.DialogWrapper.invokeShow(DialogWrapper.java:1682)
at com.intellij.openapi.ui.DialogWrapper.show(DialogWrapper.java:1631)
at com.intellij.refactoring.ui.RefactoringDialog.show(RefactoringDialog.java:55)
at com.intellij.refactoring.rename.PsiElementRenameHandler.rename(PsiElementRenameHandler.java:191)
at com.intellij.refactoring.rename.PsiElementRenameHandler.rename(PsiElementRenameHandler.java:162)
at com.intellij.refactoring.rename.PsiElementRenameHandler.invoke(PsiElementRenameHandler.java:112)
at com.intellij.refactoring.rename.PsiElementRenameHandler.invoke(PsiElementRenameHandler.java:88)
at manifold.ij.extensions.ManRenameHandler.invoke(ManRenameHandler.java:65)
at com.intellij.refactoring.actions.BaseRefactoringAction.actionPerformed(BaseRefactoringAction.java:131)
at com.intellij.openapi.actionSystem.ex.ActionUtil$1.run(ActionUtil.java:261)
at com.intellij.openapi.application.TransactionGuardImpl.runSyncTransaction(TransactionGuardImpl.java:88)
at com.intellij.openapi.application.TransactionGuardImpl.submitTransactionAndWait(TransactionGuardImpl.java:153)
at com.intellij.openapi.actionSystem.ex.ActionUtil.performActionDumbAware(ActionUtil.java:276)
at com.intellij.openapi.actionSystem.impl.ActionMenuItem$ActionTransmitter.lambda$actionPerformed$0(ActionMenuItem.java:292)
at com.intellij.openapi.wm.impl.FocusManagerImpl.runOnOwnContext(FocusManagerImpl.java:283)
at com.intellij.openapi.wm.impl.IdeFocusManagerImpl.runOnOwnContext(IdeFocusManagerImpl.java:107)
at com.intellij.openapi.actionSystem.impl.ActionMenuItem$ActionTransmitter.actionPerformed(ActionMenuItem.java:282)
at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:2022)
at com.intellij.openapi.actionSystem.impl.ActionMenuItem.lambda$fireActionPerformed$0(ActionMenuItem.java:111)
at com.intellij.openapi.application.TransactionGuardImpl.runSyncTransaction(TransactionGuardImpl.java:88)
at com.intellij.openapi.application.TransactionGuardImpl.lambda$submitTransaction$1(TransactionGuardImpl.java:111)
at com.intellij.openapi.application.TransactionGuardImpl.submitTransaction(TransactionGuardImpl.java:120)
at com.intellij.openapi.application.TransactionGuard.submitTransaction(TransactionGuard.java:121)
at com.intellij.openapi.actionSystem.impl.ActionMenuItem.fireActionPerformed(ActionMenuItem.java:111)
at com.intellij.ui.plaf.beg.BegMenuItemUI.doClick(BegMenuItemUI.java:524)
at com.intellij.ui.plaf.beg.BegMenuItemUI.access$300(BegMenuItemUI.java:35)
at com.intellij.ui.plaf.beg.BegMenuItemUI$MyMouseInputHandler.mouseReleased(BegMenuItemUI.java:546)
at java.awt.Component.processMouseEvent(Component.java:6550)
at javax.swing.JComponent.processMouseEvent(JComponent.java:3325)
at java.awt.Component.processEvent(Component.java:6315)
at java.awt.Container.processEvent(Container.java:2239)
at java.awt.Component.dispatchEventImpl(Component.java:4899)
at java.awt.Container.dispatchEventImpl(Container.java:2297)
at java.awt.Component.dispatchEvent(Component.java:4721)
at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4904)
at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4535)
at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4476)
at java.awt.Container.dispatchEventImpl(Container.java:2283)
at java.awt.Window.dispatchEventImpl(Window.java:2746)
at java.awt.Component.dispatchEvent(Component.java:4721)
at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:766)
at java.awt.EventQueue.access$500(EventQueue.java:98)
at java.awt.EventQueue$3.run(EventQueue.java:715)
at java.awt.EventQueue$3.run(EventQueue.java:709)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:74)
at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:84)
at java.awt.EventQueue$4.run(EventQueue.java:739)
at java.awt.EventQueue$4.run(EventQueue.java:737)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:74)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:736)
at com.intellij.ide.IdeEventQueue.defaultDispatchEvent(IdeEventQueue.java:741)
at com.intellij.ide.IdeEventQueue._dispatchEvent(IdeEventQueue.java:686)
at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.java:385)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:205)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:82)

@rsmckinney

This comment has been minimized.

Copy link
Member

commented May 15, 2019

58f97882 scott on 5/14/2019 at 5:35 PM

(fixed in IJ plugin version 0.66-alpha)

@rsmckinney rsmckinney closed this May 15, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.