boolean (PsiElement element, PsiMethod containingMethod) { if (containingMethod.hasModifierProperty(PsiModifier.STATIC)) { return false; } if (element instanceof PsiMethodCallExpression methodCallExpression) { final PsiReferenceExpression methodExpression = methodCallExpression.getMethodExpression(); final PsiExpression qualifierExpression = methodExpression.getQualifierExpression(); return qualifierExpression == null; } else if (element instanceof PsiReferenceExpression referenceExpression) { final PsiElement parent = referenceExpression.getParent(); if (parent instanceof PsiMethodCallExpression) { return false; } final PsiExpression qualifier = referenceExpression.getQualifierExpression(); if (qualifier != null) { return false; } final PsiElement target = referenceExpression.resolve(); return target instanceof PsiField; } else { return false; } }