[java] MethodParameterInfoHandler: handle constructor completion when it's resolved to a class

Fixes CCE: MethodParameterInfoHandler.findElementForUpdatingParameterInfo

GitOrigin-RevId: 78cc87045e240bbd54418c85edf354618a67a17f
This commit is contained in:
Tagir Valeev
2023-11-28 14:37:55 +00:00
committed by intellij-monorepo-bot
parent 634f6fb5ca
commit 652fdc6960
@@ -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();