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 0c5ea1c2a759..3cec310962c8 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 @@ -327,9 +327,10 @@ public class MethodParameterInfoHandler implements ParameterInfoHandlerWithTabAc context.setHighlightedParameter(completeMatch); } - CandidateInfo resultingCandidate = (CandidateInfo)(candidates.length == 1 ? candidates[0] : context.getHighlightedParameter()); - if (resultingCandidate != null) { - PsiMethod method = (PsiMethod)resultingCandidate.getElement(); + Object highlightedCandidate = candidates.length == 1 ? candidates[0] : context.getHighlightedParameter(); + if (highlightedCandidate != null) { + PsiMethod method = (PsiMethod)(highlightedCandidate instanceof CandidateInfo + ? ((CandidateInfo)highlightedCandidate).getElement() : highlightedCandidate); if (!method.isVarArgs() && index >= method.getParameterList().getParametersCount()) context.setCurrentParameter(-1); } }