boolean (@Nullable PsiType from, @Nullable PsiType to, @NotNull String fromClassName, @NotNull String toClassName) { if (!(from instanceof PsiClassType)) { return false; } if (!(to instanceof PsiClassType)) { return false; } final PsiClassType.ClassResolveResult fromResolveResult = ((PsiClassType)from).resolveGenerics(); PsiClass fromClass = fromResolveResult.getElement(); if (fromClass instanceof PsiAnonymousClass) { fromClass = ((PsiAnonymousClass)fromClass).getBaseClassType().resolve(); } if (fromClass == null || !fromClassName.equals(fromClass.getQualifiedName())) { return false; } final PsiClassType.ClassResolveResult toResolveResult = ((PsiClassType)to).resolveGenerics(); final PsiClass toClass = toResolveResult.getElement(); if (toClass == null || !toClassName.equals(toClass.getQualifiedName())) { return false; } //final Collection<PsiType> fromTypeParameters = fromResolveResult.getSubstitutor().getSubstitutionMap().values(); //final Collection<PsiType> toTypeParameters = toResolveResult.getSubstitutor().getSubstitutionMap().values(); return true;//!fromTypeParameters.equals(toTypeParameters); }