boolean (@NotNull PsiField field) { if (field.getType() instanceof PsiPrimitiveType) return false; List<PsiReferenceExpression> refs = VariableAccessUtils.getVariableReferences(field, field.getContainingFile()); for (PsiReferenceExpression ref : refs) { PsiElement parent = PsiUtil.skipParenthesizedExprUp(ref.getParent()); if (parent instanceof PsiSynchronizedStatement) return true; if (parent instanceof PsiBinaryExpression binOp && (binOp.getOperationTokenType() == JavaTokenType.EQEQ || binOp.getOperationTokenType() == JavaTokenType.NE) && ExpressionUtils.getValueComparedWithNull(binOp) == null) { return true; } } return false; }