kontext-e / AutoFillingCallArguments

This IntelliJ IDEA plugin guesses the call parameters by the callee parameter names.
Apache License 2.0
22 stars 11 forks source link

NPE @AutoFillCallArguments #3

Closed Tichu78 closed 1 year ago

Tichu78 commented 3 years ago

java.lang.NullPointerException at de.kontext_e.idea.plugins.autofill.AutoFillCallArguments.invoke(AutoFillCallArguments.java:27) at com.intellij.codeInsight.intention.PsiElementBaseIntentionAction.invoke(PsiElementBaseIntentionAction.java:41) at com.intellij.codeInsight.intention.impl.config.IntentionActionWrapper.invoke(IntentionActionWrapper.java:65) at com.intellij.codeInsight.intention.impl.IntentionActionWithTextCaching$MyIntentionAction.invoke(IntentionActionWithTextCaching.java:184) at com.intellij.codeInsight.intention.impl.ShowIntentionActionsHandler.lambda$invokeIntention$4(ShowIntentionActionsHandler.java:251) at com.intellij.openapi.application.WriteAction.run(WriteAction.java:102) at com.intellij.codeInsight.intention.impl.ShowIntentionActionsHandler.invokeIntention(ShowIntentionActionsHandler.java:251) at com.intellij.codeInsight.intention.impl.ShowIntentionActionsHandler.lambda$chooseActionAndInvoke$3(ShowIntentionActionsHandler.java:227) at com.intellij.openapi.command.impl.CoreCommandProcessor.executeCommand(CoreCommandProcessor.java:220) at com.intellij.openapi.command.impl.CoreCommandProcessor.executeCommand(CoreCommandProcessor.java:177) at com.intellij.openapi.command.impl.CoreCommandProcessor.executeCommand(CoreCommandProcessor.java:167) at com.intellij.openapi.command.impl.CoreCommandProcessor.executeCommand(CoreCommandProcessor.java:153) at com.intellij.codeInsight.intention.impl.ShowIntentionActionsHandler.chooseActionAndInvoke(ShowIntentionActionsHandler.java:226) at com.intellij.codeInsight.intention.impl.IntentionListStep.lambda$applyAction$3(IntentionListStep.java:117) at com.intellij.openapi.application.TransactionGuardImpl.performUserActivity(TransactionGuardImpl.java:94) at com.intellij.ui.popup.AbstractPopup.lambda$dispose$16(AbstractPopup.java:1464) at com.intellij.util.ui.UIUtil.invokeLaterIfNeeded(UIUtil.java:2254) at com.intellij.ide.IdeEventQueue.ifFocusEventsInTheQueue(IdeEventQueue.java:188) at com.intellij.ide.IdeEventQueue.executeWhenAllFocusEventsLeftTheQueue(IdeEventQueue.java:140) at com.intellij.openapi.wm.impl.FocusManagerImpl.doWhenFocusSettlesDown(FocusManagerImpl.java:178) at com.intellij.openapi.wm.impl.IdeFocusManagerImpl.doWhenFocusSettlesDown(IdeFocusManagerImpl.java:36) at com.intellij.ui.popup.AbstractPopup.dispose(AbstractPopup.java:1460) at com.intellij.ui.popup.WizardPopup.dispose(WizardPopup.java:158) at com.intellij.ui.popup.list.ListPopupImpl.dispose(ListPopupImpl.java:326) at com.intellij.openapi.util.ObjectNode.lambda$execute$0(ObjectNode.java:111) at com.intellij.openapi.util.ObjectTree.executeActionWithRecursiveGuard(ObjectTree.java:193) at com.intellij.openapi.util.ObjectNode.execute(ObjectNode.java:71) at com.intellij.openapi.util.ObjectTree.executeAll(ObjectTree.java:141) at com.intellij.openapi.util.Disposer.dispose(Disposer.java:130) at com.intellij.openapi.util.Disposer.dispose(Disposer.java:120) at com.intellij.ui.popup.WizardPopup.disposeAllParents(WizardPopup.java:261) at com.intellij.ui.popup.list.ListPopupImpl.handleNextStep(ListPopupImpl.java:461) at com.intellij.ui.popup.list.ListPopupImpl._handleSelect(ListPopupImpl.java:415) at com.intellij.ui.popup.list.ListPopupImpl.handleSelect(ListPopupImpl.java:356) at com.intellij.ui.popup.list.ListPopupImpl$1.actionPerformed(ListPopupImpl.java:269) at com.intellij.ui.popup.WizardPopup.proceedKeyEvent(WizardPopup.java:376) at com.intellij.ui.popup.WizardPopup.dispatch(WizardPopup.java:356) at com.intellij.ui.popup.PopupDispatcher.dispatchKeyEvent(PopupDispatcher.java:112) at com.intellij.ui.popup.PopupDispatcher.dispatch(PopupDispatcher.java:148) at com.intellij.ide.IdePopupManager.dispatch(IdePopupManager.java:93) at com.intellij.ide.IdeEventQueue._dispatchEvent(IdeEventQueue.java:808) at com.intellij.ide.IdeEventQueue.lambda$dispatchEvent$8(IdeEventQueue.java:452) at com.intellij.openapi.progress.impl.CoreProgressManager.computePrioritized(CoreProgressManager.java:744) at com.intellij.ide.IdeEventQueue.lambda$dispatchEvent$9(IdeEventQueue.java:451) at com.intellij.openapi.application.impl.ApplicationImpl.runIntendedWriteActionOnCurrentThread(ApplicationImpl.java:802) at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.java:505) at java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:203) at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:124) at java.desktop/java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:113) at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:109) at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101) at java.desktop/java.awt.EventDispatchThread.run(EventDispatchThread.java:90)

