Deque<InferenceStep> (@NotNull PsiMethod method, PsiTypeParameter @NotNull [] typeParameters, GrClosureParameter[] params, GrClosureSignatureUtil.ArgInfo<PsiType>[] argInfos) { Deque<InferenceStep> inferenceQueue = new ArrayDeque<>(); List<PsiType> parameterTypes = new ArrayList<>(); List<PsiType> argumentTypes = new ArrayList<>(); for (int paramIndex = 0; paramIndex < params.length; paramIndex++) { PsiType paramType = params[paramIndex].getType(); GrClosureSignatureUtil.ArgInfo<PsiType> argInfo = argInfos[paramIndex]; if (argInfo != null) { if (argInfo.isMultiArg) { if (paramType instanceof PsiArrayType) paramType = ((PsiArrayType)paramType).getComponentType(); } for (PsiType type : argInfo.args) { PsiType argType = type; if (InheritanceUtil.isInheritor(argType, GroovyCommonClassNames.GROOVY_LANG_CLOSURE)) { inferenceQueue.add(handleClosure(paramType, argType, typeParameters)); continue; } if (argType instanceof GrTupleType) { PsiType rawWildcardType = TypesUtil.rawWildcard(argType, method); argType = rawWildcardType != null ? rawWildcardType : argType; } if (argType != null) { argType = com.intellij.psi.util.PsiUtil.captureToplevelWildcards(argType, method); } parameterTypes.add(paramType); argumentTypes.add(argType); } } else { parameterTypes.add(paramType); argumentTypes.add(PsiTypes.nullType()); } } PsiType[] parameterArray = parameterTypes.toArray(PsiType.EMPTY_ARRAY); PsiType[] argumentArray = argumentTypes.toArray(PsiType.EMPTY_ARRAY); inferenceQueue.addFirst(buildStep(parameterArray, argumentArray, typeParameters)); return inferenceQueue; }