void (@NotNull PsiAssignmentExpression expression) { super.visitAssignmentExpression(expression); final PsiExpression lhs = PsiUtil.skipParenthesizedExprDown(expression.getLExpression()); if (!(lhs instanceof PsiReferenceExpression reference)) { return; } final PsiExpression rhs = PsiUtil.skipParenthesizedExprDown(expression.getRExpression()); if (rhs == null) { return; } final PsiElement referent = reference.resolve(); if (!(referent instanceof PsiField field)) { return; } if (!field.hasModifierProperty(PsiModifier.STATIC)) { return; } if (isInStaticInitializer(expression)) { return; } if (isInSynchronizedContext(expression)) { return; } final PsiStatement statement = PsiTreeUtil.getParentOfType(expression, PsiStatement.class); final PsiElement parent = PsiTreeUtil.skipParentsOfType(statement, PsiCodeBlock.class, PsiBlockStatement.class); if (!(parent instanceof PsiIfStatement ifStatement)) { return; } final PsiExpression condition = ifStatement.getCondition(); if (!ComparisonUtils.isNullComparison(condition, field, true)) { return; } registerError(lhs, ifStatement, field); }