ConversionResult (@NotNull PsiType ltype, @NotNull PsiType rtype, @NotNull Position position, @NotNull GroovyPsiElement context) { if (!(ltype instanceof PsiClassType && rtype instanceof PsiClassType)) { return null; } if (isCompileStatic(context)) return null; ClassResolveResult lResult = ((PsiClassType)ltype).resolveGenerics(); PsiClass lClass = lResult.getElement(); if (lClass == null) return null; if (lClass.getTypeParameters().length == 0) return null; ClassResolveResult rResult = ((PsiClassType)rtype).resolveGenerics(); PsiClass rClass = rResult.getElement(); if (rClass == null) return null; if (!InheritanceUtil.isInheritorOrSelf(rClass, lClass, true)) return null; if (!((PsiClassType)ltype).hasParameters()) return ConversionResult.OK; if (typeParametersAgree(lClass, rClass, lResult.getSubstitutor(), rResult.getSubstitutor(), context)) return ConversionResult.OK; return null; }