private static boolean areConvertibleSubtypesOf(PsiType type1, PsiType type2, String className) {
    PsiClass class1 = PsiUtil.resolveClassInClassTypeOnly(type1);
    if (class1 == null) return false;
    PsiClass class2 = PsiUtil.resolveClassInClassTypeOnly(type2);
    if (class2 == null) return false;
    PsiClass superClass = JavaPsiFacade.getInstance(class1.getProject()).findClass(className, class1.getResolveScope());
    if (superClass == null) return false;
    return InheritanceUtil.isInheritorOrSelf(class1, superClass, true) && InheritanceUtil.isInheritorOrSelf(class2, superClass, true);
  }
private static boolean areConvertibleSubtypesOf(PsiType type1, PsiType type2, String className)