BaseInspectionVisitor () { return new BaseEqualsVisitor() { @Override boolean checkTypes(@NotNull PsiReferenceExpression expression, @NotNull PsiType type1, @NotNull PsiType type2) { if (checkType(expression, type1)) return true; if (checkType(expression, type2)) return true; return false; } private boolean checkType(PsiReferenceExpression expression, PsiType type) { PsiClass psiClass = PsiUtil.resolveClassInClassTypeOnly(type); if (psiClass != null) { String qualifiedName = psiClass.getQualifiedName(); if (qualifiedName != null && myClasses.containsKey(qualifiedName)) { PsiElement name = expression.getReferenceNameElement(); registerError(name == null ? expression : name, qualifiedName, expression); return true; } } return false; } }; }