From 652fdc69606dc6e944628b638bec982fc46a4af9 Mon Sep 17 00:00:00 2001 From: Tagir Valeev Date: Tue, 28 Nov 2023 12:46:34 +0100 Subject: [PATCH] [java] MethodParameterInfoHandler: handle constructor completion when it's resolved to a class Fixes CCE: MethodParameterInfoHandler.findElementForUpdatingParameterInfo GitOrigin-RevId: 78cc87045e240bbd54418c85edf354618a67a17f --- .../hint/api/impls/MethodParameterInfoHandler.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/java/java-impl/src/com/intellij/codeInsight/hint/api/impls/MethodParameterInfoHandler.java b/java/java-impl/src/com/intellij/codeInsight/hint/api/impls/MethodParameterInfoHandler.java index 3bc4ce5b9ca1..a6ff82ba9e1d 100644 --- a/java/java-impl/src/com/intellij/codeInsight/hint/api/impls/MethodParameterInfoHandler.java +++ b/java/java-impl/src/com/intellij/codeInsight/hint/api/impls/MethodParameterInfoHandler.java @@ -151,11 +151,11 @@ public final class MethodParameterInfoHandler Object[] candidates = context.getObjectsToView(); if (candidates != null && candidates.length != 0) { Object highlighted = context.getHighlightedParameter(); - CandidateWithPresentation currentMethodInfo; + CandidateWithPresentation currentMethodInfo = null; if (highlighted instanceof PsiMethod method) { currentMethodInfo = (CandidateWithPresentation)ContainerUtil.find(candidates, c -> getMethodFromCandidate(c).equals(method)); - } else { - currentMethodInfo = (CandidateWithPresentation)highlighted; + } else if (highlighted instanceof CandidateWithPresentation cwp) { + currentMethodInfo = cwp; } if (currentMethodInfo == null) currentMethodInfo = (CandidateWithPresentation)candidates[0]; PsiMethod method = currentMethodInfo.getMethod();