ConversionResult (@NotNull PsiType targetType, @NotNull PsiType actualType, @NotNull Position position, @NotNull GroovyPsiElement context) { if (!TypesUtil.isClassType(targetType, GroovyCommonClassNames.GROOVY_LANG_CLOSURE) ) return null; if (!TypesUtil.isClassType(actualType, GroovyCommonClassNames.GROOVY_LANG_CLOSURE) ) return null; PsiClass lclass = ((PsiClassType)targetType).resolve(); PsiClass rclass = ((PsiClassType)actualType).resolve(); if (lclass == null || rclass == null) return null; PsiClassType.ClassResolveResult lresult = ((PsiClassType)targetType).resolveGenerics(); PsiClassType.ClassResolveResult rresult = ((PsiClassType)actualType).resolveGenerics(); if (GrGenericTypeConverter.typeParametersAgree(lclass, rclass, lresult.getSubstitutor(), rresult.getSubstitutor(), context)) return ConversionResult.OK; return null; }