void (@NotNull PsiMethod method, PsiReferenceExpression methodExpression) { if (!method.hasModifierProperty(PsiModifier.STATIC)) { return; } PsiExpression qualifier = methodExpression.getQualifierExpression(); if (!(qualifier instanceof PsiReferenceExpression)) { return; } final PsiElement referent = ((PsiReference)qualifier).resolve(); if (!(referent instanceof PsiClass referencedClass)) { return; } final PsiClass declaringClass = method.getContainingClass(); if (declaringClass == null) { return; } if (declaringClass.equals(referencedClass) || declaringClass.isInterface()) { return; } final PsiResolveHelper resolveHelper = JavaPsiFacade.getInstance(methodExpression.getProject()).getResolveHelper(); if (!resolveHelper.isAccessible(declaringClass, methodExpression, null)) { return; } PsiElement referenceNameElement = methodExpression.getReferenceNameElement(); if (referenceNameElement == null) { return; } registerError(referenceNameElement, declaringClass, referencedClass); }