CymricNPG commented 2 years ago

I get the same error with IntelliJ 2022.2, Plugin Version: 1.0

java.lang.NullPointerException: Cannot invoke "com.intellij.psi.PsiMethod.getParameterList()" because the return value of "com.intellij.psi.PsiCallExpression.resolveMethod()" is null
    at de.kontext_e.idea.plugins.autofill.AutoFillCallArguments.invoke(AutoFillCallArguments.java:27)
    at com.intellij.codeInsight.intention.PsiElementBaseIntentionAction.invoke(PsiElementBaseIntentionAction.java:41)
    at com.intellij.codeInsight.intention.impl.config.IntentionActionWrapper.invoke(IntentionActionWrapper.java:61)
    at com.intellij.codeInsight.intention.impl.IntentionActionWithTextCaching$MyIntentionAction.lambda$invoke$0(IntentionActionWithTextCaching.java:224)
    at com.intellij.util.SlowOperations.allowSlowOperations(SlowOperations.java:149)
omasseau commented 1 year ago

Getting the same error in IntelliJ 2022.3.1, Plugin version 1.0 :

2023-04-18 17:19:30,974 [ 201327] SEVERE - #c.i.o.u.ObjectTree - Cannot invoke "com.intellij.psi.PsiMethod.getParameterList()" because the return value of "com.intellij.psi.PsiCallExpression.resolveMethod()" is null java.lang.NullPointerException: Cannot invoke "com.intellij.psi.PsiMethod.getParameterList()" because the return value of "com.intellij.psi.PsiCallExpression.resolveMethod()" is null at de.kontext_e.idea.plugins.autofill.AutoFillCallArguments.invoke(AutoFillCallArguments.java:27) at com.intellij.codeInsight.intention.PsiElementBaseIntentionAction.invoke(PsiElementBaseIntentionAction.java:41) at com.intellij.codeInsight.intention.impl.config.IntentionActionWrapper.invoke(IntentionActionWrapper.java:86) at com.intellij.codeInsight.intention.impl.IntentionActionWithTextCaching$MyIntentionAction.lambda$invoke$0(IntentionActionWithTextCaching.java:224) at com.intellij.util.SlowOperations.allowSlowOperations(SlowOperations.java:167) at com.intellij.codeInsight.intention.impl.IntentionActionWithTextCaching$MyIntentionAction.invoke(IntentionActionWithTextCaching.java:224) at com.intellij.codeInsight.intention.impl.ShowIntentionActionsHandler.lambda$invokeIntention$5(ShowIntentionActionsHandler.java:255) at com.intellij.openapi.application.WriteAction.lambda$run$1(WriteAction.java:86) at com.intellij.openapi.application.impl.ApplicationImpl.runWriteActionWithClass(ApplicationImpl.java:943) at com.intellij.openapi.application.impl.ApplicationImpl.runWriteAction(ApplicationImpl.java:969) at com.intellij.openapi.application.WriteAction.run(WriteAction.java:85) at com.intellij.codeInsight.intention.impl.ShowIntentionActionsHandler.invokeIntention(ShowIntentionActionsHandler.java:255) at com.intellij.codeInsight.intention.impl.ShowIntentionActionsHandler.lambda$chooseActionAndInvoke$4(ShowIntentionActionsHandler.java:231) at com.intellij.openapi.command.impl.CoreCommandProcessor.executeCommand(CoreCommandProcessor.java:219) at com.intellij.openapi.command.impl.CoreCommandProcessor.executeCommand(CoreCommandProcessor.java:174) at com.intellij.openapi.command.impl.CoreCommandProcessor.executeCommand(CoreCommandProcessor.java:164) at com.intellij.openapi.command.impl.CoreCommandProcessor.executeCommand(CoreCommandProcessor.java:150) at com.intellij.codeInsight.intention.impl.ShowIntentionActionsHandler.chooseActionAndInvoke(ShowIntentionActionsHandler.java:230) at com.intellij.codeInsight.intention.impl.IntentionListStep.chooseActionAndInvoke(IntentionListStep.java:140) at com.intellij.codeInsight.intention.impl.IntentionListStep.lambda$applyAction$3(IntentionListStep.java:132) at com.intellij.ui.popup.AbstractPopup.lambda$dispose$17(AbstractPopup.java:1585) at com.intellij.openapi.wm.impl.FocusManagerImpl.lambda$doWhenFocusSettlesDown$3(FocusManagerImpl.java:173) at com.intellij.util.ui.EdtInvocationManager.invokeLaterIfNeeded(EdtInvocationManager.java:33) at com.intellij.ide.IdeEventQueue.ifFocusEventsInTheQueue(IdeEventQueue.java:176) at com.intellij.ide.IdeEventQueue.executeWhenAllFocusEventsLeftTheQueue(IdeEventQueue.java:129) at com.intellij.openapi.wm.impl.FocusManagerImpl.doWhenFocusSettlesDown(FocusManagerImpl.java:169) at com.intellij.openapi.wm.impl.FocusManagerImpl.doWhenFocusSettlesDown(FocusManagerImpl.java:163) at com.intellij.ui.popup.AbstractPopup.dispose(AbstractPopup.java:1583) at com.intellij.ui.popup.WizardPopup.dispose(WizardPopup.java:165) at com.intellij.ui.popup.list.ListPopupImpl.dispose(ListPopupImpl.java:377) at com.intellij.openapi.util.ObjectTree.runWithTrace(ObjectTree.java:127) at com.intellij.openapi.util.ObjectTree.executeAll(ObjectTree.java:159) at com.intellij.openapi.util.Disposer.dispose(Disposer.java:243) at com.intellij.openapi.util.Disposer.dispose(Disposer.java:231) at com.intellij.ui.popup.WizardPopup.disposeAllParents(WizardPopup.java:269) at com.intellij.ui.popup.list.ListPopupImpl.disposePopup(ListPopupImpl.java:470) at com.intellij.ui.popup.list.ListPopupImpl.handleNextStep(ListPopupImpl.java:497) at com.intellij.ui.popup.list.ListPopupImpl._handleSelect(ListPopupImpl.java:464) at com.intellij.ui.popup.list.ListPopupImpl.handleSelect(ListPopupImpl.java:407) at com.intellij.ui.popup.list.ListPopupImpl$1.actionPerformed(ListPopupImpl.java:274) at com.intellij.ui.popup.WizardPopup.proceedKeyEvent(WizardPopup.java:392) at com.intellij.ui.popup.WizardPopup.dispatch(WizardPopup.java:368) at com.intellij.ui.popup.PopupDispatcher.dispatchKeyEvent(PopupDispatcher.java:112) at com.intellij.ui.popup.PopupDispatcher.dispatch(PopupDispatcher.java:148) at com.intellij.ide.IdePopupManager.dispatch(IdePopupManager.java:109) at com.intellij.ide.IdeEventQueue._dispatchEvent(IdeEventQueue.java:720) at com.intellij.ide.IdeEventQueue.lambda$dispatchEvent$5(IdeEventQueue.java:437) at com.intellij.openapi.progress.impl.CoreProgressManager.computePrioritized(CoreProgressManager.java:772) at com.intellij.ide.IdeEventQueue.lambda$dispatchEvent$6(IdeEventQueue.java:436) at com.intellij.openapi.application.TransactionGuardImpl.performActivity(TransactionGuardImpl.java:113) at com.intellij.ide.IdeEventQueue.performActivity(IdeEventQueue.java:615) at com.intellij.ide.IdeEventQueue.lambda$dispatchEvent$7(IdeEventQueue.java:434) at com.intellij.openapi.application.impl.ApplicationImpl.runIntendedWriteActionOnCurrentThread(ApplicationImpl.java:813) at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.java:480) at java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:207) at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:128) at java.desktop/java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:117) at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:113) at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:105) at java.desktop/java.awt.EventDispatchThread.run(EventDispatchThread.java:92) 2023-04-18 17:19:30,974 [ 201327] SEVERE - #c.i.o.u.ObjectTree - IntelliJ IDEA 2022.3.1 Build #IU-223.8214.52 2023-04-18 17:19:30,974 [ 201327] SEVERE - #c.i.o.u.ObjectTree - JDK: 17.0.5; VM: OpenJDK 64-Bit Server VM; Vendor: JetBrains s.r.o. 2023-04-18 17:19:30,974 [ 201327] SEVERE - #c.i.o.u.ObjectTree - OS: Windows 10 2023-04-18 17:19:30,975 [ 201328] SEVERE - #c.i.o.u.ObjectTree - Plugin to blame: Auto filling Java call arguments version: 1.0

omasseau commented 1 year ago

Seems to be the same problem with overloaded methods : https://github.com/kontext-e/AutoFillingCallArguments/issues/1

EDIT: Fixed by https://github.com/kontext-e/AutoFillingCallArguments/issues/1#issuecomment-1513391992

JensNercheKE commented 1 year ago

Thanks to @CymricNPG a new version 1.2 could be released which asks for the overloaded method to use.