void (@NotNull PsiClassObjectAccessExpression expression) { super.visitClassObjectAccessExpression(expression); PsiElement parent = expression.getParent(); if (parent instanceof PsiReferenceExpression referenceExpression) { if (!expression.equals(referenceExpression.getQualifierExpression())) { return; } @NonNls final String name = referenceExpression.getReferenceName(); if (!"getName".equals(name)) { return; } final PsiElement grandParent = referenceExpression.getParent(); if (!(grandParent instanceof PsiMethodCallExpression methodCallExpression)) { return; } final PsiExpressionList list = methodCallExpression.getArgumentList(); if (!list.isEmpty()) { return; } parent = methodCallExpression.getParent(); } if (!(parent instanceof PsiExpressionList)) { return; } final PsiElement grandParent = parent.getParent(); if (!(grandParent instanceof PsiMethodCallExpression)) { return; } final PsiMethodCallExpression methodCallExpression = (PsiMethodCallExpression)grandParent; final PsiExpressionList argumentList = methodCallExpression.getArgumentList(); final PsiExpression[] expressions = argumentList.getExpressions(); if (expressions.length != 1) { return; } PsiClass containingClass = ClassUtils.getContainingClass(expression); while (containingClass instanceof PsiAnonymousClass) { containingClass = ClassUtils.getContainingClass(containingClass); } if (containingClass == null) { return; } if (ignoreNonPublicClasses && !containingClass.hasModifierProperty(PsiModifier.PUBLIC)) { return; } final String containingClassName = containingClass.getName(); if (containingClassName == null) { return; } final PsiMethod method = methodCallExpression.resolveMethod(); if (method == null) { return; } final PsiClass aClass = method.getContainingClass(); if (aClass == null) { return; } final String className = aClass.getQualifiedName(); final int index = loggerFactoryClassNames.indexOf(className); if (index < 0) { return; } final PsiReferenceExpression methodExpression = methodCallExpression.getMethodExpression(); final String referenceName = methodExpression.getReferenceName(); final String loggerFactoryMethodName = loggerFactoryMethodNames.get(index); if (!loggerFactoryMethodName.equals(referenceName)) { return; } final PsiTypeElement operand = expression.getOperand(); final PsiClass initializerClass = PsiUtil.resolveClassInClassTypeOnly(operand.getType()); if (initializerClass == null) { return; } if (containingClass.equals(initializerClass)) { return; } if (ignoreSuperClass && containingClass.isInheritor(initializerClass, true) || PsiTreeUtil.isAncestor(initializerClass, containingClass, true)) { if (isOnTheFly()) { registerError(expression, ProblemHighlightType.INFORMATION, containingClassName); } return; } registerError(expression, containingClassName); }