void (@NotNull GroovyPsiElement place, @NotNull UpdateParameterInfoContext context) { int offset = context.getEditor().getCaretModel().getOffset(); offset = CharArrayUtil.shiftForward(context.getEditor().getDocument().getText(), offset, " \t\n"); final int currIndex = getCurrentParameterIndex(place, offset); context.setCurrentParameter(currIndex); final Object[] objects = context.getObjectsToView(); Outer: for (int i = 0; i < objects.length; i++) { PsiType[] parameterTypes = null; PsiType[] argTypes = null; PsiSubstitutor substitutor = null; if (objects[i] instanceof GroovyResolveResult resolveResult) { PsiNamedElement namedElement = (PsiNamedElement)resolveResult.getElement(); if (namedElement instanceof GrReflectedMethod) namedElement = ((GrReflectedMethod)namedElement).getBaseMethod(); substitutor = resolveResult.getSubstitutor(); assert namedElement != null; if (!namedElement.isValid()) { context.setUIComponentEnabled(i, false); continue Outer; } if (namedElement instanceof PsiMethod method) { PsiParameter[] parameters = method.getParameterList().getParameters(); parameters = updateConstructorParams(method, parameters, context.getParameterOwner()); parameterTypes = PsiType.createArray(parameters.length); for (int j = 0; j < parameters.length; j++) { parameterTypes[j] = parameters[j].getType(); } argTypes = PsiUtil.getArgumentTypes(place, false); } if (argTypes == null) continue; } else if (objects[i] instanceof GrSignature signature) { argTypes = PsiUtil.getArgumentTypes(place, false); parameterTypes = PsiType.createArray(signature.getParameterCount()); int j = 0; for (GrClosureParameter parameter : signature.getParameters()) { parameterTypes[j++] = parameter.getType(); } } else { continue Outer; } assert argTypes != null; if (argTypes.length > currIndex) { if (parameterTypes.length <= currIndex) { context.setUIComponentEnabled(i, false); continue; } else { for (int j = 0; j < currIndex; j++) { PsiType argType = argTypes[j]; final PsiType paramType = substitutor != null ? substitutor.substitute(parameterTypes[j]) : parameterTypes[j]; if (!TypesUtil.isAssignableByMethodCallConversion(paramType, argType, place)) { context.setUIComponentEnabled(i, false); break Outer; } } } } context.setUIComponentEnabled(i, true); } }