boolean (@NotNull PsiVariable variable, @Nullable PsiStatement statement) { if (!(statement instanceof PsiExpressionStatement expressionStatement)) { return false; } final PsiExpression expression = PsiUtil.skipParenthesizedExprDown(expressionStatement.getExpression()); if (expression instanceof PsiPrefixExpression prefixExpression) { final IElementType tokenType = prefixExpression.getOperationTokenType(); if (!tokenType.equals(JavaTokenType.PLUSPLUS) && !tokenType.equals(JavaTokenType.MINUSMINUS)) { return false; } final PsiExpression operand = prefixExpression.getOperand(); return ExpressionUtils.isReferenceTo(operand, variable); } else if (expression instanceof PsiPostfixExpression postfixExpression) { final IElementType tokenType = postfixExpression.getOperationTokenType(); if (!tokenType.equals(JavaTokenType.PLUSPLUS) && !tokenType.equals(JavaTokenType.MINUSMINUS)) { return false; } final PsiExpression operand = postfixExpression.getOperand(); return ExpressionUtils.isReferenceTo(operand, variable); } else if (expression instanceof PsiAssignmentExpression assignmentExpression) { final IElementType tokenType = assignmentExpression.getOperationTokenType(); final PsiExpression lhs = PsiUtil.skipParenthesizedExprDown(assignmentExpression.getLExpression()); if (!ExpressionUtils.isReferenceTo(lhs, variable)) { return false; } final PsiExpression rhs = PsiUtil.skipParenthesizedExprDown(assignmentExpression.getRExpression()); if (rhs == null) { return false; } if (tokenType == JavaTokenType.EQ) { if (!(rhs instanceof PsiBinaryExpression binaryExpression)) { return false; } final IElementType token = binaryExpression.getOperationTokenType(); if (!token.equals(JavaTokenType.PLUS) && !token.equals(JavaTokenType.MINUS)) { return false; } final PsiExpression lOperand = PsiUtil.skipParenthesizedExprDown(binaryExpression.getLOperand()); final PsiExpression rOperand = PsiUtil.skipParenthesizedExprDown(binaryExpression.getROperand()); return ExpressionUtils.isReferenceTo(rOperand, variable) || ExpressionUtils.isReferenceTo(lOperand, variable); } else if (tokenType == JavaTokenType.PLUSEQ || tokenType == JavaTokenType.MINUSEQ) { return true; } } return false; }