apache / rocketmq

Apache RocketMQ is a cloud native messaging and streaming platform, making it simple to build event-driven applications.

Home Page:https://rocketmq.apache.org/

Repository from Github https://github.comapache/rocketmqRepository from Github https://github.comapache/rocketmq

[Enhancement] Optimize JmsSelector method

Kris20030907 opened this issue · comments

Before Creating the Enhancement Request

  • I have confirmed that this should be classified as an enhancement rather than a bug/feature.

Summary

Remove dead code patterns in SelectorParser methods.

Motivation

  • if (true) return patterns are redundant and misleading
  • Unreachable throw statements clutter code and may cause static analysis warnings
  • Cleanup improves code readability and maintainability

Describe the Solution You'd Like

  • Fix all occurrences in these methods:
    orExpression()
    andExpression()
    equalityExpression()
    literal()
    stringLitteral()
    variable()
  • Direct return instead of if (true) return
  • Remove unreachable throw new Error(...)

Describe Alternatives You've Considered

  • Keeping redundant code with comments: Rejected as it retains technical debt.
  • Repurposing the throw statement: Irrelevant since code is unreachable.

Additional Context

// Pattern to remove in all affected methods:
{
    if (true) return ...; // <- Remove wrapper
}
throw new Error(...);     // <- Dead code