boolean (PsiExpression expression) { PsiField field = PsiTreeUtil.getParentOfType(expression, PsiField.class); if (field == null) { final PsiAssignmentExpression assignmentExpression = PsiTreeUtil.getParentOfType(expression, PsiAssignmentExpression.class); if (assignmentExpression == null) { return false; } final PsiExpression lhs = assignmentExpression.getLExpression(); if (!(lhs instanceof final PsiReferenceExpression referenceExpression)) { return false; } final PsiElement target = referenceExpression.resolve(); if (!(target instanceof PsiField)) { return false; } field = (PsiField)target; } return field.hasModifierProperty(PsiModifier.STATIC) && field.hasModifierProperty(PsiModifier.FINAL); }