Public report of yuanzhongqiao/rocketmq, published 22 October 2026. It has the same score, grades and number of
findings as the full report. The details of security findings (where they are in the code, which known
vulnerabilities and which passwords or keys were found) are left out, so nobody can use them against the project.
Public
Executive reportMeasured under the Code Assurance Index, an open standard for code quality, using its published scoring rules (rubric version 2026.10.5). Watchdog signed this survey and filed it in the standard's public register, where anyone can look it up by its survey ID. Check this survey →
Signed and filed in the standard's public register, 22 October 2026, 23:50 UTC · Survey ID cd_04d3907f27404e0a91b767b0616fe731
yuanzhongqiao/rocketmq
Measured 22 October 2026, 23:41 UTC, at code version faae647
A regression is a drop of 0.5 points or more in the score, or of 2.5 or more out of 10 in a dimension, since the last survey.
Bus factor is not measured: No living knowledge left to concentrate.
CAI scoreAt riskDown 7 since the last survey
The score is built from these lenses. Each lens grades one area of the code, such as how easy it is to change or how well it is protected. The weakest lens counts most, so one weak area pulls the score down instead of being averaged away.
A large codebase: 181,624 lines of product code in 16 projects, tests not counted · Estimated rebuild effort: about 2.0 person-years · Weakest lens: Maturity, 41
Findings by how serious they are
79 critical1569 serious891 minor
15 dimensions are left out of the score. For each one, Watchdog either couldn't measure it in this code, or found no evidence of the safeguard it looks for, such as a tested backup restore. They count neither for nor against the score, and Limitations lists each one with its reason.
This survey was produced by
Watchdog
Producer
Canine Development
Analyzer
Watchdog engine 1.0.0
Measured
22 October 2026, 23:41 UTC
A measurement, not a certificate. The Code Assurance Index records a number
together with the evidence it was worked out from, so anyone can recalculate it, but it doesn't certify or guarantee
the code. The standard was written by Canine Development, which also builds Watchdog. It is open to any tool that
implements it, and today Watchdog is the only one that does.
A critical security finding is open, such as a library with a known critical vulnerability or a password or key found in the code. The score itself is unchanged, but its band shows At risk until the finding is fixed. See the Security and Compliance lens.
The score is deterministic, which means the same code always gets the same score. Watchdog works it out with tools that follow published rules, and an AI model never decides it, so anyone who applies the same rules to the same code gets the same number. How it is done is explained under Methodology ▸
58of 62 dimensions measured by tools. The other 4 are advisory notes from an AI model, which explain the code but don't count towards the score.
2522of 2539 findings point to an exact file and line, so you can open each one in the code. The other 17 concern the repository as a whole, such as missing documentation.
62dimensions across 6 lenses, read from 181,624 lines of product code in 16 projects.
yuanzhongqiao/rocketmq scores 51 out of 100, but it is rated At risk while a critical security finding is open; the score itself is unchanged.
The weakest lens counts most in the score, and here that is Maturity, which scores 41 and is rated Weak. Its Knowledge Freshness dimension scores 0 out of 10, and until that reaches 4, Maturity can't be rated higher than Adequate. The first actions are to resolve the 697 Orphaned file finding(s) in Knowledge Freshness and to reconcile the README with reality: Apache RocketMQ operator CRDs installed in README but no CRD project exists; README advertises Docker containerisation, but no Dockerfile/compose file exists; docs/cn/best_practice.md links to `[](`, but `docs/cn/[](` does not exist; docs/cn/controller/persistent_unique_broker_id.md names `.broker.meta.temp`, but no file or folder `.broker.meta.temp` exists; docs/cn/controller/persistent_unique_broker_id.md names `.broker.meta`, but no file or folder `.broker.meta` exists, and if Maturity rose to 70, the score would rise from 51 to about 60.
79 findings are critical: 69 in Static Analysis (SAST), seven in Dependency Vulnerabilities, two in Test Quality and one in Secrets (history).
Watchdog couldn't measure 14 dimensions in this code, among them Code Coverage, Test Reliability and Dependency Hygiene, so they are left out of the score. The product code is 181,624 lines, which would take an estimated 2.0 person-years, around €290,000, to rebuild.
A lens is capped at Adequate while one of its dimensions scores below 4 out of 10, however well the rest of the lens does. That way a serious problem in one place always shows in the lens's rating.
How the score is built: what each lens counts forThe lenses don't count equally. The weakest lens counts most, the next weakest a little less, and so on, so a weak area pulls the score down instead of being averaged away. In the bar below, each part's width shows how much that lens counts and its colour shows its rating. Improving the widest part moves the score most, and as that lens improves, it counts for less, because another lens becomes the weakest.
Watchdog compares every finding with the previous survey's. A finding that has only moved to another line in the same file counts as the same finding, so only new findings appear here. Advisory notes from the AI model are left out, because the model words them afresh in every survey.
Fixed since the last survey: 81 findings
These 81 critical or serious findings were in the previous survey, on 8 October 2026, and are gone from this one.
€97,000 to €490,000, for 1,610 to 5,108 hours of work, about 2.0 person-years for 1 to 4 engineers
Difficulty of the problem
Standard, judged from the kind of software and how it is built. Code that solves a harder problem, such as payments or medical bookings, costs more per line to write.
Quality factor
×0.7 at a score of 51. Better code takes more work to write, so the factor is ×1.0 at a score of 70, lower below it and higher above it.
Size
Large: 181,624 lines of product code
How the estimate is made: Watchdog prices the hours a team would need to write this code again, at €60 to €95 an hour. Declarations and boilerplate are priced at a fast rate and logic at a slower one, and the logic is then multiplied by the difficulty of the problem and by the quality factor. The estimate can be about 30% off either way, and it moves most with the hourly rate and the difficulty. For this code, every line is priced as straight logic, which keeps the estimate on the low side.
Top priorities
The three actions that raise the score most for the work they take. The full ranked list is in the Roadmap.
1
Resolve the 697 Orphaned file finding(s) in Knowledge Freshness — start with SendMessageActivity.java (2), ClientConfig.java (2), Configuration.java (2).
Reconcile the README with reality: Apache RocketMQ operator CRDs installed in README but no CRD project exists; README advertises Docker containerisation, but no Dockerfile/compose file exists; docs/cn/best_practice.md links to `[](`, but `docs/cn/[](` does not exist; docs/cn/controller/persistent_unique_broker_id.md names `.broker.meta.temp`, but no file or folder `.broker.meta.temp` exists; docs/cn/controller/persistent_unique_broker_id.md names `.broker.meta`, but no file or folder `.broker.meta` exists.
Each conclusion below combines several dimensions into one point that no single dimension shows, and lists the measurements it rests on.
Where the investment is most exposed · Value at risk
This code would cost about €290,000 to build again, about 2.0 person-years of work. Its weakest lens is Maturity, at 41 (Weak). Maturity is about how well the project explains and looks after itself, which decides whether a new developer, or a new supplier, can take over. Because the weakest lens counts most in the score, work on Maturity also moves the score most.
Based on: the rebuild estimate · the Maturity grade · how much each lens counts
What to do: Start with the Maturity actions in Top priorities.
If you do one thing first · First action
Resolve the 697 Orphaned file finding(s) in Knowledge Freshness. Of all the actions in this report, it raises the score most for the work it takes: about 9 points for high effort, because it clears the 697 Knowledge Freshness findings. The next survey will show the change in the score.
Based on: the ranked actions in Top priorities, by score gain and effort
Architecture — module dependency graph
Project dependencies, layered top-to-bottom; arrows show direction. Any dashed red edge points upward or sideways — a layering smell or cycle. A clean layered graph has none.
Architecture: which parts of the code depend on which
The code is divided into modules, groups of code that each handle one part of the product, and a module depends on another when it uses code from it. The table lists the modules both down the side and across the top, in an order where each module should only use modules listed above it. A number in a cell means the module on that row uses the module in that column, and it counts the pairs of building blocks (types) that connect them. The one thing to look for is a mark above the diagonal line. It means two or more modules use each other in a loop (a dependency cycle), so none of them can be changed, tested or released on its own.
224 modules, with 952 dependencies between them. 11 loops run through 71 of the modules, marked above the diagonal.
The table shows the 40 modules with the most connections; 184 more are left out to keep it readable.
Which modules use which. The module on each row uses the module in each column, and the number counts the pairs of types that connect them. A cell above the diagonal is part of a loop.
remoting.protocol.heartbeat uses remoting.protocol, so a change to remoting.protocol can break remoting.protocol.heartbeat, while a change to remoting.protocol.heartbeat can't break remoting.protocol.
Position
Below the diagonal: remoting.protocol.heartbeat uses a module listed above it, which is the healthy direction.
remoting.protocol.route uses remoting.protocol, so a change to remoting.protocol can break remoting.protocol.route, while a change to remoting.protocol.route can't break remoting.protocol.
Position
Below the diagonal: remoting.protocol.route uses a module listed above it, which is the healthy direction.
remoting.protocol.subscription uses remoting.protocol, so a change to remoting.protocol can break remoting.protocol.subscription, while a change to remoting.protocol.subscription can't break remoting.protocol.
Position
Below the diagonal: remoting.protocol.subscription uses a module listed above it, which is the healthy direction.
remoting.netty uses remoting.protocol, so a change to remoting.protocol can break remoting.netty, while a change to remoting.netty can't break remoting.protocol.
Position
Below the diagonal: remoting.netty uses a module listed above it, which is the healthy direction.
remoting.protocol.body uses common.message, so a change to common.message can break remoting.protocol.body, while a change to remoting.protocol.body can't break common.message.
Position
Below the diagonal: remoting.protocol.body uses a module listed above it, which is the healthy direction.
56 pairs of types, where a type in remoting.protocol.body uses a type in remoting.protocol. Showing 25 of them; the rest are in namespace-graph.json in this report's bundle.
remoting.protocol.body uses remoting.protocol, so a change to remoting.protocol can break remoting.protocol.body, while a change to remoting.protocol.body can't break remoting.protocol.
Position
Below the diagonal: remoting.protocol.body uses a module listed above it, which is the healthy direction.
remoting.protocol.body uses common, so a change to common can break remoting.protocol.body, while a change to remoting.protocol.body can't break common.
Position
Below the diagonal: remoting.protocol.body uses a module listed above it, which is the healthy direction.
remoting.protocol.body uses remoting.protocol.heartbeat, so a change to remoting.protocol.heartbeat can break remoting.protocol.body, while a change to remoting.protocol.body can't break remoting.protocol.heartbeat.
Position
Below the diagonal: remoting.protocol.body uses a module listed above it, which is the healthy direction.
remoting.protocol.body uses remoting.protocol.route, so a change to remoting.protocol.route can break remoting.protocol.body, while a change to remoting.protocol.body can't break remoting.protocol.route.
Position
Below the diagonal: remoting.protocol.body uses a module listed above it, which is the healthy direction.
remoting.protocol.body uses remoting.protocol.subscription, so a change to remoting.protocol.subscription can break remoting.protocol.body, while a change to remoting.protocol.body can't break remoting.protocol.subscription.
Position
Below the diagonal: remoting.protocol.body uses a module listed above it, which is the healthy direction.
store uses remoting.protocol.heartbeat, so a change to remoting.protocol.heartbeat can break store, while a change to store can't break remoting.protocol.heartbeat.
Position
Below the diagonal: store uses a module listed above it, which is the healthy direction.
broker.client uses remoting.protocol, so a change to remoting.protocol can break broker.client, while a change to broker.client can't break remoting.protocol.
Position
Below the diagonal: broker.client uses a module listed above it, which is the healthy direction.
broker.client uses remoting.protocol.heartbeat, so a change to remoting.protocol.heartbeat can break broker.client, while a change to broker.client can't break remoting.protocol.heartbeat.
Position
Below the diagonal: broker.client uses a module listed above it, which is the healthy direction.
broker.client uses remoting.protocol.body, so a change to remoting.protocol.body can break broker.client, while a change to broker.client can't break remoting.protocol.body.
Position
Below the diagonal: broker.client uses a module listed above it, which is the healthy direction.
37 pairs of types, where a type in client.impl.consumer uses a type in common.message. Showing 25 of them; the rest are in namespace-graph.json in this report's bundle.
client.impl.consumer uses common.message, so a change to common.message can break client.impl.consumer, while a change to client.impl.consumer can't break common.message.
Position
Below the diagonal: client.impl.consumer uses a module listed above it, which is the healthy direction.
client.impl.consumer uses remoting.protocol.heartbeat, so a change to remoting.protocol.heartbeat can break client.impl.consumer, while a change to client.impl.consumer can't break remoting.protocol.heartbeat.
Position
Below the diagonal: client.impl.consumer uses a module listed above it, which is the healthy direction.
client.impl.consumer uses remoting.protocol.body, so a change to remoting.protocol.body can break client.impl.consumer, while a change to client.impl.consumer can't break remoting.protocol.body.
Position
Below the diagonal: client.impl.consumer uses a module listed above it, which is the healthy direction.
client.impl.consumer uses remoting, so a change to remoting can break client.impl.consumer, while a change to client.impl.consumer can't break remoting.
Position
Below the diagonal: client.impl.consumer uses a module listed above it, which is the healthy direction.
14→18 client.impl.consumer uses client.impl.factorypart of a loop✕
Connections
10 pairs of types, where a type in client.impl.consumer uses a type in client.impl.factory.
client.impl.consumer uses client.impl.factory, so a change to client.impl.factory can break client.impl.consumer, while a change to client.impl.consumer can't break client.impl.factory.
Position
Above the diagonal, so it is part of a loop. Neither module can be changed, tested or released on its own until one of these dependencies is removed.
14→20 client.impl.consumer uses client.implpart of a loop✕
Connections
1 pair of types, where a type in client.impl.consumer uses a type in client.impl.
client.impl.consumer uses client.impl, so a change to client.impl can break client.impl.consumer, while a change to client.impl.consumer can't break client.impl.
Position
Above the diagonal, so it is part of a loop. Neither module can be changed, tested or released on its own until one of these dependencies is removed.
14→23 client.impl.consumer uses clientpart of a loop✕
Connections
2 pairs of types, where a type in client.impl.consumer uses a type in client.
client.impl.consumer uses client, so a change to client can break client.impl.consumer, while a change to client.impl.consumer can't break client.
Position
Above the diagonal, so it is part of a loop. Neither module can be changed, tested or released on its own until one of these dependencies is removed.
14→24 client.impl.consumer uses client.consumerpart of a loop✕
Connections
29 pairs of types, where a type in client.impl.consumer uses a type in client.consumer. Showing 25 of them; the rest are in namespace-graph.json in this report's bundle.
client.impl.consumer uses client.consumer, so a change to client.consumer can break client.impl.consumer, while a change to client.impl.consumer can't break client.consumer.
Position
Above the diagonal, so it is part of a loop. Neither module can be changed, tested or released on its own until one of these dependencies is removed.
controller uses remoting.protocol.body, so a change to remoting.protocol.body can break controller, while a change to controller can't break remoting.protocol.body.
Position
Below the diagonal: controller uses a module listed above it, which is the healthy direction.
remoting.protocol.header uses remoting.protocol, so a change to remoting.protocol can break remoting.protocol.header, while a change to remoting.protocol.header can't break remoting.protocol.
Position
Below the diagonal: remoting.protocol.header uses a module listed above it, which is the healthy direction.
remoting.protocol.header uses common, so a change to common can break remoting.protocol.header, while a change to remoting.protocol.header can't break common.
Position
Below the diagonal: remoting.protocol.header uses a module listed above it, which is the healthy direction.
65 pairs of types, where a type in remoting.protocol.header uses a type in remoting. Showing 25 of them; the rest are in namespace-graph.json in this report's bundle.
remoting.protocol.header uses remoting, so a change to remoting can break remoting.protocol.header, while a change to remoting.protocol.header can't break remoting.
Position
Below the diagonal: remoting.protocol.header uses a module listed above it, which is the healthy direction.
store.plugin uses remoting.protocol.body, so a change to remoting.protocol.body can break store.plugin, while a change to store.plugin can't break remoting.protocol.body.
Position
Below the diagonal: store.plugin uses a module listed above it, which is the healthy direction.
client.impl.factory uses common.message, so a change to common.message can break client.impl.factory, while a change to client.impl.factory can't break common.message.
Position
Below the diagonal: client.impl.factory uses a module listed above it, which is the healthy direction.
client.impl.factory uses remoting.protocol.heartbeat, so a change to remoting.protocol.heartbeat can break client.impl.factory, while a change to client.impl.factory can't break remoting.protocol.heartbeat.
Position
Below the diagonal: client.impl.factory uses a module listed above it, which is the healthy direction.
client.impl.factory uses remoting.protocol.route, so a change to remoting.protocol.route can break client.impl.factory, while a change to client.impl.factory can't break remoting.protocol.route.
Position
Below the diagonal: client.impl.factory uses a module listed above it, which is the healthy direction.
client.impl.factory uses remoting.netty, so a change to remoting.netty can break client.impl.factory, while a change to client.impl.factory can't break remoting.netty.
Position
Below the diagonal: client.impl.factory uses a module listed above it, which is the healthy direction.
client.impl.factory uses remoting.protocol.body, so a change to remoting.protocol.body can break client.impl.factory, while a change to client.impl.factory can't break remoting.protocol.body.
Position
Below the diagonal: client.impl.factory uses a module listed above it, which is the healthy direction.
client.impl.factory uses client.impl.consumer, so a change to client.impl.consumer can break client.impl.factory, while a change to client.impl.factory can't break client.impl.consumer.
Position
Below the diagonal: client.impl.factory uses a module listed above it, which is the healthy direction.
18→20 client.impl.factory uses client.implpart of a loop✕
Connections
3 pairs of types, where a type in client.impl.factory uses a type in client.impl.
client.impl.factory uses client.impl, so a change to client.impl can break client.impl.factory, while a change to client.impl.factory can't break client.impl.
Position
Above the diagonal, so it is part of a loop. Neither module can be changed, tested or released on its own until one of these dependencies is removed.
18→21 client.impl.factory uses client.impl.producerpart of a loop✕
Connections
3 pairs of types, where a type in client.impl.factory uses a type in client.impl.producer.
client.impl.factory uses client.impl.producer, so a change to client.impl.producer can break client.impl.factory, while a change to client.impl.factory can't break client.impl.producer.
Position
Above the diagonal, so it is part of a loop. Neither module can be changed, tested or released on its own until one of these dependencies is removed.
18→22 client.impl.factory uses client.producerpart of a loop✕
Connections
1 pair of types, where a type in client.impl.factory uses a type in client.producer.
client.impl.factory uses client.producer, so a change to client.producer can break client.impl.factory, while a change to client.impl.factory can't break client.producer.
Position
Above the diagonal, so it is part of a loop. Neither module can be changed, tested or released on its own until one of these dependencies is removed.
18→23 client.impl.factory uses clientpart of a loop✕
Connections
1 pair of types, where a type in client.impl.factory uses a type in client.
controller.impl uses remoting.protocol, so a change to remoting.protocol can break controller.impl, while a change to controller.impl can't break remoting.protocol.
Position
Below the diagonal: controller.impl uses a module listed above it, which is the healthy direction.
controller.impl uses remoting.netty, so a change to remoting.netty can break controller.impl, while a change to controller.impl can't break remoting.netty.
Position
Below the diagonal: controller.impl uses a module listed above it, which is the healthy direction.
controller.impl uses remoting.protocol.body, so a change to remoting.protocol.body can break controller.impl, while a change to controller.impl can't break remoting.protocol.body.
Position
Below the diagonal: controller.impl uses a module listed above it, which is the healthy direction.
client.impl uses remoting.protocol, so a change to remoting.protocol can break client.impl, while a change to client.impl can't break remoting.protocol.
Position
Below the diagonal: client.impl uses a module listed above it, which is the healthy direction.
client.impl uses remoting.protocol.heartbeat, so a change to remoting.protocol.heartbeat can break client.impl, while a change to client.impl can't break remoting.protocol.heartbeat.
Position
Below the diagonal: client.impl uses a module listed above it, which is the healthy direction.
client.impl uses remoting.protocol.route, so a change to remoting.protocol.route can break client.impl, while a change to client.impl can't break remoting.protocol.route.
Position
Below the diagonal: client.impl uses a module listed above it, which is the healthy direction.
client.impl uses remoting.protocol.subscription, so a change to remoting.protocol.subscription can break client.impl, while a change to client.impl can't break remoting.protocol.subscription.
Position
Below the diagonal: client.impl uses a module listed above it, which is the healthy direction.
client.impl uses remoting.protocol.body, so a change to remoting.protocol.body can break client.impl, while a change to client.impl can't break remoting.protocol.body.
Position
Below the diagonal: client.impl uses a module listed above it, which is the healthy direction.
client.impl uses remoting.protocol.header, so a change to remoting.protocol.header can break client.impl, while a change to client.impl can't break remoting.protocol.header.
Position
Below the diagonal: client.impl uses a module listed above it, which is the healthy direction.
client.impl uses client.impl.factory, so a change to client.impl.factory can break client.impl, while a change to client.impl can't break client.impl.factory.
Position
Below the diagonal: client.impl uses a module listed above it, which is the healthy direction.
20→21 client.impl uses client.impl.producerpart of a loop✕
Connections
2 pairs of types, where a type in client.impl uses a type in client.impl.producer.
client.impl uses client.impl.producer, so a change to client.impl.producer can break client.impl, while a change to client.impl can't break client.impl.producer.
Position
Above the diagonal, so it is part of a loop. Neither module can be changed, tested or released on its own until one of these dependencies is removed.
20→22 client.impl uses client.producerpart of a loop✕
Connections
3 pairs of types, where a type in client.impl uses a type in client.producer.
client.impl.producer uses common.message, so a change to common.message can break client.impl.producer, while a change to client.impl.producer can't break common.message.
Position
Below the diagonal: client.impl.producer uses a module listed above it, which is the healthy direction.
client.impl.producer uses remoting.protocol.route, so a change to remoting.protocol.route can break client.impl.producer, while a change to client.impl.producer can't break remoting.protocol.route.
Position
Below the diagonal: client.impl.producer uses a module listed above it, which is the healthy direction.
client.impl.producer uses remoting, so a change to remoting can break client.impl.producer, while a change to client.impl.producer can't break remoting.
Position
Below the diagonal: client.impl.producer uses a module listed above it, which is the healthy direction.
client.impl.producer uses remoting.protocol.header, so a change to remoting.protocol.header can break client.impl.producer, while a change to client.impl.producer can't break remoting.protocol.header.
Position
Below the diagonal: client.impl.producer uses a module listed above it, which is the healthy direction.
client.impl.producer uses client.impl.factory, so a change to client.impl.factory can break client.impl.producer, while a change to client.impl.producer can't break client.impl.factory.
Position
Below the diagonal: client.impl.producer uses a module listed above it, which is the healthy direction.
client.impl.producer uses client.impl, so a change to client.impl can break client.impl.producer, while a change to client.impl.producer can't break client.impl.
Position
Below the diagonal: client.impl.producer uses a module listed above it, which is the healthy direction.
21→22 client.impl.producer uses client.producerpart of a loop✕
Connections
27 pairs of types, where a type in client.impl.producer uses a type in client.producer. Showing 25 of them; the rest are in namespace-graph.json in this report's bundle.
client.impl.producer uses client.producer, so a change to client.producer can break client.impl.producer, while a change to client.impl.producer can't break client.producer.
Position
Above the diagonal, so it is part of a loop. Neither module can be changed, tested or released on its own until one of these dependencies is removed.
21→23 client.impl.producer uses clientpart of a loop✕
Connections
1 pair of types, where a type in client.impl.producer uses a type in client.
client.producer uses common.message, so a change to common.message can break client.producer, while a change to client.producer can't break common.message.
Position
Below the diagonal: client.producer uses a module listed above it, which is the healthy direction.
client.producer uses client.impl.producer, so a change to client.impl.producer can break client.producer, while a change to client.producer can't break client.impl.producer.
Position
Below the diagonal: client.producer uses a module listed above it, which is the healthy direction.
client uses remoting.protocol.heartbeat, so a change to remoting.protocol.heartbeat can break client, while a change to client can't break remoting.protocol.heartbeat.
Position
Below the diagonal: client uses a module listed above it, which is the healthy direction.
client uses remoting.protocol.subscription, so a change to remoting.protocol.subscription can break client, while a change to client can't break remoting.protocol.subscription.
Position
Below the diagonal: client uses a module listed above it, which is the healthy direction.
client uses remoting.protocol.body, so a change to remoting.protocol.body can break client, while a change to client can't break remoting.protocol.body.
Position
Below the diagonal: client uses a module listed above it, which is the healthy direction.
client uses remoting.protocol.header, so a change to remoting.protocol.header can break client, while a change to client can't break remoting.protocol.header.
Position
Below the diagonal: client uses a module listed above it, which is the healthy direction.
client.consumer uses common.message, so a change to common.message can break client.consumer, while a change to client.consumer can't break common.message.
Position
Below the diagonal: client.consumer uses a module listed above it, which is the healthy direction.
client.consumer uses remoting.protocol.heartbeat, so a change to remoting.protocol.heartbeat can break client.consumer, while a change to client.consumer can't break remoting.protocol.heartbeat.
Position
Below the diagonal: client.consumer uses a module listed above it, which is the healthy direction.
client.consumer uses client.impl.consumer, so a change to client.impl.consumer can break client.consumer, while a change to client.consumer can't break client.impl.consumer.
Position
Below the diagonal: client.consumer uses a module listed above it, which is the healthy direction.
tools.admin uses remoting.protocol.heartbeat, so a change to remoting.protocol.heartbeat can break tools.admin, while a change to tools.admin can't break remoting.protocol.heartbeat.
Position
Below the diagonal: tools.admin uses a module listed above it, which is the healthy direction.
tools.admin uses remoting.protocol.route, so a change to remoting.protocol.route can break tools.admin, while a change to tools.admin can't break remoting.protocol.route.
Position
Below the diagonal: tools.admin uses a module listed above it, which is the healthy direction.
tools.admin uses remoting.protocol.subscription, so a change to remoting.protocol.subscription can break tools.admin, while a change to tools.admin can't break remoting.protocol.subscription.
Position
Below the diagonal: tools.admin uses a module listed above it, which is the healthy direction.
60 pairs of types, where a type in tools.admin uses a type in remoting.protocol.body. Showing 25 of them; the rest are in namespace-graph.json in this report's bundle.
tools.admin uses remoting.protocol.body, so a change to remoting.protocol.body can break tools.admin, while a change to tools.admin can't break remoting.protocol.body.
Position
Below the diagonal: tools.admin uses a module listed above it, which is the healthy direction.
tools.admin uses client.impl.factory, so a change to client.impl.factory can break tools.admin, while a change to tools.admin can't break client.impl.factory.
Position
Below the diagonal: tools.admin uses a module listed above it, which is the healthy direction.
broker.out uses remoting.protocol.route, so a change to remoting.protocol.route can break broker.out, while a change to broker.out can't break remoting.protocol.route.
Position
Below the diagonal: broker.out uses a module listed above it, which is the healthy direction.
broker.out uses remoting.protocol.body, so a change to remoting.protocol.body can break broker.out, while a change to broker.out can't break remoting.protocol.body.
Position
Below the diagonal: broker.out uses a module listed above it, which is the healthy direction.
broker.out uses client.impl.consumer, so a change to client.impl.consumer can break broker.out, while a change to broker.out can't break client.impl.consumer.
Position
Below the diagonal: broker.out uses a module listed above it, which is the healthy direction.
broker.out uses remoting.protocol.header, so a change to remoting.protocol.header can break broker.out, while a change to broker.out can't break remoting.protocol.header.
Position
Below the diagonal: broker.out uses a module listed above it, which is the healthy direction.
broker.processor uses common.message, so a change to common.message can break broker.processor, while a change to broker.processor can't break common.message.
Position
Below the diagonal: broker.processor uses a module listed above it, which is the healthy direction.
broker.processor uses remoting.protocol, so a change to remoting.protocol can break broker.processor, while a change to broker.processor can't break remoting.protocol.
Position
Below the diagonal: broker.processor uses a module listed above it, which is the healthy direction.
broker.processor uses remoting.protocol.heartbeat, so a change to remoting.protocol.heartbeat can break broker.processor, while a change to broker.processor can't break remoting.protocol.heartbeat.
Position
Below the diagonal: broker.processor uses a module listed above it, which is the healthy direction.
broker.processor uses remoting.protocol.subscription, so a change to remoting.protocol.subscription can break broker.processor, while a change to broker.processor can't break remoting.protocol.subscription.
Position
Below the diagonal: broker.processor uses a module listed above it, which is the healthy direction.
broker.processor uses remoting.netty, so a change to remoting.netty can break broker.processor, while a change to broker.processor can't break remoting.netty.
Position
Below the diagonal: broker.processor uses a module listed above it, which is the healthy direction.
broker.processor uses remoting.protocol.body, so a change to remoting.protocol.body can break broker.processor, while a change to broker.processor can't break remoting.protocol.body.
Position
Below the diagonal: broker.processor uses a module listed above it, which is the healthy direction.
broker.processor uses broker.client, so a change to broker.client can break broker.processor, while a change to broker.processor can't break broker.client.
Position
Below the diagonal: broker.processor uses a module listed above it, which is the healthy direction.
broker.processor uses remoting.protocol.header, so a change to remoting.protocol.header can break broker.processor, while a change to broker.processor can't break remoting.protocol.header.
Position
Below the diagonal: broker.processor uses a module listed above it, which is the healthy direction.
broker.processor uses client.consumer, so a change to client.consumer can break broker.processor, while a change to broker.processor can't break client.consumer.
Position
Below the diagonal: broker.processor uses a module listed above it, which is the healthy direction.
client.impl.mqclient uses common.message, so a change to common.message can break client.impl.mqclient, while a change to client.impl.mqclient can't break common.message.
Position
Below the diagonal: client.impl.mqclient uses a module listed above it, which is the healthy direction.
client.impl.mqclient uses remoting.protocol, so a change to remoting.protocol can break client.impl.mqclient, while a change to client.impl.mqclient can't break remoting.protocol.
Position
Below the diagonal: client.impl.mqclient uses a module listed above it, which is the healthy direction.
client.impl.mqclient uses remoting.protocol.heartbeat, so a change to remoting.protocol.heartbeat can break client.impl.mqclient, while a change to client.impl.mqclient can't break remoting.protocol.heartbeat.
Position
Below the diagonal: client.impl.mqclient uses a module listed above it, which is the healthy direction.
client.impl.mqclient uses common.utils, so a change to common.utils can break client.impl.mqclient, while a change to client.impl.mqclient can't break common.utils.
Position
Below the diagonal: client.impl.mqclient uses a module listed above it, which is the healthy direction.
client.impl.mqclient uses remoting.netty, so a change to remoting.netty can break client.impl.mqclient, while a change to client.impl.mqclient can't break remoting.netty.
Position
Below the diagonal: client.impl.mqclient uses a module listed above it, which is the healthy direction.
client.impl.mqclient uses remoting.protocol.body, so a change to remoting.protocol.body can break client.impl.mqclient, while a change to client.impl.mqclient can't break remoting.protocol.body.
Position
Below the diagonal: client.impl.mqclient uses a module listed above it, which is the healthy direction.
client.impl.mqclient uses remoting, so a change to remoting can break client.impl.mqclient, while a change to client.impl.mqclient can't break remoting.
Position
Below the diagonal: client.impl.mqclient uses a module listed above it, which is the healthy direction.
client.impl.mqclient uses remoting.protocol.header, so a change to remoting.protocol.header can break client.impl.mqclient, while a change to client.impl.mqclient can't break remoting.protocol.header.
Position
Below the diagonal: client.impl.mqclient uses a module listed above it, which is the healthy direction.
client.impl.mqclient uses client.impl.factory, so a change to client.impl.factory can break client.impl.mqclient, while a change to client.impl.mqclient can't break client.impl.factory.
Position
Below the diagonal: client.impl.mqclient uses a module listed above it, which is the healthy direction.
client.impl.mqclient uses client.impl, so a change to client.impl can break client.impl.mqclient, while a change to client.impl.mqclient can't break client.impl.
Position
Below the diagonal: client.impl.mqclient uses a module listed above it, which is the healthy direction.
client.impl.mqclient uses client.producer, so a change to client.producer can break client.impl.mqclient, while a change to client.impl.mqclient can't break client.producer.
Position
Below the diagonal: client.impl.mqclient uses a module listed above it, which is the healthy direction.
client.impl.mqclient uses client.consumer, so a change to client.consumer can break client.impl.mqclient, while a change to client.impl.mqclient can't break client.consumer.
Position
Below the diagonal: client.impl.mqclient uses a module listed above it, which is the healthy direction.
proxy.common uses remoting.protocol.subscription, so a change to remoting.protocol.subscription can break proxy.common, while a change to proxy.common can't break remoting.protocol.subscription.
Position
Below the diagonal: proxy.common uses a module listed above it, which is the healthy direction.
broker.topic uses remoting.protocol, so a change to remoting.protocol can break broker.topic, while a change to broker.topic can't break remoting.protocol.
Position
Below the diagonal: broker.topic uses a module listed above it, which is the healthy direction.
broker.topic uses remoting.protocol.route, so a change to remoting.protocol.route can break broker.topic, while a change to broker.topic can't break remoting.protocol.route.
Position
Below the diagonal: broker.topic uses a module listed above it, which is the healthy direction.
broker.topic uses remoting.protocol.body, so a change to remoting.protocol.body can break broker.topic, while a change to broker.topic can't break remoting.protocol.body.
Position
Below the diagonal: broker.topic uses a module listed above it, which is the healthy direction.
broker.topic uses client.impl.producer, so a change to client.impl.producer can break broker.topic, while a change to broker.topic can't break client.impl.producer.
Position
Below the diagonal: broker.topic uses a module listed above it, which is the healthy direction.
proxy.grpc.v2.channel uses common.message, so a change to common.message can break proxy.grpc.v2.channel, while a change to proxy.grpc.v2.channel can't break common.message.
Position
Below the diagonal: proxy.grpc.v2.channel uses a module listed above it, which is the healthy direction.
proxy.grpc.v2.channel uses remoting.protocol, so a change to remoting.protocol can break proxy.grpc.v2.channel, while a change to proxy.grpc.v2.channel can't break remoting.protocol.
Position
Below the diagonal: proxy.grpc.v2.channel uses a module listed above it, which is the healthy direction.
proxy.grpc.v2.channel uses common.utils, so a change to common.utils can break proxy.grpc.v2.channel, while a change to proxy.grpc.v2.channel can't break common.utils.
Position
Below the diagonal: proxy.grpc.v2.channel uses a module listed above it, which is the healthy direction.
proxy.grpc.v2.channel uses remoting.protocol.body, so a change to remoting.protocol.body can break proxy.grpc.v2.channel, while a change to proxy.grpc.v2.channel can't break remoting.protocol.body.
Position
Below the diagonal: proxy.grpc.v2.channel uses a module listed above it, which is the healthy direction.
proxy.grpc.v2.channel uses remoting.protocol.header, so a change to remoting.protocol.header can break proxy.grpc.v2.channel, while a change to proxy.grpc.v2.channel can't break remoting.protocol.header.
Position
Below the diagonal: proxy.grpc.v2.channel uses a module listed above it, which is the healthy direction.
proxy.grpc.v2.channel uses proxy.common, so a change to proxy.common can break proxy.grpc.v2.channel, while a change to proxy.grpc.v2.channel can't break proxy.common.
Position
Below the diagonal: proxy.grpc.v2.channel uses a module listed above it, which is the healthy direction.
broker.metrics uses remoting.protocol, so a change to remoting.protocol can break broker.metrics, while a change to broker.metrics can't break remoting.protocol.
Position
Below the diagonal: broker.metrics uses a module listed above it, which is the healthy direction.
broker.metrics uses remoting.protocol.heartbeat, so a change to remoting.protocol.heartbeat can break broker.metrics, while a change to broker.metrics can't break remoting.protocol.heartbeat.
Position
Below the diagonal: broker.metrics uses a module listed above it, which is the healthy direction.
broker.metrics uses remoting.protocol.header, so a change to remoting.protocol.header can break broker.metrics, while a change to broker.metrics can't break remoting.protocol.header.
Position
Below the diagonal: broker.metrics uses a module listed above it, which is the healthy direction.
broker.metrics uses broker.processor, so a change to broker.processor can break broker.metrics, while a change to broker.metrics can't break broker.processor.
Position
Below the diagonal: broker.metrics uses a module listed above it, which is the healthy direction.
broker uses remoting.protocol.body, so a change to remoting.protocol.body can break broker, while a change to broker can't break remoting.protocol.body.
Position
Below the diagonal: broker uses a module listed above it, which is the healthy direction.
proxy.service.route uses common.message, so a change to common.message can break proxy.service.route, while a change to proxy.service.route can't break common.message.
Position
Below the diagonal: proxy.service.route uses a module listed above it, which is the healthy direction.
proxy.service.route uses remoting.protocol.route, so a change to remoting.protocol.route can break proxy.service.route, while a change to proxy.service.route can't break remoting.protocol.route.
Position
Below the diagonal: proxy.service.route uses a module listed above it, which is the healthy direction.
proxy.service.route uses common.utils, so a change to common.utils can break proxy.service.route, while a change to proxy.service.route can't break common.utils.
Position
Below the diagonal: proxy.service.route uses a module listed above it, which is the healthy direction.
proxy.service.route uses client.impl.producer, so a change to client.impl.producer can break proxy.service.route, while a change to proxy.service.route can't break client.impl.producer.
Position
Below the diagonal: proxy.service.route uses a module listed above it, which is the healthy direction.
proxy.service.route uses client.impl.mqclient, so a change to client.impl.mqclient can break proxy.service.route, while a change to proxy.service.route can't break client.impl.mqclient.
Position
Below the diagonal: proxy.service.route uses a module listed above it, which is the healthy direction.
proxy.service.route uses proxy.common, so a change to proxy.common can break proxy.service.route, while a change to proxy.service.route can't break proxy.common.
Position
Below the diagonal: proxy.service.route uses a module listed above it, which is the healthy direction.
proxy.service.message uses common.message, so a change to common.message can break proxy.service.message, while a change to proxy.service.message can't break common.message.
Position
Below the diagonal: proxy.service.message uses a module listed above it, which is the healthy direction.
proxy.service.message uses remoting.protocol, so a change to remoting.protocol can break proxy.service.message, while a change to proxy.service.message can't break remoting.protocol.
Position
Below the diagonal: proxy.service.message uses a module listed above it, which is the healthy direction.
proxy.service.message uses remoting.protocol.body, so a change to remoting.protocol.body can break proxy.service.message, while a change to proxy.service.message can't break remoting.protocol.body.
Position
Below the diagonal: proxy.service.message uses a module listed above it, which is the healthy direction.
proxy.service.message uses remoting, so a change to remoting can break proxy.service.message, while a change to proxy.service.message can't break remoting.
Position
Below the diagonal: proxy.service.message uses a module listed above it, which is the healthy direction.
33 pairs of types, where a type in proxy.service.message uses a type in remoting.protocol.header. Showing 25 of them; the rest are in namespace-graph.json in this report's bundle.
proxy.service.message uses remoting.protocol.header, so a change to remoting.protocol.header can break proxy.service.message, while a change to proxy.service.message can't break remoting.protocol.header.
Position
Below the diagonal: proxy.service.message uses a module listed above it, which is the healthy direction.
proxy.service.message uses client.producer, so a change to client.producer can break proxy.service.message, while a change to proxy.service.message can't break client.producer.
Position
Below the diagonal: proxy.service.message uses a module listed above it, which is the healthy direction.
proxy.service.message uses client.consumer, so a change to client.consumer can break proxy.service.message, while a change to proxy.service.message can't break client.consumer.
Position
Below the diagonal: proxy.service.message uses a module listed above it, which is the healthy direction.
proxy.service.message uses client.impl.mqclient, so a change to client.impl.mqclient can break proxy.service.message, while a change to proxy.service.message can't break client.impl.mqclient.
Position
Below the diagonal: proxy.service.message uses a module listed above it, which is the healthy direction.
proxy.service.message uses proxy.common, so a change to proxy.common can break proxy.service.message, while a change to proxy.service.message can't break proxy.common.
Position
Below the diagonal: proxy.service.message uses a module listed above it, which is the healthy direction.
proxy.service.message uses proxy.service.route, so a change to proxy.service.route can break proxy.service.message, while a change to proxy.service.message can't break proxy.service.route.
Position
Below the diagonal: proxy.service.message uses a module listed above it, which is the healthy direction.
proxy.service.sysmessage uses common.message, so a change to common.message can break proxy.service.sysmessage, while a change to proxy.service.sysmessage can't break common.message.
Position
Below the diagonal: proxy.service.sysmessage uses a module listed above it, which is the healthy direction.
proxy.service.sysmessage uses remoting.protocol, so a change to remoting.protocol can break proxy.service.sysmessage, while a change to proxy.service.sysmessage can't break remoting.protocol.
Position
Below the diagonal: proxy.service.sysmessage uses a module listed above it, which is the healthy direction.
proxy.service.sysmessage uses remoting.protocol.heartbeat, so a change to remoting.protocol.heartbeat can break proxy.service.sysmessage, while a change to proxy.service.sysmessage can't break remoting.protocol.heartbeat.
Position
Below the diagonal: proxy.service.sysmessage uses a module listed above it, which is the healthy direction.
proxy.service.sysmessage uses common.utils, so a change to common.utils can break proxy.service.sysmessage, while a change to proxy.service.sysmessage can't break common.utils.
Position
Below the diagonal: proxy.service.sysmessage uses a module listed above it, which is the healthy direction.
proxy.service.sysmessage uses remoting, so a change to remoting can break proxy.service.sysmessage, while a change to proxy.service.sysmessage can't break remoting.
Position
Below the diagonal: proxy.service.sysmessage uses a module listed above it, which is the healthy direction.
proxy.service.sysmessage uses broker.client, so a change to broker.client can break proxy.service.sysmessage, while a change to proxy.service.sysmessage can't break broker.client.
Position
Below the diagonal: proxy.service.sysmessage uses a module listed above it, which is the healthy direction.
proxy.service.sysmessage uses remoting.protocol.header, so a change to remoting.protocol.header can break proxy.service.sysmessage, while a change to proxy.service.sysmessage can't break remoting.protocol.header.
Position
Below the diagonal: proxy.service.sysmessage uses a module listed above it, which is the healthy direction.
proxy.service.sysmessage uses client.consumer, so a change to client.consumer can break proxy.service.sysmessage, while a change to proxy.service.sysmessage can't break client.consumer.
Position
Below the diagonal: proxy.service.sysmessage uses a module listed above it, which is the healthy direction.
proxy.service.sysmessage uses client.impl.mqclient, so a change to client.impl.mqclient can break proxy.service.sysmessage, while a change to proxy.service.sysmessage can't break client.impl.mqclient.
Position
Below the diagonal: proxy.service.sysmessage uses a module listed above it, which is the healthy direction.
proxy.service.sysmessage uses proxy.service.route, so a change to proxy.service.route can break proxy.service.sysmessage, while a change to proxy.service.sysmessage can't break proxy.service.route.
Position
Below the diagonal: proxy.service.sysmessage uses a module listed above it, which is the healthy direction.
proxy.service uses client.impl.mqclient, so a change to client.impl.mqclient can break proxy.service, while a change to proxy.service can't break client.impl.mqclient.
Position
Below the diagonal: proxy.service uses a module listed above it, which is the healthy direction.
proxy.service uses proxy.service.route, so a change to proxy.service.route can break proxy.service, while a change to proxy.service can't break proxy.service.route.
Position
Below the diagonal: proxy.service uses a module listed above it, which is the healthy direction.
proxy.service uses proxy.service.message, so a change to proxy.service.message can break proxy.service, while a change to proxy.service can't break proxy.service.message.
Position
Below the diagonal: proxy.service uses a module listed above it, which is the healthy direction.
proxy.processor uses common.message, so a change to common.message can break proxy.processor, while a change to proxy.processor can't break common.message.
Position
Below the diagonal: proxy.processor uses a module listed above it, which is the healthy direction.
proxy.processor uses remoting.protocol, so a change to remoting.protocol can break proxy.processor, while a change to proxy.processor can't break remoting.protocol.
Position
Below the diagonal: proxy.processor uses a module listed above it, which is the healthy direction.
proxy.processor uses remoting.protocol.heartbeat, so a change to remoting.protocol.heartbeat can break proxy.processor, while a change to proxy.processor can't break remoting.protocol.heartbeat.
Position
Below the diagonal: proxy.processor uses a module listed above it, which is the healthy direction.
proxy.processor uses remoting.protocol.subscription, so a change to remoting.protocol.subscription can break proxy.processor, while a change to proxy.processor can't break remoting.protocol.subscription.
Position
Below the diagonal: proxy.processor uses a module listed above it, which is the healthy direction.
proxy.processor uses broker.client, so a change to broker.client can break proxy.processor, while a change to proxy.processor can't break broker.client.
Position
Below the diagonal: proxy.processor uses a module listed above it, which is the healthy direction.
proxy.processor uses remoting.protocol.header, so a change to remoting.protocol.header can break proxy.processor, while a change to proxy.processor can't break remoting.protocol.header.
Position
Below the diagonal: proxy.processor uses a module listed above it, which is the healthy direction.
proxy.processor uses client.producer, so a change to client.producer can break proxy.processor, while a change to proxy.processor can't break client.producer.
Position
Below the diagonal: proxy.processor uses a module listed above it, which is the healthy direction.
proxy.processor uses client.consumer, so a change to client.consumer can break proxy.processor, while a change to proxy.processor can't break client.consumer.
Position
Below the diagonal: proxy.processor uses a module listed above it, which is the healthy direction.
proxy.processor uses proxy.service.route, so a change to proxy.service.route can break proxy.processor, while a change to proxy.processor can't break proxy.service.route.
Position
Below the diagonal: proxy.processor uses a module listed above it, which is the healthy direction.
proxy.processor uses proxy.service.message, so a change to proxy.service.message can break proxy.processor, while a change to proxy.processor can't break proxy.service.message.
Position
Below the diagonal: proxy.processor uses a module listed above it, which is the healthy direction.
proxy.processor uses proxy.service, so a change to proxy.service can break proxy.processor, while a change to proxy.processor can't break proxy.service.
Position
Below the diagonal: proxy.processor uses a module listed above it, which is the healthy direction.
proxy.grpc.v2 uses proxy.grpc.v2.channel, so a change to proxy.grpc.v2.channel can break proxy.grpc.v2, while a change to proxy.grpc.v2 can't break proxy.grpc.v2.channel.
Position
Below the diagonal: proxy.grpc.v2 uses a module listed above it, which is the healthy direction.
proxy.grpc.v2 uses proxy.processor, so a change to proxy.processor can break proxy.grpc.v2, while a change to proxy.grpc.v2 can't break proxy.processor.
Position
Below the diagonal: proxy.grpc.v2 uses a module listed above it, which is the healthy direction.
At a glance — Code Health · 53% · Adequate · gated by X5 ·
Findings mapped to OWASP categories; the specific CVEs/secrets are in the Security dimension cards below and findings.md (redacted only on the public version of this report).
OWASP category
Findings
Severity
A05:2025 — Injection
89
High / Critical
A03:2025 — Software Supply Chain Failures
25
High / Critical
A07:2025 — Authentication Failures
2
High / Critical
Roadmap
First, eliminate the 697 orphaned files in the knowledge base, prioritizing SendMessageActivity.java, ClientConfig.java, and Configuration.java. Next, correct the documentation by reconciling the README with the actual codebase and resolving the specific finding in Deployment.md. Then, establish a structured record of significant design decisions in a dedicated folder to capture context and consequences. Finally, enforce nullable reference types by declaring default null-marking and resolving suppressions to prevent potential null pointer exceptions.
Ranked by impact ÷ effort. "Helps" is the estimated gain on the 0–100 health score.
Do this
Helps
Effort
Dimension
Resolve the 697 Orphaned file finding(s) in Knowledge Freshness — start with SendMessageActivity.java (2), ClientConfig.java (2), Configuration.java (2).
Reconcile the README with reality: Apache RocketMQ operator CRDs installed in README but no CRD project exists; README advertises Docker containerisation, but no Dockerfile/compose file exists; docs/cn/best_practice.md links to `[](`, but `docs/cn/[](` does not exist; docs/cn/controller/persistent_unique_broker_id.md names `.broker.meta.temp`, but no file or folder `.broker.meta.temp` exists; docs/cn/controller/persistent_unique_broker_id.md names `.broker.meta`, but no file or folder `.broker.meta` exists.
Record your significant design decisions. Write one short document per decision, giving its date, the situation, the decision and its consequences, and keep them together with your other design documents. A docs/adr folder with each file named by number and title is the easiest place to find them.
Declare the default where Java declares it: `@NullMarked` (org.jspecify.annotations) in each package's `package-info.java`, or once in `module-info.java`, and run NullAway (Error Prone) or the Checker Framework so the declaration is enforced. Then annotate the real exceptions `@Nullable` and resolve the suppressions rather than adding to them: a `@SuppressWarnings("NullAway")` or `castToNonNull(x)` on a value the checker could show to be null is a `NullPointerException` waiting for the path that makes it true — where the value genuinely cannot be null, say something the checker can see instead (a null check, `Objects.requireNonNull`, a non-null field initialised in the constructor).
Explain in the README how to run the tests. Add a section called Testing to the README in the repository's top folder, saying how to run the test suite.
Every finding carries one of four grades. Three say how serious it is. The fourth says this
survey could not settle it — and it is a grade, not a gap.
Critical — 79
A definite problem that already costs you something and drags the score down: a
missing authorisation check, a dependency with a known exploit, a build that does not reproduce. Failure here
tends to cause failures elsewhere.
Serious — 1569
Likely wrong, but not failing yet. It degrades
the codebase over a longer horizon and can cause failures elsewhere — not urgent this week, not something to
carry for two years either.
Minor — 891
Recorded, with no effect on how the codebase functions.
Present so the survey is complete, not because it needs doing.
Could not be resolved — 15
Something this survey could not settle
from the outside, and which could be critical or serious. Either a control was required and no
positive evidence of it exists in the repository — a backup job that nothing shows was ever restored from proves
nothing about restores — or our own analysis could not run over that part of the tree. This is not a clean
result. These are excluded from the score rather than awarded a pass, so the number on the cover neither
rewards nor penalises them: if you act on this survey without resolving them, you carry that risk yourself. Each
one is named under Limitations.
Methodology & how to trust this report
Watchdog is a deep, periodic assessment — run each sprint, monthly, or quarterly, taking the time to go wider and deeper than a quick check and surfacing in one coherent report what you'd otherwise piece together from a dozen separate tools. It scores deterministically: the same commit yields the same score, every run. 58 of 62 evaluated dimensions are computed purely by tools and static analysis (confidence 1.0); 4 documentation/naming judgement(s) are LLM-assisted and labelled advisory. Overall confidence is 0.8 — the weighted average across measured dimensions; it falls as more of the score leans on LLM-assisted judgement and rises when it's fully tool-backed.
Every figure here is one of three kinds, and we label which: ✓ Measured — a deterministic fact (LoC, complexity, coverage); ~ Modeled — an estimate from a stated model (cost, effort, value-at-risk), always a range with its assumptions, never a precise fact; ◐ Advisory — an LLM prose judgement. We never present a modelled estimate as if it were measured. Perfect or absent scores carry their provenance too (ADR-0011): ✓ Tool-verified means the property itself was measured across the surface; ○ Nothing flagged means the probes came back clean — a claim bounded by what a repository can show; ⊘ Not evidenced means a working control (a tested restore, an automated rollback) showed no positive evidence — absence of evidence is not evidence of a control, so it's excluded from the score rather than awarded a spurious 10; ◐ Sampled · advisory marks an LLM verdict over a bounded sample — advisory, never a deterministic measurement.
What we checked — 62 dimensions across the health lenses
Each chip is a dimension scored from real signals across architecture, testing, dependencies, security & compliance, documentation, git-history and code quality — in one coherent pass. A surface report typically covers a handful.
How to trust any code-health report — three questions
Can you open the finding? Real findings cite a repo-relative file and line you can open at the cited line — never an absolute scratch path. Here, 2522 of 2539 do; the remainder are repo-wide signals — a dimension-level measurement, not a single line. (Every path in this report is repo-relative by construction: paths are normalized at the producer and the report is rejected if any rooted path leaks through.)
Is there a tool behind the number? Every score below names the method that produced it — Roslyn, git, a scanner, or (for a handful of documentation/naming dimensions) an LLM labelled sampled · advisory — not a narrative.
Does re-running give the same result? Run it again on the same commit and the score — and this report, byte for byte — is identical. A report whose numbers move between runs is describing the run, not the code.
This report answers yes to all three. That's the bar to hold any assessment to.
Tools & methods
The actual versions used this run (captured at analysis time) — re-run on the same commit for the identical score.
Method
Backs
Version
Evaluator
Roslyn static analysis
Complexity, cohesion, coupling, dead code, API surface, layering
What ran differently this time — a tool absent, degraded, or that fell back to an estimate. Named openly, not folded silently into the scores. A degraded run also records its exact cause in diagnostics.md.
D8 Code Coverage — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. Coverage NOT READ here — but this repository measures it: a coverage step in CI (`codecov/codecov-action`) shows that coverage is collected and tracked in your own CI. The built-in collector has no runner for this ecosystem (.java), so the analyzer could not read the number — a gap in the analyzer's language coverage, not an unmeasured repo. Not scored. To have the real number read, produce a coverage report in a standard format (JaCoCo XML — `mvn jacoco:report`) and commit it — a hosted scan measures a clone of the repository, so a report that exists only in a working tree, a CI runner's or your own, never reaches it; the artefact is commonly gitignored, so `git add -f` that one file (or un-ignore its path) and commit it alongside the code it measures. You can widen what we reach: optional: produce a coverage report in a standard format (JaCoCo XML — `mvn jacoco:report`) and commit it — a hosted scan measures a clone of the repository, so a report that exists only in a working tree, a CI runner's or your own, never reaches it; the artefact is commonly gitignored, so `git add -f` that one file (or un-ignore its path) and commit it alongside the code it measures — then the real number is read on the next scan.
D11 Test Reliability — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. Test source is present (.java) and this repository declares a JVM test suite (repository root, Maven), but it was not re-run: no test result was produced. Not scored — this is a gap in the analyzer's language coverage, not a finding about this repository.
D12 Dependency Hygiene — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. Not scored — 19 Maven/Gradle manifest(s) were read, stating a version for 11 dependency(ies) and leaving 143 to a parent or an imported BOM, but no build resolved the dependency graph, so the outdated signal was not established. NOT a finding that these dependencies are current or healthy.
D16 Bus Factor — not measured this run — This is a true statement about the repository that carries nothing for its owner to act on, so it is reported here rather than as a defect in their code. All 700 significant source file(s) were last meaningfully changed so long ago that no living knowledge remains — nothing since has been substantial enough to re-establish ownership (a broad, mechanical sweep that touches many files shallowly does not count, and neither does no activity at all). There is no concentration to measure, so the bus factor is not scored. This is not a clean bill: nobody currently holds working knowledge of this code (see D34 Knowledge Freshness). Counted over 672 of the 1249 production source files in this repository: 549 are under the ~2,400-byte size floor this dimension measures over, and the remaining 28 have no attributable history left to measure.
D22 Internal API Consistency — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. D22 identifies the intentionally-exposed surface from `IsPackable` and `.Contracts` project names, MSBuild conventions read off the loaded project set. This target exposed no such projects, so the probe never ran; this says nothing about whether the repository has a public API. This repository commits no C#/VB source at all, so there was never an MSBuild project set to read these conventions off. That is OUR side and it is an ADMISSION gap, not an environment fault: it declares a published package (REDACTED), but no published-package marker D22 reads admitted any project here. D22 DOES collect the public API of every language in this tree, and admits a project only when its manifest makes that ecosystem's publication act in a form the marker recognises — so what is missing is not a collector but an admission rule for the publication act this repository makes, if it makes one. The remedy is a better discriminator for that marker — not a collector, and no change to the scan image can close it. The marker's rules are measured to refuse applications, so one refused repository is the rule working as calibrated; several are the evidence that it is too strict.
D32 Data Compliance (PII/GDPR) — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. `filter/src/main/java/org/apache/rocketmq/filter/parser/SelectorParser.java` produced a parse error, so every rule in this engine's `gdpr.yml` was absent there. That absence is NOT a clean result: these rules detect personal data crossing a boundary into a log sink, a URL or browser storage, and a file that was never parsed cannot report any of the three. The rest of the tree analysed normally and its rows above stand; only these files are unaccounted for. You can widen what we reach: fix the syntax error (or exclude the file deliberately) and re-scan to cover it.
AX1 Captive dependencies — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check reads Microsoft.Extensions.DependencyInjection registrations in C# and Spring beans in Java/Kotlin only, and this repository defines its own container in broker/src/main/java/org/apache/rocketmq/broker/filter/ConsumerFilterManager.java, whose lifetimes are not modelled yet, so it had nothing of this repository's product to read. That is a gap in this analyzer's language reach — not a finding that the repository is free of what this check looks for.
C1 Data Protection — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. These personal data controls are read from declarative annotations, request middleware, entity/column names and guard methods in a C# source model, and none was loaded on this run, so there was nothing to gather. That is a gap in this analyzer's language reach — not a finding that the repository lacks personal data controls.
C2 Access Controls — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. These authorization controls are read from declarative annotations, request middleware, entity/column names and guard methods in a C# source model, and none was loaded on this run, so there was nothing to gather. That is a gap in this analyzer's language reach — not a finding that the repository lacks authorization controls.
C3 Audit Trail — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. These audit controls are read from declarative annotations, request middleware, entity/column names and guard methods in a C# source model, and none was loaded on this run, so there was nothing to gather. That is a gap in this analyzer's language reach — not a finding that the repository lacks audit controls.
C4 Data Retention — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. These retention controls are read from declarative annotations, request middleware, entity/column names and guard methods in a C# source model, and none was loaded on this run, so there was nothing to gather. That is a gap in this analyzer's language reach — not a finding that the repository lacks retention controls.
C5 Data-Subject Rights — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. These data-subject rights controls are read from declarative annotations, request middleware, entity/column names and guard methods in a C# source model, and none was loaded on this run, so there was nothing to gather. That is a gap in this analyzer's language reach — not a finding that the repository lacks data-subject rights controls.
ED5 Idempotency — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check decides whether a handler's mutation is safe to re-run by recognising its persistence writes (a database save, a repository write, an event publish) and its guards. Those markers are .NET member names, so in this repository's language a write such as `repository.save(order)` is not recognised and a same-named call on an unrelated library type could be. The handlers were found; their idempotency was neither confirmed nor ruled out.
GD1 Unfinished & placeholder code — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check reads C# syntax, F#, JavaScript/TypeScript, Dart, Ruby and Scala source only, and no C#, F#, JavaScript/TypeScript, Dart, Ruby or Scala was found, and this repository's Java, Python is not read yet, so it had nothing of this repository's product to read. That is a gap in this analyzer's language reach — not a finding that the repository is free of what this check looks for.
IC1 Incompleteness & stubs — measured, with a gap in what it reached — Watchdog measured this, but not all of it. What it did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. 35 further occurrence(s) are not listed individually; the score already reflects all 75.
S1 Web-Security Posture — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. These web-security controls are read from declarative annotations, request middleware, entity/column names and guard methods in a C# source model, and none was loaded on this run, so there was nothing to gather. That is a gap in this analyzer's language reach — not a finding that the repository lacks web-security controls.
X3 Exception handling — measured, with a gap in what it reached — Watchdog measured this, but not all of it. What it did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. 68 further occurrence(s) are not listed individually; the score already reflects all 108.
X4 Structured logging — measured, with a gap in what it reached — Watchdog measured this, but not all of it. What it did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. 316 further occurrence(s) are not listed individually; the score already reflects all 356.
Repo exclusion declarations (.gitattributes linguist-generated/vendored, .editorconfig generated_code): none declared — every source file was scored.
Limitations & what we did not check
Watchdog assesses the repository exactly as committed, and only the repository. By design it does not reach outside the source tree: the live cloud account, the running CI/CD pipeline, the host's branch-protection and approval rules, the production configuration, or a restore actually exercised against a backup are all out of scope. That boundary is a feature, not a gap — a repo-relative, deterministic scan re-runs identically on any commit and every finding opens at a real file and line, where a live audit can neither be reproduced nor traced. The visible consequence is that controls which leave no in-repo evidence are reported as "not evidenced" and excluded from the score rather than awarded a number a static scan cannot justify.
Per-dimension blind spots
For each dimension that was measured, what a static, repo-only scan structurally cannot see — the honest edge of the measurement, not a failure of it.
D1 Cyclomatic Complexity: Cyclomatic complexity counts branches statically — it cannot tell an essential decision tree from accidental tangle, nor see complexity that lives in data or configuration (large switch-case token tables, DSL lexers/parsers, data-as-code rule tables) rather than control flow: a tokenizer's many single-character cases read as high complexity though each branch is trivial.
D2 Cognitive Complexity: Cognitive-complexity heuristics approximate how hard code is to follow; genuine domain difficulty and well-named intent that eases reading are not captured.
D3 God Classes: "God class" is sized by members and responsibilities visible in the type — a deliberately broad facade over a coherent subsystem can read the same as an accidental grab-bag. For front-end JS the file-length check is cohesion-aware (a single-responsibility module — one class/IIFE — earns a 3× threshold), but cohesion is approximated from top-level declarations, not true dependency structure.
D4 Code Duplication: Duplication is token-similarity — an in-process token-stream comparison over sliding windows, with type-aware normalization — so it finds copy-paste, not semantic duplication expressed differently. Committed machine-written code (scaffolded migrations, designer/codegen output, protobuf/OpenAPI stubs, model snapshots) is EXCLUDED — its repetition is the tool's, not the team's — so the score reflects hand-written duplication only.
D5 Coupling: Coupling is measured between projects/assemblies — runtime coupling through DI, reflection, messaging or shared databases is invisible to a static reference graph.
D6 Cohesion (LCOM4): LCOM4 cohesion is syntactic — it infers connectivity from which methods touch which fields/methods by name, not from real runtime behaviour or intent.
D9 Test Distribution: The test-pyramid shape is inferred from project/folder naming and references, with a single test host bucketed per-file by its path tier and content signals — a suite that names tiers unconventionally and gives no per-file signal can still be mis-bucketed.
D10 Test Quality: Assertion density is structural — it cannot tell a meaningful behavioural assertion from a trivial one, only that an assertion is present.
D13 REDACTED Scanning: REDACTED detection is signature- and entropy-based on the current tree — a secret that does not match a known pattern, or one already rotated, will not be flagged (a clean scan is "nothing matched", not "no secrets exist").
D15 Churn × Complexity Hotspots: Churn hotspots come from git history — a freshly imported or squashed repository has no churn signal, and recent rewrites can mask a historically risky file.
D17 Explicit Debt: Acknowledged-debt signals (TODO/FIXME, suppressions, dead code) are textual — undocumented debt that nobody marked, and debt that lives in design rather than annotations, is invisible. Committed machine-written code (scaffolded migrations, designer/codegen output, generated stubs) is excluded — it is never the team's dead code to delete.
D19 Documentation Quality: Documentation quality is judged by an LLM over a bounded sample of docs — it reads what is written, not whether the docs match the running system, and it is advisory, not a measurement. Its critique rows are drawn from a closed category vocabulary and each row means the same thing in every run, so two scans can be compared row by row; the SET that fires is still a sample, and does not repeat exactly. Measured on one frozen input, six scans at one engine SHA: 2-5 critique rows per scan, 8 distinct rows across the six, 3 of those 8 seen in only one scan. So a D19 row is evidence about the documentation, but a COUNT of D19 rows is not a quantity — never read a change in it as an improvement or a regression.
D21 Naming Consistency: Naming quality is an LLM judgement over a bounded sample — it assesses clarity/consistency of the names it sees, not domain-correctness, and is advisory.
D26 Project Cohesion: Project focus is sized from members/namespaces per project — a project that is broad by deliberate design reads the same as one that has sprawled.
D27 Navigability: Indirection/navigability is structural — it measures hops to follow a call, not whether that indirection buys real flexibility or just ceremony.
D28 Secrets (history): Secret-history scanning sweeps the git log for known patterns — a secret that predates the available history, or never matched a signature, is not found (clean means "nothing matched in the history we can see").
D29 Static Analysis (SAST): SAST findings are pattern-based (semgrep) — it finds classes of bug it has rules for; logic flaws, auth/authorization gaps and issues needing runtime context are out of reach (and clean means "no rule matched").
D30 Dependency Vulnerabilities: CVE matching depends on accurate package/version metadata and on the advisory databases — a vulnerability with no published advisory, or in code not declared as a dependency, is not seen. Coverage needs a RESOLVED graph: an unpinned requirements.txt, or a pom without a resolved build, yields partial coverage rather than a clean verdict. An ecosystem the analyzer cannot scan is reported as unmeasured, never as clean.
D34 Knowledge Freshness: Freshness is decayed commit RECENCY, not comprehension — code read often but rarely committed reads as orphaned, and stable code that genuinely needs no changes is penalised the same as forgotten code; bot/squash commits distort it like the bus factor.
D35 Change Coupling: Change coupling is co-change in COMMITS — files split across separate commits, or coupled only through a shared config/build step, read as uncoupled, and a sweeping commit (rename/format) is excluded so it doesn't couple everything. It shows that files change together, not WHY: a high coupling can be a healthy cohesive pair as readily as a hidden leak.
D43 Malicious Dependencies: Only packages some vulnerability database has already NAMED as malicious are seen — a compromise published in the last hours, or never reported at all, is invisible here, and this dimension reading 10 is not evidence that a dependency is trustworthy. There is no typosquat or dependency-confusion analysis: a package nobody has reported is simply absent from the feeds. Coverage is the dependency scan's: an ecosystem that could not be scanned is disclosed as unmeasured, never as clean.
D44 Platform End-of-Life: The support table is FROZEN, so it goes out of date by losing RECALL: a release that ended support after the table was written is missed until the table is refreshed, and this dimension reading 10 is not evidence that a platform is current. Only platforms the repository DECLARES in a place this pass reads are seen — a runtime named only in a Dockerfile (D31's subject), in a CI workflow (D29's), or in a file this pass does not parse (go.mod, a Gemfile ruby directive) is invisible here, which is why a repository declaring none of them abstains rather than scoring. Only frameworks with a PUBLISHED support policy are tracked: React, Flask and Express publish none, so their age cannot be judged and their absence from a report is not a statement that they are supported.
AX10 Code composition: Role is inferred from namespace/folder convention, not semantics — a domain concept living in a folder named "Services" reads as application, and the split is lines-of-code, not business value. The business-logic-share score is a SOFT, FLOORED signal: it contributes to the Architecture lens but is floored at the Critical gate, so an infrastructure-heavy design (a gateway, an ETL, a driver) is legitimately low without being nuked to zero.
M4 Documentation accuracy: Onboarding quality is an LLM read of the docs/setup present — it cannot run the onboarding or measure how long a real new joiner takes; the verdict is sampled and advisory.
P4 Deployment & Rollback: Approval/branch-protection rules live in repository settings the scan cannot see — only their in-repo evidence (config files, workflows) is checked, so a control enforced purely in the host's settings reads as "not evidenced".
P6 Release Hygiene: Rollback/observability controls are inferred from repo artefacts (pipelines, dashboards-as-code) — controls configured in external tooling, with no in-repo trace, cannot be credited.
The LLM boundary
LLM-set scores this run (4): D19, D21, D26, M4 (model: Local LLM). For these, a model reads a bounded sample and sets the numeric score; each names its own sample and method on its card. They are sampled and advisory by design: they vary at the margins between runs and are never a deterministic measurement. Every other score in this report is tool-computed at confidence 1.0.
What it measures: How tangled the control flow is — methods with many branches are hard to test and change.
Method: Cyclomatic complexity per method (1 + decision points), computed exhaustively across production source; test projects separated by convention. Deterministic.
111 method(s) exceeded the cyclomatic complexity threshold of 15; the worst was ComparisonExpression.__compare at 54. A further 4 method(s) were over the threshold but excluded as flat dispatchers (a long switch/match over independent cases: many branches, almost no nesting), the largest being AdminBrokerProcessor.processRequest at 62 — they are counted neither in the figure above nor in this dimension's score. 3 files carry no cyclomatic complexity row at all for this reason — every one of their over-threshold methods was excluded, so the exclusion is disclosed nowhere in the file itself: broker/src/main/java/org/apache/rocketmq/broker/processor/AdminBrokerProcessor.java (AdminBrokerProcessor.processRequest at 62), namesrv/src/main/java/org/apache/rocketmq/namesrv/processor/DefaultRequestProcessor.java (DefaultRequestProcessor.processRequest at 24), broker/src/main/java/org/apache/rocketmq/broker/processor/ReplyMessageProcessor.java (ReplyMessageProcessor.handlePutMessageResult at 16). They are named here because the per-file figures other dimensions report are taken BEFORE this exclusion, so such a file can show a high maximum complexity elsewhere in this report and nothing here, with nothing to reconcile the two.
+ 106 more group(s) — more in Appendix A; the complete list is findings.md.
What to do
Bring the 14 bodies over 30 down to 30 or less in Cyclomatic Complexity — start with ComparisonExpression.__compare (cyclomatic 54), PopMessageProcessor.processRequest (cyclomatic 46), BrokerController.shutdownBasicService (cyclomatic 45). — This score is capped by its worst body, so a finding fixed alone moves it by almost nothing — the next one down takes its place. Refactoring these 14 together lifts Cyclomatic Complexity from 6.7 to about 7.3/10, projected with the scoring formula itself and assuming each lands exactly at 30; a cleaner split scores higher.
Enforce Cyclomatic Complexity in CI to reach Verified (currently Documented). — Hardens enforcement from Documented toward Prevented — provenance only; does not change the score.
Detailed fixes: d1_recommendation.md · top locations in Appendix A, every location in findings.md.
What it measures: How hard the code is for a person to follow, beyond raw branching.
Method: Cognitive complexity per method (Sonar-style nesting-penalized score), computed exhaustively over production code, excluding test projects. Deterministic.
+ 295 more group(s) — more in Appendix A; the complete list is findings.md.
What to do
Bring the 1 body over 120 down to 120 or less in Cognitive Complexity — start with TransactionalMessageServiceImpl.check (cognitive 126). — Refactoring it lifts Cognitive Complexity from 5.8 to about 5.8/10.
Enforce Cognitive Complexity in CI to reach Verified (currently Documented). — Hardens enforcement from Documented toward Prevented — provenance only; does not change the score.
Detailed fixes: d2_recommendation.md · top locations in Appendix A, every location in findings.md.
Do you agree with this assessment?
D3 · God Classes7.7 / 10Strong✓ Tool-verified
What it measures: Over-large classes that try to do too much ("god classes").
Method: God-class detection by line and method-count thresholds per logical type (partial classes unified), filtered for generated code and registration/contract false positives. Deterministic.
Resolve the 67 TooManyMethods finding(s) in God Classes — start with ClientConfig.java (2), BrokerConfig.java, MessageStoreConfig.java. — One of this dimension's main actionable groups (67 warning-level).
Resolve the 44 ClassTooLong finding(s) in God Classes — start with MQClientAPIImpl.java, DefaultMessageStore.java, AdminBrokerProcessor.java. — One of this dimension's main actionable groups (44 warning-level).
Resolve the 36 FileTooLong finding(s) in God Classes — start with MQClientAPIImpl.java, AdminBrokerProcessor.java, DefaultMessageStore.java. — One of this dimension's main actionable groups (36 warning-level).
Enforce God Classes in CI to reach Verified (currently Documented). — Hardens enforcement from Documented toward Prevented — provenance only; does not change the score.
Detailed fixes: d3_recommendation.md · top locations in Appendix A, every location in findings.md.
What it measures: Copy-pasted code that should be shared instead.
Method: Code duplication via token-stream sliding windows with type-aware normalization (locals masked, type names preserved), density-scored per KLoC of production code. Deterministic.
520 duplicated block group(s) detected. A further 52 rows report members as variants of one another; they aggregate block groups already counted above and are not themselves counted. 10 of the 572 are in trees this repository does not ship — vendored, example/demo, fixture and benchmark code — and are ranked below the shipped groups rather than excluded from them: the duplication there is real and is still counted in this dimension's score. The dimensions that publish a production-file census leave those trees out of theirs, so this count is deliberately drawn over the wider population.
+ 156 more group(s) — more in Appendix A; the complete list is findings.md.
What to do
Resolve the 46 Duplicated block (9 lines × 2) finding(s) in Code Duplication — start with DefaultMQAdminExtImpl.java (3), EndTransactionProcessor.java (2), TraceDataEncoder.java (2). — One of this dimension's main actionable groups (46 warning-level).
Resolve the 41 Duplicated block (6 lines × 2) finding(s) in Code Duplication — start with EscapeBridge.java (2), AdminBrokerProcessor.java (2), PopBufferMergeService.java (2). — One of this dimension's main actionable groups (41 warning-level).
Resolve the 34 Duplicated block (7 lines × 2) finding(s) in Code Duplication — start with AdminBrokerProcessor.java (2), ConsumeMessageConcurrentlyService.java (2), RocksDBSubscriptionGroupManager.java (2). — One of this dimension's main actionable groups (34 warning-level).
Enforce Code Duplication in CI to reach Verified (currently Documented). — Hardens enforcement from Documented toward Verified — provenance only; does not change the score.
Detailed fixes: d4_recommendation.md · top locations in Appendix A, every location in findings.md.
Do you agree with this assessment?
D5 · Coupling9.5 / 10Stronggated by 1 serious finding✓ Tool-verified
What it measures: Whether volatile projects sit underneath others that depend on them (so their churn ripples upward), and whether project dependencies form cycles. A widely-depended-on but stable shared/kernel project is healthy, not penalised.
Method: Dependency cycles via elementary-DFS over real .csproj references, plus Martin instability (afferent/efferent) per project. Exhaustive over the reference graph, deterministic.
Coverage: Exhaustive · type-level: afferent/efferent coupling + cycles computed over every production type — the population is all types, not a name convention.
16 production modules (Maven), 0 dependency cycle(s), 0 unstable depended-on module(s). Read from the build's own module declarations; 2 module(s) off the main sequence, with abstractness counted on 15 of the 16 (the rest declare no modelled class or interface, export only macros, declare types in source no model reads, or have no source directory of their own).
Off the main sequence: rocketmq-remoting
Off the main sequence: rocketmq-common
What to do
Resolve the 1 Off the main sequence finding(s) in Coupling. — One of this dimension's main actionable groups (1 warning-level).
Enforce Coupling in CI to reach Verified (currently Documented). — Hardens enforcement from Documented toward Prevented — provenance only; does not change the score.
Detailed fixes: d5_recommendation.md · top locations in Appendix A, every location in findings.md.
What it measures: Whether a class's methods are focused on a single responsibility.
Method: LCOM4 cohesion per production class with at least two methods: connected components of methods sharing state or calls, computed syntactically. Deterministic, not a proxy.
Coverage: Exhaustive · type-level: LCOM4 cohesion computed over every production class — the population is all types, not a name convention.
Resolve the 3 Low cohesion finding(s) in Cohesion (LCOM4) — start with ProduceAccumulator.java, RemotingChannel.java, TopicRouteService.java. — One of this dimension's main actionable groups (3 warning-level).
Enforce Cohesion (LCOM4) in CI to reach Verified (currently Documented). — Hardens enforcement from Documented toward Verified — provenance only; does not change the score.
Detailed fixes: d6_recommendation.md · top locations in Appendix A, every location in findings.md.
Do you agree with this assessment?
D9 · Test Distribution10.0 / 10Exemplary✓ Tool-verified
What it measures: Whether the test suite has a healthy mix of unit / integration / end-to-end tests.
Method: Test projects classified (Unit/Integration/BDD/E2E) from compiled metadata; test methods counted exhaustively across projects with placement-agnostic disk fallback. Deterministic.
1833 test methods: 1833 unit, 0 integration, 0 BDD, 0 e2e.
✓ On the Gold path — maintain.
Detailed fixes: d9_recommendation.md.
Do you agree with this assessment?
D10 · Test Quality7.9 / 10Adequategated by 2 critical findings✓ Tool-verified
What it measures: Whether the tests truly assert behaviour rather than just running the code.
Method: Per-test assertions, skips, and mock references analyzed via Roslyn; structured skip-reason tags (BUG:/ENV:) separate documented deferrals from debt. Deterministic.
24 skipped (24 with a documented reason), 315 zero-assertion, no mocking-framework packages referenced (hand-written doubles or no mocking) across 1833 tests (1 harness-style project(s) excluded from the assertion penalty).
No assertions (empty test): itWorks · ×2namesrv/src/test/java/org/apache/rocketmq/namesrv/NameServerInstanceTest.java:45
No assertions: calSignatureExceptionTest · ×252acl/src/test/java/org/apache/rocketmq/acl/common/AclSignerTest.java:25
No direct assertions: testContainsAllInOne · ×61filter/src/test/java/org/apache/rocketmq/filter/ExpressionTest.java:383
Resolve the 2 No assertions (empty test) finding(s) in Test Quality — start with NameServerInstanceTest.java, TopicQueueMappingTest.java. — One of this dimension's main actionable groups (2 issue-level).
Resolve the 252 No assertions finding(s) in Test Quality — start with TlsTest.java (12), SendMessageProcessorTest.java (9), ClusterGrpcIT.java (9). — One of this dimension's main actionable groups (252 warning-level).
Resolve the 61 No direct assertions finding(s) in Test Quality — start with ExpressionTest.java (61). — One of this dimension's main actionable groups (61 recommendation-level).
Enforce Test Quality in CI to reach Verified (currently Documented). — Hardens enforcement from Documented toward Prevented — provenance only; does not change the score.
Detailed fixes: d10_recommendation.md · top locations in Appendix A, every location in findings.md.
What it measures: Whether any secrets (keys, tokens, passwords) have leaked into the code.
Method: In-process native secret scanner (entropy plus signature patterns) across all tracked files; no external tool. A clean result is a measured 10, not no-data zero. Deterministic.
What it measures: Files that change often and are also complex — the riskiest hotspots.
Method: Per production file churn times cyclomatic complexity over a rolling window, computed from git and Roslyn/JS/Razor analysis. Exhaustive, deterministic per commit date.
Resolve the 5 Hotspot finding(s) in Churn × Complexity Hotspots — start with CommitLog.java, PopMessageProcessor.java, PopReviveService.java. — One of this dimension's main actionable groups (5 warning-level).
Detailed fixes: d15_recommendation.md · top locations in Appendix A, every location in findings.md.
What it measures: Acknowledged debt left in the code — TODOs, dead code, suppressed warnings.
Method: Roslyn syntactic debt markers (suppressions/TODO/FIXME/HACK/empty-catch/commented-code/Obsolete) plus SymbolFinder dead-code analysis; weighted-debt-per-KLoC density deducted 2.0x per unit. Deterministic, exhaustive.
22 deducted task-comment markers across 181624 LoC (0.0/KLoC) → score 10.0. Task comments only: this repository's language is read without a compiler, so D17's suppression, dead-code and commented-out-code arms did not run and this score counts fewer marker kinds than a .NET repository's would.
Resolve the 12 TodoComment finding(s) in Explicit Debt — start with TieredFlatFile.java (2), SendMessageProcessor.java, Validators.java. — One of this dimension's main actionable groups (12 warning-level).
Resolve the 9 XxxComment finding(s) in Explicit Debt — start with PullMessageProcessor.java (2), ConsumeQueue.java (2), CommitLog.java (2). — One of this dimension's main actionable groups (9 warning-level).
Resolve the 1 FixmeComment finding(s) in Explicit Debt — start with PopReviveService.java. — One of this dimension's main actionable groups (1 warning-level).
Enforce Explicit Debt in CI to reach Verified (currently Documented). — Hardens enforcement from Documented toward Prevented — provenance only; does not change the score.
Detailed fixes: d17_recommendation.md · top locations in Appendix A, every location in findings.md.
What it measures: Whether the project's documentation is clear, complete, and useful.
Method: Judged by language model at low temperature (0.0-0.1) on a deterministic doc sample (READMEs plus first 25 architecture docs), with two-pass stability filtering. Advisory, sampled.
The repository's root README (Apache RocketMQ) is excellent at conveying what the project is and its features with a strong overview plus an extensive Quick Start guide. The proxy/README and tieredstore/README each document their own directories (proxy, tiered storage), while the docs/cn directory serves as a comprehensive cross-directory developer guide covering concepts, architecture design, examples, best practices, API reference, and more. The docs are well-structured with clear headings and an outline for every visible section; however, the root README lacks installation/build/contribution guidance (which is where most of the quality score sits), so it is judged against its own directory rather than the repository as a whole. RocketMQ documentation is clear and complete for a messaging project: the READMEs cover deployment (single/master, multi-master, multi-master-multi-slave), batch sending, compaction topics, topic creation, scheduled message examples, LMQ queues, and a FAQ. The architecture/Docs markdown files provide detailed design docs on quorum-write replication, auto-in-syncreplicas, and the full scope of the project (5 READMEs + 81 architecture/docs). All visible content is present in the outline; no missing sections. This project's documentation is comprehensive and well-organized: the READMEs (5) cover the repository root with an overview, installation, usage, contribution guidance, and license; architecture/Docs markdown files (81) provide detailed design docs, a full architecture section, deployment characteristics, best practices, concepts, and features. The content is clear and complete for its scope.
Documentation: no project overviewdocs/cn/Deployment.md
What to do
Resolve the 1 Documentation finding(s) in Documentation Quality — start with Deployment.md. — One of this dimension's main actionable groups (1 recommendation-level).
Detailed fixes: d19_recommendation.md · top locations in Appendix A, every location in findings.md.
What it measures: Whether names — types, methods, variables — are clear and consistent.
Method: Judged by language model at low temperature (0.0-0.1) on a deterministic random symbol sample (fixed size, not exhaustive), with disclosed confidence band. Advisory, sampled.
What it measures: How far you must trace to follow a call — low indirection and co-located slices read easier.
Method: Call indirection (interface hops, cross-namespace calls, slice-locality scaled) over a sampled set of method invocations, size-aware baseline. Sampled; confidence discounted by symbol-resolution gaps. C# also names each pass-through layer (a class whose every public method only forwards its own parameters to one collaborator) as a located finding; the score is not affected.
Coverage: Slice locality from the first namespace segments, SAMPLED (≤400 methods) — not exhaustive.
77 % of calls cross a namespace and 0 % go through an interface, but 100 % of collaborators are co-located — so a call's collaborators sit together and tracing stays easy. Baseline: small — navigation cost is tolerated.
What it measures: Whether any secrets were ever committed — scanned across the full git history, not just now.
Method: REDACTED scan via TWO gitleaks detect passes in an isolated checkout — the full git history, then a second --no-git pass over the working tree as it stands — merged and de-duplicated by (rule, file, line); each match flagged High. Both invocations are recorded in the audit trail. Exhaustive; when the tool is absent, or when its output cannot be parsed into the expected shape, the dimension is WITHHELD as an explicit measurement gap on our side — unscored and excluded from the lens, never a hedged middling score.
1 finding(s): 0 critical, 1 high, 0 medium, 0 low. Remediation for historically-committed secrets is credential rotation — they remain in history regardless of later deletion.
REDACTED
REDACTED
What to do
Resolve the 1 REDACTED finding(s) in Secrets (history) — start with REDACTED. — One of this dimension's main actionable groups (1 issue-level).
Resolve the 1 Rotate the exposed credentials finding(s) in Secrets (history). — One of this dimension's main actionable groups (1 recommendation-level).
Detailed fixes: d28_recommendation.md · top locations in Appendix A, every location in findings.md.
What it measures: Real static-analysis (SAST) findings — likely security bugs in the code, any language.
Method: Polyglot static analysis via semgrep across the repo using the pinned, image-baked p/security-audit + p/owasp-top-ten rulesets (no scan-time registry fetch); severity rules (ERROR/WARNING/INFO) map to a full-band severity-weighted score. Exhaustive, deterministic; degrades on parse failure.
Coverage: semgrep pattern rules over all files — exhaustive for the rule set, blind to classes of bug without a rule (clean = no rule matched).
89 finding(s): 0 critical, 69 high, 20 medium, 0 low. 58 unpinned-GitHub-Actions row(s) are reported here but scored by D36 (supply-chain provenance), which measures that posture as `pinned_actions` — one pinning decision is charged once, not once per lens. semgrep hit a parse error in 1 file(s) — `filter/src/main/java/org/apache/rocketmq/filter/parser/SelectorParser.java` (line 515) — so no absence of findings in the named regions is evidence of anything; rows reported elsewhere in those files are real. Fix the syntax error (or exclude the file deliberately) and re-scan to cover them. Separately, one or more rules could not re-parse an embedded snippet in 3 file(s) (e.g. a workflow `run:` block read as shell). Those files WERE scanned and their other rows are unaffected; only those rules' view of those snippets is missing.
REDACTED
REDACTED
REDACTED
REDACTED
REDACTED
+ 2 more group(s) — more in Appendix A; the complete list is findings.md.
What to do
Resolve the 6 REDACTED finding(s) in Static Analysis (SAST) — start with REDACTED (2), REDACTED (2), REDACTED (2). — One of this dimension's main actionable groups (6 issue-level).
Resolve the 4 REDACTED finding(s) in Static Analysis (SAST) — start with REDACTED (2), REDACTED, REDACTED. — One of this dimension's main actionable groups (4 issue-level).
No action in Static Analysis (SAST) — all 58 REDACTED finding(s) are reported here at file:line but scored by D36 (supply-chain provenance), so none is charged to this dimension. — One of this dimension's main actionable groups (58 issue-level, 0 of them charged here).
Detailed fixes: d29_recommendation.md · top locations in Appendix A, every location in findings.md.
What it measures: Whether any dependency has a known published vulnerability (CVE), direct or transitive, in ANY ecosystem the repository declares — Dart pub, Elixir and Erlang via Hex, Go modules, Java and Kotlin via Maven/Gradle, JavaScript/npm, .NET/NuGet, PHP/Composer, Python/PyPI, RubyGems, Rust/Cargo and Swift.
Method: Dependency-CVE scan across every ecosystem the repository declares, scored ONCE. Three sources are unioned and deduplicated by advisory identity (rule id + alias closure, CVE<->GHSA) scoped to package+version, keeping the worst severity: `osv-scanner --recursive` over osv.dev for Dart pub, Elixir/Hex (and Erlang, whose `rebar.lock` syft first converts to a CycloneDX SBOM the scanner reads, with rows attributed back to the lock), Go, Java and Kotlin via Maven/Gradle (and Scala, whose sbt build's pinned direct declarations are written into a CycloneDX SBOM the scanner reads, with rows attributed back to the build file), npm, PHP/Composer, Python/PyPI, RubyGems, Rust/Cargo and Swift; `trivy fs --scanners vuln` for npm lockfiles; and `dotnet list package --vulnerable --include-transitive` for NuGet (with per-advisory collapse of the project x target-framework fan-out), plus a DECLARED-dependency arm that resolves a published gem's gemspec against rubygems.org where no Gemfile.lock is committed. `SeverityScore(c,h,m,l, normalizer 8.0)`. NotApplicable only when NO ecosystem is readable; if any applicable ecosystem could not be scanned the findings are REPORTED and the score is withheld. Supersedes the npm and OSV arms, retired 2026-09-05.
Resolve the 6 High CVE finding(s) in Dependency Vulnerabilities — start with REDACTED (6). — One of this dimension's main actionable groups (6 issue-level).
Resolve the 4 Medium CVE finding(s) in Dependency Vulnerabilities — start with REDACTED (4). — One of this dimension's main actionable groups (4 warning-level).
Resolve the 1 Critical CVE finding(s) in Dependency Vulnerabilities — start with REDACTED. — One of this dimension's main actionable groups (1 issue-level).
Detailed fixes: d30_recommendation.md · top locations in Appendix A, every location in findings.md.
What it measures: Whether anyone still has living knowledge of each file, or it has been orphaned — last understood long ago by someone now gone quiet. The sibling of the bus factor: D16 asks who owns it, D34 asks whether anyone still knows it.
Method: File orphaning as total living-knowledge decay below one focused-commit's worth within a year, computed per-file from the D16 decay model. Exhaustive, deterministic over fixed history.
700 of 700 significant source file(s) are orphaned — their living knowledge has decayed to nothing, so no one currently understands them. The largest is client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java. Counted over 700 of the 1249 production source files in this repository: the rest are under the ~2,400-byte size floor this dimension measures over.
Most significant orphaned file · ×3client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:1
Dormant codebase
What to do
Resolve the 697 Orphaned file finding(s) in Knowledge Freshness — start with SendMessageActivity.java (2), ClientConfig.java (2), Configuration.java (2). — One of this dimension's main actionable groups (697 recommendation-level).
Resolve the 3 Most significant orphaned file finding(s) in Knowledge Freshness — start with MQClientAPIImpl.java, AdminBrokerProcessor.java, DefaultMessageStore.java. — One of this dimension's main actionable groups (3 recommendation-level).
Resolve the 1 Dormant codebase finding(s) in Knowledge Freshness. — One of this dimension's main actionable groups (1 recommendation-level).
Detailed fixes: d34_recommendation.md · top locations in Appendix A, every location in findings.md.
What it measures: Whether files that change together actually belong together — pairs that repeatedly co-change in git history despite having no explicit code dependency, surfacing the hidden/logical coupling (and boundaries in the wrong place) a static scan can't see.
Method: Pairwise co-occurrence over the per-commit file sets in git history (production source only — tests and generated dropped): Degree-of-Coupling = shared ÷ min individual revisions, reported above noise floors (each file ≥10 revisions, ≥5 shared commits, ≥50% strength); sweeping commits excluded. Deterministic over fixed history.
Coverage: Population: PRODUCTION source files only — test and generated files are dropped before pairing, so a class co-changing with its own test (trivially ~100%) can't drown the real production↔production coupling. Pairs ranked by Degree-of-Coupling. A non-source file is never a coupling PARTICIPANT either: documentation, schemas, config and data files are dropped with the rest, so a code↔docs pair — a command and the reference page that restates it — is not reported however strongly the two co-change; nor is coupling that runs THROUGH a build step or config file.
Resolve the 10 Change coupling finding(s) in Change Coupling — start with DefaultMessageStore.java (2), CommitLog.java, Controller.java. — One of this dimension's main actionable groups (10 warning-level).
Resolve the 1 Change-coupling hub finding(s) in Change Coupling — start with ReplicasInfoManager.java. — One of this dimension's main actionable groups (1 warning-level).
Detailed fixes: d35_recommendation.md · top locations in Appendix A, every location in findings.md.
What it measures: Whether the build pipeline provides supply-chain integrity — generated provenance/attestation, signed artifacts (cosign/sigstore), an SBOM, and pinned build actions. Presence of the configuration, not a runtime guarantee.
Method: Supply-chain provenance/signing read deterministically from CI/build config (.github/workflows, .gitlab-ci.yml, azure-pipelines, Jenkinsfile, .circleci) + the release surface: four signals — generated provenance/attestation (SLSA/in-toto/actions-attest), artifact signing (cosign/sigstore/gitsign), an SBOM (syft/sbom-action/*.spdx.json/*.cdx.json), and SHA-pinned build actions — scored 10·present/denom. NotApplicable without a build pipeline. Detects configuration presence, not runtime enforcement.
+ 2 more group(s) — more in Appendix A; the complete list is findings.md.
What to do
Resolve the 7 REDACTED finding(s) in Supply-chain Provenance & Signing — start with REDACTED, REDACTED, REDACTED. — One of this dimension's main actionable groups (7 warning-level).
Resolve the 2 REDACTED finding(s) in Supply-chain Provenance & Signing — start with REDACTED, REDACTED. — One of this dimension's main actionable groups (2 warning-level).
Resolve the 1 REDACTED finding(s) in Supply-chain Provenance & Signing. — One of this dimension's main actionable groups (1 warning-level).
Detailed fixes: d36_recommendation.md · top locations in Appendix A, every location in findings.md.
What it measures: Whether any dependency the repository declares is published as MALICIOUS rather than merely vulnerable — a package that is an attacker's work, in any ecosystem osv-scanner reads. Scored apart from D30 because the answer is binary: there is no safe version to upgrade to, and the fix is to remove the package and rotate every credential it could have read.
Method: The same dependency scan D30 reads, partitioned on the scanner's own classification rather than rescanned: a row is MALICIOUS when its id is in the `MAL-` space (the ossf/malicious-packages feed) OR its `database_specific.cwe_ids` carries `CWE-506` ("Embedded Malicious Code"). Both channels are structural; the summary text is deliberately NOT read, because a malicious-package record whose summary says only "Critical severity vulnerability" is a real shape ([GHSA redacted]) and a text matcher misses it. Scored BINARY: any surviving row is 0, whatever its severity and however many CVEs sit beside it — a hostile dependency is not a quantity. Applicability and degradation are D30's: NotApplicable only when no ecosystem is readable, and an unscannable ecosystem degrades rather than reading clean. SCORED, not informational.
What it measures: Whether anyone still ships security patches for the platform this repository RUNS ON — the runtime it pins and the framework majors its own constraints hold it to. Separate from D12 because the question differs: a current Django on an end-of-life Python is perfectly up to date and completely unsupported, and the fix is a migration rather than a version bump. What the repository says it merely SUPPORTS is never charged.
Method: End-of-life PLATFORM read from the repository's own declarations and graded against a FROZEN, dated table of vendor support dates — no network, no feed, no API, so this dimension answers identically inside a closed scan fence. Two subjects: a RUNTIME the project pins (a single or all-end-of-life TargetFramework, a .nvmrc or .python-version, a requires-python CAP) and a FRAMEWORK major a dependency constraint cannot move off (a caret, tilde or exact version; `vue@^2.7.16` pins Vue 2). A FLOOR is deliberately never charged — `requires-python = ">=3.8"` states what a package SUPPORTS, not what it runs on — and a multi-target project is charged only when EVERY target is out of support. Runtime 4.0/product capped 8.0, framework 1.5 capped 4.5. The table is safe to freeze because a statement about support that ended in the past cannot become false: it loses recall as it ages, never precision, and a test asserts every entry predates the freeze date. Disjoint from D31 (a container image's OS layer) and D29 (the toolchain a CI workflow installs). Abstains when the repository declares no platform this pass reads — never scores it clean.
0 end-of-life runtime(s) and 0 end-of-life framework(s), read from 2 platform declaration(s) and 30 dependency declaration(s). This dimension reads what the repository says about ITSELF — a pinned target framework, a version file, a capped requires-python, a Rust toolchain pin, a framework major a constraint cannot move off. A FLOOR is deliberately never charged: `requires-python = ">=3.8"` states what the package SUPPORTS, not what it runs on, and a well-maintained library declares exactly that while running its own CI on a current release. The end-of-life facts are FROZEN and dated, so this dimension needs no network and answers identically inside a closed scan fence; as the table ages it loses recall and never precision, because a statement about support that ended in the past cannot become false. The OS layer of a container image is D31's question and the toolchain a CI workflow installs is D29's; this row is neither.
Other · Architecture — How the codebase splits by code ROLE — domain, application, infrastructure, test, generated. The significance map behind the knowledge/coupling weighting, and a DDD signal in its own right: a thin domain core under fat infrastructure is the anemic-domain smell, quantified. How each file's role is decided, because the split is only as good as that: a generated name or a build-output tree makes it Generated, a test project makes it Test, and otherwise the file's NAMESPACE and PATH words are matched against fixed vocabularies in a fixed ORDER — domain, then infrastructure, then application — so a file whose words hit two layers is counted under the earlier one. A production file matching none of them counts as application, so that share reads 'application or unclassified' rather than a measured application layer. Roles come from naming convention, never from what the code does. On this repository the split was taken from the source tree on disk rather than from a loaded .NET workspace, so a file's role is decided by its PATH segments alone — no declared namespace was available to add to the evidence — and generated output is excluded from the census entirely rather than counted as a generated share.
Method: Roslyn line-count by code ROLE: every source file classified Domain/Application/Infrastructure/Test/Generated by namespace + path convention (the shared CodeRoleClassifier), then significant lines summed per role. Deterministic; the advisory score is the business-logic (domain+application) share of production code.
Coverage: Population: ALL source files, each bucketed into ONE of five roles (Domain/Application/Infrastructure/Test/Generated) by namespace + path convention — a file whose layer isn't named in the convention falls to Application (the neutral default), and the split is line-count, not semantic depth or business value.
What to do
The domain core is a small share of production code, but most of the rest matched no layer vocabulary at all — so this is not yet an anemic-domain finding. The namespace/path convention could not place that code, which makes the composition above a statement about the naming, not about the design. Name the layers (or check that the repository's conventions differ from the ones this check knows) before reading a thin domain into it.
Other · Architecture — Whether the project-reference graph is acyclic (cycles block independent build/deploy and signal eroding boundaries).
Method: Project reference cycles via elementary-DFS over real .csproj references, using the engine shared with D5/D7; cyclic versus acyclic. Exhaustive, deterministic.
Other · Architecture — Whether the codebase has a recognisable, scale-appropriate structure (a named architectural style, or modular enough for its size) rather than being an ad-hoc ball of mud.
Method: Roslyn plus csproj analysis: architecture style detection (DDD, clean, vertical-slice, CQRS) and structure fitness for repo size. Deterministic.
Other · Architecture — Whether interfaces stay focused rather than fat — the Interface-Segregation principle (SOLID 'I').
Method: Roslyn scan: public interface declared-member counts (accessors fold into their property/event); fat-interface threshold (over 15 declared members) flagged per type. Each finding also reports the distinct-OPERATION count — members counted by name, so an overload group counts once — which decides whether it states the caller-side ISP harm or the implementer-side burden of an overload set. TypeScript: exported interfaces that declare behaviour, counted over their REQUIRED operations (method signatures and function-typed properties with no `?`, once per signature) — data-shape interfaces and ambient .d.ts declarations are outside the population; JavaScript declares no interfaces and is not applicable. Deterministic, type-level.
`MQAdminExt` declares 104 abstract methods: `addBrokerToContainer`, `addWritePermOfBroker`, `cleanControllerBrokerData`, `cleanExpiredConsumerQueue`, `cleanExpiredConsumerQueueByAddr`, `cleanUnusedTopic`, `cleanUnusedTopicByAddr`, `cloneGroupOffset`, `consumeMessageDirectly`, `consumeMessageDirectly`, `createAndUpdateKvConfig`, `createAndUpdatePlainAccessConfig`, `createAndUpdateSubscriptionGroupConfig`, `createAndUpdateTopicConfig`, `createOrUpdateOrderConf`, `createStaticTopic`, `deleteExpiredCommitLog`, `deleteExpiredCommitLogByAddr`, `deleteKvConfig`, `deletePlainAccessConfig`, `deleteSubscriptionGroup`, `deleteSubscriptionGroup`, `deleteTopic`, `deleteTopicInBroker`, `deleteTopicInBrokerConcurrent`, `deleteTopicInNameServer`, `deleteTopicInNameServer`, `electMaster`, `examineBrokerClusterAclVersionInfo`, `examineBrokerClusterInfo`, `examineConsumeStats`, `examineConsumeStats`, `examineConsumeStats`, `examineConsumeStatsConcurrent`, `examineConsumerConnectionInfo`, `examineConsumerConnectionInfo`, `examineProducerConnectionInfo`, `examineSubscriptionGroupConfig`, `examineTopicConfig`, `examineTopicRouteInfo`, and 64 more. Counted over its ABSTRACT methods, once per signature; `default`, `static` and `private` methods and constants are not counted, because no implementer is forced to write them. Those 104 declarations carry 94 distinct name(s), so part of the width is overloading rather than separate responsibilities — but 94 operations clears the >15 bar on its own, so the row is about responsibilities, not signatures. A wide interface forces every implementer and caller to depend on methods they don't use (the Interface-Segregation 'I' in SOLID). Split it into focused role-interfaces. — tools/src/main/java/org/apache/rocketmq/tools/admin/MQAdminExt.java:72
`TieredMetadataStore` declares 18 abstract methods: `addQueue`, `addTopic`, `deleteFileSegment`, `deleteFileSegment`, `deleteQueue`, `deleteTopic`, `destroy`, `getFileSegment`, `getQueue`, `getTopic`, `iterateFileSegment`, `iterateFileSegment`, `iterateQueue`, `iterateTopic`, `setTopicSequenceNumber`, `updateFileSegment`, `updateQueue`, `updateTopic`. Counted over its ABSTRACT methods, once per signature; `default`, `static` and `private` methods and constants are not counted, because no implementer is forced to write them. Those 18 declarations carry 16 distinct name(s), so part of the width is overloading rather than separate responsibilities — but 16 operations clears the >15 bar on its own, so the row is about responsibilities, not signatures. A wide interface forces every implementer and caller to depend on methods they don't use (the Interface-Segregation 'I' in SOLID). Split it into focused role-interfaces. — tieredstore/src/main/java/org/apache/rocketmq/tieredstore/metadata/TieredMetadataStore.java:26
`MappedFile` declares 48 abstract methods: `appendMessage`, `appendMessage`, `appendMessage`, `appendMessage`, `appendMessage`, `appendMessages`, `cleanSwapedMap`, `commit`, `destroy`, `flush`, `getData`, `getFile`, `getFileChannel`, `getFileFromOffset`, `getFileName`, `getFileSize`, `getFlushedPosition`, `getLastFlushTime`, `getLastModifiedTimestamp`, `getMappedByteBuffer`, `getMappedByteBufferAccessCountSinceLastSwap`, `getReadPosition`, `getRecentSwapMapTime`, `getStoreTimestamp`, `getWrotePosition`, `hold`, `init`, `isAvailable`, `isFirstCreateInQueue`, `isFull`, `isLoaded`, `iterator`, `mlock`, `moveToParent`, `munlock`, `release`, `renameTo`, `renameToDelete`, `selectMappedBuffer`, `selectMappedBuffer`, and 8 more. Counted over its ABSTRACT methods, once per signature; `default`, `static` and `private` methods and constants are not counted, because no implementer is forced to write them. Those 48 declarations carry 43 distinct name(s), so part of the width is overloading rather than separate responsibilities — but 43 operations clears the >15 bar on its own, so the row is about responsibilities, not signatures. A wide interface forces every implementer and caller to depend on methods they don't use (the Interface-Segregation 'I' in SOLID). Split it into focused role-interfaces. — store/src/main/java/org/apache/rocketmq/store/logfile/MappedFile.java:35
`ConsumeQueueInterface` declares 25 abstract methods: `assignQueueOffset`, `correctMinOffset`, `estimateMessageCount`, `get`, `getCQType`, `getCqUnitAndStoreTime`, `getEarliestUnit`, `getEarliestUnitAndStoreTime`, `getLastOffset`, `getLatestUnit`, `getMaxOffsetInQueue`, `getMaxPhysicOffset`, `getMessageTotalInQueue`, `getMinLogicOffset`, `getMinOffsetInQueue`, `getOffsetInQueueByTime`, `getOffsetInQueueByTime`, `getQueueId`, `getTopic`, `getTotalSize`, `getUnitSize`, `increaseQueueOffset`, `iterateFrom`, `iterateFrom`, `putMessagePositionInfoWrapper`. Counted over its ABSTRACT methods, once per signature; `default`, `static` and `private` methods and constants are not counted, because no implementer is forced to write them. Those 25 declarations carry 23 distinct name(s), so part of the width is overloading rather than separate responsibilities — but 23 operations clears the >15 bar on its own, so the row is about responsibilities, not signatures. A wide interface forces every implementer and caller to depend on methods they don't use (the Interface-Segregation 'I' in SOLID). Split it into focused role-interfaces. — store/src/main/java/org/apache/rocketmq/store/queue/ConsumeQueueInterface.java:28
`ConsumeQueueStoreInterface` declares 39 abstract methods: `assignQueueOffset`, `checkSelf`, `cleanExpired`, `deleteExpiredFile`, `destroy`, `destroy`, `findConsumeQueueMap`, `findOrCreateConsumeQueue`, `flush`, `get`, `getConsumeQueueTable`, `getLmqQueueOffset`, `getMaxOffset`, `getMaxOffsetInQueue`, `getMaxPhyOffsetInConsumeQueue`, `getMaxPhyOffsetInConsumeQueue`, `getMinOffsetInQueue`, `getOffsetInQueueByTime`, `getStoreTime`, `getTopicQueueTable`, `getTotalSize`, `increaseLmqOffset`, `increaseQueueOffset`, `isFirstFileAvailable`, `isFirstFileExist`, `load`, `loadAfterDestroy`, `putMessagePositionInfoWrapper`, `putMessagePositionInfoWrapper`, `rangeQuery`, `recover`, `recoverConcurrently`, `recoverOffsetTable`, `removeTopicQueueTable`, `rollNextFile`, `setTopicQueueTable`, `shutdown`, `start`, `truncateDirty`. Counted over its ABSTRACT methods, once per signature; `default`, `static` and `private` methods and constants are not counted, because no implementer is forced to write them. Those 39 declarations carry 36 distinct name(s), so part of the width is overloading rather than separate responsibilities — but 36 operations clears the >15 bar on its own, so the row is about responsibilities, not signatures. A wide interface forces every implementer and caller to depend on methods they don't use (the Interface-Segregation 'I' in SOLID). Split it into focused role-interfaces. — store/src/main/java/org/apache/rocketmq/store/queue/ConsumeQueueStoreInterface.java:27
`MessageStore` declares 115 abstract methods: `addDispatcher`, `appendToCommitLog`, `assignOffset`, `calcDeltaChecksum`, `checkInDiskByConsumeOffset`, `checkInMemByConsumeOffset`, `checkInStoreByConsumeOffset`, `checkMessageAndReturnSize`, `cleanExpiredConsumerQueue`, `cleanUnusedTopic`, `deleteTopics`, `destroy`, `dispatchBehindBytes`, `estimateMessageCount`, `executeDeleteFilesManually`, `findConsumeQueue`, `finishCommitLogDispatch`, `flush`, `getAliveReplicaNumInGroup`, `getAllocateMappedFileService`, `getBrokerInitMaxOffset`, `getBrokerStatsManager`, `getBulkCommitLogData`, `getCommitLog`, `getCommitLogData`, `getCommitLogOffsetInQueue`, `getConfirmOffset`, `getConsumeQueue`, `getData`, `getDispatcherList`, `getEarliestMessageTime`, `getEarliestMessageTime`, `getEarliestMessageTimeAsync`, `getFlushedWhere`, `getHARuntimeInfo`, `getHaService`, `getLastFileFromOffset`, `getLastMappedFile`, `getMasterFlushedOffset`, `getMasterStoreInProcess`, and 75 more. Counted over its ABSTRACT methods, once per signature; `default`, `static` and `private` methods and constants are not counted, because no implementer is forced to write them. Those 115 declarations carry 108 distinct name(s), so part of the width is overloading rather than separate responsibilities — but 108 operations clears the >15 bar on its own, so the row is about responsibilities, not signatures. A wide interface forces every implementer and caller to depend on methods they don't use (the Interface-Segregation 'I' in SOLID). Split it into focused role-interfaces. — store/src/main/java/org/apache/rocketmq/store/MessageStore.java:52
`MessagingProcessor` declares 33 abstract methods: `ackMessage`, `addReceiptHandle`, `addTransactionSubscription`, `batchAckMessage`, `changeInvisibleTime`, `doChannelCloseEvent`, `endTransaction`, `findConsumerChannel`, `findProducerChannel`, `forwardMessageToDeadLetterQueue`, `getConsumerGroupInfo`, `getMaxOffset`, `getMetadataService`, `getMinOffset`, `getProxyRelayService`, `getSubscriptionGroupConfig`, `getTopicRouteDataForProxy`, `lockBatchMQ`, `popMessage`, `pullMessage`, `queryConsumerOffset`, `registerConsumer`, `registerConsumerListener`, `registerProducer`, `registerProducerListener`, `removeReceiptHandle`, `request`, `requestOneway`, `sendMessage`, `unRegisterConsumer`, `unRegisterProducer`, `unlockBatchMQ`, `updateConsumerOffset`. Counted over its ABSTRACT methods, once per signature; `default`, `static` and `private` methods and constants are not counted, because no implementer is forced to write them. A wide interface forces every implementer and caller to depend on methods they don't use (the Interface-Segregation 'I' in SOLID). Split it into focused role-interfaces. — proxy/src/main/java/org/apache/rocketmq/proxy/processor/MessagingProcessor.java:50
`MessageService` declares 16 abstract methods: `ackMessage`, `batchAckMessage`, `changeInvisibleTime`, `endTransactionOneway`, `getMaxOffset`, `getMinOffset`, `lockBatchMQ`, `popMessage`, `pullMessage`, `queryConsumerOffset`, `request`, `requestOneway`, `sendMessage`, `sendMessageBack`, `unlockBatchMQ`, `updateConsumerOffset`. Counted over its ABSTRACT methods, once per signature; `default`, `static` and `private` methods and constants are not counted, because no implementer is forced to write them. A wide interface forces every implementer and caller to depend on methods they don't use (the Interface-Segregation 'I' in SOLID). Split it into focused role-interfaces. — proxy/src/main/java/org/apache/rocketmq/proxy/service/message/MessageService.java:46
`Controller` declares 16 abstract methods: `alterSyncStateSet`, `applyBrokerId`, `cleanBrokerData`, `electMaster`, `getControllerMetadata`, `getNextBrokerId`, `getRemotingServer`, `getReplicaInfo`, `getSyncStateData`, `isLeaderState`, `registerBroker`, `registerBrokerLifecycleListener`, `shutdown`, `startScheduling`, `startup`, `stopScheduling`. Counted over its ABSTRACT methods, once per signature; `default`, `static` and `private` methods and constants are not counted, because no implementer is forced to write them. A wide interface forces every implementer and caller to depend on methods they don't use (the Interface-Segregation 'I' in SOLID). Split it into focused role-interfaces. — controller/src/main/java/org/apache/rocketmq/controller/Controller.java:38
`LitePullConsumer` declares 30 abstract methods: `assign`, `assignment`, `commit`, `commit`, `commit`, `commitSync`, `commitSync`, `committed`, `fetchMessageQueues`, `isAutoCommit`, `isRunning`, `offsetForTimestamp`, `pause`, `poll`, `poll`, `registerTopicMessageQueueChangeListener`, `resume`, `seek`, `seekToBegin`, `seekToEnd`, `setAutoCommit`, `setSubExpressionForAssign`, `shutdown`, `start`, `subscribe`, `subscribe`, `subscribe`, `subscribe`, `unsubscribe`, `updateNameServerAddress`. Counted over its ABSTRACT methods, once per signature; `default`, `static` and `private` methods and constants are not counted, because no implementer is forced to write them. Those 30 declarations carry 23 distinct name(s), so part of the width is overloading rather than separate responsibilities — but 23 operations clears the >15 bar on its own, so the row is about responsibilities, not signatures. A wide interface forces every implementer and caller to depend on methods they don't use (the Interface-Segregation 'I' in SOLID). Split it into focused role-interfaces. — client/src/main/java/org/apache/rocketmq/client/consumer/LitePullConsumer.java:28
`MQPullConsumer` declares 18 abstract methods under just 9 distinct name(s): `fetchConsumeOffset`, `fetchMessageQueuesInBalance`, `pull`, `pull`, `pull`, `pull`, `pull`, `pull`, `pull`, `pull`, `pull`, `pullBlockIfNotFound`, `pullBlockIfNotFound`, `registerMessageQueueListener`, `sendMessageBack`, `shutdown`, `start`, `updateConsumeOffset`. Counted over its ABSTRACT methods, once per signature; `default`, `static` and `private` methods and constants are not counted, because no implementer is forced to write them. That is an OVERLOAD SET, not 18 separate responsibilities: a caller binds to 9 operation(s) and uses the overload it selected, so the Interface-Segregation harm does NOT apply on the caller's side and splitting this into role-interfaces would scatter one operation without relieving anything. The burden that does remain is the IMPLEMENTER's — all 18 signatures must be written and kept in step. Reduce it by collapsing overloads (optional or default parameters, or an options object) rather than by segregating the interface. — client/src/main/java/org/apache/rocketmq/client/consumer/MQPullConsumer.java:29
`MQProducer` declares 33 abstract methods under just 7 distinct name(s): `fetchPublishMessageQueues`, `request`, `request`, `request`, `request`, `request`, `request`, `send`, `send`, `send`, `send`, `send`, `send`, `send`, `send`, `send`, `send`, `send`, `send`, `send`, `send`, `send`, `send`, `send`, `send`, `send`, `send`, `sendMessageInTransaction`, `sendOneway`, `sendOneway`, `sendOneway`, `shutdown`, `start`. Counted over its ABSTRACT methods, once per signature; `default`, `static` and `private` methods and constants are not counted, because no implementer is forced to write them. That is an OVERLOAD SET, not 33 separate responsibilities: a caller binds to 7 operation(s) and uses the overload it selected, so the Interface-Segregation harm does NOT apply on the caller's side and splitting this into role-interfaces would scatter one operation without relieving anything. The burden that does remain is the IMPLEMENTER's — all 33 signatures must be written and kept in step. Reduce it by collapsing overloads (optional or default parameters, or an options object) rather than by segregating the interface. — client/src/main/java/org/apache/rocketmq/client/producer/MQProducer.java:29
`MqClientAdmin` declares 19 abstract methods: `consumeMessageDirectly`, `deleteKvConfig`, `deleteSubscriptionGroup`, `deleteTopicInBroker`, `deleteTopicInNameserver`, `getBrokerClusterInfo`, `getConsumeStats`, `getConsumerConnectionList`, `getConsumerRunningInfo`, `getTopicStatsInfo`, `invokeBrokerToResetOffset`, `queryConsumeTimeSpan`, `queryMessage`, `querySubscriptionByConsumer`, `queryTopicConsumeByWho`, `queryTopicsByConsumer`, `updateOrCreateSubscriptionGroup`, `updateOrCreateTopic`, `viewMessage`. Counted over its ABSTRACT methods, once per signature; `default`, `static` and `private` methods and constants are not counted, because no implementer is forced to write them. A wide interface forces every implementer and caller to depend on methods they don't use (the Interface-Segregation 'I' in SOLID). Split it into focused role-interfaces. — client/src/main/java/org/apache/rocketmq/client/MqClientAdmin.java:54
What to do
Split fat interfaces into focused role-interfaces so clients depend only on what they use.
Where the width is an overload set rather than separate responsibilities, collapse the overloads instead — segregating those relieves no caller.
Other · Code Health — Unfinished work detected by code SHAPE, not keywords, in this repository's Java: methods that only throw a "not implemented" exception, methods that take inputs and return a constant or do nothing, dead `if (false)` branches, and skeleton classes most of whose methods are holes.
Method: Roslyn syntax scan: incompleteness by code shape (constant-returning methods, async-never-await, #if false branches, guards that return what the code already falls through to, tests an earlier guard already decided, comparisons against NaN, skeleton types), not keyword-gated. Deterministic, code-shape heuristic.
`main` takes parameters but its body is empty — it accepts inputs and does nothing. Either implement it or remove it. — common/src/main/java/org/apache/rocketmq/common/sysflag/SubscriptionSysFlag.java:45
`doConfigure` takes parameters but its body is empty — it accepts inputs and does nothing. Either implement it or remove it. — container/src/main/java/org/apache/rocketmq/container/logback/BrokerLogbackConfigurator.java:39
`SimpleChannelHandlerContext` has 36 unfinished members out of 41 declared methods (whether or not each carries a body) — a scaffolded class that was never implemented. — proxy/src/main/java/org/apache/rocketmq/proxy/service/channel/SimpleChannelHandlerContext.java:34
`executor` throws an exception whose message says it isn't finished — a not-implemented stub wearing an ordinary exception. Implement it or remove it. — proxy/src/main/java/org/apache/rocketmq/proxy/service/channel/SimpleChannelHandlerContext.java:48
`name` throws an exception whose message says it isn't finished — a not-implemented stub wearing an ordinary exception. Implement it or remove it. — proxy/src/main/java/org/apache/rocketmq/proxy/service/channel/SimpleChannelHandlerContext.java:53
`handler` throws an exception whose message says it isn't finished — a not-implemented stub wearing an ordinary exception. Implement it or remove it. — proxy/src/main/java/org/apache/rocketmq/proxy/service/channel/SimpleChannelHandlerContext.java:58
`fireChannelRegistered` throws an exception whose message says it isn't finished — a not-implemented stub wearing an ordinary exception. Implement it or remove it. — proxy/src/main/java/org/apache/rocketmq/proxy/service/channel/SimpleChannelHandlerContext.java:68
`fireChannelUnregistered` throws an exception whose message says it isn't finished — a not-implemented stub wearing an ordinary exception. Implement it or remove it. — proxy/src/main/java/org/apache/rocketmq/proxy/service/channel/SimpleChannelHandlerContext.java:73
`fireChannelActive` throws an exception whose message says it isn't finished — a not-implemented stub wearing an ordinary exception. Implement it or remove it. — proxy/src/main/java/org/apache/rocketmq/proxy/service/channel/SimpleChannelHandlerContext.java:78
`fireChannelInactive` throws an exception whose message says it isn't finished — a not-implemented stub wearing an ordinary exception. Implement it or remove it. — proxy/src/main/java/org/apache/rocketmq/proxy/service/channel/SimpleChannelHandlerContext.java:83
`fireExceptionCaught` throws an exception whose message says it isn't finished — a not-implemented stub wearing an ordinary exception. Implement it or remove it. — proxy/src/main/java/org/apache/rocketmq/proxy/service/channel/SimpleChannelHandlerContext.java:88
`fireUserEventTriggered` throws an exception whose message says it isn't finished — a not-implemented stub wearing an ordinary exception. Implement it or remove it. — proxy/src/main/java/org/apache/rocketmq/proxy/service/channel/SimpleChannelHandlerContext.java:93
`fireChannelRead` throws an exception whose message says it isn't finished — a not-implemented stub wearing an ordinary exception. Implement it or remove it. — proxy/src/main/java/org/apache/rocketmq/proxy/service/channel/SimpleChannelHandlerContext.java:98
`fireChannelReadComplete` throws an exception whose message says it isn't finished — a not-implemented stub wearing an ordinary exception. Implement it or remove it. — proxy/src/main/java/org/apache/rocketmq/proxy/service/channel/SimpleChannelHandlerContext.java:103
`fireChannelWritabilityChanged` throws an exception whose message says it isn't finished — a not-implemented stub wearing an ordinary exception. Implement it or remove it. — proxy/src/main/java/org/apache/rocketmq/proxy/service/channel/SimpleChannelHandlerContext.java:108
`bind` throws an exception whose message says it isn't finished — a not-implemented stub wearing an ordinary exception. Implement it or remove it. (×2) — proxy/src/main/java/org/apache/rocketmq/proxy/service/channel/SimpleChannelHandlerContext.java:113, proxy/src/main/java/org/apache/rocketmq/proxy/service/channel/SimpleChannelHandlerContext.java:143
`connect` throws an exception whose message says it isn't finished — a not-implemented stub wearing an ordinary exception. Implement it or remove it. (×4) — proxy/src/main/java/org/apache/rocketmq/proxy/service/channel/SimpleChannelHandlerContext.java:118, proxy/src/main/java/org/apache/rocketmq/proxy/service/channel/SimpleChannelHandlerContext.java:123, proxy/src/main/java/org/apache/rocketmq/proxy/service/channel/SimpleChannelHandlerContext.java:148, …
`disconnect` throws an exception whose message says it isn't finished — a not-implemented stub wearing an ordinary exception. Implement it or remove it. (×2) — proxy/src/main/java/org/apache/rocketmq/proxy/service/channel/SimpleChannelHandlerContext.java:128, proxy/src/main/java/org/apache/rocketmq/proxy/service/channel/SimpleChannelHandlerContext.java:158
`close` throws an exception whose message says it isn't finished — a not-implemented stub wearing an ordinary exception. Implement it or remove it. (×2) — proxy/src/main/java/org/apache/rocketmq/proxy/service/channel/SimpleChannelHandlerContext.java:133, proxy/src/main/java/org/apache/rocketmq/proxy/service/channel/SimpleChannelHandlerContext.java:163
`deregister` throws an exception whose message says it isn't finished — a not-implemented stub wearing an ordinary exception. Implement it or remove it. (×2) — proxy/src/main/java/org/apache/rocketmq/proxy/service/channel/SimpleChannelHandlerContext.java:138, proxy/src/main/java/org/apache/rocketmq/proxy/service/channel/SimpleChannelHandlerContext.java:168
`read` throws an exception whose message says it isn't finished — a not-implemented stub wearing an ordinary exception. Implement it or remove it. — proxy/src/main/java/org/apache/rocketmq/proxy/service/channel/SimpleChannelHandlerContext.java:173
`write` throws an exception whose message says it isn't finished — a not-implemented stub wearing an ordinary exception. Implement it or remove it. (×2) — proxy/src/main/java/org/apache/rocketmq/proxy/service/channel/SimpleChannelHandlerContext.java:178, proxy/src/main/java/org/apache/rocketmq/proxy/service/channel/SimpleChannelHandlerContext.java:183
`flush` throws an exception whose message says it isn't finished — a not-implemented stub wearing an ordinary exception. Implement it or remove it. — proxy/src/main/java/org/apache/rocketmq/proxy/service/channel/SimpleChannelHandlerContext.java:188
`pipeline` throws an exception whose message says it isn't finished — a not-implemented stub wearing an ordinary exception. Implement it or remove it. — proxy/src/main/java/org/apache/rocketmq/proxy/service/channel/SimpleChannelHandlerContext.java:203
`alloc` throws an exception whose message says it isn't finished — a not-implemented stub wearing an ordinary exception. Implement it or remove it. — proxy/src/main/java/org/apache/rocketmq/proxy/service/channel/SimpleChannelHandlerContext.java:208
`newPromise` throws an exception whose message says it isn't finished — a not-implemented stub wearing an ordinary exception. Implement it or remove it. — proxy/src/main/java/org/apache/rocketmq/proxy/service/channel/SimpleChannelHandlerContext.java:213
`newProgressivePromise` throws an exception whose message says it isn't finished — a not-implemented stub wearing an ordinary exception. Implement it or remove it. — proxy/src/main/java/org/apache/rocketmq/proxy/service/channel/SimpleChannelHandlerContext.java:218
`newSucceededFuture` throws an exception whose message says it isn't finished — a not-implemented stub wearing an ordinary exception. Implement it or remove it. — proxy/src/main/java/org/apache/rocketmq/proxy/service/channel/SimpleChannelHandlerContext.java:223
`newFailedFuture` throws an exception whose message says it isn't finished — a not-implemented stub wearing an ordinary exception. Implement it or remove it. — proxy/src/main/java/org/apache/rocketmq/proxy/service/channel/SimpleChannelHandlerContext.java:228
`voidPromise` throws an exception whose message says it isn't finished — a not-implemented stub wearing an ordinary exception. Implement it or remove it. — proxy/src/main/java/org/apache/rocketmq/proxy/service/channel/SimpleChannelHandlerContext.java:233
`attr` throws an exception whose message says it isn't finished — a not-implemented stub wearing an ordinary exception. Implement it or remove it. — proxy/src/main/java/org/apache/rocketmq/proxy/service/channel/SimpleChannelHandlerContext.java:238
`reportFailedMsgs` takes parameters but its body is empty — it accepts inputs and does nothing. Either implement it or remove it. — tools/src/main/java/org/apache/rocketmq/tools/monitor/MonitorService.java:320
What to do
Finish or delete the unfinished stubs (functions that throw "not implemented", or whose body is empty or a bare constant) — they are dead surface that looks live.
Clear the softer debt: re-enable or delete @Disabled/@Ignore tests, decide whether each empty method or UnsupportedOperationException is deliberate (and say so in a comment), and replace @SuppressWarnings("all") with targeted, justified suppressions.
Maturity · Maturity — Whether the repo and its projects have a README, and whether it's substantive and current.
Method: Filesystem scan: README presence, word count, and headings for depth; git history for staleness. Exhaustive across root and project dirs, deterministic.
What to do
Explain in the README how to run the tests. Add a section called Testing to the README in the repository's top folder, saying how to run the test suite.
Add an 'Architecture' / 'How it works' section to the root README — the high-level shape.
Add a README to the 15 of 17 project(s) that lack one — worth up to 1.8 pts.
Maturity · Maturity — Whether key decisions (ADRs) and the high-level shape (C4/diagrams) are written down.
Method: Filesystem scan: ADR folder/naming conventions or content, plus Mermaid/PlantUML/C4/architecture.md discovery. Exhaustive, deterministic.
No Architecture Decision Records found — no conventional ADR directory, no numbered `NNNN-title` documents in any markup this check reads, and nothing ADR-shaped by content. Design rationale recorded elsewhere (a design-notes tree, a mailing list, pull-request discussion) is not visible to this check and is not re-findable per decision, so a future maintainer cannot ask why one choice was made and get an answer.
What to do
Record your significant design decisions. Write one short document per decision, giving its date, the situation, the decision and its consequences, and keep them together with your other design documents. A docs/adr folder with each file named by number and title is the easiest place to find them.
Maturity · Maturity — Whether the README actually describes the code that exists (LLM-judged, advisory).
Method: Judged by language model at low temperature: README accuracy versus actual projects, within a disclosed tolerance. Advisory, not a measured number.
Apache RocketMQ operator CRDs installed in README but no CRD project exists — searched for: `CRDs`. Each was matched case- and separator-insensitively against file and directory NAMES anywhere in the tree, and against the CONTENTS of manifest and configuration files (package.json and other *.json, *.csproj, *.props, *.sln/*.slnx, *.yml, *.toml, *.config, tool configs such as eslint.config.js, Dockerfile); the README's own prose never counts, so a claim is never refuted by merely being made. Nothing outside that search was read — a footprint living only in a submodule, in a file type not listed here, or under a name none of those terms matches is not seen, and this row is then wrong. — README.md:1
README advertises Docker containerisation, but no Dockerfile/compose file exists — searched for: `dockerfile`, `docker-compose`, `compose.yaml`, `compose.yml`. Each was matched case- and separator-insensitively against file and directory NAMES anywhere in the tree, and against the CONTENTS of manifest and configuration files (package.json and other *.json, *.csproj, *.props, *.sln/*.slnx, *.yml, *.toml, *.config, tool configs such as eslint.config.js, Dockerfile); the README's own prose never counts, so a claim is never refuted by merely being made. Nothing outside that search was read — a footprint living only in a submodule, in a file type not listed here, or under a name none of those terms matches is not seen, and this row is then wrong. — README.md:30
docs/cn/best_practice.md links to `[](`, but `docs/cn/[](` does not exist. Checked without a model against the repository: its files and folders, the scripts and dependencies of every package.json, the projects, namespaces, package references and target frameworks of the .NET build, the SDK and Node pins, and the identifiers of every file that is not a document; the documents' own text never counts. A footprint generated at build time, read only by a platform, or living outside this repository is not seen, and this row is then wrong. — docs/cn/best_practice.md:373
docs/cn/controller/persistent_unique_broker_id.md names `.broker.meta.temp`, but no file or folder `.broker.meta.temp` exists. Checked without a model against the repository: its files and folders, the scripts and dependencies of every package.json, the projects, namespaces, package references and target frameworks of the .NET build, the SDK and Node pins, and the identifiers of every file that is not a document; the documents' own text never counts. A footprint generated at build time, read only by a platform, or living outside this repository is not seen, and this row is then wrong. — docs/cn/controller/persistent_unique_broker_id.md:32
docs/cn/controller/persistent_unique_broker_id.md names `.broker.meta`, but no file or folder `.broker.meta` exists. Checked without a model against the repository: its files and folders, the scripts and dependencies of every package.json, the projects, namespaces, package references and target frameworks of the .NET build, the SDK and Node pins, and the identifiers of every file that is not a document; the documents' own text never counts. A footprint generated at build time, read only by a platform, or living outside this repository is not seen, and this row is then wrong. — docs/cn/controller/persistent_unique_broker_id.md:48
docs/en/controller/quick_start.md names `fast-try-namesrv-plugin.sh`, but no file or folder `fast-try-namesrv-plugin.sh` exists. Checked without a model against the repository: its files and folders, the scripts and dependencies of every package.json, the projects, namespaces, package references and target frameworks of the .NET build, the SDK and Node pins, and the identifiers of every file that is not a document; the documents' own text never counts. A footprint generated at build time, read only by a platform, or living outside this repository is not seen, and this row is then wrong. — docs/en/controller/quick_start.md:148
docs/en/controller/quick_start.md names `fast-try-independent-deployment.sh`, but no file or folder `fast-try-independent-deployment.sh` exists. Checked without a model against the repository: its files and folders, the scripts and dependencies of every package.json, the projects, namespaces, package references and target frameworks of the .NET build, the SDK and Node pins, and the identifiers of every file that is not a document; the documents' own text never counts. A footprint generated at build time, read only by a platform, or living outside this repository is not seen, and this row is then wrong. — docs/en/controller/quick_start.md:193
What to do
Reconcile the README with reality: Apache RocketMQ operator CRDs installed in README but no CRD project exists; README advertises Docker containerisation, but no Dockerfile/compose file exists; docs/cn/best_practice.md links to `[](`, but `docs/cn/[](` does not exist; docs/cn/controller/persistent_unique_broker_id.md names `.broker.meta.temp`, but no file or folder `.broker.meta.temp` exists; docs/cn/controller/persistent_unique_broker_id.md names `.broker.meta`, but no file or folder `.broker.meta` exists.
Only 13/14 runnable modules use logging (modules with no entry point or server are excluded — they are libraries a runnable module hosts). Silent: `.`.
What to do
Extend structured logging to the remaining runnable modules so everything you run is diagnosable in production.
Readiness · Readiness — Whether SAST, secret/dependency scanning and performance benchmarking are wired in (presence, not runtime).
Method: Filesystem scan: SAST configuration, dependency-update automation, secret scanning, and a benchmark harness or benchmark step — in this repository's own ecosystem. Exhaustive, deterministic.
What to do
Enable Dependabot/Renovate or a dependency-review gate.
Add gitleaks/trufflehog in CI to block PRs that introduce committed secrets.
Readiness · Readiness — Whether releases are automated and safely reversible (probes, rolling updates, approval gates) — from manifests/pipeline files, not the live environment.
Method: Filesystem scan: deployment manifests/IaC (K8s YAML, Helm, Terraform) for rolling updates, probes, approval gates, migration hooks. Exhaustive, deterministic.
What to do
Nothing pauses a release for a human: publish as a draft release (or gate the release job on a protected tag/manual dispatch) so a bad build can be stopped before users can download it.
Readiness · Readiness — Whether releases are traceable — a maintained changelog and explicit version stamping.
Method: Filesystem scan: changelog file presence and version tags in csproj or git tags. Exhaustive, deterministic.
No CHANGELOG/HISTORY/RELEASES file — what shipped when isn't easy to reconstruct for support or audit. (Versioning/tagging makes releases traceable, but a changelog records the what.)
What to do
Keep a changelog (e.g. Keep-a-Changelog) recording what shipped in each release.
Readiness · Performance — Whether the code protects its performance with benchmarks — a benchmark suite, allocation/memory measurement, and (ideally) a CI gate. Presence is credited as a bonus, never a deduction.
Method: Repo + source scan: BenchmarkDotNet referenced (csproj/source), [Benchmark]/[MemoryDiagnoser] attribute counts, and a benchmark step in CI; off .NET, the same ladder over Go testing.B, Rust criterion/#[bench]/divan, JMH/kotlinx-benchmark, pytest-benchmark/asv/pyperf, tinybench/mitata/vitest bench/benchmark.js and Swift package-benchmark — scored as a bonus ladder (absence is neutral, never a deduction). Deterministic, presence detection.
A JMH/Jetpack Benchmark suite exists but nothing turns on its allocation measurement — allocations (the main way hot code pressures a garbage collector or allocator) aren't being measured. — namesrv/src/test/java/org/apache/rocketmq/namesrv/routeinfo/RegisterBrokerBenchmark.java
What to do
Run JMH with the GC profiler (`-prof gc`, or addProfiler(GCProfiler.class)) so allocation rate regressions are visible, not just time.
Readiness · Performance — Whether the code is written to minimise allocations so it doesn't pressure its host's memory manager — buffer/slice views over copies, object pooling, stack or value-type allocation, and buffer writers. Reward-only: credited where present, never penalised where a simpler style is fine.
Method: Production-source scan: density (per 1k LoC) of allocation-aware APIs — in .NET Span/Memory, ArrayPool/ObjectPool, stackalloc, ValueTask, value-type structs, IBufferWriter, string.Create, SkipLocalsInit; off .NET, with comments and strings blanked, Go's sync.Pool, preallocated slices/maps, Grow, strconv.Append* and buf[:0] reuse; the JVM's NIO buffer views, MemorySegment, primitive collections, pools and literal presizes (plus Kotlin primitive arrays and value classes, Scala AnyVal and @specialized); Swift's reserveCapacity, ContiguousArray, withUnsafe* access and ~Copyable. Activated off .NET on the same floor (400 lines, and benchmarks or 8 uses); Rust and garbage-collected scripting languages are not applicable. Reward-only. Deterministic, syntax/text detection.
What to do
Raise allocation-aware density on the hot paths — currently 788 use(s) across 204,835 production line(s) (~3.8/1k). More of the idioms below on the allocation-heavy paths climbs this toward 10.
Java: on hot paths, work through buffer views (ByteBuffer/LongBuffer slices, MemorySegment) instead of copies, avoid boxing with primitive collections (fastutil, Eclipse Collections, HPPC, Trove), presize collections and StringBuilders, and pool expensive buffers (Netty's pooled allocator, commons-pool).
Other · Code Health — Whether the code avoids sync-over-async (deadlock-prone blocking on tasks) and async void.
Method: Roslyn syntax scan: async methods scanned for .Wait()/.GetAwaiter().GetResult() and async-void outside event handlers. Deterministic, hard fact per invocation.
Other · Code Health — Whether any branch is dead by construction — a switch arm whose label can never equal a case-normalised subject, or an `else if` whose predicate the arm above has already swallowed.
Method: Roslyn syntax + semantics: switch labels compared against the subject's own case normaliser, and if/else-if chains checked for a literal an earlier arm's containment test already swallows. Deterministic, provable per finding. Advisory.
Do you agree with this assessment?
X13 · Undrained process stream10.0 / 10Exemplary○ Nothing flagged
Other · Code Health — Whether a child process that has BOTH standard streams redirected drains both — reading one to the end while the other is never read deadlocks once the child fills the unread pipe.
Method: Roslyn syntax + semantics: ProcessStartInfo launches with both streams redirected, checked for a drain of each stream across the enclosing type. On a repository with no .NET source it reads JavaScript/TypeScript off the engine’s own token stream (test, vendored and minified paths not) with the same rule: a `spawn` imported from `child_process` whose stdout and stderr are both pipes (no options, no `stdio`, or `stdio` of `'pipe'`), bound to a local that never leaves its scope, where exactly one of the two streams is read, the other never, and the child’s `close`/`exit` (or the read stream’s end) is awaited; a shell redirect in the call’s arguments or a `kill` of the child suppresses it. The same rule reads Python’s `subprocess.Popen`, Dart’s `Process.start`, Ruby’s `Open3.popen3`, and Scala’s JDK process starts (`new ProcessBuilder(…).start()` with no `redirectErrorStream`/`redirectError`/`redirectOutput`/`inheritIO`, `Runtime.getRuntime.exec`) where one of `getInputStream`/`getErrorStream` is read and the other never while `waitFor()` is called or the read stream is read to its end. Deterministic, provable per finding. Advisory.
Other · Security — Whether a hand-rolled public/private IP check can be walked past — a method that unwraps IPv4-mapped IPv6 but returns the opposite verdict for the same host written as IPv4-compatible, 6to4 or NAT64.
Method: Roslyn syntax + semantics: methods that unwrap IPv4-mapped IPv6 and hand-roll IPv4 range carve-outs, checked for whether the IPv6 branch also accounts for the IPv4-compatible, 6to4 and NAT64 embeddings. Deterministic, provable per finding. Advisory.
Do you agree with this assessment?
X15 · Unvalidated length from an untrusted reader2.7 / 10Weak✓ Tool-verified
Other · Security — Whether a length read out of the stream being parsed is bounded before it is allocated or read — an unchecked count taken from the input lets the input choose the allocation.
Method: Roslyn syntax + semantics: integer lengths read from a BinaryReader and spent on a bulk read or an array allocation, checked for any comparison or bounding call on the value anywhere in the method. Deterministic, provable per finding. Advisory.
`bodyLen` is read from the bytes being parsed at line 505 (`getInt`), then used to size a `new byte[]` at line 508 — and nowhere in its scope is `bodyLen` bounded from above — compared to a limit, clamped, or checked against the input that remains (a zero or sign test, or the loop that counts up to it, bounds nothing). Whoever wrote those bytes therefore chooses the allocation directly: a 32-bit length asks for up to 2 GiB before a single byte of the payload is known to exist, which either exhausts the heap with an `OutOfMemoryError` or, negative, throws `NegativeArraySizeException` out of a parser whose failure path was written for malformed input, not for hostile input. Bound `bodyLen` against the bytes actually remaining and a maximum the format allows before allocating. — common/src/main/java/org/apache/rocketmq/common/message/MessageDecoder.java:508
`bodyLen` is read from the bytes being parsed at line 718 (`getInt`), then used to size a `new byte[]` at line 719 — and nowhere in its scope is `bodyLen` bounded from above — compared to a limit, clamped, or checked against the input that remains (a zero or sign test, or the loop that counts up to it, bounds nothing). Whoever wrote those bytes therefore chooses the allocation directly: a 32-bit length asks for up to 2 GiB before a single byte of the payload is known to exist, which either exhausts the heap with an `OutOfMemoryError` or, negative, throws `NegativeArraySizeException` out of a parser whose failure path was written for malformed input, not for hostile input. Bound `bodyLen` against the bytes actually remaining and a maximum the format allows before allocating. — common/src/main/java/org/apache/rocketmq/common/message/MessageDecoder.java:719
`size` is read from the bytes being parsed at line 157 (`getInt`), then used to size a `ByteBuffer.allocate` at line 158 — and nowhere in its scope is `size` bounded from above — compared to a limit, clamped, or checked against the input that remains (a zero or sign test, or the loop that counts up to it, bounds nothing). Whoever wrote those bytes therefore chooses the allocation directly: a 32-bit length asks for up to 2 GiB before a single byte of the payload is known to exist, which either exhausts the heap with an `OutOfMemoryError` or, negative, throws `NegativeArraySizeException` out of a parser whose failure path was written for malformed input, not for hostile input. Bound `size` against the bytes actually remaining and a maximum the format allows before allocating. — remoting/src/main/java/org/apache/rocketmq/remoting/common/RemotingHelper.java:158
`topicLen` is read from the bytes being parsed at line 237 (`getInt`), then used to size a `new byte[]` at line 238 — and nowhere in its scope is `topicLen` bounded from above — compared to a limit, clamped, or checked against the input that remains (a zero or sign test, or the loop that counts up to it, bounds nothing). Whoever wrote those bytes therefore chooses the allocation directly: a 32-bit length asks for up to 2 GiB before a single byte of the payload is known to exist, which either exhausts the heap with an `OutOfMemoryError` or, negative, throws `NegativeArraySizeException` out of a parser whose failure path was written for malformed input, not for hostile input. Bound `topicLen` against the bytes actually remaining and a maximum the format allows before allocating. — store/src/main/java/org/apache/rocketmq/store/queue/RocksDBConsumeQueueOffsetTable.java:238
What to do
Each finding names the read that takes the length from the input and the site that spends it, and states that the value is never compared in between. Confirm from the two, then bound the length against the remaining stream before using it.
Other · Code Health — Whether a loop that shortens a string until it fits a length budget has a floor — one with none grinds the value down to the empty string, or past it into a negative-length `Substring`.
Method: Roslyn syntax + semantics: while/do loops whose body's only effect on a string is to drop its last character, checked for whether anything — a direct comparison on the length, a body guard, a break — bounds that length below. On a repository with no .NET source it reads JavaScript/TypeScript off the engine’s own token stream (test, vendored and minified paths not) with the same rule: a `while`/`do` loop whose body’s one assignment to a value is `x = x.slice(0, -1)` or `x = x.slice|substring|substr(0, x.length - 1)`, driven by a condition that reads `x.length` only as a term of a larger expression — never compared directly, never tested for truthiness, and with no other read of `x` — and whose body has no `break`, `return`, `throw` or `if` naming `x`. Deterministic, provable per finding. Advisory.
Do you agree with this assessment?
X17 · Uncapped recursion over a caller-supplied document10.0 / 10Exemplary○ Nothing flagged
Other · Security — Whether a walk that recurses through a JSON/XML tree handed in by its caller bounds how deep it will go — an uncapped walk lets the document's nesting choose the stack depth, and the resulting StackOverflowException cannot be caught.
Method: Roslyn syntax + semantics: methods that take a JSON/XML document node and call themselves with a child of it, reachable from an externally-callable member of the same type that accepts a document, checked for any depth parameter, descent counter or threaded arithmetic anywhere in the walk. On a repository with no .NET source it reads TypeScript off the engine’s own token stream (test, vendored, generated and minified paths and `.d.ts` not) with the same rule: a function or method with a parameter typed as a document value — `unknown`, `any`, `object`, `Record<string, unknown|any>`, a JSON alias (`JsonValue`, `JSONObject`, …) or a DOM node global the file does not rebind — that calls itself (bare, or through `this` for a method, or hands itself to a call over the value as in `value.map(walk)`) with something it took out of that value and never through an ancestor accessor such as `closest()` or `parentElement`, that is exported or reached from an exported function (a public method of the same exported class) taking such a value, and that names no depth, level, nesting, recursion, remaining or budget anywhere and threads no `+`/`-` arithmetic through a self-call. Plain JavaScript is not read: with no annotation nothing tells a parsed document from a tree the code built itself. Deterministic, provable per finding. Advisory.
Other · Code Health — Whether a type's disposal matches what it OWNS — releasing what it created, leaving alone what it was handed, and not declaring a finalizer for state that has nothing unmanaged to finalize.
Method: Roslyn syntax + semantics: every assignment to a disposable field is read to decide whether the type CREATED the value or was handed it, and the type's disposal is checked against that answer — an injected interface it disposes, a value it constructed and never releases, a finalizer on a type holding nothing unmanaged, and a disposable local whose every reference is a plain member read. A value handed to a container that disposes its contents (a parent control's `Controls` collection, a component `IContainer`) is released by that container and is not reported; generated code is out of population. On a repository with no .NET source the same ownership questions are read in JavaScript/TypeScript off the engine’s own token stream (test, vendored, generated and minified paths not): a class declaring `dispose()`, `[Symbol.dispose]()` or `[Symbol.asyncDispose]()` that disposes a field it was handed through a constructor parameter typed as a repository interface or resolved by a dependency-injection container; that assigns a field only ever from `new X(…)` of a disposable class and neither releases it anywhere in the class nor names it in its disposal member or a method that member calls, nor hands it to anything else; and a `const`/`let` local built from literals only whose every reference opens a statement operating on a non-release member of it. A class is disposable when every repository declaration of its name declares or inherits a disposal member, or when it is a documented library disposable (`vscode` EventEmitter, CancellationTokenSource and Disposable; three.js geometries, materials, textures, render targets, renderers, controls and composers). The finalizer arm has no JavaScript counterpart: a class cannot declare one. Dart is read for the owned-and-never-released arm: a Flutter `State` (or a class declaring `dispose()`/`close()`) whose library-private field is written only with direct creations of a framework controller, `FocusNode`, `StreamController` or periodic `Timer` (or a `.listen(…)` into a field declared `StreamSubscription`), which nothing in the class or its library releases (`dispose`/`close`/`cancel`) and which is never handed on except as a named argument. Ruby is read for the owned-and-never-released arm and the abandoned-local arm: a class declaring an instance `close`, `dispose`, `shutdown`, `stop`, `disconnect` or `terminate` whose instance variable is written only with a blockless core descriptor creation (`File.open`/`new`, `Tempfile`, `Dir.open`, `IO.popen`, the `socket` and `openssl` socket classes) that no method of the class closes and that is never handed on (passed, returned, stored, exposed by `attr_reader`, delegated) — a class whose superclass or mixin lies outside the repository is not judged — and a blockless creation read through and dropped (`File.open(path).read`) or held in a local that is never closed, returned, passed or stored (a `&:read` block-pass, an `autoclose: false` borrow and a `fileno` hand-over are not abandonment). PHP is read for the same two arms: a class (not a trait, and not one using a trait) declaring an instance `close`, `dispose`, `shutdown`, `stop`, `disconnect` or `terminate` whose `private` property (or a `final` class's `protected` one) is written only with a direct core `fopen`, `tmpfile`, `popen`, `proc_open`, `fsockopen`, `stream_socket_client`/`server` or `opendir` that nothing in the class closes (`fclose`, `pclose`, `closedir`, `unset`, a reset to `null`) and that is never handed on, and a handle held in a function's local, or read through as the argument of a reader, that is never closed, returned, passed, captured or stored; a `php://` stream, `curl_init`, `SplFileObject`, `PDO` and a function the repository declares under the core name are not read. Deterministic, provable per finding. Advisory.
Other · Code Health — Whether a method that temporarily changes state belonging to the whole process — the working directory, an environment variable — puts it back on EVERY path: a restore reached only when nothing throws leaks the change to the rest of the process.
Method: Roslyn syntax + semantics: method bodies that write the process working directory or an environment variable and write it back in the same body, checked for whether that restore sits in a `finally`/`catch` or only on the straight-line path. On a repository with no .NET source the same rule reads production JavaScript/TypeScript off the engine’s own token stream (test, vendored and minified paths not): `process.chdir`, `process.env.NAME =`/`["NAME"] =` and `delete process.env.NAME`, and Deno’s `Deno.chdir`/`Deno.env.set`/`Deno.env.delete`, paired per function body (a nested function or arrow is its own body, and module top-level code is none), where the last write puts back a local the body captured from the same global or deletes a variable the first write set, with at least one statement between them; a write in a `catch`/`finally` of that body silences it. Deterministic, provable per finding. Advisory.
Other · Code Health — Whether an argument guard throws the exception its own condition describes — a guard that rejects a value for being EMPTY and reports it as `NullPointerException` (Java, Kotlin, Scala), `ArgumentError.notNull` (Dart) or `ArgumentNullException` (F#'s `nullArg`) tells the caller a parameter was null when it provably was not.
Method: Roslyn syntax: `throw new ArgumentNullException(nameof(p))` statements controlled by an `if`, whose condition is read for a test that is true of a NON-null `p` — an emptiness test that dereferences it (`p.Count == 0`, `!p.Any()`) or a BCL predicate documented true of the empty value (`string.IsNullOrEmpty(p)`). Deterministic, provable per finding. Advisory.
Other · Code Health — Whether a `when` guard is free of side effects — a guard that increments a counter or assigns while deciding whether its arm matches applies that change during PATTERN MATCHING, on an arm that may not be selected, and skips it entirely when a short-circuit to its left answers first.
Method: Roslyn syntax: `when` guards on case labels and switch-expression arms, read for a mutation (`++`/`--`/assignment) sitting in a position the guard's own `&&`/`||`/`??`/`?:`/`?.` can skip. Deterministic, provable per finding. Advisory.
Other · Code Health — Whether a method that TAKES a lock or semaphore and gives it back from a flag-guarded `finally` returns the value that flag implies — reporting success while the guard hands the primitive back admits a second caller the exclusion was there to keep out, and reporting failure while the guard keeps it leaves nothing to ever give it back.
Method: Roslyn syntax: `try` statements whose `finally` releases a synchronisation primitive under a bare local-bool guard, where the method also TOOK that same primitive before the `try`, checked for a `return` of a bool literal whose value disagrees with the flag state the method's own straight-line assignments put it in. Deterministic, provable per finding. Advisory.
Other · Code Health — Whether the work a diagnostic log line costs is paid only when that line is wanted — C# evaluates a call's arguments BEFORE the call, so a trace/debug message joined or projected out of a collection is built in full on every pass, and then discarded by a sink the shipped configuration leaves switched off.
Method: Roslyn syntax: log calls at a diagnostic level (a `Log`-prefixed method naming Trace/Debug/Verbose, or a bare `Debug`/`Trace`/`Verbose` on a receiver named for a logger), whose argument list is read for a call whose cost scales with a sequence — a LINQ operator, a materialisation, `string.Join`, a serializer — with no enclosing level check or conditional-compilation region. On a repository with no .NET source it reads JavaScript/TypeScript off the engine’s own token stream (test, vendored and minified paths not) with the same rule: a `debug`/`trace`/`verbose` call on a receiver named for a logger, or a `log`-prefixed method naming the level, whose argument calls an array operator (`map`/`filter`/`reduce`/`sort`/…), `Array.from`, `Object.keys/values/entries`, `JSON.stringify`/`util.inspect` over anything but a literal, or an array `join` — outside any arrow or function passed as an argument, which the logger calls only when the level is on — with no enclosing `if`, `&&` or `?:` whose condition names a level, a level string, or the `NODE_ENV`/`__DEV__`/`DEV` build switch. Deterministic, provable per finding. Advisory.
Do you agree with this assessment?
X24 · Document value interpolated into markup unescaped10.0 / 10Exemplary○ Nothing flagged
Other · Security — Whether text read out of the document being converted is escaped before it is written into generated markup — a value the document's author chose, interpolated into an attribute the surrounding literal delimits, can close that attribute and open another.
Method: Roslyn semantic model over the whole compilation: a string-typed `Value`/`InnerText`/`InnerXml`/`Text` member declared inside `DocumentFormat.OpenXml` or `System.Xml` is a taint SOURCE, propagated through assignments, returns, arguments, tuple elements and string composition to its transitive closure, then read at interpolated-string holes that sit in a markup position the surrounding literal itself delimits. Escaper/encoder calls and enclosing validator conditions cut the flow. Flow- and container-insensitive by construction. A second arm needs no provenance at all and reports a type that CONTRADICTS ITSELF — the same expression escaped at one delimited markup hole and interpolated raw at another hole in the same markup position of the same type, which the type's own escaping proves is a defect without knowing where the value came from. On a repository with no .NET source it reads JavaScript/TypeScript off the token stream with the same rule: a DOM read of raw document text (`getAttribute`, `textContent`, `innerText`, `nodeValue`) is the source, propagated through local bindings and string composition, and judged at template-literal and concatenation holes in the same two delimited markup positions; escapers and validating conditions cut it, and documentation-site, test, vendored and minified scripts are not read. Deterministic, provable per finding. Advisory.
Other · Code Health — Whether a value the caller is invited to supply is the value the type actually uses — a constructor parameter stored in a private field that nothing ever reads while the default it was given is spelled out a second time at the site that should have read it, a keyed lookup that falls back to a different setting than the one its key names while the same type falls back to the matching one for that same key, or a culture-sensitive parse given no format provider by a type that feeds its own settable culture to the same kind of parse elsewhere, or a number an entry point writes to standard output under the host's culture while the same entry point formats with the invariant culture elsewhere. Either way, every caller who supplies a value silently gets something else.
Method: Roslyn syntax: private instance fields of a non-partial type assigned in a constructor from one of its own parameters with a `??` fallback, checked for whether anything in the type body reads the field and whether that same fallback expression is spelled out again outside the constructor; and `??` fallbacks onto a member access from a lookup call carrying exactly one string literal, grouped by that key across the type and checked for a fallback member whose folded name disagrees with the key while a sibling site for the same key agrees with it. On a repository with no .NET source the first two arms read JavaScript/TypeScript off the engine’s own token stream (tests included, bundles and vendored paths not): a `#x`, `private` or `private` parameter-property instance field filled in the constructor from a parameter (or one member of one) through `??`/`||` or a parameter default, never read anywhere in the file by name, whose constructed default is spelled again in the class body; and `lookup("key") ?? s.member` grouped by key per class, or per module outside every class. The culture arm has no JavaScript counterpart: its parses take no locale. Deterministic, provable per finding. Advisory.
Other · Code Health — Whether a value handed from a callback to the body that waits on it crosses on something built to be crossed — a `Queue<T>`/`List<T>`/`Dictionary<K,V>` written inside an event handler and read back outside it is mutated by two flows at once, and the semaphore or completion source beside it orders how MANY items exist while leaving the collection's own head, tail and backing array unprotected.
Method: Roslyn syntax: method, accessor, local-function and lambda bodies that declare BOTH a non-thread-safe generic collection (`Queue`/`Stack`/`List`/`Dictionary`/`HashSet`/`Sorted*`/`LinkedList`) and a synchronisation primitive (`SemaphoreSlim`/`TaskCompletionSource`/`ManualResetEvent(Slim)`/`AutoResetEvent`/`CountdownEvent`) as locals, then read for a `+=`-registered lambda that raises that primitive while the body outside every lambda waits on it — and, in that scope, a mutating call on the collection inside the lambda paired with a mention of it outside. Any `lock` in the scope abstains it. On a repository with no .NET source the same handoff is read in Java off the engine’s own token stream (test source sets, vendored and demonstration paths not): an `ArrayList`/`LinkedList`/`ArrayDeque`/`PriorityQueue`/`Hash*`/`LinkedHash*`/`Tree*` local and a `CountDownLatch`/`Semaphore`/`CompletableFuture` local, a lambda or anonymous class that raises the primitive and mutates the collection, and a wait outside it; any `synchronized` or `lock()` abstains the body. Because each of those primitives orders what the callback wrote before raising it, only a touch that provably overlaps the callback is convicted: one after the registration and before the next wait, or one in a loop registered-before, waiting on every pass and not declaring the collection. Deterministic, provable per finding. Advisory.
Do you agree with this assessment?
X27 · Collection changed while being enumerated10.0 / 10Exemplary○ Nothing flagged
Other · Code Health — Whether an enhanced `for` leaves the collection it is walking alone — a body that adds to or removes from the very collection the loop is iterating invalidates the fail-fast iterator it is holding, so the next `next()` throws `ConcurrentModificationException` and the remaining elements are never seen. Whether a `for` loop leaves the `dict`, `set` or `deque` it is walking alone — CPython's iterators over those check that the collection has not changed size since the loop began, so a body that removes from (or empties) the very collection the loop is walking makes the next step raise `RuntimeError: dictionary changed size during iteration` and the remaining items are never seen.
Method: Roslyn syntax + semantics: `foreach` statements whose body calls a structural mutator (`Add`/`Remove`/`Clear`/`Insert`/…) on the very expression the loop is enumerating. Two arms. ARM A — the source is a concrete fragile BCL collection, or a live `Keys`/`Values` view over one, and the mutator resolves to that same collection's own member; concurrent and immutable collections and arrays are outside the population by construction, since their enumerators survive a structural change. ARM B — the source is an argument-less accessor CALL on a receiver whose body is in source: the accessor must return a stored field VERBATIM and a sibling member must structurally change that same field, both read off the implementations rather than from the members' names. A mutation the loop provably exits immediately after (`break`/`return`/`throw`/`goto`), or one written inside a nested loop or a lambda, is counted and never reported. Deterministic, provable per finding. Advisory.
Do you agree with this assessment?
X28 · Index access outside its own emptiness guard10.0 / 10Exemplary○ Nothing flagged
Other · Code Health — Whether a condition that tests a value for emptiness indexes that same value only where the test holds — an `||` written one parenthesis too far to the left leaves an index access outside the guard beside it, so the empty case the guard exists to anticipate reaches the index and throws.
Method: Roslyn syntax only, no semantic model: the OUTERMOST `&&`/`||` of every boolean condition, read for a symbol the condition tests for emptiness (`string.IsNullOrEmpty`/`IsNullOrWhiteSpace`, a `Length`/`Count` comparison against a literal, `Any()`, a `Length`/`Count` pattern, or a comparison against `""`) and ALSO indexes. Each `symbol[...]` access is placed by a boolean-reachability walk from the access up to the outermost connective: an access is COVERED when some enclosing step has it in the right operand and the left operand, under the truth value that step forces, proves the symbol non-empty — a recursion over `&&`/`||` whose true- and false-directions are asymmetric. A finding needs BOTH an uncovered access and a covered one on the same symbol in the same condition, which is the agreeing twin that separates a misplaced parenthesis from an unrelated length test. Bare index accesses with no emptiness test in the condition are neither counted nor reported; a non-identifier receiver and a lambda nested inside the condition are outside the population. Deterministic, provable per finding. Advisory.
Do you agree with this assessment?
X29 · Per-element action decided by a fixed element10.0 / 10Exemplary○ Nothing flagged
Other · Code Health — Whether a decision taken once per element is taken ABOUT that element — a test inside a counted loop that reads a fixed subscript of the very collection its guarded statement indexes by the loop variable applies element zero's answer to all of them, so the elements that differ from it are all handled wrongly, and in the same direction.
Method: Roslyn syntax only, no semantic model: every `for` statement declaring exactly ONE loop variable, and every `if` inside its body that is not under a nested loop or a lambda. A site enters the population when the `if`’s condition never mentions the loop variable while the statement it guards indexes some collection by that variable ALONE (`c[i]`; `c[i + 1]` and `c[i, j]` are outside it). A finding additionally needs the AGREEING TWIN at the same-collection grain: the condition must read THAT SAME collection at a subscript that does not move — written into the condition, or reached through a local declared BEFORE the loop, so an alias bound inside the body is not followed. Both collection expressions must be simple identifiers. On a repository with no .NET source the same rule reads JavaScript/TypeScript off the engine’s own token stream (tests included, bundles and vendored paths not): a `for (let|var|const x = …; …; …)` with one declarator and a braced body, an alias followed only when it is declared before the loop in a block that encloses it and never assigned inside the loop. Deterministic, provable per finding. Advisory.
Other · Code Health — Whether exceptions are handled rather than silently swallowed or rethrown with lost stack traces.
Method: Roslyn syntax scan: every catch clause counted; empty catches and bare rethrows flagged. Population is all catch clauses, not estimated. Deterministic, hard fact.
An empty catch block silently discards the error — failures vanish with no log and no rethrow. Log it, handle it, or don't catch it. (×32) — broker/src/main/java/org/apache/rocketmq/broker/controller/ReplicasManager.java:186, broker/src/main/java/org/apache/rocketmq/broker/dledger/DLedgerRoleChangeHandler.java:150, broker/src/main/java/org/apache/rocketmq/broker/dledger/DLedgerRoleChangeHandler.java:173, …
`catch (Exception)` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter. (×8) — client/src/main/java/org/apache/rocketmq/client/impl/producer/DefaultMQProducerImpl.java:172, common/src/main/java/org/apache/rocketmq/common/UtilAll.java:69, common/src/main/java/org/apache/rocketmq/common/UtilAll.java:226, …
What to do
Swallowed exception (empty catch)
Do you agree with this assessment?
X30 · Support guard that admits what it rejects10.0 / 10Exemplary○ Nothing flagged
Other · Code Health — Whether a guard written as a NEGATED `||` says what its author meant — `!(a || b || x != k)` is `!a && !b && x == k` by De Morgan, so a bail-out that mixes capabilities the code needs with a fault it refuses turns inside out: it fires only where the capabilities are ABSENT, and lets every value the fault term names walk straight into the body that cannot handle it.
Method: Roslyn syntax only, no semantic model: every logical-not whose operand is a parenthesised `||` chain of two or more disjuncts, flattened (a left-nested `a || b || c` read once would see `(a || b)` as one disjunct). A site enters the population on that shape alone. A finding additionally needs the disjuncts to DISAGREE in polarity: at least one bare boolean read — an identifier or member access, never an invocation, which is a predicate rather than a capability flag — and at least one `x != <constant>`, the only form that negates into an exact-value pin (`== null` negates into a looser requirement and is outside the fault set). Consistently-polarised disjunctions, all-fault or all-capability, are counted and never reported; a negated `&&` is outside the population entirely. No same-receiver gate: it was measured to cost a real defect and remove no false positive. Deterministic, provable per finding. Advisory.
Other · Code Health — Whether log calls use message templates (queryable) rather than interpolated strings.
Method: Roslyn syntax scan: every log call-site counted; interpolated-string first-argument violations flagged. Population is all log calls, not estimated. On a repository with no .NET source it reads JavaScript/TypeScript off the engine’s own token stream (test, vendored and minified paths not) with the same rule: a `trace`/`debug`/`info`/`warn`/`error`/`fatal`/`verbose`/`silly`/`http`/`log` call on a receiver named for a logger, in a package whose own or an enclosing `package.json` declares a logger that carries values as fields (pino, pino-http, nestjs-pino, Fastify, winston, bunyan, tslog, LogTape, roarr), whose first deciding argument is a template literal with substitutions; an object-literal fields argument is stepped over, a plain string message clears the call. Python is read the same way: a `debug`/`info`/`warning`/`error`/`exception`/`critical`/`log` call on a logger in a file that imports the standard library’s `logging` or structlog (loguru, which formats at the call, is not judged), whose message is a whole f-string with a non-constant field; a `%`-formatted, `.format()`-ed or concatenated message is not convicted, as in C#. PHP is read the same way: a PSR-3 level call (`emergency`…`debug`, `log`) on a logger (`$logger`, `$this->logger`, Laravel’s `Log::`, `logger()`, `\Drupal::logger()`) in a package whose `composer.json` requires a PSR-3 logger or a framework that hands one out (psr/log, Monolog, Laravel, Symfony, Drupal, CakePHP), or a file that imports one, whose message is a double-quoted string interpolating a variable; a single-quoted message clears the call, and `sprintf` or `.` concatenation is not convicted, as in C#. Dart is read the same way: a `trace`/`debug`/`info`/`warn`/`error`/`fatal` call on Sentry’s structured logger (`Sentry.logger`) whose message is a whole string literal interpolating a value (`$name`, `${…}`); the `Sentry.logger.fmt` template API clears the call. Dart that logs only through loggers with one message and no fields (package:logging, package:logger, talker, dart:developer) is not applicable rather than a reach gap. Ruby is read the same way: a `trace`/`debug`/`info`/`warn`/`error`/`fatal` call on the console gem’s `Console` (declared by a Gemfile, gemspec or Gemfile.lock, or required) or, where SemanticLogger, Ougai or dry-logger is declared or required, on a receiver named for a logger (`logger`, `@logger`, `Rails.logger`, `log`), whose first deciding argument is, as the whole argument, a double-quoted string interpolating a non-constant value (`#{…}`, `#@ivar`); a plain literal clears the call, keyword arguments are the fields, and a block, `%`-format or `+` concatenation is not convicted. Ruby that logs only through the standard Logger (Rails.logger) is not applicable rather than a reach gap. Deterministic.
`error` at line 202 is handed a message assembled at the call — a string concatenated with a value, or `String.format` — through SLF4J or log4j 2, so the logger receives one finished string: the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the level is filtered out. Pass a constant pattern and the values beside it instead: `log.error("Order {} moved to {}", orderId, status)`, which keeps the pattern and its arguments apart on the event for a structured encoder (logstash-logback-encoder, log4j 2's JsonTemplateLayout, OpenTelemetry), or `log.atInfo().addKeyValue("order_id", orderId).log("order moved")` with SLF4J 2's fluent API. An exception goes last, as the throwable argument, not into the text. — acl/src/main/java/org/apache/rocketmq/acl/plain/PlainPermissionManager.java:202
`error` at line 483 is handed a message assembled at the call — a string concatenated with a value, or `String.format` — through SLF4J or log4j 2, so the logger receives one finished string: the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the level is filtered out. Pass a constant pattern and the values beside it instead: `log.error("Order {} moved to {}", orderId, status)`, which keeps the pattern and its arguments apart on the event for a structured encoder (logstash-logback-encoder, log4j 2's JsonTemplateLayout, OpenTelemetry), or `log.atInfo().addKeyValue("order_id", orderId).log("order moved")` with SLF4J 2's fluent API. An exception goes last, as the throwable argument, not into the text. — acl/src/main/java/org/apache/rocketmq/acl/plain/PlainPermissionManager.java:483
`error` at line 488 is handed a message assembled at the call — a string concatenated with a value, or `String.format` — through SLF4J or log4j 2, so the logger receives one finished string: the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the level is filtered out. Pass a constant pattern and the values beside it instead: `log.error("Order {} moved to {}", orderId, status)`, which keeps the pattern and its arguments apart on the event for a structured encoder (logstash-logback-encoder, log4j 2's JsonTemplateLayout, OpenTelemetry), or `log.atInfo().addKeyValue("order_id", orderId).log("order moved")` with SLF4J 2's fluent API. An exception goes last, as the throwable argument, not into the text. — acl/src/main/java/org/apache/rocketmq/acl/plain/PlainPermissionManager.java:488
`error` at line 493 is handed a message assembled at the call — a string concatenated with a value, or `String.format` — through SLF4J or log4j 2, so the logger receives one finished string: the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the level is filtered out. Pass a constant pattern and the values beside it instead: `log.error("Order {} moved to {}", orderId, status)`, which keeps the pattern and its arguments apart on the event for a structured encoder (logstash-logback-encoder, log4j 2's JsonTemplateLayout, OpenTelemetry), or `log.atInfo().addKeyValue("order_id", orderId).log("order moved")` with SLF4J 2's fluent API. An exception goes last, as the throwable argument, not into the text. — acl/src/main/java/org/apache/rocketmq/acl/plain/PlainPermissionManager.java:493
`info` at line 63 is handed a message assembled at the call — a string concatenated with a value, or `String.format` — through SLF4J or log4j 2, so the logger receives one finished string: the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the level is filtered out. Pass a constant pattern and the values beside it instead: `log.info("Order {} moved to {}", orderId, status)`, which keeps the pattern and its arguments apart on the event for a structured encoder (logstash-logback-encoder, log4j 2's JsonTemplateLayout, OpenTelemetry), or `log.atInfo().addKeyValue("order_id", orderId).log("order moved")` with SLF4J 2's fluent API. An exception goes last, as the throwable argument, not into the text. — broker/src/main/java/org/apache/rocketmq/broker/BrokerPreOnlineService.java:63
`info` at line 82 is handed a message assembled at the call — a string concatenated with a value, or `String.format` — through SLF4J or log4j 2, so the logger receives one finished string: the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the level is filtered out. Pass a constant pattern and the values beside it instead: `log.info("Order {} moved to {}", orderId, status)`, which keeps the pattern and its arguments apart on the event for a structured encoder (logstash-logback-encoder, log4j 2's JsonTemplateLayout, OpenTelemetry), or `log.atInfo().addKeyValue("order_id", orderId).log("order moved")` with SLF4J 2's fluent API. An exception goes last, as the throwable argument, not into the text. — broker/src/main/java/org/apache/rocketmq/broker/BrokerPreOnlineService.java:82
`warn` at line 76 is handed a message assembled at the call — a string concatenated with a value, or `String.format` — through SLF4J or log4j 2, so the logger receives one finished string: the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the level is filtered out. Pass a constant pattern and the values beside it instead: `log.warn("Order {} moved to {}", orderId, status)`, which keeps the pattern and its arguments apart on the event for a structured encoder (logstash-logback-encoder, log4j 2's JsonTemplateLayout, OpenTelemetry), or `log.atInfo().addKeyValue("order_id", orderId).log("order moved")` with SLF4J 2's fluent API. An exception goes last, as the throwable argument, not into the text. — broker/src/main/java/org/apache/rocketmq/broker/coldctr/ColdDataPullRequestHoldService.java:76
`warn` at line 93 is handed a message assembled at the call — a string concatenated with a value, or `String.format` — through SLF4J or log4j 2, so the logger receives one finished string: the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the level is filtered out. Pass a constant pattern and the values beside it instead: `log.warn("Order {} moved to {}", orderId, status)`, which keeps the pattern and its arguments apart on the event for a structured encoder (logstash-logback-encoder, log4j 2's JsonTemplateLayout, OpenTelemetry), or `log.atInfo().addKeyValue("order_id", orderId).log("order moved")` with SLF4J 2's fluent API. An exception goes last, as the throwable argument, not into the text. — broker/src/main/java/org/apache/rocketmq/broker/coldctr/ColdDataCgCtrService.java:93
`error` at line 148 is handed a message assembled at the call — a string concatenated with a value, or `String.format` — through SLF4J or log4j 2, so the logger receives one finished string: the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the level is filtered out. Pass a constant pattern and the values beside it instead: `log.error("Order {} moved to {}", orderId, status)`, which keeps the pattern and its arguments apart on the event for a structured encoder (logstash-logback-encoder, log4j 2's JsonTemplateLayout, OpenTelemetry), or `log.atInfo().addKeyValue("order_id", orderId).log("order moved")` with SLF4J 2's fluent API. An exception goes last, as the throwable argument, not into the text. — broker/src/main/java/org/apache/rocketmq/broker/failover/EscapeBridge.java:148
`error` at line 151 is handed a message assembled at the call — a string concatenated with a value, or `String.format` — through SLF4J or log4j 2, so the logger receives one finished string: the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the level is filtered out. Pass a constant pattern and the values beside it instead: `log.error("Order {} moved to {}", orderId, status)`, which keeps the pattern and its arguments apart on the event for a structured encoder (logstash-logback-encoder, log4j 2's JsonTemplateLayout, OpenTelemetry), or `log.atInfo().addKeyValue("order_id", orderId).log("order moved")` with SLF4J 2's fluent API. An exception goes last, as the throwable argument, not into the text. — broker/src/main/java/org/apache/rocketmq/broker/failover/EscapeBridge.java:151
`error` at line 108 is handed a message assembled at the call — a string concatenated with a value, or `String.format` — through SLF4J or log4j 2, so the logger receives one finished string: the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the level is filtered out. Pass a constant pattern and the values beside it instead: `log.error("Order {} moved to {}", orderId, status)`, which keeps the pattern and its arguments apart on the event for a structured encoder (logstash-logback-encoder, log4j 2's JsonTemplateLayout, OpenTelemetry), or `log.atInfo().addKeyValue("order_id", orderId).log("order moved")` with SLF4J 2's fluent API. An exception goes last, as the throwable argument, not into the text. — broker/src/main/java/org/apache/rocketmq/broker/filter/ExpressionMessageFilter.java:108
`error` at line 149 is handed a message assembled at the call — a string concatenated with a value, or `String.format` — through SLF4J or log4j 2, so the logger receives one finished string: the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the level is filtered out. Pass a constant pattern and the values beside it instead: `log.error("Order {} moved to {}", orderId, status)`, which keeps the pattern and its arguments apart on the event for a structured encoder (logstash-logback-encoder, log4j 2's JsonTemplateLayout, OpenTelemetry), or `log.atInfo().addKeyValue("order_id", orderId).log("order moved")` with SLF4J 2's fluent API. An exception goes last, as the throwable argument, not into the text. — broker/src/main/java/org/apache/rocketmq/broker/filter/ExpressionMessageFilter.java:149
`error` at line 86 is handed a message assembled at the call — a string concatenated with a value, or `String.format` — through SLF4J or log4j 2, so the logger receives one finished string: the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the level is filtered out. Pass a constant pattern and the values beside it instead: `log.error("Order {} moved to {}", orderId, status)`, which keeps the pattern and its arguments apart on the event for a structured encoder (logstash-logback-encoder, log4j 2's JsonTemplateLayout, OpenTelemetry), or `log.atInfo().addKeyValue("order_id", orderId).log("order moved")` with SLF4J 2's fluent API. An exception goes last, as the throwable argument, not into the text. — broker/src/main/java/org/apache/rocketmq/broker/filter/ExpressionForRetryMessageFilter.java:86
`error` at line 252 is handed a message assembled at the call — a string concatenated with a value, or `String.format` — through SLF4J or log4j 2, so the logger receives one finished string: the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the level is filtered out. Pass a constant pattern and the values beside it instead: `log.error("Order {} moved to {}", orderId, status)`, which keeps the pattern and its arguments apart on the event for a structured encoder (logstash-logback-encoder, log4j 2's JsonTemplateLayout, OpenTelemetry), or `log.atInfo().addKeyValue("order_id", orderId).log("order moved")` with SLF4J 2's fluent API. An exception goes last, as the throwable argument, not into the text. — broker/src/main/java/org/apache/rocketmq/broker/filter/ConsumerFilterManager.java:252
`error` at line 59 is handed a message assembled at the call — a string concatenated with a value, or `String.format` — through SLF4J or log4j 2, so the logger receives one finished string: the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the level is filtered out. Pass a constant pattern and the values beside it instead: `log.error("Order {} moved to {}", orderId, status)`, which keeps the pattern and its arguments apart on the event for a structured encoder (logstash-logback-encoder, log4j 2's JsonTemplateLayout, OpenTelemetry), or `log.atInfo().addKeyValue("order_id", orderId).log("order moved")` with SLF4J 2's fluent API. An exception goes last, as the throwable argument, not into the text. — broker/src/main/java/org/apache/rocketmq/broker/latency/BrokerFastFailure.java:59
`warn` at line 140 is handed a message assembled at the call — a string concatenated with a value, or `String.format` — through SLF4J or log4j 2, so the logger receives one finished string: the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the level is filtered out. Pass a constant pattern and the values beside it instead: `log.warn("Order {} moved to {}", orderId, status)`, which keeps the pattern and its arguments apart on the event for a structured encoder (logstash-logback-encoder, log4j 2's JsonTemplateLayout, OpenTelemetry), or `log.atInfo().addKeyValue("order_id", orderId).log("order moved")` with SLF4J 2's fluent API. An exception goes last, as the throwable argument, not into the text. — broker/src/main/java/org/apache/rocketmq/broker/latency/BrokerFastFailure.java:140
`warn` at line 85 is handed a message assembled at the call — a string concatenated with a value, or `String.format` — through SLF4J or log4j 2, so the logger receives one finished string: the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the level is filtered out. Pass a constant pattern and the values beside it instead: `log.warn("Order {} moved to {}", orderId, status)`, which keeps the pattern and its arguments apart on the event for a structured encoder (logstash-logback-encoder, log4j 2's JsonTemplateLayout, OpenTelemetry), or `log.atInfo().addKeyValue("order_id", orderId).log("order moved")` with SLF4J 2's fluent API. An exception goes last, as the throwable argument, not into the text. — broker/src/main/java/org/apache/rocketmq/broker/longpolling/PullRequestHoldService.java:85
`error` at line 338 is handed a message assembled at the call — a string concatenated with a value, or `String.format` — through SLF4J or log4j 2, so the logger receives one finished string: the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the level is filtered out. Pass a constant pattern and the values beside it instead: `log.error("Order {} moved to {}", orderId, status)`, which keeps the pattern and its arguments apart on the event for a structured encoder (logstash-logback-encoder, log4j 2's JsonTemplateLayout, OpenTelemetry), or `log.atInfo().addKeyValue("order_id", orderId).log("order moved")` with SLF4J 2's fluent API. An exception goes last, as the throwable argument, not into the text. — broker/src/main/java/org/apache/rocketmq/broker/out/BrokerOuterAPI.java:338
`error` at line 369 is handed a message assembled at the call — a string concatenated with a value, or `String.format` — through SLF4J or log4j 2, so the logger receives one finished string: the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the level is filtered out. Pass a constant pattern and the values beside it instead: `log.error("Order {} moved to {}", orderId, status)`, which keeps the pattern and its arguments apart on the event for a structured encoder (logstash-logback-encoder, log4j 2's JsonTemplateLayout, OpenTelemetry), or `log.atInfo().addKeyValue("order_id", orderId).log("order moved")` with SLF4J 2's fluent API. An exception goes last, as the throwable argument, not into the text. — broker/src/main/java/org/apache/rocketmq/broker/out/BrokerOuterAPI.java:369
`error` at line 1013 is handed a message assembled at the call — a string concatenated with a value, or `String.format` — through SLF4J or log4j 2, so the logger receives one finished string: the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the level is filtered out. Pass a constant pattern and the values beside it instead: `log.error("Order {} moved to {}", orderId, status)`, which keeps the pattern and its arguments apart on the event for a structured encoder (logstash-logback-encoder, log4j 2's JsonTemplateLayout, OpenTelemetry), or `log.atInfo().addKeyValue("order_id", orderId).log("order moved")` with SLF4J 2's fluent API. An exception goes last, as the throwable argument, not into the text. — broker/src/main/java/org/apache/rocketmq/broker/out/BrokerOuterAPI.java:1013
`error` at line 1024 is handed a message assembled at the call — a string concatenated with a value, or `String.format` — through SLF4J or log4j 2, so the logger receives one finished string: the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the level is filtered out. Pass a constant pattern and the values beside it instead: `log.error("Order {} moved to {}", orderId, status)`, which keeps the pattern and its arguments apart on the event for a structured encoder (logstash-logback-encoder, log4j 2's JsonTemplateLayout, OpenTelemetry), or `log.atInfo().addKeyValue("order_id", orderId).log("order moved")` with SLF4J 2's fluent API. An exception goes last, as the throwable argument, not into the text. — broker/src/main/java/org/apache/rocketmq/broker/out/BrokerOuterAPI.java:1024
`error` at line 586 is handed a message assembled at the call — a string concatenated with a value, or `String.format` — through SLF4J or log4j 2, so the logger receives one finished string: the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the level is filtered out. Pass a constant pattern and the values beside it instead: `log.error("Order {} moved to {}", orderId, status)`, which keeps the pattern and its arguments apart on the event for a structured encoder (logstash-logback-encoder, log4j 2's JsonTemplateLayout, OpenTelemetry), or `log.atInfo().addKeyValue("order_id", orderId).log("order moved")` with SLF4J 2's fluent API. An exception goes last, as the throwable argument, not into the text. — broker/src/main/java/org/apache/rocketmq/broker/processor/PopBufferMergeService.java:586
`warn` at line 294 is handed a message assembled at the call — a string concatenated with a value, or `String.format` — through SLF4J or log4j 2, so the logger receives one finished string: the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the level is filtered out. Pass a constant pattern and the values beside it instead: `log.warn("Order {} moved to {}", orderId, status)`, which keeps the pattern and its arguments apart on the event for a structured encoder (logstash-logback-encoder, log4j 2's JsonTemplateLayout, OpenTelemetry), or `log.atInfo().addKeyValue("order_id", orderId).log("order moved")` with SLF4J 2's fluent API. An exception goes last, as the throwable argument, not into the text. — broker/src/main/java/org/apache/rocketmq/broker/processor/DefaultPullMessageResultHandler.java:294
`error` at line 365 is handed a message assembled at the call — a string concatenated with a value, or `String.format` — through SLF4J or log4j 2, so the logger receives one finished string: the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the level is filtered out. Pass a constant pattern and the values beside it instead: `log.error("Order {} moved to {}", orderId, status)`, which keeps the pattern and its arguments apart on the event for a structured encoder (logstash-logback-encoder, log4j 2's JsonTemplateLayout, OpenTelemetry), or `log.atInfo().addKeyValue("order_id", orderId).log("order moved")` with SLF4J 2's fluent API. An exception goes last, as the throwable argument, not into the text. — broker/src/main/java/org/apache/rocketmq/broker/processor/AdminBrokerProcessor.java:365
`error` at line 2665 is handed a message assembled at the call — a string concatenated with a value, or `String.format` — through SLF4J or log4j 2, so the logger receives one finished string: the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the level is filtered out. Pass a constant pattern and the values beside it instead: `log.error("Order {} moved to {}", orderId, status)`, which keeps the pattern and its arguments apart on the event for a structured encoder (logstash-logback-encoder, log4j 2's JsonTemplateLayout, OpenTelemetry), or `log.atInfo().addKeyValue("order_id", orderId).log("order moved")` with SLF4J 2's fluent API. An exception goes last, as the throwable argument, not into the text. — broker/src/main/java/org/apache/rocketmq/broker/processor/AdminBrokerProcessor.java:2665
`error` at line 276 is handed a message assembled at the call — a string concatenated with a value, or `String.format` — through SLF4J or log4j 2, so the logger receives one finished string: the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the level is filtered out. Pass a constant pattern and the values beside it instead: `log.error("Order {} moved to {}", orderId, status)`, which keeps the pattern and its arguments apart on the event for a structured encoder (logstash-logback-encoder, log4j 2's JsonTemplateLayout, OpenTelemetry), or `log.atInfo().addKeyValue("order_id", orderId).log("order moved")` with SLF4J 2's fluent API. An exception goes last, as the throwable argument, not into the text. — broker/src/main/java/org/apache/rocketmq/broker/processor/AckMessageProcessor.java:276
`info` at line 185 is handed a message assembled at the call — a string concatenated with a value, or `String.format` — through SLF4J or log4j 2, so the logger receives one finished string: the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the level is filtered out. Pass a constant pattern and the values beside it instead: `log.info("Order {} moved to {}", orderId, status)`, which keeps the pattern and its arguments apart on the event for a structured encoder (logstash-logback-encoder, log4j 2's JsonTemplateLayout, OpenTelemetry), or `log.atInfo().addKeyValue("order_id", orderId).log("order moved")` with SLF4J 2's fluent API. An exception goes last, as the throwable argument, not into the text. — broker/src/main/java/org/apache/rocketmq/broker/topic/TopicRouteInfoManager.java:185
`warn` at line 150 is handed a message assembled at the call — a string concatenated with a value, or `String.format` — through SLF4J or log4j 2, so the logger receives one finished string: the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the level is filtered out. Pass a constant pattern and the values beside it instead: `log.warn("Order {} moved to {}", orderId, status)`, which keeps the pattern and its arguments apart on the event for a structured encoder (logstash-logback-encoder, log4j 2's JsonTemplateLayout, OpenTelemetry), or `log.atInfo().addKeyValue("order_id", orderId).log("order moved")` with SLF4J 2's fluent API. An exception goes last, as the throwable argument, not into the text. — broker/src/main/java/org/apache/rocketmq/broker/transaction/queue/TransactionalMessageServiceImpl.java:150
`warn` at line 78 is handed a message assembled at the call — a string concatenated with a value, or `String.format` — through SLF4J or log4j 2, so the logger receives one finished string: the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the level is filtered out. Pass a constant pattern and the values beside it instead: `log.warn("Order {} moved to {}", orderId, status)`, which keeps the pattern and its arguments apart on the event for a structured encoder (logstash-logback-encoder, log4j 2's JsonTemplateLayout, OpenTelemetry), or `log.atInfo().addKeyValue("order_id", orderId).log("order moved")` with SLF4J 2's fluent API. An exception goes last, as the throwable argument, not into the text. — broker/src/main/java/org/apache/rocketmq/broker/util/HookUtils.java:78
`warn` at line 102 is handed a message assembled at the call — a string concatenated with a value, or `String.format` — through SLF4J or log4j 2, so the logger receives one finished string: the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the level is filtered out. Pass a constant pattern and the values beside it instead: `log.warn("Order {} moved to {}", orderId, status)`, which keeps the pattern and its arguments apart on the event for a structured encoder (logstash-logback-encoder, log4j 2's JsonTemplateLayout, OpenTelemetry), or `log.atInfo().addKeyValue("order_id", orderId).log("order moved")` with SLF4J 2's fluent API. An exception goes last, as the throwable argument, not into the text. — client/src/main/java/org/apache/rocketmq/client/consumer/store/RemoteBrokerOffsetStore.java:102
`error` at line 134 is handed a message assembled at the call — a string concatenated with a value, or `String.format` — through SLF4J or log4j 2, so the logger receives one finished string: the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the level is filtered out. Pass a constant pattern and the values beside it instead: `log.error("Order {} moved to {}", orderId, status)`, which keeps the pattern and its arguments apart on the event for a structured encoder (logstash-logback-encoder, log4j 2's JsonTemplateLayout, OpenTelemetry), or `log.atInfo().addKeyValue("order_id", orderId).log("order moved")` with SLF4J 2's fluent API. An exception goes last, as the throwable argument, not into the text. — client/src/main/java/org/apache/rocketmq/client/consumer/store/RemoteBrokerOffsetStore.java:134
`error` at line 162 is handed a message assembled at the call — a string concatenated with a value, or `String.format` — through SLF4J or log4j 2, so the logger receives one finished string: the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the level is filtered out. Pass a constant pattern and the values beside it instead: `log.error("Order {} moved to {}", orderId, status)`, which keeps the pattern and its arguments apart on the event for a structured encoder (logstash-logback-encoder, log4j 2's JsonTemplateLayout, OpenTelemetry), or `log.atInfo().addKeyValue("order_id", orderId).log("order moved")` with SLF4J 2's fluent API. An exception goes last, as the throwable argument, not into the text. — client/src/main/java/org/apache/rocketmq/client/consumer/store/RemoteBrokerOffsetStore.java:162
`error` at line 150 is handed a message assembled at the call — a string concatenated with a value, or `String.format` — through SLF4J or log4j 2, so the logger receives one finished string: the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the level is filtered out. Pass a constant pattern and the values beside it instead: `log.error("Order {} moved to {}", orderId, status)`, which keeps the pattern and its arguments apart on the event for a structured encoder (logstash-logback-encoder, log4j 2's JsonTemplateLayout, OpenTelemetry), or `log.atInfo().addKeyValue("order_id", orderId).log("order moved")` with SLF4J 2's fluent API. An exception goes last, as the throwable argument, not into the text. — client/src/main/java/org/apache/rocketmq/client/consumer/store/LocalFileOffsetStore.java:150
`info` at line 294 is handed a message assembled at the call — a string concatenated with a value, or `String.format` — through SLF4J or log4j 2, so the logger receives one finished string: the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the level is filtered out. Pass a constant pattern and the values beside it instead: `log.info("Order {} moved to {}", orderId, status)`, which keeps the pattern and its arguments apart on the event for a structured encoder (logstash-logback-encoder, log4j 2's JsonTemplateLayout, OpenTelemetry), or `log.atInfo().addKeyValue("order_id", orderId).log("order moved")` with SLF4J 2's fluent API. An exception goes last, as the throwable argument, not into the text. — client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:294
`info` at line 310 is handed a message assembled at the call — a string concatenated with a value, or `String.format` — through SLF4J or log4j 2, so the logger receives one finished string: the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the level is filtered out. Pass a constant pattern and the values beside it instead: `log.info("Order {} moved to {}", orderId, status)`, which keeps the pattern and its arguments apart on the event for a structured encoder (logstash-logback-encoder, log4j 2's JsonTemplateLayout, OpenTelemetry), or `log.atInfo().addKeyValue("order_id", orderId).log("order moved")` with SLF4J 2's fluent API. An exception goes last, as the throwable argument, not into the text. — client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:310
`warn` at line 291 is handed a message assembled at the call — a string concatenated with a value, or `String.format` — through SLF4J or log4j 2, so the logger receives one finished string: the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the level is filtered out. Pass a constant pattern and the values beside it instead: `log.warn("Order {} moved to {}", orderId, status)`, which keeps the pattern and its arguments apart on the event for a structured encoder (logstash-logback-encoder, log4j 2's JsonTemplateLayout, OpenTelemetry), or `log.atInfo().addKeyValue("order_id", orderId).log("order moved")` with SLF4J 2's fluent API. An exception goes last, as the throwable argument, not into the text. — client/src/main/java/org/apache/rocketmq/client/impl/ClientRemotingProcessor.java:291
`info` at line 37 is handed a message assembled at the call — a string concatenated with a value, or `String.format` — through SLF4J or log4j 2, so the logger receives one finished string: the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the level is filtered out. Pass a constant pattern and the values beside it instead: `log.info("Order {} moved to {}", orderId, status)`, which keeps the pattern and its arguments apart on the event for a structured encoder (logstash-logback-encoder, log4j 2's JsonTemplateLayout, OpenTelemetry), or `log.atInfo().addKeyValue("order_id", orderId).log("order moved")` with SLF4J 2's fluent API. An exception goes last, as the throwable argument, not into the text. — client/src/main/java/org/apache/rocketmq/client/impl/consumer/RebalanceService.java:37
`info` at line 44 is handed a message assembled at the call — a string concatenated with a value, or `String.format` — through SLF4J or log4j 2, so the logger receives one finished string: the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the level is filtered out. Pass a constant pattern and the values beside it instead: `log.info("Order {} moved to {}", orderId, status)`, which keeps the pattern and its arguments apart on the event for a structured encoder (logstash-logback-encoder, log4j 2's JsonTemplateLayout, OpenTelemetry), or `log.atInfo().addKeyValue("order_id", orderId).log("order moved")` with SLF4J 2's fluent API. An exception goes last, as the throwable argument, not into the text. — client/src/main/java/org/apache/rocketmq/client/impl/consumer/RebalanceService.java:44
`error` at line 93 is handed a message assembled at the call — a string concatenated with a value, or `String.format` — through SLF4J or log4j 2, so the logger receives one finished string: the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the level is filtered out. Pass a constant pattern and the values beside it instead: `log.error("Order {} moved to {}", orderId, status)`, which keeps the pattern and its arguments apart on the event for a structured encoder (logstash-logback-encoder, log4j 2's JsonTemplateLayout, OpenTelemetry), or `log.atInfo().addKeyValue("order_id", orderId).log("order moved")` with SLF4J 2's fluent API. An exception goes last, as the throwable argument, not into the text. — client/src/main/java/org/apache/rocketmq/client/impl/consumer/RebalanceImpl.java:93
`error` at line 127 is handed a message assembled at the call — a string concatenated with a value, or `String.format` — through SLF4J or log4j 2, so the logger receives one finished string: the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the level is filtered out. Pass a constant pattern and the values beside it instead: `log.error("Order {} moved to {}", orderId, status)`, which keeps the pattern and its arguments apart on the event for a structured encoder (logstash-logback-encoder, log4j 2's JsonTemplateLayout, OpenTelemetry), or `log.atInfo().addKeyValue("order_id", orderId).log("order moved")` with SLF4J 2's fluent API. An exception goes last, as the throwable argument, not into the text. — client/src/main/java/org/apache/rocketmq/client/impl/consumer/RebalanceImpl.java:127
Other · Code Health — Whether Java packages are null-marked and not undermined by heavy nullness suppression — a package under `@NullMarked` (or `@NonNullApi`, `@ParametersAreNonnullByDefault`, `@NonNullByDefault`, or a NullAway/Checker Framework configuration naming it) makes an unannotated reference exclude null, and `@SuppressWarnings("NullAway")`, `("nullness")`, `("null")` and `castToNonNull(…)` are what silence it.
Method: Roslyn compiler-options scan: NullableContextOptions per project; null-forgiving (!) suppression density per 1k syntax nodes. Deterministic, adoption plus suppression penalty.
0/222 of this repository's Java package directories are under a non-null default: a `package-info.java` declaring `@NullMarked` (JSpecify) or `@NonNullApi`, `@ParametersAreNonnullByDefault`, `@NonNullByDefault`, `@DefaultQualifier(NonNull.class)`; a `module-info.java` declaring `@NullMarked`; every type in it `@NullMarked`; or a build that runs NullAway with the package in `AnnotatedPackages`, or the Checker Framework's `NullnessChecker`. Elsewhere every reference admits null and no checker warns on the dereference that throws a `NullPointerException`.
What to do
Declare the default where Java declares it: `@NullMarked` (org.jspecify.annotations) in each package's `package-info.java`, or once in `module-info.java`, and run NullAway (Error Prone) or the Checker Framework so the declaration is enforced. Then annotate the real exceptions `@Nullable` and resolve the suppressions rather than adding to them: a `@SuppressWarnings("NullAway")` or `castToNonNull(x)` on a value the checker could show to be null is a `NullPointerException` waiting for the path that makes it true — where the value genuinely cannot be null, say something the checker can see instead (a null check, `Objects.requireNonNull`, a non-null field initialised in the constructor).
Do you agree with this assessment?
Reference — by lens
The score is the rank-weighted fold of these lenses (worst-heaviest), each including its meta-dimensions; a lens with a Critical contributor is capped at Fair (its band reads "gated by …") and is never the strongest area however high its average.
Unscored — 2 check(s) recorded observations but carry no score
These checks ran and found something, but they do not carry a score — either by design (an advisory check reports evidence rather than grading it) or because they could not be scored here. They are excluded from the score for that reason, not because there was nothing to see.
X10 Duplicated predicate — 25 observation(s) recorded · Advisory — this card reports evidence and never carries a score.
X7 Silent fallback defaults — 4 observation(s) recorded · Advisory — this card reports evidence and never carries a score.
Not evidenced — 4 control(s) we could not find positive evidence for
These checks grade a working control, and the repository shows no evidence of one. That is deliberately not scored as a zero: a repository cannot show an ops runbook, a database TTL or an infrastructure-side audit log, so absence of evidence here is not evidence the control is missing. It is also not a statement that the check is irrelevant to this codebase — the thing it grades applies; we just could not see it. Excluded from the score either way.
C3 Audit Trail — Not assessed: these audit controls are read from a source model (declarative annotations, request middleware, entity/column names, guard methods) that was not loaded for this repository — because the repository is written in a language this check does not yet model, or because its projects failed to load. Absence of an idiom this check recognises is NOT evidence that this repository lacks audit controls: it may implement them entirely in its own ecosystem. This is a gap in the analyzer's language coverage, not a finding about this repository.
C4 Data Retention — Not assessed: these retention controls are read from a source model (declarative annotations, request middleware, entity/column names, guard methods) that was not loaded for this repository — because the repository is written in a language this check does not yet model, or because its projects failed to load. Absence of an idiom this check recognises is NOT evidence that this repository lacks retention controls: it may implement them entirely in its own ecosystem. This is a gap in the analyzer's language coverage, not a finding about this repository.
C5 Data-Subject Rights — Not assessed: these data-subject rights controls are read from a source model (declarative annotations, request middleware, entity/column names, guard methods) that was not loaded for this repository — because the repository is written in a language this check does not yet model, or because its projects failed to load. Absence of an idiom this check recognises is NOT evidence that this repository lacks data-subject rights controls: it may implement them entirely in its own ecosystem. This is a gap in the analyzer's language coverage, not a finding about this repository.
P5 DR & Backup — not evidenced — repo shows no backup/RTO/RPO controls; absence of evidence is not evidence of a working control
Not included — 50 check(s) not relevant to this codebase
These checks had nothing to measure here (no tests, no git history, the codebase is small, or the architecture style doesn't apply), so they're omitted above rather than scored low.
AC1 Text alternatives — No web markup found — accessibility is not applicable to this repository.
AC2 Forms & labels — No web markup found — accessibility is not applicable to this repository.
AC3 Page structure — No web markup found — accessibility is not applicable to this repository.
AC4 Keyboard semantics — No web markup found — accessibility is not applicable to this repository.
AC5 ARIA correctness — No web markup found — accessibility is not applicable to this repository.
AC6 Visual & motion safety — No web markup found — accessibility is not applicable to this repository.
AC7 A11y enforcement — No web markup found — accessibility is not applicable to this repository.
AX1 Captive dependencies — not analysed — these correctness checks read a source model that was not loaded for this repository, because the repository is written in a language this check does not yet model, or because its projects failed to load. This is a gap in the analyzer, not a finding about this repository
AX2 Stateful singletons — No container singleton was found, so there is no shared instance for concurrent requests to race on. No class in this Java code is a Spring, JSR-330 or CDI singleton bean. No function in this Python code is served by a threaded web framework (a Flask, Bottle or FastAPI route, a Django or Pyramid view), so no module is shared between request threads.
AX4 Dependency direction — not applicable to a CQRS architecture (the inward-dependency rule is for layered/clean styles)
AX7 Slice cohesion — not applicable — not a vertical-slice architecture
AX8 Test isolation — no test/production split to check
AX9 CQS / query purity — no CQRS query handlers detected — query purity is not applicable to this codebase
AXB1 Runtime evidence locked — no reproducible boot — This repository has nothing the runtime tiers could boot or serve — no markup, no UI framework or web-server dependency, no UI component source, no native UI project and no API definition — nothing here is a surface to boot — so runtime a11y/egress/header evidence has no subject here. Not applicable: this is neither a gap in the scan nor a finding about your code.
C1 Data Protection — Not assessed: these personal data controls are read from a source model (declarative annotations, request middleware, entity/column names, guard methods) that was not loaded for this repository — because the repository is written in a language this check does not yet model, or because its projects failed to load. Absence of an idiom this check recognises is NOT evidence that this repository lacks personal data controls: it may implement them entirely in its own ecosystem. This is a gap in the analyzer's language coverage, not a finding about this repository.
C2 Access Controls — Not assessed: these authorization controls are read from a source model (declarative annotations, request middleware, entity/column names, guard methods) that was not loaded for this repository — because the repository is written in a language this check does not yet model, or because its projects failed to load. Absence of an idiom this check recognises is NOT evidence that this repository lacks authorization controls: it may implement them entirely in its own ecosystem. This is a gap in the analyzer's language coverage, not a finding about this repository.
D11 Test Reliability — Test reliability not included — the .java suite was found but not re-run
D12 Dependency Hygiene — Not scored — 19 Maven/Gradle manifest(s) were read, stating a version for 11 dependency(ies) and leaving 143 to a parent or an imported BOM, but no build resolved the dependency graph, so the outdated signal was not established. NOT a finding that these dependencies are current or healthy.
D14 License Compliance — Not scored — this repository's 11 declared JVM dependency coordinate(s) were read from its 19 Maven/Gradle manifest(s), but Maven Central could not be asked for the licence of 11 of them (HTTP 429 Too Many Requests from https://repo1.maven.org/maven2/junit/junit/4.13.2/junit-4.13.2.pom), and a licence verdict over part of a dependency graph is not a licence verdict. Nothing is asserted about this repository's licensing in either direction.
D16 Bus Factor — dormant codebase — no living knowledge left to concentrate
D18 Solution Shape — D18 scores the shape of a .NET solution; this repository has no .NET solution or project files, so the dimension does not apply.
D20 ADR Quality — N/A — ADRs are expected on deployable products with a user-facing host, not consumed libraries; no ADR log is required here.
D22 Internal API Consistency — The exposed public-API surface could not be collected — no C#/VB projects loaded.
D23 Boundary Type-Coupling — No bounded-context organisation was detected either — neither a context-shaped layout, nor 2+ sibling source directories each declaring an aggregate root, nor 2+ projects each declaring an entity of their own. Declaring this codebase's bounded contexts (≥2) would let cross-boundary type coupling be assessed. Declare them in `.codehealth/config.yaml` at the repository root (create it if absent), mapping each context name to the module-path or namespace prefixes that belong to it — e.g. `architecture:` → `contexts:` → `Billing: ["src/billing", "Acme.Billing"]`, `Catalog: ["src/catalog", "Acme.Catalog"]`.
D24 Comment Value — No inline comments to assess — comment value is not applicable here.
D25 ADR Conformance — no ADRs to check
D31 IaC & Container Security — No Infrastructure-as-Code or container manifests found (Dockerfile, Docker Compose, Terraform, Kubernetes/Helm, CloudFormation, ARM, Bicep, Ansible); nothing to scan.
D32 Data Compliance (PII/GDPR) — 1 file(s) were not parsed by semgrep — the PII/GDPR ruleset never ran over them
D37 Vulnerability-disclosure Policy — No vulnerability-disclosure policy file found (SECURITY.md/.markdown/.rst/.txt at root or under .github/.forgejo/.gitea/docs, .well-known/security.txt). A coordinated-disclosure policy may live off-repo, so this is not evidenced rather than failed.
D39 IL Efficiency — D39 measures the IL emitted by a .NET build; this repository has no .NET solution or project files, so the dimension does not apply.
D40 Network Egress Confinement — No Kubernetes/orchestration workloads found in the repository manifests; network egress policy is a cluster-native control that may live at the platform/firewall layer, so there is nothing to assess here.
D41 Kernel & Syscall Confinement — No Kubernetes/orchestration workloads found in the repository manifests; seccomp/AppArmor/SELinux confinement is a workload-level control, so there is nothing to assess here.
D42 Runtime Threat Enforcement — No Kubernetes/orchestration workloads found in the repository manifests; runtime threat-detection and admission-control policy are cluster-level controls, so there is nothing to assess here.
D7 Architectural Integrity — no checkable ADRs, and no project-reference graph for the cycle pass to read — so this dimension makes no claim about dependency cycles in either direction (where this repository's language has an import-cycle lens, cycles are reported there). Architectural integrity not assessed
D8 Code Coverage — Coverage not included — suite not readable by the collector
DM1 Domain Modelling — applicable but not scored (3 signals for this style, 3 needed — the count is met but a required primary signal is absent): 38 value object(s); 4 domain event(s); its domain events are published by services or handlers — no domain entity raises one; a Domain/Aggregates/ValueObjects layer; a domain structure with no aggregate, domain event or strongly-typed id in it: a CRUD / clean-architecture model, measured but not claimed as DDD; a top-level example/ tree: a library or framework whose examples are its consumers — these types are building blocks, not a domain
ED1 Event-Driven — not scored — this repository shows only 1 of the 3 signals this lens looks for (1 CQRS handler(s))
ED5 Idempotency — Not assessed, and this one is on us: 1 command handler(s) or message consumer(s) were found here, but this check does not yet recognise persistence writes in this repository's language. Idempotency was neither confirmed nor ruled out — this is a limit of the analyzer, not a finding about your code.
ES1 Event Sourcing — not scored — this repository shows none of the 3 signals this lens looks for
GD1 Unfinished & placeholder code — no source files were read — this check reads C#, F#, JavaScript/TypeScript, Dart, Ruby and Scala, and none was read for this repository's product. That is a limit of the analyzer, not a finding about your code.
P12 CI test-gate honesty — Reported, not scored — this card publishes what the CI gate does with the test inventory rather than grading it. The findings above are its output.
P7 Outbound HTTP resilience — not applicable — no HTTP server, API framework or worker entry point was found in the JVM, Python source, so there is no service whose uptime a failing dependency could take down
P8 Schema migrations — no ORM, schema-migration tool or schema auto-create was found in this repository's dependency manifests or source, so there is no database schema for this check to judge
P9 Domain vs controller coverage — no coverage report found on disk — produce a coverage report in a standard format (JaCoCo XML — `mvn jacoco:report`) and commit it — a hosted scan measures a clone of the repository, so a report that exists only in a working tree, a CI runner's or your own, never reaches it; the artefact is commonly gitignored, so `git add -f` that one file (or un-ignore its path) and commit it alongside the code it measures, or wire coverage collection into CI, to enable this cross-layer check
PF3 Async & latency hygiene — Not applicable: this repository declares no async functions, so there is no asynchronous code for a blocking call to stall.
S1 Web-Security Posture — Not assessed: these web-security controls are read from a source model (declarative annotations, request middleware, entity/column names, guard methods) that was not loaded for this repository — because the repository is written in a language this check does not yet model, or because its projects failed to load. Absence of an idiom this check recognises is NOT evidence that this repository lacks web-security controls: it may implement them entirely in its own ecosystem. This is a gap in the analyzer's language coverage, not a finding about this repository.
X2 Cancellation propagation — no C# was loaded; this repository's Java and Python were read, and no request in it can be cancelled by a caller — a Java request off Android takes no token: it is cancelled through the handle it returns (Future.cancel, Call.cancel, a Disposable), ambiently (io.grpc.Context) or by interrupting its thread, not through a parameter; a Python request takes no token: asyncio cancels the task and trio or anyio the scope that made it, from outside the call, and requests, httpx, aiohttp and gRPC take a timeout, not a cancellation
X32 Type resolved by simple name across every loaded assembly — This check is about how a .NET program searches the assemblies loaded into its process for a type, and this repository contains no .NET source, so there is nothing here for it to assess. Not a gap in the analyzer and not a finding about your code.
X6 Hand-rolled structured-format parsing — Advisory — this card reports evidence and never carries a score, so there is nothing missing here.
X9 Subsumed condition operand — Advisory — this card reports evidence and never carries a score, so there is nothing missing here.
Appendix A — Findings (grouped)
The findings behind the scores, grouped by severity, then by dimension and kind. The high-severity issues are enumerated in full below; items per group are capped at 25 with any overflow stated explicitly per group, never silently truncated. The complete machine-readable list of every finding (all severities) is the companion findings.md in this report's bundle.
D10 · Test Quality· No assertions (empty test) · ×2
No assertions (empty test): itWorks namesrv/src/test/java/org/apache/rocketmq/namesrv/NameServerInstanceTest.java:45— Test method has an empty body — it asserts nothing and exercises no code.
No assertions (empty test): test remoting/src/test/java/org/apache/rocketmq/remoting/protocol/statictopic/TopicQueueMappingTest.java:74— Test method has an empty body — it asserts nothing and exercises no code.
No assertions: calSignatureExceptionTest acl/src/test/java/org/apache/rocketmq/acl/common/AclSignerTest.java:25— This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure* — so verification routed through a helper of your own naming, through a base-class or callback object whose members hold the assertions, or through a harness that fails by throwing under some other name, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
No assertions: checkResourcePermsExceptionTest1 acl/src/test/java/org/apache/rocketmq/acl/common/PermissionTest.java:179— This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure* — so verification routed through a helper of your own naming, through a base-class or callback object whose members hold the assertions, or through a harness that fails by throwing under some other name, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
No assertions: checkResourcePermsExceptionTest2 acl/src/test/java/org/apache/rocketmq/acl/common/PermissionTest.java:184— This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure* — so verification routed through a helper of your own naming, through a base-class or callback object whose members hold the assertions, or through a harness that fails by throwing under some other name, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
No assertions: checkResourcePermsExceptionTest3 acl/src/test/java/org/apache/rocketmq/acl/common/PermissionTest.java:189— This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure* — so verification routed through a helper of your own naming, through a base-class or callback object whose members hold the assertions, or through a harness that fails by throwing under some other name, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
No assertions: checkResourcePermsNormalTest acl/src/test/java/org/apache/rocketmq/acl/common/PermissionTest.java:171— This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure* — so verification routed through a helper of your own naming, through a base-class or callback object whose members hold the assertions, or through a harness that fails by throwing under some other name, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
No assertions: updateContentTest acl/src/test/java/org/apache/rocketmq/acl/common/SessionCredentialsTest.java:35— This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure* — so verification routed through a helper of your own naming, through a base-class or callback object whose members hold the assertions, or through a harness that fails by throwing under some other name, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
No assertions: testBothAclFileAndFolderCase acl/src/test/java/org/apache/rocketmq/acl/plain/PlainAccessControlFlowTest.java:93— This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure* — so verification routed through a helper of your own naming, through a base-class or callback object whose members hold the assertions, or through a harness that fails by throwing under some other name, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
No assertions: testEmptyAclFolderCase acl/src/test/java/org/apache/rocketmq/acl/plain/PlainAccessControlFlowTest.java:68— This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure* — so verification routed through a helper of your own naming, through a base-class or callback object whose members hold the assertions, or through a harness that fails by throwing under some other name, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
No assertions: testOnlyAclFolderCase acl/src/test/java/org/apache/rocketmq/acl/plain/PlainAccessControlFlowTest.java:81— This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure* — so verification routed through a helper of your own naming, through a base-class or callback object whose members hold the assertions, or through a harness that fails by throwing under some other name, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
No assertions: createAndUpdateAccessAclNullSkExceptionTest acl/src/test/java/org/apache/rocketmq/acl/plain/PlainAccessValidatorTest.java:818— This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure* — so verification routed through a helper of your own naming, through a base-class or callback object whose members hold the assertions, or through a harness that fails by throwing under some other name, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
No assertions: validateForAdminCommandWithOutAclRPCHook acl/src/test/java/org/apache/rocketmq/acl/plain/PlainAccessValidatorTest.java:218— This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure* — so verification routed through a helper of your own naming, through a base-class or callback object whose members hold the assertions, or through a harness that fails by throwing under some other name, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
No assertions: accountNullTest acl/src/test/java/org/apache/rocketmq/acl/plain/PlainPermissionManagerTest.java:181— This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure* — so verification routed through a helper of your own naming, through a base-class or callback object whose members hold the assertions, or through a harness that fails by throwing under some other name, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
No assertions: accountThanTest acl/src/test/java/org/apache/rocketmq/acl/plain/PlainPermissionManagerTest.java:187— This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure* — so verification routed through a helper of your own naming, through a base-class or callback object whose members hold the assertions, or through a harness that fails by throwing under some other name, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
No assertions: checkErrorPermDefaultValueNotMatch acl/src/test/java/org/apache/rocketmq/acl/plain/PlainPermissionManagerTest.java:173— This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure* — so verification routed through a helper of your own naming, through a base-class or callback object whose members hold the assertions, or through a harness that fails by throwing under some other name, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
No assertions: checkPerm acl/src/test/java/org/apache/rocketmq/acl/plain/PlainPermissionManagerTest.java:156— This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure* — so verification routed through a helper of your own naming, through a base-class or callback object whose members hold the assertions, or through a harness that fails by throwing under some other name, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
No assertions: checkPermAdmin acl/src/test/java/org/apache/rocketmq/acl/plain/PlainPermissionManagerTest.java:149— This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure* — so verification routed through a helper of your own naming, through a base-class or callback object whose members hold the assertions, or through a harness that fails by throwing under some other name, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
No assertions: deleteAccessConfigTest acl/src/test/java/org/apache/rocketmq/acl/plain/PlainPermissionManagerTest.java:351— This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure* — so verification routed through a helper of your own naming, through a base-class or callback object whose members hold the assertions, or through a harness that fails by throwing under some other name, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
No assertions: passWordThanTest acl/src/test/java/org/apache/rocketmq/acl/plain/PlainPermissionManagerTest.java:199— This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure* — so verification routed through a helper of your own naming, through a base-class or callback object whose members hold the assertions, or through a harness that fails by throwing under some other name, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
No assertions: passWordtNullTest acl/src/test/java/org/apache/rocketmq/acl/plain/PlainPermissionManagerTest.java:193— This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure* — so verification routed through a helper of your own naming, through a base-class or callback object whose members hold the assertions, or through a harness that fails by throwing under some other name, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
No assertions: multipleNetAddressStrategyExceptionTest acl/src/test/java/org/apache/rocketmq/acl/plain/RemoteAddressStrategyTest.java:195— This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure* — so verification routed through a helper of your own naming, through a base-class or callback object whose members hold the assertions, or through a harness that fails by throwing under some other name, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
No assertions: rangeNetAddressStrategyExceptionScopeTest acl/src/test/java/org/apache/rocketmq/acl/plain/RemoteAddressStrategyTest.java:364— This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure* — so verification routed through a helper of your own naming, through a base-class or callback object whose members hold the assertions, or through a harness that fails by throwing under some other name, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
No assertions: rangeNetAddressStrategyExceptionScopeTwoTest acl/src/test/java/org/apache/rocketmq/acl/plain/RemoteAddressStrategyTest.java:369— This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure* — so verification routed through a helper of your own naming, through a base-class or callback object whose members hold the assertions, or through a harness that fails by throwing under some other name, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
No assertions: rangeNetAddressStrategyExceptionStartGreaterEndTest acl/src/test/java/org/apache/rocketmq/acl/plain/RemoteAddressStrategyTest.java:359— This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure* — so verification routed through a helper of your own naming, through a base-class or callback object whose members hold the assertions, or through a harness that fails by throwing under some other name, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
No assertions: rangeNetAddressStrategyTest acl/src/test/java/org/apache/rocketmq/acl/plain/RemoteAddressStrategyTest.java:262— This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure* — so verification routed through a helper of your own naming, through a base-class or callback object whose members hold the assertions, or through a harness that fails by throwing under some other name, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
No assertions: verifyTest acl/src/test/java/org/apache/rocketmq/acl/plain/RemoteAddressStrategyTest.java:106— This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure* — so verification routed through a helper of your own naming, through a base-class or callback object whose members hold the assertions, or through a harness that fails by throwing under some other name, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
TooManyMethods: BrokerConfig common/src/main/java/org/apache/rocketmq/common/BrokerConfig.java:28— TooManyMethods — 342 methods. The bar is 30 methods; this is 312 over it, 11.40× the bar. This type is on a published API surface — a Clirr binary-compatibility gate (REDACTED) declares its compatibility contractual — so moving members onto a smaller type is a breaking change for every consumer, not a local refactor. To reduce it, treat the split as an API migration: move each cohesive group onto its own published type and keep the old members as deprecated forwards for a deprecation period, removing them at the next compatibility break. Where the surface has to stay as it is, that is a decision to record rather than a change to make.
TooManyMethods: MessageStoreConfig store/src/main/java/org/apache/rocketmq/store/config/MessageStoreConfig.java:26— TooManyMethods — 341 methods. The bar is 30 methods; this is 311 over it, 11.37× the bar. This type is on a published API surface — a Clirr binary-compatibility gate (REDACTED) declares its compatibility contractual — so moving members onto a smaller type is a breaking change for every consumer, not a local refactor. To reduce it, treat the split as an API migration: move each cohesive group onto its own published type and keep the old members as deprecated forwards for a deprecation period, removing them at the next compatibility break. Where the surface has to stay as it is, that is a decision to record rather than a change to make.
TooManyMethods: ProxyConfig proxy/src/main/java/org/apache/rocketmq/proxy/config/ProxyConfig.java:41— TooManyMethods — 292 methods. The bar is 30 methods; this is 262 over it, 9.73× the bar. This type is on a published API surface — a Clirr binary-compatibility gate (REDACTED) declares its compatibility contractual — so moving members onto a smaller type is a breaking change for every consumer, not a local refactor. To reduce it, treat the split as an API migration: move each cohesive group onto its own published type and keep the old members as deprecated forwards for a deprecation period, removing them at the next compatibility break. Where the surface has to stay as it is, that is a decision to record rather than a change to make.
TooManyMethods: DefaultMessageStore store/src/main/java/org/apache/rocketmq/store/DefaultMessageStore.java:116— TooManyMethods — 162 methods. The bar is 30 methods; this is 132 over it, 5.40× the bar. Most of these members implement store.MessageStore (110 of 155 members), so moving them onto a smaller type would remove them from that contract rather than reduce it. To reduce it, split the contract instead: give each cohesive group of operations its own smaller interface and its own implementing type. Where the contract has to stay whole, move the work behind these members into collaborator types, so what is left here is a forward per member rather than a responsibility per member.
TooManyMethods: BrokerController broker/src/main/java/org/apache/rocketmq/broker/BrokerController.java:170— TooManyMethods — 158 methods. The bar is 30 methods; this is 128 over it, 5.27× the bar. This type is on a published API surface — a Clirr binary-compatibility gate (REDACTED) declares its compatibility contractual — so moving members onto a smaller type is a breaking change for every consumer, not a local refactor. To reduce it, treat the split as an API migration: move each cohesive group onto its own published type and keep the old members as deprecated forwards for a deprecation period, removing them at the next compatibility break. Where the surface has to stay as it is, that is a decision to record rather than a change to make.
TooManyMethods: MQClientAPIImpl client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:230— TooManyMethods — 130 methods. The bar is 30 methods; this is 100 over it, 4.33× the bar. This type is on a published API surface — a Clirr binary-compatibility gate (REDACTED) declares its compatibility contractual — so moving members onto a smaller type is a breaking change for every consumer, not a local refactor. To reduce it, treat the split as an API migration: move each cohesive group onto its own published type and keep the old members as deprecated forwards for a deprecation period, removing them at the next compatibility break. Where the surface has to stay as it is, that is a decision to record rather than a change to make.
TooManyMethods: DefaultMQAdminExt tools/src/main/java/org/apache/rocketmq/tools/admin/DefaultMQAdminExt.java:76— TooManyMethods — 128 methods. The bar is 30 methods; this is 98 over it, 4.27× the bar. Most of these members implement admin.MQAdminExt (94 of 108 members), so moving them onto a smaller type would remove them from that contract rather than reduce it. To reduce it, split the contract instead: give each cohesive group of operations its own smaller interface and its own implementing type. Where the contract has to stay whole, move the work behind these members into collaborator types, so what is left here is a forward per member rather than a responsibility per member.
TooManyMethods: DefaultMQAdminExtImpl tools/src/main/java/org/apache/rocketmq/tools/admin/DefaultMQAdminExtImpl.java:124— TooManyMethods — 127 methods. The bar is 30 methods; this is 97 over it, 4.23× the bar. Most of these members implement admin.MQAdminExt (94 of 109 members), so moving them onto a smaller type would remove them from that contract rather than reduce it. To reduce it, split the contract instead: give each cohesive group of operations its own smaller interface and its own implementing type. Where the contract has to stay whole, move the work behind these members into collaborator types, so what is left here is a forward per member rather than a responsibility per member.
TooManyMethods: AbstractPluginMessageStore store/src/main/java/org/apache/rocketmq/store/plugin/AbstractPluginMessageStore.java:65— TooManyMethods — 117 methods. The bar is 30 methods; this is 87 over it, 3.90× the bar. Most of these members implement store.MessageStore (110 of 111 members), so moving them onto a smaller type would remove them from that contract rather than reduce it. To reduce it, split the contract instead: give each cohesive group of operations its own smaller interface and its own implementing type. Where the contract has to stay whole, move the work behind these members into collaborator types, so what is left here is a forward per member rather than a responsibility per member.
TooManyMethods: DefaultMQProducer client/src/main/java/org/apache/rocketmq/client/producer/DefaultMQProducer.java:64— TooManyMethods — 107 methods. The bar is 30 methods; this is 77 over it, 3.57× the bar. This type is on a published API surface — a Clirr binary-compatibility gate (REDACTED) declares its compatibility contractual — so moving members onto a smaller type is a breaking change for every consumer, not a local refactor. To reduce it, treat the split as an API migration: move each cohesive group onto its own published type and keep the old members as deprecated forwards for a deprecation period, removing them at the next compatibility break. Where the surface has to stay as it is, that is a decision to record rather than a change to make.
TooManyMethods: DefaultMQPushConsumer client/src/main/java/org/apache/rocketmq/client/consumer/DefaultMQPushConsumer.java:65— TooManyMethods — 103 methods. The bar is 30 methods; this is 73 over it, 3.43× the bar. This type is on a published API surface — a Clirr binary-compatibility gate (REDACTED) declares its compatibility contractual — so moving members onto a smaller type is a breaking change for every consumer, not a local refactor. To reduce it, treat the split as an API migration: move each cohesive group onto its own published type and keep the old members as deprecated forwards for a deprecation period, removing them at the next compatibility break. Where the surface has to stay as it is, that is a decision to record rather than a change to make.
TooManyMethods: DefaultMQProducerImpl client/src/main/java/org/apache/rocketmq/client/impl/producer/DefaultMQProducerImpl.java:101— TooManyMethods — 97 methods. The bar is 30 methods; this is 67 over it, 3.23× the bar. This type is on a published API surface — a Clirr binary-compatibility gate (REDACTED) declares its compatibility contractual — so moving members onto a smaller type is a breaking change for every consumer, not a local refactor. To reduce it, treat the split as an API migration: move each cohesive group onto its own published type and keep the old members as deprecated forwards for a deprecation period, removing them at the next compatibility break. Where the surface has to stay as it is, that is a decision to record rather than a change to make.
TooManyMethods: DefaultMQPushConsumerImpl client/src/main/java/org/apache/rocketmq/client/impl/consumer/DefaultMQPushConsumerImpl.java:97— TooManyMethods — 86 methods. The bar is 30 methods; this is 56 over it, 2.87× the bar. This type is on a published API surface — a Clirr binary-compatibility gate (REDACTED) declares its compatibility contractual — so moving members onto a smaller type is a breaking change for every consumer, not a local refactor. To reduce it, treat the split as an API migration: move each cohesive group onto its own published type and keep the old members as deprecated forwards for a deprecation period, removing them at the next compatibility break. Where the surface has to stay as it is, that is a decision to record rather than a change to make.
TooManyMethods: DefaultLitePullConsumer client/src/main/java/org/apache/rocketmq/client/consumer/DefaultLitePullConsumer.java:44— TooManyMethods — 84 methods. The bar is 30 methods; this is 54 over it, 2.80× the bar. This type is on a published API surface — a Clirr binary-compatibility gate (REDACTED) declares its compatibility contractual — so moving members onto a smaller type is a breaking change for every consumer, not a local refactor. To reduce it, treat the split as an API migration: move each cohesive group onto its own published type and keep the old members as deprecated forwards for a deprecation period, removing them at the next compatibility break. Where the surface has to stay as it is, that is a decision to record rather than a change to make.
TooManyMethods: TimerMessageStore store/src/main/java/org/apache/rocketmq/store/timer/TimerMessageStore.java:74— TooManyMethods — 83 methods. The bar is 30 methods; this is 53 over it, 2.77× the bar. This type is on a published API surface — a Clirr binary-compatibility gate (REDACTED) declares its compatibility contractual — so moving members onto a smaller type is a breaking change for every consumer, not a local refactor. To reduce it, treat the split as an API migration: move each cohesive group onto its own published type and keep the old members as deprecated forwards for a deprecation period, removing them at the next compatibility break. Where the surface has to stay as it is, that is a decision to record rather than a change to make.
TooManyMethods: AdminBrokerProcessor broker/src/main/java/org/apache/rocketmq/broker/processor/AdminBrokerProcessor.java:194— TooManyMethods — 80 methods. The bar is 30 methods; this is 50 over it, 2.67× the bar. This type is on a published API surface — a Clirr binary-compatibility gate (REDACTED) declares its compatibility contractual — so moving members onto a smaller type is a breaking change for every consumer, not a local refactor. To reduce it, treat the split as an API migration: move each cohesive group onto its own published type and keep the old members as deprecated forwards for a deprecation period, removing them at the next compatibility break. Where the surface has to stay as it is, that is a decision to record rather than a change to make.
TooManyMethods: DefaultLitePullConsumerImpl client/src/main/java/org/apache/rocketmq/client/impl/consumer/DefaultLitePullConsumerImpl.java:79— TooManyMethods — 79 methods. The bar is 30 methods; this is 49 over it, 2.63× the bar. This type is on a published API surface — a Clirr binary-compatibility gate (REDACTED) declares its compatibility contractual — so moving members onto a smaller type is a breaking change for every consumer, not a local refactor. To reduce it, treat the split as an API migration: move each cohesive group onto its own published type and keep the old members as deprecated forwards for a deprecation period, removing them at the next compatibility break. Where the surface has to stay as it is, that is a decision to record rather than a change to make.
TooManyMethods: CommitLog store/src/main/java/org/apache/rocketmq/store/CommitLog.java:72— TooManyMethods — 69 methods. The bar is 30 methods; this is 39 over it, 2.30× the bar. This type is on a published API surface — a Clirr binary-compatibility gate (REDACTED) declares its compatibility contractual — so moving members onto a smaller type is a breaking change for every consumer, not a local refactor. To reduce it, treat the split as an API migration: move each cohesive group onto its own published type and keep the old members as deprecated forwards for a deprecation period, removing them at the next compatibility break. Where the surface has to stay as it is, that is a decision to record rather than a change to make.
TooManyMethods: DefaultMQPullConsumerImpl client/src/main/java/org/apache/rocketmq/client/impl/consumer/DefaultMQPullConsumerImpl.java:74— TooManyMethods — 67 methods. The bar is 30 methods; this is 37 over it, 2.23× the bar. This type is on a published API surface — a Clirr binary-compatibility gate (REDACTED) declares its compatibility contractual — so moving members onto a smaller type is a breaking change for every consumer, not a local refactor. To reduce it, treat the split as an API migration: move each cohesive group onto its own published type and keep the old members as deprecated forwards for a deprecation period, removing them at the next compatibility break. Where the surface has to stay as it is, that is a decision to record rather than a change to make.
TooManyMethods: TieredMessageStoreConfig tieredstore/src/main/java/org/apache/rocketmq/tieredstore/common/TieredMessageStoreConfig.java:23— TooManyMethods — 67 methods. The bar is 30 methods; this is 37 over it, 2.23× the bar. This type is on a published API surface — a Clirr binary-compatibility gate (REDACTED) declares its compatibility contractual — so moving members onto a smaller type is a breaking change for every consumer, not a local refactor. To reduce it, treat the split as an API migration: move each cohesive group onto its own published type and keep the old members as deprecated forwards for a deprecation period, removing them at the next compatibility break. Where the surface has to stay as it is, that is a decision to record rather than a change to make.
TooManyMethods: BrokerStatsManager store/src/main/java/org/apache/rocketmq/store/stats/BrokerStatsManager.java:43— TooManyMethods — 65 methods. The bar is 30 methods; this is 35 over it, 2.17× the bar. This type is on a published API surface — a Clirr binary-compatibility gate (REDACTED) declares its compatibility contractual — so moving members onto a smaller type is a breaking change for every consumer, not a local refactor. To reduce it, treat the split as an API migration: move each cohesive group onto its own published type and keep the old members as deprecated forwards for a deprecation period, removing them at the next compatibility break. Where the surface has to stay as it is, that is a decision to record rather than a change to make.
TooManyMethods: SendMessageContext broker/src/main/java/org/apache/rocketmq/broker/mqtrace/SendMessageContext.java:24— TooManyMethods — 64 methods. The bar is 30 methods; this is 34 over it, 2.13× the bar. This type is on a published API surface — a Clirr binary-compatibility gate (REDACTED) declares its compatibility contractual — so moving members onto a smaller type is a breaking change for every consumer, not a local refactor. To reduce it, treat the split as an API migration: move each cohesive group onto its own published type and keep the old members as deprecated forwards for a deprecation period, removing them at the next compatibility break. Where the surface has to stay as it is, that is a decision to record rather than a change to make.
TooManyMethods: DefaultMappedFile store/src/main/java/org/apache/rocketmq/store/logfile/DefaultMappedFile.java:61— TooManyMethods — 64 methods. The bar is 30 methods; this is 34 over it, 2.13× the bar. Most of these members implement logfile.MappedFile (39 of 56 members), so moving them onto a smaller type would remove them from that contract rather than reduce it. To reduce it, split the contract instead: give each cohesive group of operations its own smaller interface and its own implementing type. Where the contract has to stay whole, move the work behind these members into collaborator types, so what is left here is a forward per member rather than a responsibility per member.
TooManyMethods: BrokerOuterAPI broker/src/main/java/org/apache/rocketmq/broker/out/BrokerOuterAPI.java:145— TooManyMethods — 63 methods. The bar is 30 methods; this is 33 over it, 2.10× the bar. This type is on a published API surface — a Clirr binary-compatibility gate (REDACTED) declares its compatibility contractual — so moving members onto a smaller type is a breaking change for every consumer, not a local refactor. To reduce it, treat the split as an API migration: move each cohesive group onto its own published type and keep the old members as deprecated forwards for a deprecation period, removing them at the next compatibility break. Where the surface has to stay as it is, that is a decision to record rather than a change to make.
TooManyMethods: ClientConfig client/src/main/java/org/apache/rocketmq/client/ClientConfig.java:36— TooManyMethods — 63 methods. The bar is 30 methods; this is 33 over it, 2.10× the bar. This type is on a published API surface — a Clirr binary-compatibility gate (REDACTED) declares its compatibility contractual — so moving members onto a smaller type is a breaking change for every consumer, not a local refactor. To reduce it, treat the split as an API migration: move each cohesive group onto its own published type and keep the old members as deprecated forwards for a deprecation period, removing them at the next compatibility break. Where the surface has to stay as it is, that is a decision to record rather than a change to make.
Duplicated block (9 lines × 2) broker/src/main/java/org/apache/rocketmq/broker/metrics/ConsumerLagCalculator.java:322— broker/src/main/java/org/apache/rocketmq/broker/metrics/ConsumerLagCalculator.java:322-330 | broker/src/main/java/org/apache/rocketmq/broker/metrics/ConsumerLagCalculator.java:377-385 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `broker/src/main/java/org/apache/rocketmq/broker/metrics/ConsumerLagCalculator.java:322` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
Duplicated block (9 lines × 2) broker/src/main/java/org/apache/rocketmq/broker/offset/ConsumerOffsetManager.java:77— broker/src/main/java/org/apache/rocketmq/broker/offset/ConsumerOffsetManager.java:77-85 | broker/src/main/java/org/apache/rocketmq/broker/offset/ConsumerOffsetManager.java:93-101 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `broker/src/main/java/org/apache/rocketmq/broker/offset/ConsumerOffsetManager.java:77` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (9 lines × 2) broker/src/main/java/org/apache/rocketmq/broker/out/BrokerOuterAPI.java:1451— broker/src/main/java/org/apache/rocketmq/broker/out/BrokerOuterAPI.java:1451-1459 | client/src/main/java/org/apache/rocketmq/client/impl/consumer/PullAPIWrapper.java:131-139 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `broker/src/main/java/org/apache/rocketmq/broker/out/BrokerOuterAPI.java:1451` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note first that the copies are not typed on the same thing: the declarations holding them bind `pullResult` to `PullResultExt` in one and `PullResult` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
Duplicated block (9 lines × 2) broker/src/main/java/org/apache/rocketmq/broker/processor/AdminBrokerProcessor.java:2634— broker/src/main/java/org/apache/rocketmq/broker/processor/AdminBrokerProcessor.java:2634-2642 | broker/src/main/java/org/apache/rocketmq/broker/transaction/queue/DefaultTransactionalMessageCheckListener.java:72-80 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `broker/src/main/java/org/apache/rocketmq/broker/processor/AdminBrokerProcessor.java:2634` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
Duplicated block (9 lines × 2) broker/src/main/java/org/apache/rocketmq/broker/processor/DefaultPullMessageResultHandler.java:149— broker/src/main/java/org/apache/rocketmq/broker/processor/DefaultPullMessageResultHandler.java:149-157 | broker/src/main/java/org/apache/rocketmq/broker/processor/PeekMessageProcessor.java:195-203 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `broker/src/main/java/org/apache/rocketmq/broker/processor/DefaultPullMessageResultHandler.java:149` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (9 lines × 2) broker/src/main/java/org/apache/rocketmq/broker/processor/EndTransactionProcessor.java:129— broker/src/main/java/org/apache/rocketmq/broker/processor/EndTransactionProcessor.java:129-137 | broker/src/main/java/org/apache/rocketmq/broker/processor/EndTransactionProcessor.java:154-162 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `broker/src/main/java/org/apache/rocketmq/broker/processor/EndTransactionProcessor.java:129` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (9 lines × 2) broker/src/main/java/org/apache/rocketmq/broker/processor/EndTransactionProcessor.java:288— broker/src/main/java/org/apache/rocketmq/broker/processor/EndTransactionProcessor.java:288-296 | broker/src/main/java/org/apache/rocketmq/broker/processor/SendMessageProcessor.java:396-404 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `broker/src/main/java/org/apache/rocketmq/broker/processor/EndTransactionProcessor.java:288` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (9 lines × 2) broker/src/main/java/org/apache/rocketmq/broker/processor/PopReviveService.java:372— broker/src/main/java/org/apache/rocketmq/broker/processor/PopReviveService.java:372-380 | broker/src/main/java/org/apache/rocketmq/broker/processor/PopReviveService.java:397-405 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `broker/src/main/java/org/apache/rocketmq/broker/processor/PopReviveService.java:372` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (9 lines × 2) broker/src/main/java/org/apache/rocketmq/broker/subscription/SubscriptionGroupManager.java:332— broker/src/main/java/org/apache/rocketmq/broker/subscription/SubscriptionGroupManager.java:332-340 | broker/src/main/java/org/apache/rocketmq/broker/topic/TopicConfigManager.java:572-580 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `broker/src/main/java/org/apache/rocketmq/broker/subscription/SubscriptionGroupManager.java:332` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (9 lines × 2) client/src/main/java/org/apache/rocketmq/client/consumer/rebalance/AllocateMachineRoomNearby.java:68— client/src/main/java/org/apache/rocketmq/client/consumer/rebalance/AllocateMachineRoomNearby.java:68-76 | client/src/main/java/org/apache/rocketmq/client/consumer/rebalance/AllocateMachineRoomNearby.java:82-90 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `client/src/main/java/org/apache/rocketmq/client/consumer/rebalance/AllocateMachineRoomNearby.java:68` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (9 lines × 2) client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:388— client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:388-396 | client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:3049-3057 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (9 lines × 2) client/src/main/java/org/apache/rocketmq/client/impl/consumer/ConsumeMessageConcurrentlyService.java:420— client/src/main/java/org/apache/rocketmq/client/impl/consumer/ConsumeMessageConcurrentlyService.java:420-428 | client/src/main/java/org/apache/rocketmq/client/impl/consumer/ConsumeMessageOrderlyService.java:519-527 — before extracting anything, compare `client/src/main/java/org/apache/rocketmq/client/impl/consumer/ConsumeMessageConcurrentlyService.java` and `client/src/main/java/org/apache/rocketmq/client/impl/consumer/ConsumeMessageOrderlyService.java` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 47 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `client/src/main/java/org/apache/rocketmq/client/impl/consumer/ConsumeMessageConcurrentlyService.java:420` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (9 lines × 2) client/src/main/java/org/apache/rocketmq/client/impl/consumer/DefaultLitePullConsumerImpl.java:746— client/src/main/java/org/apache/rocketmq/client/impl/consumer/DefaultLitePullConsumerImpl.java:746-754 | client/src/main/java/org/apache/rocketmq/client/impl/consumer/DefaultLitePullConsumerImpl.java:787-795 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `client/src/main/java/org/apache/rocketmq/client/impl/consumer/DefaultLitePullConsumerImpl.java:746` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (9 lines × 2) client/src/main/java/org/apache/rocketmq/client/impl/consumer/PopRequest.java:107— client/src/main/java/org/apache/rocketmq/client/impl/consumer/PopRequest.java:107-115 | client/src/main/java/org/apache/rocketmq/client/impl/consumer/PullRequest.java:79-87 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `client/src/main/java/org/apache/rocketmq/client/impl/consumer/PopRequest.java:107` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (9 lines × 2) client/src/main/java/org/apache/rocketmq/client/impl/consumer/RebalanceImpl.java:102— client/src/main/java/org/apache/rocketmq/client/impl/consumer/RebalanceImpl.java:102-110 | client/src/main/java/org/apache/rocketmq/client/impl/consumer/RebalanceImpl.java:193-201 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `client/src/main/java/org/apache/rocketmq/client/impl/consumer/RebalanceImpl.java:102` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (9 lines × 2) client/src/main/java/org/apache/rocketmq/client/impl/factory/MQClientInstance.java:1040— client/src/main/java/org/apache/rocketmq/client/impl/factory/MQClientInstance.java:1040-1048 | client/src/main/java/org/apache/rocketmq/client/impl/factory/MQClientInstance.java:1085-1093 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `client/src/main/java/org/apache/rocketmq/client/impl/factory/MQClientInstance.java:1040` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (9 lines × 2) client/src/main/java/org/apache/rocketmq/client/trace/TraceDataEncoder.java:50— client/src/main/java/org/apache/rocketmq/client/trace/TraceDataEncoder.java:50-58 | client/src/main/java/org/apache/rocketmq/client/trace/TraceDataEncoder.java:118-126 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (9 lines × 2) remoting/src/main/java/org/apache/rocketmq/remoting/protocol/header/PullMessageRequestHeader.java:108— remoting/src/main/java/org/apache/rocketmq/remoting/protocol/header/PullMessageRequestHeader.java:108-116 | remoting/src/main/java/org/apache/rocketmq/remoting/protocol/header/SendMessageResponseHeader.java:60-68 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
Duplicated block (9 lines × 2) store/src/main/java/org/apache/rocketmq/store/ConsumeQueue.java:163— store/src/main/java/org/apache/rocketmq/store/ConsumeQueue.java:163-171 | store/src/main/java/org/apache/rocketmq/store/queue/BatchConsumeQueue.java:246-254 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `store/src/main/java/org/apache/rocketmq/store/ConsumeQueue.java:163` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (9 lines × 2) store/src/main/java/org/apache/rocketmq/store/ConsumeQueue.java:414— store/src/main/java/org/apache/rocketmq/store/ConsumeQueue.java:414-422 | store/src/main/java/org/apache/rocketmq/store/queue/BatchConsumeQueue.java:385-393 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `store/src/main/java/org/apache/rocketmq/store/ConsumeQueue.java:414` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `store/src/main/java/org/apache/rocketmq/store/queue/BatchConsumeQueue.java:394` calls `position` and `store/src/main/java/org/apache/rocketmq/store/ConsumeQueue.java:423` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (9 lines × 2) store/src/main/java/org/apache/rocketmq/store/DefaultMessageStore.java:836— store/src/main/java/org/apache/rocketmq/store/DefaultMessageStore.java:836-844 | REDACTED:486-494 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `store/src/main/java/org/apache/rocketmq/store/DefaultMessageStore.java:836` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (9 lines × 2) store/src/main/java/org/apache/rocketmq/store/MappedFileQueue.java:528— store/src/main/java/org/apache/rocketmq/store/MappedFileQueue.java:528-536 | store/src/main/java/org/apache/rocketmq/store/MappedFileQueue.java:571-579 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `store/src/main/java/org/apache/rocketmq/store/MappedFileQueue.java:528` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (9 lines × 2) store/src/main/java/org/apache/rocketmq/store/MessageExtEncoder.java:126— store/src/main/java/org/apache/rocketmq/store/MessageExtEncoder.java:126-134 | store/src/main/java/org/apache/rocketmq/store/MessageExtEncoder.java:222-230 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `store/src/main/java/org/apache/rocketmq/store/MessageExtEncoder.java:123` calls `calMsgLengthNoProperties`, `getVersion`, `getSysFlag` and `store/src/main/java/org/apache/rocketmq/store/MessageExtEncoder.java:219` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (9 lines × 2) store/src/main/java/org/apache/rocketmq/store/MessageExtEncoder.java:261— store/src/main/java/org/apache/rocketmq/store/MessageExtEncoder.java:261-269 | store/src/main/java/org/apache/rocketmq/store/MessageExtEncoder.java:377-385 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (9 lines × 2) store/src/main/java/org/apache/rocketmq/store/ha/DefaultHAService.java:236— store/src/main/java/org/apache/rocketmq/store/ha/DefaultHAService.java:236-244 | store/src/main/java/org/apache/rocketmq/store/ha/autoswitch/AutoSwitchHAService.java:397-405 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `store/src/main/java/org/apache/rocketmq/store/ha/DefaultHAService.java:236` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
ClassTooLong: MQClientAPIImpl client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:230— ClassTooLong — 2206 significant lines (blank, comment-only and punctuation-only lines excluded), 130 methods. The bar is 400 significant lines; this is 1806 over it, 5.52× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
ClassTooLong: DefaultMessageStore store/src/main/java/org/apache/rocketmq/store/DefaultMessageStore.java:116— ClassTooLong — 1991 significant lines (blank, comment-only and punctuation-only lines excluded), 162 methods. The bar is 400 significant lines; this is 1591 over it, 4.98× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
ClassTooLong: AdminBrokerProcessor broker/src/main/java/org/apache/rocketmq/broker/processor/AdminBrokerProcessor.java:194— ClassTooLong — 1920 significant lines (blank, comment-only and punctuation-only lines excluded), 80 methods. The bar is 400 significant lines; this is 1520 over it, 4.80× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
ClassTooLong: CommitLog store/src/main/java/org/apache/rocketmq/store/CommitLog.java:72— ClassTooLong — 1477 significant lines (blank, comment-only and punctuation-only lines excluded), 69 methods. The bar is 400 significant lines; this is 1077 over it, 3.69× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
ClassTooLong: BrokerController broker/src/main/java/org/apache/rocketmq/broker/BrokerController.java:170— ClassTooLong — 1410 significant lines (blank, comment-only and punctuation-only lines excluded), 158 methods. The bar is 400 significant lines; this is 1010 over it, 3.53× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
ClassTooLong: DefaultMQAdminExtImpl tools/src/main/java/org/apache/rocketmq/tools/admin/DefaultMQAdminExtImpl.java:124— ClassTooLong — 1266 significant lines (blank, comment-only and punctuation-only lines excluded), 127 methods. The bar is 400 significant lines; this is 866 over it, 3.17× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
ClassTooLong: TimerMessageStore store/src/main/java/org/apache/rocketmq/store/timer/TimerMessageStore.java:74— ClassTooLong — 1236 significant lines (blank, comment-only and punctuation-only lines excluded), 83 methods. The bar is 400 significant lines; this is 836 over it, 3.09× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
ClassTooLong: DefaultMQProducerImpl client/src/main/java/org/apache/rocketmq/client/impl/producer/DefaultMQProducerImpl.java:101— ClassTooLong — 1162 significant lines (blank, comment-only and punctuation-only lines excluded), 97 methods. The bar is 400 significant lines; this is 762 over it, 2.91× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
ClassTooLong: DefaultMQPushConsumerImpl client/src/main/java/org/apache/rocketmq/client/impl/consumer/DefaultMQPushConsumerImpl.java:97— ClassTooLong — 968 significant lines (blank, comment-only and punctuation-only lines excluded), 86 methods. The bar is 400 significant lines; this is 568 over it, 2.42× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
ClassTooLong: BrokerOuterAPI broker/src/main/java/org/apache/rocketmq/broker/out/BrokerOuterAPI.java:145— ClassTooLong — 925 significant lines (blank, comment-only and punctuation-only lines excluded), 63 methods. The bar is 400 significant lines; this is 525 over it, 2.31× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
ClassTooLong: MessageStoreConfig store/src/main/java/org/apache/rocketmq/store/config/MessageStoreConfig.java:26— ClassTooLong — 912 significant lines (blank, comment-only and punctuation-only lines excluded), 341 methods. The bar is 400 significant lines; this is 512 over it, 2.28× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
ClassTooLong: BrokerConfig common/src/main/java/org/apache/rocketmq/common/BrokerConfig.java:28— ClassTooLong — 872 significant lines (blank, comment-only and punctuation-only lines excluded), 342 methods. The bar is 400 significant lines; this is 472 over it, 2.18× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
ClassTooLong: MQClientInstance client/src/main/java/org/apache/rocketmq/client/impl/factory/MQClientInstance.java:91— ClassTooLong — 795 significant lines (blank, comment-only and punctuation-only lines excluded), 61 methods. The bar is 400 significant lines; this is 395 over it, 1.99× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
ClassTooLong: ProxyConfig proxy/src/main/java/org/apache/rocketmq/proxy/config/ProxyConfig.java:41— ClassTooLong — 770 significant lines (blank, comment-only and punctuation-only lines excluded), 292 methods. The bar is 400 significant lines; this is 370 over it, 1.93× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
ClassTooLong: DefaultLitePullConsumerImpl client/src/main/java/org/apache/rocketmq/client/impl/consumer/DefaultLitePullConsumerImpl.java:79— ClassTooLong — 763 significant lines (blank, comment-only and punctuation-only lines excluded), 79 methods. The bar is 400 significant lines; this is 363 over it, 1.91× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
ClassTooLong: ConsumeQueue store/src/main/java/org/apache/rocketmq/store/ConsumeQueue.java:44— ClassTooLong — 754 significant lines (blank, comment-only and punctuation-only lines excluded), 52 methods. The bar is 400 significant lines; this is 354 over it, 1.89× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
ClassTooLong: BatchConsumeQueue store/src/main/java/org/apache/rocketmq/store/queue/BatchConsumeQueue.java:46— ClassTooLong — 740 significant lines (blank, comment-only and punctuation-only lines excluded), 60 methods. The bar is 400 significant lines; this is 340 over it, 1.85× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
ClassTooLong: NettyRemotingClient remoting/src/main/java/org/apache/rocketmq/remoting/netty/NettyRemotingClient.java:92— ClassTooLong — 740 significant lines (blank, comment-only and punctuation-only lines excluded), 36 methods. The bar is 400 significant lines; this is 340 over it, 1.85× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
ClassTooLong: CompactionLog REDACTED:71— ClassTooLong — 719 significant lines (blank, comment-only and punctuation-only lines excluded), 35 methods. The bar is 400 significant lines; this is 319 over it, 1.80× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
ClassTooLong: RouteInfoManager namesrv/src/main/java/org/apache/rocketmq/namesrv/routeinfo/RouteInfoManager.java:68— ClassTooLong — 692 significant lines (blank, comment-only and punctuation-only lines excluded), 40 methods. The bar is 400 significant lines; this is 292 over it, 1.73× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
ClassTooLong: DLedgerCommitLog store/src/main/java/org/apache/rocketmq/store/dledger/DLedgerCommitLog.java:64— ClassTooLong — 624 significant lines (blank, comment-only and punctuation-only lines excluded), 38 methods. The bar is 400 significant lines; this is 224 over it, 1.56× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
ClassTooLong: PopMessageProcessor broker/src/main/java/org/apache/rocketmq/broker/processor/PopMessageProcessor.java:96— ClassTooLong — 585 significant lines (blank, comment-only and punctuation-only lines excluded), 20 methods. The bar is 400 significant lines; this is 185 over it, 1.46× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
ClassTooLong: PullMessageProcessor broker/src/main/java/org/apache/rocketmq/broker/processor/PullMessageProcessor.java:80— ClassTooLong — 571 significant lines (blank, comment-only and punctuation-only lines excluded), 16 methods. The bar is 400 significant lines; this is 171 over it, 1.43× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
ClassTooLong: DefaultMappedFile store/src/main/java/org/apache/rocketmq/store/logfile/DefaultMappedFile.java:61— ClassTooLong — 560 significant lines (blank, comment-only and punctuation-only lines excluded), 64 methods. The bar is 400 significant lines; this is 160 over it, 1.40× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
ClassTooLong: PopBufferMergeService broker/src/main/java/org/apache/rocketmq/broker/processor/PopBufferMergeService.java:47— ClassTooLong — 550 significant lines (blank, comment-only and punctuation-only lines excluded), 26 methods. The bar is 400 significant lines; this is 150 over it, 1.38× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
Duplicated block (6 lines × 2) acl/src/main/java/org/apache/rocketmq/acl/common/AclSigner.java:49— acl/src/main/java/org/apache/rocketmq/acl/common/AclSigner.java:49-54 | acl/src/main/java/org/apache/rocketmq/acl/common/AclSigner.java:82-87 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `acl/src/main/java/org/apache/rocketmq/acl/common/AclSigner.java:49` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (6 lines × 2) acl/src/main/java/org/apache/rocketmq/acl/plain/PlainAccessResource.java:123— acl/src/main/java/org/apache/rocketmq/acl/plain/PlainAccessResource.java:123-128 | acl/src/main/java/org/apache/rocketmq/acl/plain/PlainAccessResource.java:132-137 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (6 lines × 2) acl/src/main/java/org/apache/rocketmq/acl/plain/PlainPermissionManager.java:141— acl/src/main/java/org/apache/rocketmq/acl/plain/PlainPermissionManager.java:141-146 | acl/src/main/java/org/apache/rocketmq/acl/plain/PlainPermissionManager.java:221-226 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (6 lines × 2) broker/src/main/java/org/apache/rocketmq/broker/BrokerController.java:1666— broker/src/main/java/org/apache/rocketmq/broker/BrokerController.java:1666-1671 | container/src/main/java/org/apache/rocketmq/container/InnerBrokerController.java:89-94 — before extracting anything, compare `broker/src/main/java/org/apache/rocketmq/broker/BrokerController.java` and `container/src/main/java/org/apache/rocketmq/container/InnerBrokerController.java` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 44 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `broker/src/main/java/org/apache/rocketmq/broker/BrokerController.java:1666` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (6 lines × 2) broker/src/main/java/org/apache/rocketmq/broker/failover/EscapeBridge.java:95— broker/src/main/java/org/apache/rocketmq/broker/failover/EscapeBridge.java:95-101 | broker/src/main/java/org/apache/rocketmq/broker/failover/EscapeBridge.java:210-215 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `broker/src/main/java/org/apache/rocketmq/broker/failover/EscapeBridge.java:95` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (6 lines × 2) broker/src/main/java/org/apache/rocketmq/broker/failover/EscapeBridge.java:163— broker/src/main/java/org/apache/rocketmq/broker/failover/EscapeBridge.java:163-168 | broker/src/main/java/org/apache/rocketmq/broker/failover/EscapeBridge.java:212-217 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `broker/src/main/java/org/apache/rocketmq/broker/failover/EscapeBridge.java:163` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (6 lines × 2) broker/src/main/java/org/apache/rocketmq/broker/metrics/BrokerMetricsManager.java:257— broker/src/main/java/org/apache/rocketmq/broker/metrics/BrokerMetricsManager.java:257-262 | broker/src/main/java/org/apache/rocketmq/broker/metrics/BrokerMetricsManager.java:296-301 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `broker/src/main/java/org/apache/rocketmq/broker/metrics/BrokerMetricsManager.java:257` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (6 lines × 2) broker/src/main/java/org/apache/rocketmq/broker/processor/AdminBrokerProcessor.java:799— broker/src/main/java/org/apache/rocketmq/broker/processor/AdminBrokerProcessor.java:799-804 | broker/src/main/java/org/apache/rocketmq/broker/processor/AdminBrokerProcessor.java:926-931 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `broker/src/main/java/org/apache/rocketmq/broker/processor/AdminBrokerProcessor.java:799` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (6 lines × 2) broker/src/main/java/org/apache/rocketmq/broker/processor/AdminBrokerProcessor.java:1554— broker/src/main/java/org/apache/rocketmq/broker/processor/AdminBrokerProcessor.java:1554-1559 | proxy/src/main/java/org/apache/rocketmq/proxy/remoting/activity/ConsumerManagerActivity.java:100-105 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `broker/src/main/java/org/apache/rocketmq/broker/processor/AdminBrokerProcessor.java:1554` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (6 lines × 2) broker/src/main/java/org/apache/rocketmq/broker/processor/ChangeInvisibleTimeProcessor.java:219— broker/src/main/java/org/apache/rocketmq/broker/processor/ChangeInvisibleTimeProcessor.java:219-224 | broker/src/main/java/org/apache/rocketmq/broker/processor/PopMessageProcessor.java:710-715 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
Duplicated block (6 lines × 2) broker/src/main/java/org/apache/rocketmq/broker/processor/EndTransactionProcessor.java:298— broker/src/main/java/org/apache/rocketmq/broker/processor/EndTransactionProcessor.java:298-303 | broker/src/main/java/org/apache/rocketmq/broker/processor/SendMessageProcessor.java:406-411 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (6 lines × 2) broker/src/main/java/org/apache/rocketmq/broker/processor/PeekMessageProcessor.java:139— broker/src/main/java/org/apache/rocketmq/broker/processor/PeekMessageProcessor.java:139-144 | broker/src/main/java/org/apache/rocketmq/broker/processor/PeekMessageProcessor.java:159-164 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `broker/src/main/java/org/apache/rocketmq/broker/processor/PeekMessageProcessor.java:139` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (6 lines × 2) broker/src/main/java/org/apache/rocketmq/broker/processor/PopBufferMergeService.java:630— broker/src/main/java/org/apache/rocketmq/broker/processor/PopBufferMergeService.java:630-635 | broker/src/main/java/org/apache/rocketmq/broker/processor/PopBufferMergeService.java:670-675 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (6 lines × 2) broker/src/main/java/org/apache/rocketmq/broker/processor/PopBufferMergeService.java:792— broker/src/main/java/org/apache/rocketmq/broker/processor/PopBufferMergeService.java:792-797 | broker/src/main/java/org/apache/rocketmq/broker/processor/PopBufferMergeService.java:806-811 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (6 lines × 2) broker/src/main/java/org/apache/rocketmq/broker/processor/PopMessageProcessor.java:363— broker/src/main/java/org/apache/rocketmq/broker/processor/PopMessageProcessor.java:363-368 | broker/src/main/java/org/apache/rocketmq/broker/processor/PopMessageProcessor.java:398-403 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `broker/src/main/java/org/apache/rocketmq/broker/processor/PopMessageProcessor.java:363` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (6 lines × 2) broker/src/main/java/org/apache/rocketmq/broker/processor/PopMessageProcessor.java:373— broker/src/main/java/org/apache/rocketmq/broker/processor/PopMessageProcessor.java:373-378 | broker/src/main/java/org/apache/rocketmq/broker/processor/PopMessageProcessor.java:408-413 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `broker/src/main/java/org/apache/rocketmq/broker/processor/PopMessageProcessor.java:373` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (6 lines × 2) broker/src/main/java/org/apache/rocketmq/broker/processor/PopReviveService.java:208— broker/src/main/java/org/apache/rocketmq/broker/processor/PopReviveService.java:208-213 | broker/src/main/java/org/apache/rocketmq/broker/transaction/queue/TransactionalMessageBridge.java:130-135 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `broker/src/main/java/org/apache/rocketmq/broker/processor/PopReviveService.java:208` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (6 lines × 2) client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:1161— client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:1161-1166 | proxy/src/main/java/org/apache/rocketmq/proxy/service/message/LocalMessageService.java:280-285 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:1161` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (6 lines × 2) client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:1216— client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:1216-1221 | proxy/src/main/java/org/apache/rocketmq/proxy/service/message/LocalMessageService.java:258-263 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:1216` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (6 lines × 2) client/src/main/java/org/apache/rocketmq/client/impl/consumer/RebalanceImpl.java:165— client/src/main/java/org/apache/rocketmq/client/impl/consumer/RebalanceImpl.java:165-170 | client/src/main/java/org/apache/rocketmq/client/impl/consumer/RebalanceImpl.java:207-213 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `client/src/main/java/org/apache/rocketmq/client/impl/consumer/RebalanceImpl.java:165` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (6 lines × 2) client/src/main/java/org/apache/rocketmq/client/impl/consumer/RebalanceImpl.java:480— client/src/main/java/org/apache/rocketmq/client/impl/consumer/RebalanceImpl.java:480-485 | client/src/main/java/org/apache/rocketmq/client/impl/consumer/RebalanceImpl.java:600-605 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `client/src/main/java/org/apache/rocketmq/client/impl/consumer/RebalanceImpl.java:480` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (6 lines × 2) common/src/main/java/org/apache/rocketmq/common/message/MessageDecoder.java:198— common/src/main/java/org/apache/rocketmq/common/message/MessageDecoder.java:198-203 | common/src/main/java/org/apache/rocketmq/common/message/MessageDecoder.java:317-322 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (6 lines × 2) controller/src/main/java/org/apache/rocketmq/controller/metrics/ControllerMetricsManager.java:298— controller/src/main/java/org/apache/rocketmq/controller/metrics/ControllerMetricsManager.java:298-303 | controller/src/main/java/org/apache/rocketmq/controller/metrics/ControllerMetricsManager.java:333-338 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `controller/src/main/java/org/apache/rocketmq/controller/metrics/ControllerMetricsManager.java:298` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (6 lines × 2) proxy/src/main/java/org/apache/rocketmq/proxy/grpc/ProxyAndTlsProtocolNegotiator.java:194— proxy/src/main/java/org/apache/rocketmq/proxy/grpc/ProxyAndTlsProtocolNegotiator.java:194-199 | remoting/src/main/java/org/apache/rocketmq/remoting/netty/NettyRemotingServer.java:795-800 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `proxy/src/main/java/org/apache/rocketmq/proxy/grpc/ProxyAndTlsProtocolNegotiator.java:194` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note first that the copies are not typed on the same thing: `ByteBufUtil` names `io.grpc.netty.shaded.io.netty.buffer.ByteBufUtil` in one and `io.netty.buffer.ByteBufUtil` in another — different types that share a simple name, which is why the text matched. A single extracted unit cannot be given a parameter type that fits both, so unifying those types (or introducing a shared abstraction over them) is the step that has to come BEFORE the extraction above; if they are deliberately separate, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
Duplicated block (6 lines × 2) proxy/src/main/java/org/apache/rocketmq/proxy/metrics/ProxyMetricsManager.java:150— proxy/src/main/java/org/apache/rocketmq/proxy/metrics/ProxyMetricsManager.java:150-155 | proxy/src/main/java/org/apache/rocketmq/proxy/metrics/ProxyMetricsManager.java:190-195 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `proxy/src/main/java/org/apache/rocketmq/proxy/metrics/ProxyMetricsManager.java:150` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
FileTooLong: impl/MQClientAPIImpl.java client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java— FileTooLong — 2416 significant lines (blank, comment-only and punctuation-only lines excluded), about 91% of them inside a single declaration: MQClientAPIImpl (230-3295). The bar is 500 significant lines; this is 1916 over it, 4.83× the bar. Moving the declarations that sit BESIDE it into sibling files will not shorten this file. Extract from INSIDE that declaration instead: lift each cohesive group of its body — the parts that share the same inputs and are named together — into its own unit in a sibling file, and have the original call them.
FileTooLong: processor/AdminBrokerProcessor.java broker/src/main/java/org/apache/rocketmq/broker/processor/AdminBrokerProcessor.java— FileTooLong — 2094 significant lines (blank, comment-only and punctuation-only lines excluded), about 92% of them inside a single declaration: AdminBrokerProcessor (194-2818). The bar is 500 significant lines; this is 1594 over it, 4.19× the bar. Moving the declarations that sit BESIDE it into sibling files will not shorten this file. Extract from INSIDE that declaration instead: lift each cohesive group of its body — the parts that share the same inputs and are named together — into its own unit in a sibling file, and have the original call them.
FileTooLong: store/DefaultMessageStore.java store/src/main/java/org/apache/rocketmq/store/DefaultMessageStore.java— FileTooLong — 2088 significant lines (blank, comment-only and punctuation-only lines excluded), about 95% of them inside a single declaration: DefaultMessageStore (116-3327). The bar is 500 significant lines; this is 1588 over it, 4.18× the bar. Moving the declarations that sit BESIDE it into sibling files will not shorten this file. Extract from INSIDE that declaration instead: lift each cohesive group of its body — the parts that share the same inputs and are named together — into its own unit in a sibling file, and have the original call them.
FileTooLong: broker/BrokerController.java broker/src/main/java/org/apache/rocketmq/broker/BrokerController.java— FileTooLong — 1559 significant lines (blank, comment-only and punctuation-only lines excluded), about 90% of them inside a single declaration: BrokerController (170-2422). The bar is 500 significant lines; this is 1059 over it, 3.12× the bar. Moving the declarations that sit BESIDE it into sibling files will not shorten this file. Extract from INSIDE that declaration instead: lift each cohesive group of its body — the parts that share the same inputs and are named together — into its own unit in a sibling file, and have the original call them.
FileTooLong: store/CommitLog.java store/src/main/java/org/apache/rocketmq/store/CommitLog.java— FileTooLong — 1526 significant lines (blank, comment-only and punctuation-only lines excluded), about 97% of them inside a single declaration: CommitLog (72-2447). The bar is 500 significant lines; this is 1026 over it, 3.05× the bar. Moving the declarations that sit BESIDE it into sibling files will not shorten this file. Extract from INSIDE that declaration instead: lift each cohesive group of its body — the parts that share the same inputs and are named together — into its own unit in a sibling file, and have the original call them.
FileTooLong: admin/DefaultMQAdminExtImpl.java tools/src/main/java/org/apache/rocketmq/tools/admin/DefaultMQAdminExtImpl.java— FileTooLong — 1371 significant lines (blank, comment-only and punctuation-only lines excluded), about 92% of them inside a single declaration: DefaultMQAdminExtImpl (124-1934). The bar is 500 significant lines; this is 871 over it, 2.74× the bar. Moving the declarations that sit BESIDE it into sibling files will not shorten this file. Extract from INSIDE that declaration instead: lift each cohesive group of its body — the parts that share the same inputs and are named together — into its own unit in a sibling file, and have the original call them.
FileTooLong: timer/TimerMessageStore.java store/src/main/java/org/apache/rocketmq/store/timer/TimerMessageStore.java— FileTooLong — 1291 significant lines (blank, comment-only and punctuation-only lines excluded), about 96% of them inside a single declaration: TimerMessageStore (74-1871). The bar is 500 significant lines; this is 791 over it, 2.58× the bar. Moving the declarations that sit BESIDE it into sibling files will not shorten this file. Extract from INSIDE that declaration instead: lift each cohesive group of its body — the parts that share the same inputs and are named together — into its own unit in a sibling file, and have the original call them.
FileTooLong: producer/DefaultMQProducerImpl.java client/src/main/java/org/apache/rocketmq/client/impl/producer/DefaultMQProducerImpl.java— FileTooLong — 1243 significant lines (blank, comment-only and punctuation-only lines excluded), about 93% of them inside a single declaration: DefaultMQProducerImpl (101-1813). The bar is 500 significant lines; this is 743 over it, 2.49× the bar. Moving the declarations that sit BESIDE it into sibling files will not shorten this file. Extract from INSIDE that declaration instead: lift each cohesive group of its body — the parts that share the same inputs and are named together — into its own unit in a sibling file, and have the original call them.
FileTooLong: out/BrokerOuterAPI.java broker/src/main/java/org/apache/rocketmq/broker/out/BrokerOuterAPI.java— FileTooLong — 1050 significant lines (blank, comment-only and punctuation-only lines excluded), about 88% of them inside a single declaration: BrokerOuterAPI (145-1475). The bar is 500 significant lines; this is 550 over it, 2.10× the bar. Moving the declarations that sit BESIDE it into sibling files will not shorten this file. Extract from INSIDE that declaration instead: lift each cohesive group of its body — the parts that share the same inputs and are named together — into its own unit in a sibling file, and have the original call them.
FileTooLong: consumer/DefaultMQPushConsumerImpl.java client/src/main/java/org/apache/rocketmq/client/impl/consumer/DefaultMQPushConsumerImpl.java— FileTooLong — 1046 significant lines (blank, comment-only and punctuation-only lines excluded), about 93% of them inside a single declaration: DefaultMQPushConsumerImpl (97-1564). The bar is 500 significant lines; this is 546 over it, 2.09× the bar. Moving the declarations that sit BESIDE it into sibling files will not shorten this file. Extract from INSIDE that declaration instead: lift each cohesive group of its body — the parts that share the same inputs and are named together — into its own unit in a sibling file, and have the original call them.
FileTooLong: config/MessageStoreConfig.java store/src/main/java/org/apache/rocketmq/store/config/MessageStoreConfig.java— FileTooLong — 918 significant lines (blank, comment-only and punctuation-only lines excluded), about 99% of them inside a single declaration: MessageStoreConfig (26-1808). The bar is 500 significant lines; this is 418 over it, 1.84× the bar. Moving the declarations that sit BESIDE it into sibling files will not shorten this file. Extract from INSIDE that declaration instead: lift each cohesive group of its body — the parts that share the same inputs and are named together — into its own unit in a sibling file, and have the original call them.
FileTooLong: common/BrokerConfig.java common/src/main/java/org/apache/rocketmq/common/BrokerConfig.java— FileTooLong — 880 significant lines (blank, comment-only and punctuation-only lines excluded), about 99% of them inside a single declaration: BrokerConfig (28-1783). The bar is 500 significant lines; this is 380 over it, 1.76× the bar. Moving the declarations that sit BESIDE it into sibling files will not shorten this file. Extract from INSIDE that declaration instead: lift each cohesive group of its body — the parts that share the same inputs and are named together — into its own unit in a sibling file, and have the original call them.
FileTooLong: factory/MQClientInstance.java client/src/main/java/org/apache/rocketmq/client/impl/factory/MQClientInstance.java— FileTooLong — 866 significant lines (blank, comment-only and punctuation-only lines excluded), about 92% of them inside a single declaration: MQClientInstance (91-1334). The bar is 500 significant lines; this is 366 over it, 1.73× the bar. Moving the declarations that sit BESIDE it into sibling files will not shorten this file. Extract from INSIDE that declaration instead: lift each cohesive group of its body — the parts that share the same inputs and are named together — into its own unit in a sibling file, and have the original call them.
FileTooLong: routeinfo/RouteInfoManager.java namesrv/src/main/java/org/apache/rocketmq/namesrv/routeinfo/RouteInfoManager.java— FileTooLong — 836 significant lines (blank, comment-only and punctuation-only lines excluded), about 83% of them inside a single declaration: RouteInfoManager (68-1112). The bar is 500 significant lines; this is 336 over it, 1.67× the bar. Moving the declarations that sit BESIDE it into sibling files will not shorten this file. Extract from INSIDE that declaration instead: lift each cohesive group of its body — the parts that share the same inputs and are named together — into its own unit in a sibling file, and have the original call them.
FileTooLong: consumer/DefaultLitePullConsumerImpl.java client/src/main/java/org/apache/rocketmq/client/impl/consumer/DefaultLitePullConsumerImpl.java— FileTooLong — 823 significant lines (blank, comment-only and punctuation-only lines excluded), about 93% of them inside a single declaration: DefaultLitePullConsumerImpl (79-1302). The bar is 500 significant lines; this is 323 over it, 1.65× the bar. Moving the declarations that sit BESIDE it into sibling files will not shorten this file. Extract from INSIDE that declaration instead: lift each cohesive group of its body — the parts that share the same inputs and are named together — into its own unit in a sibling file, and have the original call them.
FileTooLong: netty/NettyRemotingClient.java remoting/src/main/java/org/apache/rocketmq/remoting/netty/NettyRemotingClient.java— FileTooLong — 813 significant lines (blank, comment-only and punctuation-only lines excluded), about 91% of them inside a single declaration: NettyRemotingClient (92-1181). The bar is 500 significant lines; this is 313 over it, 1.63× the bar. Moving the declarations that sit BESIDE it into sibling files will not shorten this file. Extract from INSIDE that declaration instead: lift each cohesive group of its body — the parts that share the same inputs and are named together — into its own unit in a sibling file, and have the original call them.
FileTooLong: config/ProxyConfig.java proxy/src/main/java/org/apache/rocketmq/proxy/config/ProxyConfig.java— FileTooLong — 791 significant lines (blank, comment-only and punctuation-only lines excluded), about 97% of them inside a single declaration: ProxyConfig (41-1474). The bar is 500 significant lines; this is 291 over it, 1.58× the bar. Moving the declarations that sit BESIDE it into sibling files will not shorten this file. Extract from INSIDE that declaration instead: lift each cohesive group of its body — the parts that share the same inputs and are named together — into its own unit in a sibling file, and have the original call them.
FileTooLong: store/ConsumeQueue.java store/src/main/java/org/apache/rocketmq/store/ConsumeQueue.java— FileTooLong — 779 significant lines (blank, comment-only and punctuation-only lines excluded), about 97% of them inside a single declaration: ConsumeQueue (44-1196). The bar is 500 significant lines; this is 279 over it, 1.56× the bar. Moving the declarations that sit BESIDE it into sibling files will not shorten this file. Extract from INSIDE that declaration instead: lift each cohesive group of its body — the parts that share the same inputs and are named together — into its own unit in a sibling file, and have the original call them.
FileTooLong: REDACTED REDACTED— FileTooLong — 769 significant lines (blank, comment-only and punctuation-only lines excluded), about 93% of them inside a single declaration: CompactionLog (71-1149). The bar is 500 significant lines; this is 269 over it, 1.54× the bar. Moving the declarations that sit BESIDE it into sibling files will not shorten this file. Extract from INSIDE that declaration instead: lift each cohesive group of its body — the parts that share the same inputs and are named together — into its own unit in a sibling file, and have the original call them.
FileTooLong: queue/BatchConsumeQueue.java store/src/main/java/org/apache/rocketmq/store/queue/BatchConsumeQueue.java— FileTooLong — 766 significant lines (blank, comment-only and punctuation-only lines excluded), about 97% of them inside a single declaration: BatchConsumeQueue (46-1173). The bar is 500 significant lines; this is 266 over it, 1.53× the bar. Moving the declarations that sit BESIDE it into sibling files will not shorten this file. Extract from INSIDE that declaration instead: lift each cohesive group of its body — the parts that share the same inputs and are named together — into its own unit in a sibling file, and have the original call them.
FileTooLong: dledger/DLedgerCommitLog.java store/src/main/java/org/apache/rocketmq/store/dledger/DLedgerCommitLog.java— FileTooLong — 664 significant lines (blank, comment-only and punctuation-only lines excluded), about 94% of them inside a single declaration: DLedgerCommitLog (64-1016). The bar is 500 significant lines; this is 164 over it, 1.33× the bar. Moving the declarations that sit BESIDE it into sibling files will not shorten this file. Extract from INSIDE that declaration instead: lift each cohesive group of its body — the parts that share the same inputs and are named together — into its own unit in a sibling file, and have the original call them.
FileTooLong: processor/PopMessageProcessor.java broker/src/main/java/org/apache/rocketmq/broker/processor/PopMessageProcessor.java— FileTooLong — 661 significant lines (blank, comment-only and punctuation-only lines excluded), about 89% of them inside a single declaration: PopMessageProcessor (96-907). The bar is 500 significant lines; this is 161 over it, 1.32× the bar. Moving the declarations that sit BESIDE it into sibling files will not shorten this file. Extract from INSIDE that declaration instead: lift each cohesive group of its body — the parts that share the same inputs and are named together — into its own unit in a sibling file, and have the original call them.
FileTooLong: processor/PullMessageProcessor.java broker/src/main/java/org/apache/rocketmq/broker/processor/PullMessageProcessor.java— FileTooLong — 631 significant lines (blank, comment-only and punctuation-only lines excluded), about 90% of them inside a single declaration: PullMessageProcessor (80-882). The bar is 500 significant lines; this is 131 over it, 1.26× the bar. Moving the declarations that sit BESIDE it into sibling files will not shorten this file. Extract from INSIDE that declaration instead: lift each cohesive group of its body — the parts that share the same inputs and are named together — into its own unit in a sibling file, and have the original call them.
FileTooLong: logfile/DefaultMappedFile.java store/src/main/java/org/apache/rocketmq/store/logfile/DefaultMappedFile.java— FileTooLong — 602 significant lines (blank, comment-only and punctuation-only lines excluded), about 93% of them inside a single declaration: DefaultMappedFile (61-929). The bar is 500 significant lines; this is 102 over it, 1.20× the bar. Moving the declarations that sit BESIDE it into sibling files will not shorten this file. Extract from INSIDE that declaration instead: lift each cohesive group of its body — the parts that share the same inputs and are named together — into its own unit in a sibling file, and have the original call them.
FileTooLong: admin/DefaultMQAdminExt.java tools/src/main/java/org/apache/rocketmq/tools/admin/DefaultMQAdminExt.java— FileTooLong — 597 significant lines (blank, comment-only and punctuation-only lines excluded), about 90% of them inside a single declaration: DefaultMQAdminExt (76-877). The bar is 500 significant lines; this is 97 over it, 1.19× the bar. Moving the declarations that sit BESIDE it into sibling files will not shorten this file. Extract from INSIDE that declaration instead: lift each cohesive group of its body — the parts that share the same inputs and are named together — into its own unit in a sibling file, and have the original call them.
Unfinished stub — throws a "not implemented" exception proxy/src/main/java/org/apache/rocketmq/proxy/service/channel/SimpleChannelHandlerContext.java:48— `executor` throws an exception whose message says it isn't finished — a not-implemented stub wearing an ordinary exception. Implement it or remove it.
Unfinished stub — throws a "not implemented" exception proxy/src/main/java/org/apache/rocketmq/proxy/service/channel/SimpleChannelHandlerContext.java:53— `name` throws an exception whose message says it isn't finished — a not-implemented stub wearing an ordinary exception. Implement it or remove it.
Unfinished stub — throws a "not implemented" exception proxy/src/main/java/org/apache/rocketmq/proxy/service/channel/SimpleChannelHandlerContext.java:58— `handler` throws an exception whose message says it isn't finished — a not-implemented stub wearing an ordinary exception. Implement it or remove it.
Unfinished stub — throws a "not implemented" exception proxy/src/main/java/org/apache/rocketmq/proxy/service/channel/SimpleChannelHandlerContext.java:68— `fireChannelRegistered` throws an exception whose message says it isn't finished — a not-implemented stub wearing an ordinary exception. Implement it or remove it.
Unfinished stub — throws a "not implemented" exception proxy/src/main/java/org/apache/rocketmq/proxy/service/channel/SimpleChannelHandlerContext.java:73— `fireChannelUnregistered` throws an exception whose message says it isn't finished — a not-implemented stub wearing an ordinary exception. Implement it or remove it.
Unfinished stub — throws a "not implemented" exception proxy/src/main/java/org/apache/rocketmq/proxy/service/channel/SimpleChannelHandlerContext.java:78— `fireChannelActive` throws an exception whose message says it isn't finished — a not-implemented stub wearing an ordinary exception. Implement it or remove it.
Unfinished stub — throws a "not implemented" exception proxy/src/main/java/org/apache/rocketmq/proxy/service/channel/SimpleChannelHandlerContext.java:83— `fireChannelInactive` throws an exception whose message says it isn't finished — a not-implemented stub wearing an ordinary exception. Implement it or remove it.
Unfinished stub — throws a "not implemented" exception proxy/src/main/java/org/apache/rocketmq/proxy/service/channel/SimpleChannelHandlerContext.java:88— `fireExceptionCaught` throws an exception whose message says it isn't finished — a not-implemented stub wearing an ordinary exception. Implement it or remove it.
Unfinished stub — throws a "not implemented" exception proxy/src/main/java/org/apache/rocketmq/proxy/service/channel/SimpleChannelHandlerContext.java:93— `fireUserEventTriggered` throws an exception whose message says it isn't finished — a not-implemented stub wearing an ordinary exception. Implement it or remove it.
Unfinished stub — throws a "not implemented" exception proxy/src/main/java/org/apache/rocketmq/proxy/service/channel/SimpleChannelHandlerContext.java:98— `fireChannelRead` throws an exception whose message says it isn't finished — a not-implemented stub wearing an ordinary exception. Implement it or remove it.
Unfinished stub — throws a "not implemented" exception proxy/src/main/java/org/apache/rocketmq/proxy/service/channel/SimpleChannelHandlerContext.java:103— `fireChannelReadComplete` throws an exception whose message says it isn't finished — a not-implemented stub wearing an ordinary exception. Implement it or remove it.
Unfinished stub — throws a "not implemented" exception proxy/src/main/java/org/apache/rocketmq/proxy/service/channel/SimpleChannelHandlerContext.java:108— `fireChannelWritabilityChanged` throws an exception whose message says it isn't finished — a not-implemented stub wearing an ordinary exception. Implement it or remove it.
Unfinished stub — throws a "not implemented" exception proxy/src/main/java/org/apache/rocketmq/proxy/service/channel/SimpleChannelHandlerContext.java:113— `bind` throws an exception whose message says it isn't finished — a not-implemented stub wearing an ordinary exception. Implement it or remove it.
Unfinished stub — throws a "not implemented" exception proxy/src/main/java/org/apache/rocketmq/proxy/service/channel/SimpleChannelHandlerContext.java:118— `connect` throws an exception whose message says it isn't finished — a not-implemented stub wearing an ordinary exception. Implement it or remove it.
Unfinished stub — throws a "not implemented" exception proxy/src/main/java/org/apache/rocketmq/proxy/service/channel/SimpleChannelHandlerContext.java:123— `connect` throws an exception whose message says it isn't finished — a not-implemented stub wearing an ordinary exception. Implement it or remove it.
Unfinished stub — throws a "not implemented" exception proxy/src/main/java/org/apache/rocketmq/proxy/service/channel/SimpleChannelHandlerContext.java:128— `disconnect` throws an exception whose message says it isn't finished — a not-implemented stub wearing an ordinary exception. Implement it or remove it.
Unfinished stub — throws a "not implemented" exception proxy/src/main/java/org/apache/rocketmq/proxy/service/channel/SimpleChannelHandlerContext.java:133— `close` throws an exception whose message says it isn't finished — a not-implemented stub wearing an ordinary exception. Implement it or remove it.
Unfinished stub — throws a "not implemented" exception proxy/src/main/java/org/apache/rocketmq/proxy/service/channel/SimpleChannelHandlerContext.java:138— `deregister` throws an exception whose message says it isn't finished — a not-implemented stub wearing an ordinary exception. Implement it or remove it.
Unfinished stub — throws a "not implemented" exception proxy/src/main/java/org/apache/rocketmq/proxy/service/channel/SimpleChannelHandlerContext.java:143— `bind` throws an exception whose message says it isn't finished — a not-implemented stub wearing an ordinary exception. Implement it or remove it.
Unfinished stub — throws a "not implemented" exception proxy/src/main/java/org/apache/rocketmq/proxy/service/channel/SimpleChannelHandlerContext.java:148— `connect` throws an exception whose message says it isn't finished — a not-implemented stub wearing an ordinary exception. Implement it or remove it.
Unfinished stub — throws a "not implemented" exception proxy/src/main/java/org/apache/rocketmq/proxy/service/channel/SimpleChannelHandlerContext.java:153— `connect` throws an exception whose message says it isn't finished — a not-implemented stub wearing an ordinary exception. Implement it or remove it.
Unfinished stub — throws a "not implemented" exception proxy/src/main/java/org/apache/rocketmq/proxy/service/channel/SimpleChannelHandlerContext.java:158— `disconnect` throws an exception whose message says it isn't finished — a not-implemented stub wearing an ordinary exception. Implement it or remove it.
Unfinished stub — throws a "not implemented" exception proxy/src/main/java/org/apache/rocketmq/proxy/service/channel/SimpleChannelHandlerContext.java:163— `close` throws an exception whose message says it isn't finished — a not-implemented stub wearing an ordinary exception. Implement it or remove it.
Unfinished stub — throws a "not implemented" exception proxy/src/main/java/org/apache/rocketmq/proxy/service/channel/SimpleChannelHandlerContext.java:168— `deregister` throws an exception whose message says it isn't finished — a not-implemented stub wearing an ordinary exception. Implement it or remove it.
Unfinished stub — throws a "not implemented" exception proxy/src/main/java/org/apache/rocketmq/proxy/service/channel/SimpleChannelHandlerContext.java:173— `read` throws an exception whose message says it isn't finished — a not-implemented stub wearing an ordinary exception. Implement it or remove it.
Duplicated block (7 lines × 2) broker/src/main/java/org/apache/rocketmq/broker/failover/EscapeBridge.java:298— broker/src/main/java/org/apache/rocketmq/broker/failover/EscapeBridge.java:298-304 | broker/src/main/java/org/apache/rocketmq/broker/processor/PopReviveService.java:271-277 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `broker/src/main/java/org/apache/rocketmq/broker/failover/EscapeBridge.java:298` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (7 lines × 2) broker/src/main/java/org/apache/rocketmq/broker/metrics/ConsumerLagCalculator.java:181— broker/src/main/java/org/apache/rocketmq/broker/metrics/ConsumerLagCalculator.java:181-187 | broker/src/main/java/org/apache/rocketmq/broker/metrics/ConsumerLagCalculator.java:191-197 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (7 lines × 2) broker/src/main/java/org/apache/rocketmq/broker/metrics/PopMetricsManager.java:71— broker/src/main/java/org/apache/rocketmq/broker/metrics/PopMetricsManager.java:71-77 | remoting/src/main/java/org/apache/rocketmq/remoting/metrics/RemotingMetricsManager.java:72-78 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `broker/src/main/java/org/apache/rocketmq/broker/metrics/PopMetricsManager.java:71` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
Duplicated block (7 lines × 2) broker/src/main/java/org/apache/rocketmq/broker/out/BrokerOuterAPI.java:1208— broker/src/main/java/org/apache/rocketmq/broker/out/BrokerOuterAPI.java:1208-1214 | client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:3144-3150 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `broker/src/main/java/org/apache/rocketmq/broker/out/BrokerOuterAPI.java:1208` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (7 lines × 2) broker/src/main/java/org/apache/rocketmq/broker/processor/AdminBrokerProcessor.java:1501— broker/src/main/java/org/apache/rocketmq/broker/processor/AdminBrokerProcessor.java:1501-1507 | broker/src/main/java/org/apache/rocketmq/broker/processor/AdminBrokerProcessor.java:2018-2024 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (7 lines × 2) broker/src/main/java/org/apache/rocketmq/broker/processor/ReplyMessageProcessor.java:315— broker/src/main/java/org/apache/rocketmq/broker/processor/ReplyMessageProcessor.java:315-321 | broker/src/main/java/org/apache/rocketmq/broker/processor/SendMessageProcessor.java:480-486 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `broker/src/main/java/org/apache/rocketmq/broker/processor/ReplyMessageProcessor.java:315` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (7 lines × 2) broker/src/main/java/org/apache/rocketmq/broker/slave/SlaveSynchronize.java:89— broker/src/main/java/org/apache/rocketmq/broker/slave/SlaveSynchronize.java:89-95 | broker/src/main/java/org/apache/rocketmq/broker/slave/SlaveSynchronize.java:108-114 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `broker/src/main/java/org/apache/rocketmq/broker/slave/SlaveSynchronize.java:89` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (7 lines × 2) client/src/main/java/org/apache/rocketmq/client/consumer/MQPullConsumerScheduleService.java:65— client/src/main/java/org/apache/rocketmq/client/consumer/MQPullConsumerScheduleService.java:65-71 | client/src/main/java/org/apache/rocketmq/client/impl/consumer/DefaultLitePullConsumerImpl.java:230-236 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `client/src/main/java/org/apache/rocketmq/client/consumer/MQPullConsumerScheduleService.java:65` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (7 lines × 2) client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:1475— client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:1475-1481 | client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:1496-1502 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:1475` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (7 lines × 2) client/src/main/java/org/apache/rocketmq/client/impl/consumer/ConsumeMessageConcurrentlyService.java:252— client/src/main/java/org/apache/rocketmq/client/impl/consumer/ConsumeMessageConcurrentlyService.java:252-258 | client/src/main/java/org/apache/rocketmq/client/impl/consumer/ConsumeMessagePopConcurrentlyService.java:226-232 — before extracting anything, compare `client/src/main/java/org/apache/rocketmq/client/impl/consumer/ConsumeMessageConcurrentlyService.java` and `client/src/main/java/org/apache/rocketmq/client/impl/consumer/ConsumeMessagePopConcurrentlyService.java` as WHOLE FILES: this scan already matched 8 separate duplicated blocks between them, totalling at least 122 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `client/src/main/java/org/apache/rocketmq/client/impl/consumer/ConsumeMessageConcurrentlyService.java:252` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (7 lines × 2) client/src/main/java/org/apache/rocketmq/client/impl/consumer/ConsumeMessageConcurrentlyService.java:392— client/src/main/java/org/apache/rocketmq/client/impl/consumer/ConsumeMessageConcurrentlyService.java:392-398 | client/src/main/java/org/apache/rocketmq/client/impl/consumer/ConsumeMessagePopConcurrentlyService.java:405-411 — before extracting anything, compare `client/src/main/java/org/apache/rocketmq/client/impl/consumer/ConsumeMessageConcurrentlyService.java` and `client/src/main/java/org/apache/rocketmq/client/impl/consumer/ConsumeMessagePopConcurrentlyService.java` as WHOLE FILES: this scan already matched 8 separate duplicated blocks between them, totalling at least 122 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (7 lines × 2) client/src/main/java/org/apache/rocketmq/client/impl/consumer/DefaultMQPushConsumerImpl.java:432— client/src/main/java/org/apache/rocketmq/client/impl/consumer/DefaultMQPushConsumerImpl.java:432-438 | client/src/main/java/org/apache/rocketmq/client/impl/consumer/DefaultMQPushConsumerImpl.java:586-592 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `client/src/main/java/org/apache/rocketmq/client/impl/consumer/DefaultMQPushConsumerImpl.java:432` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (7 lines × 2) client/src/main/java/org/apache/rocketmq/client/impl/consumer/PullAPIWrapper.java:223— client/src/main/java/org/apache/rocketmq/client/impl/consumer/PullAPIWrapper.java:223-229 | proxy/src/main/java/org/apache/rocketmq/proxy/processor/ConsumerProcessor.java:362-368 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
Duplicated block (7 lines × 2) client/src/main/java/org/apache/rocketmq/client/impl/producer/DefaultMQProducerImpl.java:1538— client/src/main/java/org/apache/rocketmq/client/impl/producer/DefaultMQProducerImpl.java:1538-1544 | client/src/main/java/org/apache/rocketmq/client/impl/producer/DefaultMQProducerImpl.java:1568-1574 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `client/src/main/java/org/apache/rocketmq/client/impl/producer/DefaultMQProducerImpl.java:1538` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `client/src/main/java/org/apache/rocketmq/client/impl/producer/DefaultMQProducerImpl.java:1575` calls `executeRequestCallback` and `client/src/main/java/org/apache/rocketmq/client/impl/producer/DefaultMQProducerImpl.java:1545` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (7 lines × 2) client/src/main/java/org/apache/rocketmq/client/trace/hook/ConsumeMessageOpenTracingHookImpl.java:61— client/src/main/java/org/apache/rocketmq/client/trace/hook/ConsumeMessageOpenTracingHookImpl.java:61-67 | client/src/main/java/org/apache/rocketmq/client/trace/hook/EndTransactionOpenTracingHookImpl.java:53-59 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
Duplicated block (7 lines × 2) common/src/main/java/org/apache/rocketmq/common/MixAll.java:325— common/src/main/java/org/apache/rocketmq/common/MixAll.java:325-331 | remoting/src/main/java/org/apache/rocketmq/remoting/protocol/RemotingCommand.java:437-443 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `common/src/main/java/org/apache/rocketmq/common/MixAll.java:325` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (7 lines × 2) openmessaging/src/main/java/io/openmessaging/rocketmq/consumer/PushConsumerImpl.java:54— openmessaging/src/main/java/io/openmessaging/rocketmq/consumer/PushConsumerImpl.java:54-60 | openmessaging/src/main/java/io/openmessaging/rocketmq/producer/AbstractOMSProducer.java:51-57 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `openmessaging/src/main/java/io/openmessaging/rocketmq/consumer/PushConsumerImpl.java:54` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (7 lines × 2) openmessaging/src/main/java/io/openmessaging/rocketmq/utils/BeanUtils.java:144— openmessaging/src/main/java/io/openmessaging/rocketmq/utils/BeanUtils.java:144-150 | openmessaging/src/main/java/io/openmessaging/rocketmq/utils/BeanUtils.java:168-174 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `openmessaging/src/main/java/io/openmessaging/rocketmq/utils/BeanUtils.java:144` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (7 lines × 2) proxy/src/main/java/org/apache/rocketmq/proxy/service/route/ClusterTopicRouteService.java:43— proxy/src/main/java/org/apache/rocketmq/proxy/service/route/ClusterTopicRouteService.java:43-49 | proxy/src/main/java/org/apache/rocketmq/proxy/service/route/LocalTopicRouteService.java:66-72 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `proxy/src/main/java/org/apache/rocketmq/proxy/service/route/ClusterTopicRouteService.java:43` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (7 lines × 2) store/src/main/java/org/apache/rocketmq/store/CommitLog.java:1657— store/src/main/java/org/apache/rocketmq/store/CommitLog.java:1657-1663 | store/src/main/java/org/apache/rocketmq/store/CommitLog.java:1769-1775 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `store/src/main/java/org/apache/rocketmq/store/CommitLog.java:1657` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (7 lines × 2) store/src/main/java/org/apache/rocketmq/store/MappedFileQueue.java:99— store/src/main/java/org/apache/rocketmq/store/MappedFileQueue.java:99-105 | store/src/main/java/org/apache/rocketmq/store/MappedFileQueue.java:116-122 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `store/src/main/java/org/apache/rocketmq/store/MappedFileQueue.java:99` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (7 lines × 2) store/src/main/java/org/apache/rocketmq/store/index/IndexFile.java:115— store/src/main/java/org/apache/rocketmq/store/index/IndexFile.java:115-121 | store/src/main/java/org/apache/rocketmq/store/index/IndexFile.java:204-210 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `store/src/main/java/org/apache/rocketmq/store/index/IndexFile.java:115` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (7 lines × 2) store/src/main/java/org/apache/rocketmq/store/logfile/DefaultMappedFile.java:782— store/src/main/java/org/apache/rocketmq/store/logfile/DefaultMappedFile.java:782-788 | store/src/main/java/org/apache/rocketmq/store/logfile/DefaultMappedFile.java:811-817 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `store/src/main/java/org/apache/rocketmq/store/logfile/DefaultMappedFile.java:782` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (7 lines × 2) store/src/main/java/org/apache/rocketmq/store/stats/BrokerStatsManager.java:470— store/src/main/java/org/apache/rocketmq/store/stats/BrokerStatsManager.java:470-476 | store/src/main/java/org/apache/rocketmq/store/stats/BrokerStatsManager.java:481-487 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `store/src/main/java/org/apache/rocketmq/store/stats/BrokerStatsManager.java:470` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
Duplicated block (7 lines × 2) tieredstore/src/main/java/org/apache/rocketmq/tieredstore/metrics/TieredStoreMetricsManager.java:177— tieredstore/src/main/java/org/apache/rocketmq/tieredstore/metrics/TieredStoreMetricsManager.java:177-183 | tieredstore/src/main/java/org/apache/rocketmq/tieredstore/metrics/TieredStoreMetricsManager.java:207-213 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `tieredstore/src/main/java/org/apache/rocketmq/tieredstore/metrics/TieredStoreMetricsManager.java:177` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `tieredstore/src/main/java/org/apache/rocketmq/tieredstore/metrics/TieredStoreMetricsManager.java:206` calls `setUnit` and `tieredstore/src/main/java/org/apache/rocketmq/tieredstore/metrics/TieredStoreMetricsManager.java:176` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Swallowed exception (empty catch) broker/src/main/java/org/apache/rocketmq/broker/controller/ReplicasManager.java:186— An empty catch block silently discards the error — failures vanish with no log and no rethrow. Log it, handle it, or don't catch it.
Swallowed exception (empty catch) broker/src/main/java/org/apache/rocketmq/broker/dledger/DLedgerRoleChangeHandler.java:150— An empty catch block silently discards the error — failures vanish with no log and no rethrow. Log it, handle it, or don't catch it.
Swallowed exception (empty catch) broker/src/main/java/org/apache/rocketmq/broker/dledger/DLedgerRoleChangeHandler.java:173— An empty catch block silently discards the error — failures vanish with no log and no rethrow. Log it, handle it, or don't catch it.
Swallowed exception (empty catch) broker/src/main/java/org/apache/rocketmq/broker/latency/BrokerFastFailure.java:97— An empty catch block silently discards the error — failures vanish with no log and no rethrow. Log it, handle it, or don't catch it.
Swallowed exception (empty catch) broker/src/main/java/org/apache/rocketmq/broker/latency/BrokerFastFailure.java:149— An empty catch block silently discards the error — failures vanish with no log and no rethrow. Log it, handle it, or don't catch it.
Swallowed exception (empty catch) broker/src/main/java/org/apache/rocketmq/broker/longpolling/PopLongPollingService.java:143— An empty catch block silently discards the error — failures vanish with no log and no rethrow. Log it, handle it, or don't catch it.
Swallowed exception (empty catch) broker/src/main/java/org/apache/rocketmq/broker/processor/PullMessageProcessor.java:755— An empty catch block silently discards the error — failures vanish with no log and no rethrow. Log it, handle it, or don't catch it.
Swallowed exception (empty catch) broker/src/main/java/org/apache/rocketmq/broker/processor/PopReviveService.java:334— An empty catch block silently discards the error — failures vanish with no log and no rethrow. Log it, handle it, or don't catch it.
Swallowed exception (empty catch) broker/src/main/java/org/apache/rocketmq/broker/processor/AbstractSendMessageProcessor.java:344— An empty catch block silently discards the error — failures vanish with no log and no rethrow. Log it, handle it, or don't catch it.
Swallowed exception (empty catch) broker/src/main/java/org/apache/rocketmq/broker/processor/AbstractSendMessageProcessor.java:551— An empty catch block silently discards the error — failures vanish with no log and no rethrow. Log it, handle it, or don't catch it.
Swallowed exception (empty catch) broker/src/main/java/org/apache/rocketmq/broker/processor/AbstractSendMessageProcessor.java:580— An empty catch block silently discards the error — failures vanish with no log and no rethrow. Log it, handle it, or don't catch it.
Swallowed exception (empty catch) broker/src/main/java/org/apache/rocketmq/broker/topic/TopicQueueMappingManager.java:224— An empty catch block silently discards the error — failures vanish with no log and no rethrow. Log it, handle it, or don't catch it.
Swallowed exception (empty catch) broker/src/main/java/org/apache/rocketmq/broker/topic/TopicQueueMappingCleanService.java:84— An empty catch block silently discards the error — failures vanish with no log and no rethrow. Log it, handle it, or don't catch it.
Swallowed exception (empty catch) broker/src/main/java/org/apache/rocketmq/broker/transaction/queue/TransactionalMessageUtil.java:83— An empty catch block silently discards the error — failures vanish with no log and no rethrow. Log it, handle it, or don't catch it.
Swallowed exception (empty catch) broker/src/main/java/org/apache/rocketmq/broker/transaction/queue/TransactionalMessageServiceImpl.java:302— An empty catch block silently discards the error — failures vanish with no log and no rethrow. Log it, handle it, or don't catch it.
Swallowed exception (empty catch) client/src/main/java/org/apache/rocketmq/client/consumer/DefaultMQPushConsumer.java:527— An empty catch block silently discards the error — failures vanish with no log and no rethrow. Log it, handle it, or don't catch it.
Swallowed exception (empty catch) client/src/main/java/org/apache/rocketmq/client/consumer/DefaultMQPullConsumer.java:411— An empty catch block silently discards the error — failures vanish with no log and no rethrow. Log it, handle it, or don't catch it.
Swallowed exception (empty catch) client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:648— An empty catch block silently discards the error — failures vanish with no log and no rethrow. Log it, handle it, or don't catch it.
Swallowed exception (empty catch) client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:665— An empty catch block silently discards the error — failures vanish with no log and no rethrow. Log it, handle it, or don't catch it.
Swallowed exception (empty catch) client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:739— An empty catch block silently discards the error — failures vanish with no log and no rethrow. Log it, handle it, or don't catch it.
Swallowed exception (empty catch) client/src/main/java/org/apache/rocketmq/client/impl/consumer/RebalanceImpl.java:581— An empty catch block silently discards the error — failures vanish with no log and no rethrow. Log it, handle it, or don't catch it.
Swallowed exception (empty catch) client/src/main/java/org/apache/rocketmq/client/impl/consumer/RebalanceImpl.java:590— An empty catch block silently discards the error — failures vanish with no log and no rethrow. Log it, handle it, or don't catch it.
Swallowed exception (empty catch) client/src/main/java/org/apache/rocketmq/client/impl/consumer/ProcessQueue.java:447— An empty catch block silently discards the error — failures vanish with no log and no rethrow. Log it, handle it, or don't catch it.
Swallowed exception (empty catch) client/src/main/java/org/apache/rocketmq/client/impl/consumer/DefaultMQPullConsumerImpl.java:306— An empty catch block silently discards the error — failures vanish with no log and no rethrow. Log it, handle it, or don't catch it.
Swallowed exception (empty catch) client/src/main/java/org/apache/rocketmq/client/impl/consumer/DefaultMQPullConsumerImpl.java:325— An empty catch block silently discards the error — failures vanish with no log and no rethrow. Log it, handle it, or don't catch it.
Duplicated block (8 lines × 2) broker/src/main/java/org/apache/rocketmq/broker/client/rebalance/RebalanceLockManager.java:55— broker/src/main/java/org/apache/rocketmq/broker/client/rebalance/RebalanceLockManager.java:55-62 | broker/src/main/java/org/apache/rocketmq/broker/client/rebalance/RebalanceLockManager.java:139-146 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `broker/src/main/java/org/apache/rocketmq/broker/client/rebalance/RebalanceLockManager.java:55` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (8 lines × 2) broker/src/main/java/org/apache/rocketmq/broker/out/BrokerOuterAPI.java:361— broker/src/main/java/org/apache/rocketmq/broker/out/BrokerOuterAPI.java:361-368 | broker/src/main/java/org/apache/rocketmq/broker/out/BrokerOuterAPI.java:1350-1357 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `broker/src/main/java/org/apache/rocketmq/broker/out/BrokerOuterAPI.java:361` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (8 lines × 2) broker/src/main/java/org/apache/rocketmq/broker/processor/AdminBrokerProcessor.java:605— broker/src/main/java/org/apache/rocketmq/broker/processor/AdminBrokerProcessor.java:605-612 | broker/src/main/java/org/apache/rocketmq/broker/processor/AdminBrokerProcessor.java:639-646 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `broker/src/main/java/org/apache/rocketmq/broker/processor/AdminBrokerProcessor.java:605` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (8 lines × 2) broker/src/main/java/org/apache/rocketmq/broker/processor/ReplyMessageProcessor.java:119— broker/src/main/java/org/apache/rocketmq/broker/processor/ReplyMessageProcessor.java:119-126 | broker/src/main/java/org/apache/rocketmq/broker/processor/SendMessageProcessor.java:674-681 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `broker/src/main/java/org/apache/rocketmq/broker/processor/ReplyMessageProcessor.java:127` calls `getCode` and `broker/src/main/java/org/apache/rocketmq/broker/processor/SendMessageProcessor.java:683` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (8 lines × 2) broker/src/main/java/org/apache/rocketmq/broker/processor/SendMessageProcessor.java:328— broker/src/main/java/org/apache/rocketmq/broker/processor/SendMessageProcessor.java:328-335 | broker/src/main/java/org/apache/rocketmq/broker/processor/SendMessageProcessor.java:611-618 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `broker/src/main/java/org/apache/rocketmq/broker/processor/SendMessageProcessor.java:328` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (8 lines × 2) broker/src/main/java/org/apache/rocketmq/broker/subscription/SubscriptionGroupManager.java:153— broker/src/main/java/org/apache/rocketmq/broker/subscription/SubscriptionGroupManager.java:153-160 | broker/src/main/java/org/apache/rocketmq/broker/topic/TopicConfigManager.java:506-513 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
Duplicated block (8 lines × 2) proxy/src/main/java/org/apache/rocketmq/proxy/grpc/v2/route/RouteActivity.java:264— proxy/src/main/java/org/apache/rocketmq/proxy/grpc/v2/route/RouteActivity.java:264-271 | proxy/src/main/java/org/apache/rocketmq/proxy/grpc/v2/route/RouteActivity.java:273-280 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `proxy/src/main/java/org/apache/rocketmq/proxy/grpc/v2/route/RouteActivity.java:264` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (8 lines × 2) proxy/src/main/java/org/apache/rocketmq/proxy/service/relay/LocalProxyRelayService.java:46— proxy/src/main/java/org/apache/rocketmq/proxy/service/relay/LocalProxyRelayService.java:46-53 | proxy/src/main/java/org/apache/rocketmq/proxy/service/relay/LocalProxyRelayService.java:70-77 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `proxy/src/main/java/org/apache/rocketmq/proxy/service/relay/LocalProxyRelayService.java:46` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (8 lines × 2) proxy/src/main/java/org/apache/rocketmq/proxy/service/relay/LocalProxyRelayService.java:56— proxy/src/main/java/org/apache/rocketmq/proxy/service/relay/LocalProxyRelayService.java:56-63 | proxy/src/main/java/org/apache/rocketmq/proxy/service/relay/LocalProxyRelayService.java:80-87 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `proxy/src/main/java/org/apache/rocketmq/proxy/service/relay/LocalProxyRelayService.java:56` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
Duplicated block (8 lines × 2) store/src/main/java/org/apache/rocketmq/store/CommitLog.java:1083— store/src/main/java/org/apache/rocketmq/store/CommitLog.java:1083-1090 | store/src/main/java/org/apache/rocketmq/store/dledger/DLedgerCommitLog.java:524-531 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `store/src/main/java/org/apache/rocketmq/store/dledger/DLedgerCommitLog.java:534` calls `setStoreTimestamp`, `currentTimeMillis`, `getStoreStatsService` and `store/src/main/java/org/apache/rocketmq/store/CommitLog.java:1092` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (8 lines × 2) store/src/main/java/org/apache/rocketmq/store/DefaultMessageStore.java:2338— store/src/main/java/org/apache/rocketmq/store/DefaultMessageStore.java:2338-2346 | store/src/main/java/org/apache/rocketmq/store/DefaultMessageStore.java:2360-2367 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `store/src/main/java/org/apache/rocketmq/store/DefaultMessageStore.java:2338` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (8 lines × 2) store/src/main/java/org/apache/rocketmq/store/MappedFileQueue.java:797— store/src/main/java/org/apache/rocketmq/store/MappedFileQueue.java:797-804 | store/src/main/java/org/apache/rocketmq/store/MappedFileQueue.java:824-831 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `store/src/main/java/org/apache/rocketmq/store/MappedFileQueue.java:797` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (8 lines × 2) store/src/main/java/org/apache/rocketmq/store/ha/DefaultHAService.java:219— store/src/main/java/org/apache/rocketmq/store/ha/DefaultHAService.java:219-226 | store/src/main/java/org/apache/rocketmq/store/ha/autoswitch/AutoSwitchHAService.java:380-387 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `store/src/main/java/org/apache/rocketmq/store/ha/DefaultHAService.java:219` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (8 lines × 2) store/src/main/java/org/apache/rocketmq/store/queue/BatchConsumeQueue.java:225— store/src/main/java/org/apache/rocketmq/store/queue/BatchConsumeQueue.java:225-232 | store/src/main/java/org/apache/rocketmq/store/queue/SparseConsumeQueue.java:68-75 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `store/src/main/java/org/apache/rocketmq/store/queue/BatchConsumeQueue.java:225` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (8 lines × 2) store/src/main/java/org/apache/rocketmq/store/queue/BatchConsumeQueue.java:689— store/src/main/java/org/apache/rocketmq/store/queue/BatchConsumeQueue.java:689-697 | store/src/main/java/org/apache/rocketmq/store/queue/SparseConsumeQueue.java:142-149 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `store/src/main/java/org/apache/rocketmq/store/queue/BatchConsumeQueue.java:689` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (8 lines × 2) tools/src/main/java/org/apache/rocketmq/tools/admin/DefaultMQAdminExtImpl.java:979— tools/src/main/java/org/apache/rocketmq/tools/admin/DefaultMQAdminExtImpl.java:979-986 | tools/src/main/java/org/apache/rocketmq/tools/admin/DefaultMQAdminExtImpl.java:1733-1740 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `tools/src/main/java/org/apache/rocketmq/tools/admin/DefaultMQAdminExtImpl.java:979` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (8 lines × 2) tools/src/main/java/org/apache/rocketmq/tools/command/acl/UpdateAccessConfigSubCommand.java:130— tools/src/main/java/org/apache/rocketmq/tools/command/acl/UpdateAccessConfigSubCommand.java:130-137 | tools/src/main/java/org/apache/rocketmq/tools/command/acl/UpdateAccessConfigSubCommand.java:142-149 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `tools/src/main/java/org/apache/rocketmq/tools/command/acl/UpdateAccessConfigSubCommand.java:130` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (8 lines × 2) tools/src/main/java/org/apache/rocketmq/tools/command/broker/CleanExpiredCQSubCommand.java:55— tools/src/main/java/org/apache/rocketmq/tools/command/broker/CleanExpiredCQSubCommand.java:55-62 | tools/src/main/java/org/apache/rocketmq/tools/command/broker/CleanUnusedTopicCommand.java:55-62 — before extracting anything, compare `tools/src/main/java/org/apache/rocketmq/tools/command/broker/CleanExpiredCQSubCommand.java` and `tools/src/main/java/org/apache/rocketmq/tools/command/broker/CleanUnusedTopicCommand.java` as WHOLE FILES: 83% of the shorter file's lines also appear in the other, so this reads as one file having been copied from the other rather than as a helper waiting to be extracted. The 2 duplicated block(s) this scan matched between them are fragments of that copy, not the extent of it — treat the file pair as the unit. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `tools/src/main/java/org/apache/rocketmq/tools/command/broker/CleanExpiredCQSubCommand.java:55` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (8 lines × 2) tools/src/main/java/org/apache/rocketmq/tools/command/controller/UpdateControllerConfigSubCommand.java:88— tools/src/main/java/org/apache/rocketmq/tools/command/controller/UpdateControllerConfigSubCommand.java:88-95 | tools/src/main/java/org/apache/rocketmq/tools/command/namesrv/UpdateNamesrvConfigCommand.java:83-90 — before extracting anything, compare `tools/src/main/java/org/apache/rocketmq/tools/command/controller/UpdateControllerConfigSubCommand.java` and `tools/src/main/java/org/apache/rocketmq/tools/command/namesrv/UpdateNamesrvConfigCommand.java` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 58 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `tools/src/main/java/org/apache/rocketmq/tools/command/controller/UpdateControllerConfigSubCommand.java:88` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (8 lines × 2) tools/src/main/java/org/apache/rocketmq/tools/command/message/ConsumeMessageCommand.java:257— tools/src/main/java/org/apache/rocketmq/tools/command/message/ConsumeMessageCommand.java:257-264 | tools/src/main/java/org/apache/rocketmq/tools/command/message/ConsumeMessageCommand.java:283-290 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (8 lines × 2) broker/src/main/java/org/apache/rocketmq/broker/schedule/ScheduleMessageService.java:124— broker/src/main/java/org/apache/rocketmq/broker/schedule/ScheduleMessageService.java:124-131 | store/src/main/java/org/apache/rocketmq/store/DefaultMessageStore.java:3244-3251 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (8 lines × 2) broker/src/main/java/org/apache/rocketmq/broker/topic/TopicRouteInfoManager.java:181— broker/src/main/java/org/apache/rocketmq/broker/topic/TopicRouteInfoManager.java:181-188 | client/src/main/java/org/apache/rocketmq/client/impl/producer/DefaultMQProducerImpl.java:449-456 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
Duplicated block (8 lines × 2) client/src/main/java/org/apache/rocketmq/client/impl/consumer/ConsumeMessageOrderlyService.java:349— client/src/main/java/org/apache/rocketmq/client/impl/consumer/ConsumeMessageOrderlyService.java:349-356 | client/src/main/java/org/apache/rocketmq/client/impl/consumer/ConsumeMessagePopOrderlyService.java:266-273 — before extracting anything, compare `client/src/main/java/org/apache/rocketmq/client/impl/consumer/ConsumeMessageOrderlyService.java` and `client/src/main/java/org/apache/rocketmq/client/impl/consumer/ConsumeMessagePopOrderlyService.java` as WHOLE FILES: this scan already matched 11 separate duplicated blocks between them, totalling at least 138 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (8 lines × 2) client/src/main/java/org/apache/rocketmq/client/impl/consumer/DefaultLitePullConsumerImpl.java:1143— client/src/main/java/org/apache/rocketmq/client/impl/consumer/DefaultLitePullConsumerImpl.java:1143-1150 | client/src/main/java/org/apache/rocketmq/client/impl/consumer/DefaultMQPullConsumerImpl.java:403-410 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
Duplicated block (8 lines × 2) broker/src/main/java/org/apache/rocketmq/broker/pagecache/ManyMessageTransfer.java:42— broker/src/main/java/org/apache/rocketmq/broker/pagecache/ManyMessageTransfer.java:42-49 | broker/src/main/java/org/apache/rocketmq/broker/pagecache/QueryMessageTransfer.java:42-49 — before extracting anything, compare `broker/src/main/java/org/apache/rocketmq/broker/pagecache/ManyMessageTransfer.java` and `broker/src/main/java/org/apache/rocketmq/broker/pagecache/QueryMessageTransfer.java` as WHOLE FILES: 86% of the shorter file's lines also appear in the other, so this reads as one file having been copied from the other rather than as a helper waiting to be extracted. The 1 duplicated block(s) this scan matched between them are fragments of that copy, not the extent of it — treat the file pair as the unit. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (5 lines × 2) acl/src/main/java/org/apache/rocketmq/acl/plain/PlainPermissionManager.java:173— acl/src/main/java/org/apache/rocketmq/acl/plain/PlainPermissionManager.java:173-177 | acl/src/main/java/org/apache/rocketmq/acl/plain/PlainPermissionManager.java:256-260 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `acl/src/main/java/org/apache/rocketmq/acl/plain/PlainPermissionManager.java:173` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (5 lines × 2) acl/src/main/java/org/apache/rocketmq/acl/plain/RemoteAddressStrategyFactory.java:186— acl/src/main/java/org/apache/rocketmq/acl/plain/RemoteAddressStrategyFactory.java:186-191 | acl/src/main/java/org/apache/rocketmq/acl/plain/RemoteAddressStrategyFactory.java:208-212 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `acl/src/main/java/org/apache/rocketmq/acl/plain/RemoteAddressStrategyFactory.java:186` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (5 lines × 2) broker/src/main/java/org/apache/rocketmq/broker/BrokerController.java:1660— broker/src/main/java/org/apache/rocketmq/broker/BrokerController.java:1660-1664 | container/src/main/java/org/apache/rocketmq/container/InnerBrokerController.java:83-87 — before extracting anything, compare `broker/src/main/java/org/apache/rocketmq/broker/BrokerController.java` and `container/src/main/java/org/apache/rocketmq/container/InnerBrokerController.java` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 44 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `broker/src/main/java/org/apache/rocketmq/broker/BrokerController.java:1660` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (5 lines × 2) broker/src/main/java/org/apache/rocketmq/broker/processor/AdminBrokerProcessor.java:437— broker/src/main/java/org/apache/rocketmq/broker/processor/AdminBrokerProcessor.java:437-441 | broker/src/main/java/org/apache/rocketmq/broker/processor/AdminBrokerProcessor.java:507-511 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (5 lines × 2) client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:1123— client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:1123-1127 | proxy/src/main/java/org/apache/rocketmq/proxy/service/message/LocalMessageService.java:266-270 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:1123` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (5 lines × 2) client/src/main/java/org/apache/rocketmq/client/impl/consumer/ConsumeMessageOrderlyService.java:378— client/src/main/java/org/apache/rocketmq/client/impl/consumer/ConsumeMessageOrderlyService.java:378-382 | client/src/main/java/org/apache/rocketmq/client/impl/consumer/ConsumeMessagePopOrderlyService.java:295-299 — before extracting anything, compare `client/src/main/java/org/apache/rocketmq/client/impl/consumer/ConsumeMessageOrderlyService.java` and `client/src/main/java/org/apache/rocketmq/client/impl/consumer/ConsumeMessagePopOrderlyService.java` as WHOLE FILES: this scan already matched 11 separate duplicated blocks between them, totalling at least 138 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `client/src/main/java/org/apache/rocketmq/client/impl/consumer/ConsumeMessageOrderlyService.java:378` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (5 lines × 2) client/src/main/java/org/apache/rocketmq/client/impl/consumer/DefaultMQPullConsumerImpl.java:393— client/src/main/java/org/apache/rocketmq/client/impl/consumer/DefaultMQPullConsumerImpl.java:393-397 | client/src/main/java/org/apache/rocketmq/client/impl/consumer/DefaultMQPushConsumerImpl.java:1371-1376 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `client/src/main/java/org/apache/rocketmq/client/impl/consumer/DefaultMQPullConsumerImpl.java:393` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (5 lines × 2) client/src/main/java/org/apache/rocketmq/client/impl/factory/MQClientInstance.java:1033— client/src/main/java/org/apache/rocketmq/client/impl/factory/MQClientInstance.java:1033-1037 | remoting/src/main/java/org/apache/rocketmq/remoting/rpc/ClientMetadata.java:70-75 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
Duplicated block (5 lines × 2) client/src/main/java/org/apache/rocketmq/client/trace/hook/EndTransactionTraceHookImpl.java:57— client/src/main/java/org/apache/rocketmq/client/trace/hook/EndTransactionTraceHookImpl.java:57-61 | client/src/main/java/org/apache/rocketmq/client/trace/hook/SendMessageTraceHookImpl.java:54-58 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Note first that the copies are not typed on the same thing: the declarations holding them bind `context` to `EndTransactionContext` in one and `SendMessageContext` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `client/src/main/java/org/apache/rocketmq/client/trace/hook/SendMessageTraceHookImpl.java:52` calls `setMqTraceContext` and `client/src/main/java/org/apache/rocketmq/client/trace/hook/EndTransactionTraceHookImpl.java:55` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (5 lines × 2) common/src/main/java/org/apache/rocketmq/common/message/MessageQueue.java:71— common/src/main/java/org/apache/rocketmq/common/message/MessageQueue.java:71-75 | common/src/main/java/org/apache/rocketmq/common/message/MessageQueueForC.java:64-68 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `common/src/main/java/org/apache/rocketmq/common/message/MessageQueue.java:71` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
Duplicated block (5 lines × 2) proxy/src/main/java/org/apache/rocketmq/proxy/grpc/v2/client/ClientActivity.java:283— proxy/src/main/java/org/apache/rocketmq/proxy/grpc/v2/client/ClientActivity.java:283-288 | proxy/src/main/java/org/apache/rocketmq/proxy/grpc/v2/client/ClientActivity.java:299-303 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (5 lines × 2) proxy/src/main/java/org/apache/rocketmq/proxy/processor/ConsumerProcessor.java:429— proxy/src/main/java/org/apache/rocketmq/proxy/processor/ConsumerProcessor.java:429-433 | proxy/src/main/java/org/apache/rocketmq/proxy/processor/ConsumerProcessor.java:452-456 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `proxy/src/main/java/org/apache/rocketmq/proxy/processor/ConsumerProcessor.java:429` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (5 lines × 2) store/src/main/java/org/apache/rocketmq/store/CommitLog.java:321— store/src/main/java/org/apache/rocketmq/store/CommitLog.java:321-325 | store/src/main/java/org/apache/rocketmq/store/CommitLog.java:695-699 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `store/src/main/java/org/apache/rocketmq/store/CommitLog.java:321` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (5 lines × 2) store/src/main/java/org/apache/rocketmq/store/CommitLog.java:1856— store/src/main/java/org/apache/rocketmq/store/CommitLog.java:1856-1860 | store/src/main/java/org/apache/rocketmq/store/MessageExtEncoder.java:189-193 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `store/src/main/java/org/apache/rocketmq/store/CommitLog.java:1856` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (5 lines × 2) tieredstore/src/main/java/org/apache/rocketmq/tieredstore/TieredDispatcher.java:178— tieredstore/src/main/java/org/apache/rocketmq/tieredstore/TieredDispatcher.java:178-183 | tieredstore/src/main/java/org/apache/rocketmq/tieredstore/TieredDispatcher.java:344-348 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (5 lines × 2) tools/src/main/java/org/apache/rocketmq/tools/admin/DefaultMQAdminExtImpl.java:767— tools/src/main/java/org/apache/rocketmq/tools/admin/DefaultMQAdminExtImpl.java:767-771 | tools/src/main/java/org/apache/rocketmq/tools/admin/DefaultMQAdminExtImpl.java:1873-1877 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `tools/src/main/java/org/apache/rocketmq/tools/admin/DefaultMQAdminExtImpl.java:767` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (5 lines × 2) store/src/main/java/org/apache/rocketmq/store/ConsumeQueue.java:889— store/src/main/java/org/apache/rocketmq/store/ConsumeQueue.java:889-893 | store/src/main/java/org/apache/rocketmq/store/queue/BatchConsumeQueue.java:330-334 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (5 lines × 2) store/src/main/java/org/apache/rocketmq/store/ConsumeQueue.java:896— store/src/main/java/org/apache/rocketmq/store/ConsumeQueue.java:896-900 | store/src/main/java/org/apache/rocketmq/store/queue/BatchConsumeQueue.java:337-341 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (5 lines × 2) client/src/main/java/org/apache/rocketmq/client/impl/consumer/RebalanceLitePullImpl.java:61— client/src/main/java/org/apache/rocketmq/client/impl/consumer/RebalanceLitePullImpl.java:61-65 | client/src/main/java/org/apache/rocketmq/client/impl/consumer/RebalancePullImpl.java:56-60 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (5 lines × 2) broker/src/main/java/org/apache/rocketmq/broker/BrokerPreOnlineService.java:217— broker/src/main/java/org/apache/rocketmq/broker/BrokerPreOnlineService.java:217-221 | broker/src/main/java/org/apache/rocketmq/broker/processor/AdminBrokerProcessor.java:2703-2707 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
Duplicated block (5 lines × 2) broker/src/main/java/org/apache/rocketmq/broker/processor/AdminBrokerProcessor.java:2628— broker/src/main/java/org/apache/rocketmq/broker/processor/AdminBrokerProcessor.java:2628-2632 | broker/src/main/java/org/apache/rocketmq/broker/transaction/queue/DefaultTransactionalMessageCheckListener.java:66-70 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
Duplicated block (5 lines × 2) broker/src/main/java/org/apache/rocketmq/broker/processor/NotificationProcessor.java:67— broker/src/main/java/org/apache/rocketmq/broker/processor/NotificationProcessor.java:67-71 | broker/src/main/java/org/apache/rocketmq/broker/processor/PopMessageProcessor.java:198-202 — before extracting anything, compare `broker/src/main/java/org/apache/rocketmq/broker/processor/NotificationProcessor.java` and `broker/src/main/java/org/apache/rocketmq/broker/processor/PopMessageProcessor.java` as WHOLE FILES: this scan already matched 7 separate duplicated blocks between them, totalling at least 65 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (5 lines × 2) client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:1112— client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:1112-1116 | proxy/src/main/java/org/apache/rocketmq/proxy/service/message/LocalMessageService.java:247-251 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
Duplicated block (5 lines × 2) client/src/main/java/org/apache/rocketmq/client/impl/consumer/AssignedMessageQueue.java:123— client/src/main/java/org/apache/rocketmq/client/impl/consumer/AssignedMessageQueue.java:123-127 | client/src/main/java/org/apache/rocketmq/client/impl/consumer/AssignedMessageQueue.java:168-172 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `client/src/main/java/org/apache/rocketmq/client/impl/consumer/AssignedMessageQueue.java:123` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `client/src/main/java/org/apache/rocketmq/client/impl/consumer/AssignedMessageQueue.java:128` calls `contains`, `getKey`, `getValue` and `client/src/main/java/org/apache/rocketmq/client/impl/consumer/AssignedMessageQueue.java:173` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (5 lines × 2) filter/src/main/java/org/apache/rocketmq/filter/expression/ComparisonExpression.java:547— filter/src/main/java/org/apache/rocketmq/filter/expression/ComparisonExpression.java:547-551 | filter/src/main/java/org/apache/rocketmq/filter/expression/ComparisonExpression.java:561-565 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `filter/src/main/java/org/apache/rocketmq/filter/expression/ComparisonExpression.java:547` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `filter/src/main/java/org/apache/rocketmq/filter/expression/ComparisonExpression.java:545` calls `valueOf`, `shortValue` and `filter/src/main/java/org/apache/rocketmq/filter/expression/ComparisonExpression.java:560` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
MethodTooLong: PopMessageProcessor.processRequest broker/src/main/java/org/apache/rocketmq/broker/processor/PopMessageProcessor.java:196— MethodTooLong — processRequest runs 230 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 130 over it, 2.30× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
MethodTooLong: PullMessageProcessor.processRequest broker/src/main/java/org/apache/rocketmq/broker/processor/PullMessageProcessor.java:301— MethodTooLong — processRequest runs 217 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 117 over it, 2.17× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
MethodTooLong: DefaultMQPushConsumerImpl.pullMessage client/src/main/java/org/apache/rocketmq/client/impl/consumer/DefaultMQPushConsumerImpl.java:246— MethodTooLong — pullMessage runs 180 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 80 over it, 1.80× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
MethodTooLong: AbstractSendMessageProcessor.consumerSendMsgBack broker/src/main/java/org/apache/rocketmq/broker/processor/AbstractSendMessageProcessor.java:91— MethodTooLong — consumerSendMsgBack runs 176 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 76 over it, 1.76× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
MethodTooLong: TransactionalMessageServiceImpl.check broker/src/main/java/org/apache/rocketmq/broker/transaction/queue/TransactionalMessageServiceImpl.java:144— MethodTooLong — check runs 150 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 50 over it, 1.50× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
MethodTooLong: SendMessageProcessor.handlePutMessageResult broker/src/main/java/org/apache/rocketmq/broker/processor/SendMessageProcessor.java:352— MethodTooLong — handlePutMessageResult runs 149 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 49 over it, 1.49× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
MethodTooLong: DefaultMQProducerImpl.sendKernelImpl client/src/main/java/org/apache/rocketmq/client/impl/producer/DefaultMQProducerImpl.java:864— MethodTooLong — sendKernelImpl runs 144 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 44 over it, 1.44× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
MethodTooLong: TieredStoreMetricsManager.init tieredstore/src/main/java/org/apache/rocketmq/tieredstore/metrics/TieredStoreMetricsManager.java:147— MethodTooLong — init runs 143 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 43 over it, 1.43× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
MethodTooLong: ConsumerProgressSubCommand.execute tools/src/main/java/org/apache/rocketmq/tools/command/consumer/ConsumerProgressSubCommand.java:98— MethodTooLong — execute runs 134 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 34 over it, 1.34× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
MethodTooLong: CommitLog.checkMessageAndReturnSize store/src/main/java/org/apache/rocketmq/store/CommitLog.java:423— MethodTooLong — checkMessageAndReturnSize runs 131 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 31 over it, 1.31× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
MethodTooLong: PopMessageProcessor.popMsgFromQueue broker/src/main/java/org/apache/rocketmq/broker/processor/PopMessageProcessor.java:492— MethodTooLong — popMsgFromQueue runs 128 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 28 over it, 1.28× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
MethodTooLong: DefaultMessageStore.getMessage store/src/main/java/org/apache/rocketmq/store/DefaultMessageStore.java:782— MethodTooLong — getMessage runs 128 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 28 over it, 1.28× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
MethodTooLong: AdminBrokerProcessor.processRequest broker/src/main/java/org/apache/rocketmq/broker/processor/AdminBrokerProcessor.java:213— MethodTooLong — processRequest runs 127 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 27 over it, 1.27× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
MethodTooLong: ConsumeQueue.binarySearchInQueueByTime store/src/main/java/org/apache/rocketmq/store/ConsumeQueue.java:220— MethodTooLong — binarySearchInQueueByTime runs 124 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 24 over it, 1.24× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
MethodTooLong: DefaultMQPushConsumerImpl.checkConfig client/src/main/java/org/apache/rocketmq/client/impl/consumer/DefaultMQPushConsumerImpl.java:996— MethodTooLong — checkConfig runs 123 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 23 over it, 1.23× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
MethodTooLong: RebalanceImpl.updateMessageQueueAssignment client/src/main/java/org/apache/rocketmq/client/impl/consumer/RebalanceImpl.java:555— MethodTooLong — updateMessageQueueAssignment runs 123 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 23 over it, 1.23× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
MethodTooLong: DefaultPullMessageResultHandler.handle broker/src/main/java/org/apache/rocketmq/broker/processor/DefaultPullMessageResultHandler.java:78— MethodTooLong — handle runs 118 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 18 over it, 1.18× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
MethodTooLong: RouteInfoManager.registerBroker namesrv/src/main/java/org/apache/rocketmq/namesrv/routeinfo/RouteInfoManager.java:226— MethodTooLong — registerBroker runs 117 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 17 over it, 1.17× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
MethodTooLong: DefaultMQProducerImpl.sendDefaultImpl client/src/main/java/org/apache/rocketmq/client/impl/producer/DefaultMQProducerImpl.java:697— MethodTooLong — sendDefaultImpl runs 116 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 16 over it, 1.16× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
MethodTooLong: CommitLog.asyncPutMessage store/src/main/java/org/apache/rocketmq/store/CommitLog.java:900— MethodTooLong — asyncPutMessage runs 116 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 16 over it, 1.16× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
MethodTooLong: PeekMessageProcessor.processRequest broker/src/main/java/org/apache/rocketmq/broker/processor/PeekMessageProcessor.java:81— MethodTooLong — processRequest runs 109 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 9 over it, 1.09× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
MethodTooLong: ComparisonExpression.__compare filter/src/main/java/org/apache/rocketmq/filter/expression/ComparisonExpression.java:530— MethodTooLong — __compare runs 104 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 4 over it, 1.04× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
MethodTooLong: CommitLog.asyncPutMessages store/src/main/java/org/apache/rocketmq/store/CommitLog.java:1077— MethodTooLong — asyncPutMessages runs 104 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 4 over it, 1.04× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
MethodTooLong: ConsumeRequest.run client/src/main/java/org/apache/rocketmq/client/impl/consumer/ConsumeMessageOrderlyService.java:426— MethodTooLong — run runs 103 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 3 over it, 1.03× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
MethodTooLong: DLedgerCommitLog.asyncPutMessages store/src/main/java/org/apache/rocketmq/store/dledger/DLedgerCommitLog.java:523— MethodTooLong — asyncPutMessages runs 103 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 3 over it, 1.03× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
Duplicated block (10 lines × 2) broker/src/main/java/org/apache/rocketmq/broker/BrokerController.java:2125— broker/src/main/java/org/apache/rocketmq/broker/BrokerController.java:2125-2134 | store/src/main/java/org/apache/rocketmq/store/DefaultMessageStore.java:2137-2146 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
Duplicated block (10 lines × 2) broker/src/main/java/org/apache/rocketmq/broker/BrokerStartup.java:195— broker/src/main/java/org/apache/rocketmq/broker/BrokerStartup.java:195-204 | container/src/main/java/org/apache/rocketmq/container/BrokerContainerStartup.java:317-326 — before extracting anything, compare `broker/src/main/java/org/apache/rocketmq/broker/BrokerStartup.java` and `container/src/main/java/org/apache/rocketmq/container/BrokerContainerStartup.java` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 32 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `broker/src/main/java/org/apache/rocketmq/broker/BrokerStartup.java:195` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (10 lines × 2) broker/src/main/java/org/apache/rocketmq/broker/metrics/ConsumerLagCalculator.java:276— broker/src/main/java/org/apache/rocketmq/broker/metrics/ConsumerLagCalculator.java:276-285 | broker/src/main/java/org/apache/rocketmq/broker/metrics/ConsumerLagCalculator.java:333-342 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `broker/src/main/java/org/apache/rocketmq/broker/metrics/ConsumerLagCalculator.java:276` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (10 lines × 2) broker/src/main/java/org/apache/rocketmq/broker/out/BrokerOuterAPI.java:410— broker/src/main/java/org/apache/rocketmq/broker/out/BrokerOuterAPI.java:410-420 | client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:3285-3294 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `broker/src/main/java/org/apache/rocketmq/broker/out/BrokerOuterAPI.java:410` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (10 lines × 2) broker/src/main/java/org/apache/rocketmq/broker/out/BrokerOuterAPI.java:609— broker/src/main/java/org/apache/rocketmq/broker/out/BrokerOuterAPI.java:609-619 | client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:3112-3121 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `broker/src/main/java/org/apache/rocketmq/broker/out/BrokerOuterAPI.java:609` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (10 lines × 2) broker/src/main/java/org/apache/rocketmq/broker/out/BrokerOuterAPI.java:868— broker/src/main/java/org/apache/rocketmq/broker/out/BrokerOuterAPI.java:868-877 | client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:1320-1330 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (10 lines × 2) broker/src/main/java/org/apache/rocketmq/broker/out/BrokerOuterAPI.java:890— broker/src/main/java/org/apache/rocketmq/broker/out/BrokerOuterAPI.java:890-899 | client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:1372-1382 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (10 lines × 2) client/src/main/java/org/apache/rocketmq/client/impl/consumer/ConsumeMessageOrderlyService.java:389— client/src/main/java/org/apache/rocketmq/client/impl/consumer/ConsumeMessageOrderlyService.java:389-398 | client/src/main/java/org/apache/rocketmq/client/impl/consumer/ConsumeMessagePopOrderlyService.java:305-314 — before extracting anything, compare `client/src/main/java/org/apache/rocketmq/client/impl/consumer/ConsumeMessageOrderlyService.java` and `client/src/main/java/org/apache/rocketmq/client/impl/consumer/ConsumeMessagePopOrderlyService.java` as WHOLE FILES: this scan already matched 11 separate duplicated blocks between them, totalling at least 138 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `client/src/main/java/org/apache/rocketmq/client/impl/consumer/ConsumeMessageOrderlyService.java:389` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (10 lines × 2) client/src/main/java/org/apache/rocketmq/client/impl/consumer/DefaultLitePullConsumerImpl.java:1050— client/src/main/java/org/apache/rocketmq/client/impl/consumer/DefaultLitePullConsumerImpl.java:1050-1059 | client/src/main/java/org/apache/rocketmq/client/impl/consumer/DefaultMQPullConsumerImpl.java:252-261 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `client/src/main/java/org/apache/rocketmq/client/impl/consumer/DefaultLitePullConsumerImpl.java:1050` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (10 lines × 2) client/src/main/java/org/apache/rocketmq/client/producer/ProduceAccumulator.java:224— client/src/main/java/org/apache/rocketmq/client/producer/ProduceAccumulator.java:224-233 | client/src/main/java/org/apache/rocketmq/client/producer/ProduceAccumulator.java:238-247 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `client/src/main/java/org/apache/rocketmq/client/producer/ProduceAccumulator.java:224` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (10 lines × 2) common/src/main/java/org/apache/rocketmq/common/UtilAll.java:170— common/src/main/java/org/apache/rocketmq/common/UtilAll.java:170-179 | common/src/main/java/org/apache/rocketmq/common/UtilAll.java:182-191 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
Duplicated block (10 lines × 2) common/src/main/java/org/apache/rocketmq/common/config/ConfigRocksDBStorage.java:185— common/src/main/java/org/apache/rocketmq/common/config/ConfigRocksDBStorage.java:185-194 | store/src/main/java/org/apache/rocketmq/store/rocksdb/RocksDBOptionsFactory.java:142-151 — before extracting anything, compare `common/src/main/java/org/apache/rocketmq/common/config/ConfigRocksDBStorage.java` and `store/src/main/java/org/apache/rocketmq/store/rocksdb/RocksDBOptionsFactory.java` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 56 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `common/src/main/java/org/apache/rocketmq/common/config/ConfigRocksDBStorage.java:195` calls `setStatsDumpPeriodSec` and `store/src/main/java/org/apache/rocketmq/store/rocksdb/RocksDBOptionsFactory.java:152` does not — after which the two agree again for 4 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (10 lines × 2) common/src/main/java/org/apache/rocketmq/common/utils/HttpTinyClient.java:46— common/src/main/java/org/apache/rocketmq/common/utils/HttpTinyClient.java:46-55 | common/src/main/java/org/apache/rocketmq/common/utils/HttpTinyClient.java:111-120 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `common/src/main/java/org/apache/rocketmq/common/utils/HttpTinyClient.java:46` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (10 lines × 2) proxy/src/main/java/org/apache/rocketmq/proxy/service/message/LocalMessageService.java:116— proxy/src/main/java/org/apache/rocketmq/proxy/service/message/LocalMessageService.java:116-125 | proxy/src/main/java/org/apache/rocketmq/proxy/service/message/LocalMessageService.java:207-216 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `proxy/src/main/java/org/apache/rocketmq/proxy/service/message/LocalMessageService.java:116` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (10 lines × 2) store/src/main/java/org/apache/rocketmq/store/StoreCheckpoint.java:43— store/src/main/java/org/apache/rocketmq/store/StoreCheckpoint.java:43-52 | store/src/main/java/org/apache/rocketmq/store/timer/TimerCheckpoint.java:52-61 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `store/src/main/java/org/apache/rocketmq/store/StoreCheckpoint.java:43` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (10 lines × 2) store/src/main/java/org/apache/rocketmq/store/ha/DefaultHAConnection.java:415— store/src/main/java/org/apache/rocketmq/store/ha/DefaultHAConnection.java:415-424 | store/src/main/java/org/apache/rocketmq/store/ha/DefaultHAConnection.java:437-446 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `store/src/main/java/org/apache/rocketmq/store/ha/DefaultHAConnection.java:415` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (10 lines × 2) tieredstore/src/main/java/org/apache/rocketmq/tieredstore/TieredDispatcher.java:138— tieredstore/src/main/java/org/apache/rocketmq/tieredstore/TieredDispatcher.java:138-147 | tieredstore/src/main/java/org/apache/rocketmq/tieredstore/TieredDispatcher.java:260-269 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `tieredstore/src/main/java/org/apache/rocketmq/tieredstore/TieredDispatcher.java:138` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (10 lines × 2) tools/src/main/java/org/apache/rocketmq/tools/command/topic/RemappingStaticTopicSubCommand.java:140— tools/src/main/java/org/apache/rocketmq/tools/command/topic/RemappingStaticTopicSubCommand.java:140-149 | tools/src/main/java/org/apache/rocketmq/tools/command/topic/UpdateStaticTopicSubCommand.java:145-154 — before extracting anything, compare `tools/src/main/java/org/apache/rocketmq/tools/command/topic/RemappingStaticTopicSubCommand.java` and `tools/src/main/java/org/apache/rocketmq/tools/command/topic/UpdateStaticTopicSubCommand.java` as WHOLE FILES: this scan already matched 12 separate duplicated blocks between them, totalling at least 126 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `tools/src/main/java/org/apache/rocketmq/tools/command/topic/RemappingStaticTopicSubCommand.java:140` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `tools/src/main/java/org/apache/rocketmq/tools/command/topic/RemappingStaticTopicSubCommand.java:150` calls `refreshClusterInfo` and `tools/src/main/java/org/apache/rocketmq/tools/command/topic/UpdateStaticTopicSubCommand.java:155` does not — after which the two agree again for 4 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (10 lines × 2) client/src/main/java/org/apache/rocketmq/client/impl/consumer/DefaultLitePullConsumerImpl.java:1153— client/src/main/java/org/apache/rocketmq/client/impl/consumer/DefaultLitePullConsumerImpl.java:1153-1162 | client/src/main/java/org/apache/rocketmq/client/impl/consumer/DefaultMQPullConsumerImpl.java:413-422 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (10 lines × 2) tools/src/main/java/org/apache/rocketmq/tools/command/message/PrintMessageByQueueCommand.java:43— tools/src/main/java/org/apache/rocketmq/tools/command/message/PrintMessageByQueueCommand.java:43-53 | tools/src/main/java/org/apache/rocketmq/tools/command/message/PrintMessageSubCommand.java:37-46 — before extracting anything, compare `tools/src/main/java/org/apache/rocketmq/tools/command/message/PrintMessageByQueueCommand.java` and `tools/src/main/java/org/apache/rocketmq/tools/command/message/PrintMessageSubCommand.java` as WHOLE FILES: this scan already matched 8 separate duplicated blocks between them, totalling at least 85 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (10 lines × 2) client/src/main/java/org/apache/rocketmq/client/impl/consumer/ConsumeMessageConcurrentlyService.java:347— client/src/main/java/org/apache/rocketmq/client/impl/consumer/ConsumeMessageConcurrentlyService.java:347-356 | client/src/main/java/org/apache/rocketmq/client/impl/consumer/ConsumeMessagePopConcurrentlyService.java:334-343 — before extracting anything, compare `client/src/main/java/org/apache/rocketmq/client/impl/consumer/ConsumeMessageConcurrentlyService.java` and `client/src/main/java/org/apache/rocketmq/client/impl/consumer/ConsumeMessagePopConcurrentlyService.java` as WHOLE FILES: this scan already matched 8 separate duplicated blocks between them, totalling at least 122 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `client/src/main/java/org/apache/rocketmq/client/impl/consumer/ConsumeMessageConcurrentlyService.java:347` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (10 lines × 2) client/src/main/java/org/apache/rocketmq/client/impl/consumer/RebalanceLitePullImpl.java:49— client/src/main/java/org/apache/rocketmq/client/impl/consumer/RebalanceLitePullImpl.java:49-58 | client/src/main/java/org/apache/rocketmq/client/impl/consumer/RebalancePullImpl.java:44-53 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
Duplicated block (10 lines × 2) example/src/main/java/org/apache/rocketmq/example/schedule/ScheduledMessageProducer.java:32— example/src/main/java/org/apache/rocketmq/example/schedule/ScheduledMessageProducer.java:32-41 | example/src/main/java/org/apache/rocketmq/example/schedule/TimerMessageProducer.java:34-43 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `example/src/main/java/org/apache/rocketmq/example/schedule/ScheduledMessageProducer.java:32` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (11 lines × 2) broker/src/main/java/org/apache/rocketmq/broker/failover/EscapeBridge.java:103— broker/src/main/java/org/apache/rocketmq/broker/failover/EscapeBridge.java:103-113 | broker/src/main/java/org/apache/rocketmq/broker/failover/EscapeBridge.java:236-246 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `broker/src/main/java/org/apache/rocketmq/broker/failover/EscapeBridge.java:103` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (11 lines × 2) broker/src/main/java/org/apache/rocketmq/broker/offset/ConsumerOrderInfoManager.java:96— broker/src/main/java/org/apache/rocketmq/broker/offset/ConsumerOrderInfoManager.java:96-106 | broker/src/main/java/org/apache/rocketmq/broker/offset/ConsumerOrderInfoManager.java:144-154 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (11 lines × 2) broker/src/main/java/org/apache/rocketmq/broker/offset/LmqConsumerOffsetManager.java:41— broker/src/main/java/org/apache/rocketmq/broker/offset/LmqConsumerOffsetManager.java:41-51 | broker/src/main/java/org/apache/rocketmq/broker/offset/RocksDBLmqConsumerOffsetManager.java:36-46 — before extracting anything, compare `broker/src/main/java/org/apache/rocketmq/broker/offset/LmqConsumerOffsetManager.java` and `broker/src/main/java/org/apache/rocketmq/broker/offset/RocksDBLmqConsumerOffsetManager.java` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 41 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
Duplicated block (11 lines × 2) broker/src/main/java/org/apache/rocketmq/broker/out/BrokerOuterAPI.java:1090— broker/src/main/java/org/apache/rocketmq/broker/out/BrokerOuterAPI.java:1090-1100 | client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:787-797 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `broker/src/main/java/org/apache/rocketmq/broker/out/BrokerOuterAPI.java:1090` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `broker/src/main/java/org/apache/rocketmq/broker/out/BrokerOuterAPI.java:1101` calls `getExtFields`, `get` and `client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:798` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (11 lines × 2) broker/src/main/java/org/apache/rocketmq/broker/out/BrokerOuterAPI.java:1159— broker/src/main/java/org/apache/rocketmq/broker/out/BrokerOuterAPI.java:1159-1169 | client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:1957-1967 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `broker/src/main/java/org/apache/rocketmq/broker/out/BrokerOuterAPI.java:1159` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (11 lines × 2) broker/src/main/java/org/apache/rocketmq/broker/processor/AdminBrokerProcessor.java:871— broker/src/main/java/org/apache/rocketmq/broker/processor/AdminBrokerProcessor.java:871-881 | container/src/main/java/org/apache/rocketmq/container/BrokerContainerProcessor.java:267-278 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `broker/src/main/java/org/apache/rocketmq/broker/processor/AdminBrokerProcessor.java:871` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (11 lines × 2) broker/src/main/java/org/apache/rocketmq/broker/subscription/SubscriptionGroupManager.java:361— broker/src/main/java/org/apache/rocketmq/broker/subscription/SubscriptionGroupManager.java:361-371 | broker/src/main/java/org/apache/rocketmq/broker/topic/TopicConfigManager.java:666-676 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `broker/src/main/java/org/apache/rocketmq/broker/subscription/SubscriptionGroupManager.java:361` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (11 lines × 2) broker/src/main/java/org/apache/rocketmq/broker/topic/TopicQueueMappingCleanService.java:194— broker/src/main/java/org/apache/rocketmq/broker/topic/TopicQueueMappingCleanService.java:194-204 | broker/src/main/java/org/apache/rocketmq/broker/topic/TopicQueueMappingCleanService.java:316-326 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `broker/src/main/java/org/apache/rocketmq/broker/topic/TopicQueueMappingCleanService.java:194` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `broker/src/main/java/org/apache/rocketmq/broker/topic/TopicQueueMappingCleanService.java:206` calls `info` and `broker/src/main/java/org/apache/rocketmq/broker/topic/TopicQueueMappingCleanService.java:328` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (11 lines × 2) client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:1646— client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:1646-1656 | client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:1845-1855 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:1646` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (11 lines × 2) client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:1882— client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:1882-1892 | client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:1900-1910 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:1882` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (11 lines × 2) client/src/main/java/org/apache/rocketmq/client/impl/consumer/ConsumeMessageConcurrentlyService.java:402— client/src/main/java/org/apache/rocketmq/client/impl/consumer/ConsumeMessageConcurrentlyService.java:402-412 | client/src/main/java/org/apache/rocketmq/client/impl/consumer/ConsumeMessagePopConcurrentlyService.java:415-425 — before extracting anything, compare `client/src/main/java/org/apache/rocketmq/client/impl/consumer/ConsumeMessageConcurrentlyService.java` and `client/src/main/java/org/apache/rocketmq/client/impl/consumer/ConsumeMessagePopConcurrentlyService.java` as WHOLE FILES: this scan already matched 8 separate duplicated blocks between them, totalling at least 122 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `client/src/main/java/org/apache/rocketmq/client/impl/consumer/ConsumeMessageConcurrentlyService.java:402` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (11 lines × 2) client/src/main/java/org/apache/rocketmq/client/impl/consumer/DefaultLitePullConsumerImpl.java:524— client/src/main/java/org/apache/rocketmq/client/impl/consumer/DefaultLitePullConsumerImpl.java:524-534 | client/src/main/java/org/apache/rocketmq/client/impl/consumer/DefaultLitePullConsumerImpl.java:548-558 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `client/src/main/java/org/apache/rocketmq/client/impl/consumer/DefaultLitePullConsumerImpl.java:524` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (11 lines × 2) client/src/main/java/org/apache/rocketmq/client/impl/producer/DefaultMQProducerImpl.java:1595— client/src/main/java/org/apache/rocketmq/client/impl/producer/DefaultMQProducerImpl.java:1595-1605 | client/src/main/java/org/apache/rocketmq/client/impl/producer/DefaultMQProducerImpl.java:1626-1636 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `client/src/main/java/org/apache/rocketmq/client/impl/producer/DefaultMQProducerImpl.java:1595` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (11 lines × 2) client/src/main/java/org/apache/rocketmq/client/impl/producer/DefaultMQProducerImpl.java:1652— client/src/main/java/org/apache/rocketmq/client/impl/producer/DefaultMQProducerImpl.java:1652-1662 | client/src/main/java/org/apache/rocketmq/client/impl/producer/DefaultMQProducerImpl.java:1696-1706 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `client/src/main/java/org/apache/rocketmq/client/impl/producer/DefaultMQProducerImpl.java:1652` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (11 lines × 2) namesrv/src/main/java/org/apache/rocketmq/namesrv/processor/ClientRequestProcessor.java:98— namesrv/src/main/java/org/apache/rocketmq/namesrv/processor/ClientRequestProcessor.java:98-108 | namesrv/src/main/java/org/apache/rocketmq/namesrv/processor/ClusterTestRequestProcessor.java:75-85 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `namesrv/src/main/java/org/apache/rocketmq/namesrv/processor/ClientRequestProcessor.java:98` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (11 lines × 2) proxy/src/main/java/org/apache/rocketmq/proxy/common/ReceiptHandleGroup.java:172— proxy/src/main/java/org/apache/rocketmq/proxy/common/ReceiptHandleGroup.java:172-182 | proxy/src/main/java/org/apache/rocketmq/proxy/common/ReceiptHandleGroup.java:196-206 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `proxy/src/main/java/org/apache/rocketmq/proxy/common/ReceiptHandleGroup.java:172` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (11 lines × 2) proxy/src/main/java/org/apache/rocketmq/proxy/service/sysmessage/HeartbeatSyncer.java:109— proxy/src/main/java/org/apache/rocketmq/proxy/service/sysmessage/HeartbeatSyncer.java:109-119 | proxy/src/main/java/org/apache/rocketmq/proxy/service/sysmessage/HeartbeatSyncer.java:147-157 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `proxy/src/main/java/org/apache/rocketmq/proxy/service/sysmessage/HeartbeatSyncer.java:109` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (11 lines × 2) remoting/src/main/java/org/apache/rocketmq/remoting/protocol/header/ExtraInfoUtil.java:134— remoting/src/main/java/org/apache/rocketmq/remoting/protocol/header/ExtraInfoUtil.java:134-144 | remoting/src/main/java/org/apache/rocketmq/remoting/protocol/header/ExtraInfoUtil.java:148-158 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `remoting/src/main/java/org/apache/rocketmq/remoting/protocol/header/ExtraInfoUtil.java:134` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (11 lines × 2) store/src/main/java/org/apache/rocketmq/store/DispatchRequest.java:96— store/src/main/java/org/apache/rocketmq/store/DispatchRequest.java:96-106 | store/src/main/java/org/apache/rocketmq/store/DispatchRequest.java:112-122 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (11 lines × 2) tools/src/main/java/org/apache/rocketmq/tools/command/acl/ClusterAclConfigVersionListSubCommand.java:57— tools/src/main/java/org/apache/rocketmq/tools/command/acl/ClusterAclConfigVersionListSubCommand.java:57-67 | tools/src/main/java/org/apache/rocketmq/tools/command/broker/BrokerStatusSubCommand.java:53-63 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `tools/src/main/java/org/apache/rocketmq/tools/command/acl/ClusterAclConfigVersionListSubCommand.java:57` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
Duplicated block (11 lines × 2) tools/src/main/java/org/apache/rocketmq/tools/command/offset/ResetOffsetByTimeCommand.java:163— tools/src/main/java/org/apache/rocketmq/tools/command/offset/ResetOffsetByTimeCommand.java:163-173 | tools/src/main/java/org/apache/rocketmq/tools/command/offset/SkipAccumulationSubCommand.java:115-125 — before extracting anything, compare `tools/src/main/java/org/apache/rocketmq/tools/command/offset/ResetOffsetByTimeCommand.java` and `tools/src/main/java/org/apache/rocketmq/tools/command/offset/SkipAccumulationSubCommand.java` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 35 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `tools/src/main/java/org/apache/rocketmq/tools/command/offset/ResetOffsetByTimeCommand.java:163` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (12 lines × 2) broker/src/main/java/org/apache/rocketmq/broker/client/rebalance/RebalanceLockManager.java:64— broker/src/main/java/org/apache/rocketmq/broker/client/rebalance/RebalanceLockManager.java:64-75 | broker/src/main/java/org/apache/rocketmq/broker/client/rebalance/RebalanceLockManager.java:149-160 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `broker/src/main/java/org/apache/rocketmq/broker/client/rebalance/RebalanceLockManager.java:64` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (12 lines × 2) broker/src/main/java/org/apache/rocketmq/broker/longpolling/PopLongPollingService.java:322— broker/src/main/java/org/apache/rocketmq/broker/longpolling/PopLongPollingService.java:322-333 | broker/src/main/java/org/apache/rocketmq/broker/processor/PopBufferMergeService.java:195-206 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `broker/src/main/java/org/apache/rocketmq/broker/longpolling/PopLongPollingService.java:322` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (12 lines × 2) broker/src/main/java/org/apache/rocketmq/broker/offset/LmqConsumerOffsetManager.java:55— broker/src/main/java/org/apache/rocketmq/broker/offset/LmqConsumerOffsetManager.java:55-66 | broker/src/main/java/org/apache/rocketmq/broker/offset/RocksDBLmqConsumerOffsetManager.java:50-61 — before extracting anything, compare `broker/src/main/java/org/apache/rocketmq/broker/offset/LmqConsumerOffsetManager.java` and `broker/src/main/java/org/apache/rocketmq/broker/offset/RocksDBLmqConsumerOffsetManager.java` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 41 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
Duplicated block (12 lines × 2) broker/src/main/java/org/apache/rocketmq/broker/processor/NotificationProcessor.java:189— broker/src/main/java/org/apache/rocketmq/broker/processor/NotificationProcessor.java:189-200 | broker/src/main/java/org/apache/rocketmq/broker/processor/PeekMessageProcessor.java:263-274 — before extracting anything, compare `broker/src/main/java/org/apache/rocketmq/broker/processor/NotificationProcessor.java` and `broker/src/main/java/org/apache/rocketmq/broker/processor/PeekMessageProcessor.java` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 63 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
Duplicated block (12 lines × 2) broker/src/main/java/org/apache/rocketmq/broker/schedule/ScheduleMessageService.java:308— broker/src/main/java/org/apache/rocketmq/broker/schedule/ScheduleMessageService.java:308-319 | store/src/main/java/org/apache/rocketmq/store/DefaultMessageStore.java:306-317 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `broker/src/main/java/org/apache/rocketmq/broker/schedule/ScheduleMessageService.java:308` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `broker/src/main/java/org/apache/rocketmq/broker/schedule/ScheduleMessageService.java:321` calls `put` and `store/src/main/java/org/apache/rocketmq/store/DefaultMessageStore.java:318` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (12 lines × 2) broker/src/main/java/org/apache/rocketmq/broker/topic/TopicConfigManager.java:454— broker/src/main/java/org/apache/rocketmq/broker/topic/TopicConfigManager.java:454-465 | broker/src/main/java/org/apache/rocketmq/broker/topic/TopicConfigManager.java:477-488 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `broker/src/main/java/org/apache/rocketmq/broker/topic/TopicConfigManager.java:454` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (12 lines × 2) client/src/main/java/org/apache/rocketmq/client/consumer/store/LocalFileOffsetStore.java:98— client/src/main/java/org/apache/rocketmq/client/consumer/store/LocalFileOffsetStore.java:98-109 | client/src/main/java/org/apache/rocketmq/client/consumer/store/RemoteBrokerOffsetStore.java:79-90 — before extracting anything, compare `client/src/main/java/org/apache/rocketmq/client/consumer/store/LocalFileOffsetStore.java` and `client/src/main/java/org/apache/rocketmq/client/consumer/store/RemoteBrokerOffsetStore.java` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 50 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `client/src/main/java/org/apache/rocketmq/client/consumer/store/LocalFileOffsetStore.java:98` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (12 lines × 2) client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:1446— client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:1446-1457 | client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:1596-1607 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:1446` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (12 lines × 2) client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:1798— client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:1798-1809 | client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:1820-1831 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:1798` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (12 lines × 2) client/src/main/java/org/apache/rocketmq/client/impl/consumer/RebalanceLitePullImpl.java:127— client/src/main/java/org/apache/rocketmq/client/impl/consumer/RebalanceLitePullImpl.java:127-138 | client/src/main/java/org/apache/rocketmq/client/impl/consumer/RebalancePushImpl.java:218-229 — before extracting anything, compare `client/src/main/java/org/apache/rocketmq/client/impl/consumer/RebalanceLitePullImpl.java` and `client/src/main/java/org/apache/rocketmq/client/impl/consumer/RebalancePushImpl.java` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 37 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `client/src/main/java/org/apache/rocketmq/client/impl/consumer/RebalanceLitePullImpl.java:127` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (12 lines × 2) client/src/main/java/org/apache/rocketmq/client/impl/mqclient/MQClientAPIExt.java:455— client/src/main/java/org/apache/rocketmq/client/impl/mqclient/MQClientAPIExt.java:455-466 | client/src/main/java/org/apache/rocketmq/client/impl/mqclient/MQClientAPIExt.java:491-502 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `client/src/main/java/org/apache/rocketmq/client/impl/mqclient/MQClientAPIExt.java:455` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (12 lines × 2) client/src/main/java/org/apache/rocketmq/client/producer/ProduceAccumulator.java:78— client/src/main/java/org/apache/rocketmq/client/producer/ProduceAccumulator.java:78-89 | client/src/main/java/org/apache/rocketmq/client/producer/ProduceAccumulator.java:123-134 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
Duplicated block (12 lines × 2) common/src/main/java/org/apache/rocketmq/common/config/AbstractRocksDBStorage.java:196— common/src/main/java/org/apache/rocketmq/common/config/AbstractRocksDBStorage.java:196-207 | common/src/main/java/org/apache/rocketmq/common/config/AbstractRocksDBStorage.java:210-221 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
Duplicated block (12 lines × 2) common/src/main/java/org/apache/rocketmq/common/message/MessageQueue.java:86— common/src/main/java/org/apache/rocketmq/common/message/MessageQueue.java:86-97 | common/src/main/java/org/apache/rocketmq/common/message/MessageQueueForC.java:79-90 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (12 lines × 2) proxy/src/main/java/org/apache/rocketmq/proxy/remoting/MultiProtocolTlsHelper.java:101— proxy/src/main/java/org/apache/rocketmq/proxy/remoting/MultiProtocolTlsHelper.java:101-112 | remoting/src/main/java/org/apache/rocketmq/remoting/netty/TlsHelper.java:215-226 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
Duplicated block (12 lines × 2) store/src/main/java/org/apache/rocketmq/store/DefaultMessageStore.java:2816— store/src/main/java/org/apache/rocketmq/store/DefaultMessageStore.java:2816-2827 | store/src/main/java/org/apache/rocketmq/store/DefaultMessageStore.java:3107-3118 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `store/src/main/java/org/apache/rocketmq/store/DefaultMessageStore.java:2816` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (12 lines × 2) tools/src/main/java/org/apache/rocketmq/tools/command/message/QueryMsgByKeySubCommand.java:77— tools/src/main/java/org/apache/rocketmq/tools/command/message/QueryMsgByKeySubCommand.java:77-88 | tools/src/main/java/org/apache/rocketmq/tools/command/message/QueryMsgTraceByIdSubCommand.java:95-106 — before extracting anything, compare `tools/src/main/java/org/apache/rocketmq/tools/command/message/QueryMsgByKeySubCommand.java` and `tools/src/main/java/org/apache/rocketmq/tools/command/message/QueryMsgTraceByIdSubCommand.java` as WHOLE FILES: this scan already matched 7 separate duplicated blocks between them, totalling at least 72 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (12 lines × 2) tools/src/main/java/org/apache/rocketmq/tools/command/topic/RemappingStaticTopicSubCommand.java:55— tools/src/main/java/org/apache/rocketmq/tools/command/topic/RemappingStaticTopicSubCommand.java:55-66 | tools/src/main/java/org/apache/rocketmq/tools/command/topic/UpdateStaticTopicSubCommand.java:56-67 — before extracting anything, compare `tools/src/main/java/org/apache/rocketmq/tools/command/topic/RemappingStaticTopicSubCommand.java` and `tools/src/main/java/org/apache/rocketmq/tools/command/topic/UpdateStaticTopicSubCommand.java` as WHOLE FILES: this scan already matched 12 separate duplicated blocks between them, totalling at least 126 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (12 lines × 2) tools/src/main/java/org/apache/rocketmq/tools/command/topic/RemappingStaticTopicSubCommand.java:120— tools/src/main/java/org/apache/rocketmq/tools/command/topic/RemappingStaticTopicSubCommand.java:120-131 | tools/src/main/java/org/apache/rocketmq/tools/command/topic/UpdateStaticTopicSubCommand.java:125-136 — before extracting anything, compare `tools/src/main/java/org/apache/rocketmq/tools/command/topic/RemappingStaticTopicSubCommand.java` and `tools/src/main/java/org/apache/rocketmq/tools/command/topic/UpdateStaticTopicSubCommand.java` as WHOLE FILES: this scan already matched 12 separate duplicated blocks between them, totalling at least 126 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (12 lines × 2) example/src/main/java/org/apache/rocketmq/example/schedule/ScheduledMessageConsumer.java:32— example/src/main/java/org/apache/rocketmq/example/schedule/ScheduledMessageConsumer.java:32-43 | example/src/main/java/org/apache/rocketmq/example/schedule/TimerMessageConsumer.java:34-45 — before extracting anything, compare `example/src/main/java/org/apache/rocketmq/example/schedule/ScheduledMessageConsumer.java` and `example/src/main/java/org/apache/rocketmq/example/schedule/TimerMessageConsumer.java` as WHOLE FILES: 88% of the shorter file's lines also appear in the other, so this reads as one file having been copied from the other rather than as a helper waiting to be extracted. The 1 duplicated block(s) this scan matched between them are fragments of that copy, not the extent of it — treat the file pair as the unit. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `example/src/main/java/org/apache/rocketmq/example/schedule/ScheduledMessageConsumer.java:32` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (13 lines × 2) broker/src/main/java/org/apache/rocketmq/broker/BrokerStartup.java:221— broker/src/main/java/org/apache/rocketmq/broker/BrokerStartup.java:221-233 | container/src/main/java/org/apache/rocketmq/container/BrokerContainerStartup.java:345-357 — before extracting anything, compare `broker/src/main/java/org/apache/rocketmq/broker/BrokerStartup.java` and `container/src/main/java/org/apache/rocketmq/container/BrokerContainerStartup.java` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 32 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (13 lines × 2) broker/src/main/java/org/apache/rocketmq/broker/metrics/ConsumerLagCalculator.java:287— broker/src/main/java/org/apache/rocketmq/broker/metrics/ConsumerLagCalculator.java:287-299 | broker/src/main/java/org/apache/rocketmq/broker/metrics/ConsumerLagCalculator.java:344-356 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `broker/src/main/java/org/apache/rocketmq/broker/metrics/ConsumerLagCalculator.java:287` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
Duplicated block (13 lines × 2) broker/src/main/java/org/apache/rocketmq/broker/offset/ConsumerOffsetManager.java:141— broker/src/main/java/org/apache/rocketmq/broker/offset/ConsumerOffsetManager.java:141-153 | broker/src/main/java/org/apache/rocketmq/broker/offset/ConsumerOffsetManager.java:159-171 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `broker/src/main/java/org/apache/rocketmq/broker/offset/ConsumerOffsetManager.java:141` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
Duplicated block (13 lines × 2) broker/src/main/java/org/apache/rocketmq/broker/processor/PopReviveService.java:219— broker/src/main/java/org/apache/rocketmq/broker/processor/PopReviveService.java:219-231 | broker/src/main/java/org/apache/rocketmq/broker/transaction/queue/TransactionalMessageBridge.java:147-159 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `broker/src/main/java/org/apache/rocketmq/broker/processor/PopReviveService.java:219` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (13 lines × 2) broker/src/main/java/org/apache/rocketmq/broker/schedule/ScheduleMessageService.java:338— broker/src/main/java/org/apache/rocketmq/broker/schedule/ScheduleMessageService.java:338-350 | store/src/main/java/org/apache/rocketmq/store/timer/TimerMessageStore.java:1129-1141 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
Duplicated block (13 lines × 2) client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:2095— client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:2095-2107 | client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:2115-2127 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:2095` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:2114` calls `setClusterName` and `client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:2094` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (13 lines × 2) client/src/main/java/org/apache/rocketmq/client/impl/consumer/DefaultMQPullConsumerImpl.java:232— client/src/main/java/org/apache/rocketmq/client/impl/consumer/DefaultMQPullConsumerImpl.java:232-244 | client/src/main/java/org/apache/rocketmq/client/impl/consumer/DefaultMQPullConsumerImpl.java:483-495 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (13 lines × 2) client/src/main/java/org/apache/rocketmq/client/impl/producer/DefaultMQProducerImpl.java:956— client/src/main/java/org/apache/rocketmq/client/impl/producer/DefaultMQProducerImpl.java:956-968 | proxy/src/main/java/org/apache/rocketmq/proxy/processor/ProducerProcessor.java:183-195 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
Duplicated block (13 lines × 2) common/src/main/java/org/apache/rocketmq/common/filter/impl/PolishExpr.java:113— common/src/main/java/org/apache/rocketmq/common/filter/impl/PolishExpr.java:113-125 | common/src/main/java/org/apache/rocketmq/common/filter/impl/PolishExpr.java:140-152 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `common/src/main/java/org/apache/rocketmq/common/filter/impl/PolishExpr.java:113` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
Duplicated block (13 lines × 2) namesrv/src/main/java/org/apache/rocketmq/namesrv/processor/ClientRequestProcessor.java:90— namesrv/src/main/java/org/apache/rocketmq/namesrv/processor/ClientRequestProcessor.java:90-102 | proxy/src/main/java/org/apache/rocketmq/proxy/remoting/activity/GetTopicRouteActivity.java:59-71 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `namesrv/src/main/java/org/apache/rocketmq/namesrv/processor/ClientRequestProcessor.java:90` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
Duplicated block (13 lines × 2) store/src/main/java/org/apache/rocketmq/store/DefaultMessageStore.java:1742— store/src/main/java/org/apache/rocketmq/store/DefaultMessageStore.java:1742-1754 | REDACTED:285-297 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `store/src/main/java/org/apache/rocketmq/store/DefaultMessageStore.java:1742` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (13 lines × 2) store/src/main/java/org/apache/rocketmq/store/ha/DefaultHAConnection.java:66— store/src/main/java/org/apache/rocketmq/store/ha/DefaultHAConnection.java:66-78 | store/src/main/java/org/apache/rocketmq/store/ha/autoswitch/AutoSwitchHAConnection.java:111-123 — before extracting anything, compare `store/src/main/java/org/apache/rocketmq/store/ha/DefaultHAConnection.java` and `store/src/main/java/org/apache/rocketmq/store/ha/autoswitch/AutoSwitchHAConnection.java` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 36 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `store/src/main/java/org/apache/rocketmq/store/ha/DefaultHAConnection.java:66` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note first that the copies are not typed on the same thing: the declarations holding them bind `haService` to `DefaultHAService` in one and `AutoSwitchHAService` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
Duplicated block (13 lines × 2) tools/src/main/java/org/apache/rocketmq/tools/admin/DefaultMQAdminExtImpl.java:1402— tools/src/main/java/org/apache/rocketmq/tools/admin/DefaultMQAdminExtImpl.java:1402-1414 | tools/src/main/java/org/apache/rocketmq/tools/admin/DefaultMQAdminExtImpl.java:1493-1505 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `tools/src/main/java/org/apache/rocketmq/tools/admin/DefaultMQAdminExtImpl.java:1402` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (13 lines × 2) store/src/main/java/org/apache/rocketmq/store/CommitLog.java:1391— store/src/main/java/org/apache/rocketmq/store/CommitLog.java:1391-1403 | store/src/main/java/org/apache/rocketmq/store/dledger/DLedgerCommitLog.java:704-716 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
TodoComment broker/src/main/java/org/apache/rocketmq/broker/processor/SendMessageProcessor.java:509— // TODO process partial failures of batch message — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
TodoComment client/src/main/java/org/apache/rocketmq/client/Validators.java:130— // TODO: use MixAll.isPropertyValid() when jdk upgrade to 1.8 — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
TodoComment store/src/main/java/org/apache/rocketmq/store/RocksDBMessageStore.java:166— // todo — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
TodoComment store/src/main/java/org/apache/rocketmq/store/queue/RocksDBConsumeQueue.java:226— // todo — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
TodoComment store/src/main/java/org/apache/rocketmq/store/ha/GroupTransferService.java:123— // TODO: We must ensure every HAConnection represents a different slave — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
TodoComment store/src/main/java/org/apache/rocketmq/store/queue/ConsumeQueueStore.java:390— // TODO maybe the topic has been deleted. — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
TodoComment store/src/main/java/org/apache/rocketmq/store/stats/BrokerStatsManager.java:262— // TODO ugly — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
TodoComment store/src/main/java/org/apache/rocketmq/store/timer/TimerMessageStore.java:754— // TODO: check if the delete msg is in the same slot with "the msg to be deleted". — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
TodoComment test/src/test/java/org/apache/rocketmq/test/dledger/DLedgerProduceAndConsumeIT.java:73— // TODO: We need to acquire the actual listening port after the peer has started. — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
TodoComment tieredstore/src/main/java/org/apache/rocketmq/tieredstore/file/TieredFlatFile.java:165— // TODO check coda/size — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
TodoComment tieredstore/src/main/java/org/apache/rocketmq/tieredstore/file/TieredFlatFile.java:515— // TODO handle update segment metadata failed exception — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
TodoComment tieredstore/src/main/java/org/apache/rocketmq/tieredstore/provider/posix/PosixFileSegment.java:118— // TODO use direct IO to avoid polluting the page cache — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
Duplicated block (14 lines × 2) broker/src/main/java/org/apache/rocketmq/broker/BrokerController.java:1674— broker/src/main/java/org/apache/rocketmq/broker/BrokerController.java:1674-1687 | container/src/main/java/org/apache/rocketmq/container/InnerBrokerController.java:97-110 — before extracting anything, compare `broker/src/main/java/org/apache/rocketmq/broker/BrokerController.java` and `container/src/main/java/org/apache/rocketmq/container/InnerBrokerController.java` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 44 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `broker/src/main/java/org/apache/rocketmq/broker/BrokerController.java:1674` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (14 lines × 2) broker/src/main/java/org/apache/rocketmq/broker/latency/BrokerFastFailure.java:123— broker/src/main/java/org/apache/rocketmq/broker/latency/BrokerFastFailure.java:123-136 | proxy/src/main/java/org/apache/rocketmq/proxy/remoting/RemotingProtocolServer.java:332-345 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `broker/src/main/java/org/apache/rocketmq/broker/latency/BrokerFastFailure.java:123` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `proxy/src/main/java/org/apache/rocketmq/proxy/remoting/RemotingProtocolServer.java:331` calls `getQueue` and `broker/src/main/java/org/apache/rocketmq/broker/latency/BrokerFastFailure.java:122` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (14 lines × 2) broker/src/main/java/org/apache/rocketmq/broker/out/BrokerOuterAPI.java:928— broker/src/main/java/org/apache/rocketmq/broker/out/BrokerOuterAPI.java:928-941 | broker/src/main/java/org/apache/rocketmq/broker/out/BrokerOuterAPI.java:965-978 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `broker/src/main/java/org/apache/rocketmq/broker/out/BrokerOuterAPI.java:928` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (14 lines × 2) broker/src/main/java/org/apache/rocketmq/broker/topic/TopicQueueMappingCleanService.java:111— broker/src/main/java/org/apache/rocketmq/broker/topic/TopicQueueMappingCleanService.java:111-124 | broker/src/main/java/org/apache/rocketmq/broker/topic/TopicQueueMappingCleanService.java:221-234 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `broker/src/main/java/org/apache/rocketmq/broker/topic/TopicQueueMappingCleanService.java:111` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `broker/src/main/java/org/apache/rocketmq/broker/topic/TopicQueueMappingCleanService.java:220` calls `ClientMetadata` and `broker/src/main/java/org/apache/rocketmq/broker/topic/TopicQueueMappingCleanService.java:110` does not — after which the two agree again for 4 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (14 lines × 2) client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:2918— client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:2918-2931 | client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:3201-3214 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:2918` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
Duplicated block (14 lines × 2) namesrv/src/main/java/org/apache/rocketmq/namesrv/routeinfo/RouteInfoManager.java:826— namesrv/src/main/java/org/apache/rocketmq/namesrv/routeinfo/RouteInfoManager.java:826-839 | namesrv/src/main/java/org/apache/rocketmq/namesrv/routeinfo/RouteInfoManager.java:859-872 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `namesrv/src/main/java/org/apache/rocketmq/namesrv/routeinfo/RouteInfoManager.java:826` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (14 lines × 2) tools/src/main/java/org/apache/rocketmq/tools/admin/DefaultMQAdminExtImpl.java:373— tools/src/main/java/org/apache/rocketmq/tools/admin/DefaultMQAdminExtImpl.java:373-386 | tools/src/main/java/org/apache/rocketmq/tools/admin/DefaultMQAdminExtImpl.java:1109-1122 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `tools/src/main/java/org/apache/rocketmq/tools/admin/DefaultMQAdminExtImpl.java:373` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (14 lines × 2) tools/src/main/java/org/apache/rocketmq/tools/admin/DefaultMQAdminExtImpl.java:1440— tools/src/main/java/org/apache/rocketmq/tools/admin/DefaultMQAdminExtImpl.java:1440-1453 | tools/src/main/java/org/apache/rocketmq/tools/admin/DefaultMQAdminExtImpl.java:1471-1484 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `tools/src/main/java/org/apache/rocketmq/tools/admin/DefaultMQAdminExtImpl.java:1440` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (14 lines × 2) tools/src/main/java/org/apache/rocketmq/tools/command/broker/BrokerConsumeStatsSubCommad.java:42— tools/src/main/java/org/apache/rocketmq/tools/command/broker/BrokerConsumeStatsSubCommad.java:42-55 | tools/src/main/java/org/apache/rocketmq/tools/command/message/QueryMsgByUniqueKeySubCommand.java:47-60 — before extracting anything, compare `tools/src/main/java/org/apache/rocketmq/tools/command/broker/BrokerConsumeStatsSubCommad.java` and `tools/src/main/java/org/apache/rocketmq/tools/command/message/QueryMsgByUniqueKeySubCommand.java` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 60 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
Duplicated block (14 lines × 2) tools/src/main/java/org/apache/rocketmq/tools/command/message/PrintMessageByQueueCommand.java:181— tools/src/main/java/org/apache/rocketmq/tools/command/message/PrintMessageByQueueCommand.java:181-194 | tools/src/main/java/org/apache/rocketmq/tools/command/message/PrintMessageSubCommand.java:122-135 — before extracting anything, compare `tools/src/main/java/org/apache/rocketmq/tools/command/message/PrintMessageByQueueCommand.java` and `tools/src/main/java/org/apache/rocketmq/tools/command/message/PrintMessageSubCommand.java` as WHOLE FILES: this scan already matched 8 separate duplicated blocks between them, totalling at least 85 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (14 lines × 2) tools/src/main/java/org/apache/rocketmq/tools/command/message/QueryMsgByIdSubCommand.java:149— tools/src/main/java/org/apache/rocketmq/tools/command/message/QueryMsgByIdSubCommand.java:149-162 | tools/src/main/java/org/apache/rocketmq/tools/command/message/QueryMsgByUniqueKeySubCommand.java:100-113 — before extracting anything, compare `tools/src/main/java/org/apache/rocketmq/tools/command/message/QueryMsgByIdSubCommand.java` and `tools/src/main/java/org/apache/rocketmq/tools/command/message/QueryMsgByUniqueKeySubCommand.java` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 60 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `tools/src/main/java/org/apache/rocketmq/tools/command/message/QueryMsgByIdSubCommand.java:149` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (14 lines × 2) broker/src/main/java/org/apache/rocketmq/broker/util/PositiveAtomicCounter.java:26— broker/src/main/java/org/apache/rocketmq/broker/util/PositiveAtomicCounter.java:26-39 | common/src/main/java/org/apache/rocketmq/common/utils/PositiveAtomicCounter.java:26-39 — before extracting anything, compare `broker/src/main/java/org/apache/rocketmq/broker/util/PositiveAtomicCounter.java` and `common/src/main/java/org/apache/rocketmq/common/utils/PositiveAtomicCounter.java` as WHOLE FILES: 96% of the shorter file's lines also appear in the other, so this reads as one file having been copied from the other rather than as a helper waiting to be extracted. The 1 duplicated block(s) this scan matched between them are fragments of that copy, not the extent of it — treat the file pair as the unit. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication· Members sharing a duplicated core (4 members, 50+ identical tokens) · ×11
Members sharing a duplicated core (4 members, 50+ identical tokens) broker/src/main/java/org/apache/rocketmq/broker/out/BrokerOuterAPI.java:400— broker/src/main/java/org/apache/rocketmq/broker/out/BrokerOuterAPI.java:400-420 | broker/src/main/java/org/apache/rocketmq/broker/out/BrokerOuterAPI.java:600-619 | client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:3105-3121 | client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:3273-3294 — These 4 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
Members sharing a duplicated core (4 members, 50+ identical tokens) client/src/main/java/org/apache/rocketmq/client/impl/MQAdminImpl.java:192— client/src/main/java/org/apache/rocketmq/client/impl/MQAdminImpl.java:192-209 | client/src/main/java/org/apache/rocketmq/client/impl/MQAdminImpl.java:211-227 | client/src/main/java/org/apache/rocketmq/client/impl/MQAdminImpl.java:229-245 | client/src/main/java/org/apache/rocketmq/client/impl/MQAdminImpl.java:247-263 — These 4 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
Members sharing a duplicated core (4 members, 50+ identical tokens) client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:1339— client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:1339-1360 | client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:2292-2320 | client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:2325-2347 | client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:2621-2650 — These 4 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
Members sharing a duplicated core (4 members, 50+ identical tokens) client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:1636— client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:1636-1656 | client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:1835-1855 | client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:1876-1892 | client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:1895-1910 — These 4 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
Members sharing a duplicated core (4 members, 50+ identical tokens) client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:2174— client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:2174-2201 | client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:2204-2229 | client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:2874-2904 | client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:3218-3243 — These 4 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
Members sharing a duplicated core (4 members, 50+ identical tokens) client/src/main/java/org/apache/rocketmq/client/impl/consumer/ConsumeMessageConcurrentlyService.java:131— client/src/main/java/org/apache/rocketmq/client/impl/consumer/ConsumeMessageConcurrentlyService.java:131-184 | client/src/main/java/org/apache/rocketmq/client/impl/consumer/ConsumeMessageOrderlyService.java:139-197 | client/src/main/java/org/apache/rocketmq/client/impl/consumer/ConsumeMessagePopConcurrentlyService.java:116-168 | client/src/main/java/org/apache/rocketmq/client/impl/consumer/ConsumeMessagePopOrderlyService.java:133-191 — These 4 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
Members sharing a duplicated core (4 members, 50+ identical tokens) common/src/main/java/org/apache/rocketmq/common/UtilAll.java:364— common/src/main/java/org/apache/rocketmq/common/UtilAll.java:364-402 | common/src/main/java/org/apache/rocketmq/common/compression/Lz4Compressor.java:55-85 | common/src/main/java/org/apache/rocketmq/common/compression/ZlibCompressor.java:59-97 | common/src/main/java/org/apache/rocketmq/common/compression/ZstdCompressor.java:55-85 — These 4 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
Members sharing a duplicated core (4 members, 50+ identical tokens) namesrv/src/main/java/org/apache/rocketmq/namesrv/processor/DefaultRequestProcessor.java:523— namesrv/src/main/java/org/apache/rocketmq/namesrv/processor/DefaultRequestProcessor.java:523-542 | namesrv/src/main/java/org/apache/rocketmq/namesrv/processor/DefaultRequestProcessor.java:558-575 | namesrv/src/main/java/org/apache/rocketmq/namesrv/processor/DefaultRequestProcessor.java:578-595 | namesrv/src/main/java/org/apache/rocketmq/namesrv/processor/DefaultRequestProcessor.java:597-614 — These 4 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
Members sharing a duplicated core (4 members, 50+ identical tokens) store/src/main/java/org/apache/rocketmq/store/CommitLog.java:900— store/src/main/java/org/apache/rocketmq/store/CommitLog.java:900-1075 | store/src/main/java/org/apache/rocketmq/store/CommitLog.java:1077-1236 | store/src/main/java/org/apache/rocketmq/store/dledger/DLedgerCommitLog.java:402-418 | store/src/main/java/org/apache/rocketmq/store/dledger/DLedgerCommitLog.java:523-664 — These 4 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
Members sharing a duplicated core (4 members, 50+ identical tokens) tools/src/main/java/org/apache/rocketmq/tools/admin/DefaultMQAdminExtImpl.java:355— tools/src/main/java/org/apache/rocketmq/tools/admin/DefaultMQAdminExtImpl.java:355-384 | tools/src/main/java/org/apache/rocketmq/tools/admin/DefaultMQAdminExtImpl.java:506-571 | tools/src/main/java/org/apache/rocketmq/tools/admin/DefaultMQAdminExtImpl.java:1090-1120 | tools/src/main/java/org/apache/rocketmq/tools/admin/DefaultMQAdminExtImpl.java:1142-1170 — These 4 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
Members sharing a duplicated core (4 members, 50+ identical tokens) tools/src/main/java/org/apache/rocketmq/tools/command/container/AddBrokerSubCommand.java:54— tools/src/main/java/org/apache/rocketmq/tools/command/container/AddBrokerSubCommand.java:54-69 | tools/src/main/java/org/apache/rocketmq/tools/command/topic/AllocateMQSubCommand.java:61-94 | tools/src/main/java/org/apache/rocketmq/tools/command/topic/RemappingStaticTopicSubCommand.java:85-114 | tools/src/main/java/org/apache/rocketmq/tools/command/topic/UpdateStaticTopicSubCommand.java:91-118 — These 4 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
Change coupling: CommitLog.java ↔ StoreCheckpoint.java store/src/main/java/org/apache/rocketmq/store/CommitLog.java:1— `store/src/main/java/org/apache/rocketmq/store/CommitLog.java` and `store/src/main/java/org/apache/rocketmq/store/StoreCheckpoint.java` change together 73% of the time (11 of the 15 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets). They sit in the same directory, and in this ecosystem sibling files there normally share one namespace/package — so a direct reference between them needs no import and this pass cannot see whether one exists. Read the pair before acting: if one file only DECLARES what the other consumes (a constants/types file beside its user), the co-change is definitional and the question is whether the split earns its keep; if they duplicate structure, extract the common part into a shared function or type they both call; if neither holds, the coupling is hidden and worth breaking. You can check this without leaving the row: of the 11 shared commits counted here, the most recent 3 are `b410557e` [ISSUE #6609] Fix the issue that consume queue building exceeds confi…; `246be9eb` ROCKETMQ-6: Use logger for exceptions instead of e.printStackTrace().; `410b01e8` Issue #113 rename Maped to Mapped entirely (at that commit the files were still `rocketmq-store/src/main/java/com/alibaba/rocketmq/store/CommitLog.java` and `rocketmq-store/src/main/java/com/alibaba/rocketmq/store/StoreCheckpoint.java`) — run `git show` on any of them.
Change coupling: DefaultMessageStore.java ↔ AbstractPluginMessageStore.java store/src/main/java/org/apache/rocketmq/store/DefaultMessageStore.java:1— `store/src/main/java/org/apache/rocketmq/store/DefaultMessageStore.java` and `store/src/main/java/org/apache/rocketmq/store/plugin/AbstractPluginMessageStore.java` change together 69% of the time (20 of the 29 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) with no explicit dependency — the edge is real but nothing declares it. Read the pair before acting: if one registers itself into the other through a hook or an initialiser, the missing dependency is DELIBERATE — the registration is the link, and it is meant not to be an import — and the thing to add is a comment on each side naming the other, not a merge; if they simply belong together, co-locate them; if neither holds, the coupling is hidden and worth breaking. You can check this without leaving the row: of the 20 shared commits counted here, the most recent 3 are `50d10504` To config the cardinalityLimit for openTelemetry metrics exporting an…; `e3b81788` [ISSUE #6570] Fix the issue that expectLogicOffset is greater than cu…; `3fe81bfb` [ISSUE #6545] Remove getTopicConfigs method in interface MessageStore… — run `git show` on any of them.
Change coupling: Controller.java ↔ ControllerRequestProcessor.java controller/src/main/java/org/apache/rocketmq/controller/Controller.java:1— `controller/src/main/java/org/apache/rocketmq/controller/Controller.java` and `controller/src/main/java/org/apache/rocketmq/controller/processor/ControllerRequestProcessor.java` change together 55% of the time (6 of the 11 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) with no explicit dependency — the edge is real but nothing declares it. Read the pair before acting: if one registers itself into the other through a hook or an initialiser, the missing dependency is DELIBERATE — the registration is the link, and it is meant not to be an import — and the thing to add is a comment on each side naming the other, not a merge; if they simply belong together, co-locate them; if neither holds, the coupling is hidden and worth breaking. You can check this without leaving the row: of the 6 shared commits counted here, the most recent 3 are `c494a43c` refactor(controller): optimize some code suggested by reviewer; `a961d1b4` [ISSUE #4817] Add a command to clear broker data from controller for …; `0b6563b5` Add getControllerConfig and updateControllerConfig command for admin … — run `git show` on any of them.
Change coupling: ConsumeQueue.java ↔ BatchConsumeQueue.java store/src/main/java/org/apache/rocketmq/store/ConsumeQueue.java:1— `store/src/main/java/org/apache/rocketmq/store/ConsumeQueue.java` and `store/src/main/java/org/apache/rocketmq/store/queue/BatchConsumeQueue.java` change together 55% of the time (6 of the 11 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) with no explicit dependency — the edge is real but nothing declares it. Read the pair before acting: if one registers itself into the other through a hook or an initialiser, the missing dependency is DELIBERATE — the registration is the link, and it is meant not to be an import — and the thing to add is a comment on each side naming the other, not a merge; if they simply belong together, co-locate them; if neither holds, the coupling is hidden and worth breaking. You can check this without leaving the row: of the 6 shared commits counted here, the most recent 3 are `1fe5d623` [ISSUE #7074] Allow a BoundaryType to be specified when retrieving of…; `e3b81788` [ISSUE #6570] Fix the issue that expectLogicOffset is greater than cu…; `d3de48c8` [ISSUE #5605]Introduce tag estimation for lag calculation (#5606) — run `git show` on any of them.
Change coupling: DefaultMessageStore.java ↔ BatchConsumeQueue.java store/src/main/java/org/apache/rocketmq/store/DefaultMessageStore.java:1— `store/src/main/java/org/apache/rocketmq/store/DefaultMessageStore.java` and `store/src/main/java/org/apache/rocketmq/store/queue/BatchConsumeQueue.java` change together 55% of the time (6 of the 11 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) with no explicit dependency — the edge is real but nothing declares it. Read the pair before acting: if one registers itself into the other through a hook or an initialiser, the missing dependency is DELIBERATE — the registration is the link, and it is meant not to be an import — and the thing to add is a comment on each side naming the other, not a merge; if they simply belong together, co-locate them; if neither holds, the coupling is hidden and worth breaking. You can check this without leaving the row: of the 6 shared commits counted here, the most recent 3 are `1fe5d623` [ISSUE #7074] Allow a BoundaryType to be specified when retrieving of…; `e3b81788` [ISSUE #6570] Fix the issue that expectLogicOffset is greater than cu…; `d3de48c8` [ISSUE #5605]Introduce tag estimation for lag calculation (#5606) — run `git show` on any of them.
Change coupling: KVConfigManager.java ↔ DefaultRequestProcessor.java namesrv/src/main/java/org/apache/rocketmq/namesrv/kvconfig/KVConfigManager.java:1— `namesrv/src/main/java/org/apache/rocketmq/namesrv/kvconfig/KVConfigManager.java` and `namesrv/src/main/java/org/apache/rocketmq/namesrv/processor/DefaultRequestProcessor.java` change together 54% of the time (14 of the 26 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) with no explicit dependency — the edge is real but nothing declares it. Read the pair before acting: if one registers itself into the other through a hook or an initialiser, the missing dependency is DELIBERATE — the registration is the link, and it is meant not to be an import — and the thing to add is a comment on each side naming the other, not a merge; if they simply belong together, co-locate them; if neither holds, the coupling is hidden and worth breaking. You can check this without leaving the row: of the 14 shared commits counted here, the most recent 3 are `aa330615` [ISSUE #4634] fix code style in namesrv module (#5159); `80aad4af` 删除二套环境的project信息 (at that commit the files were still `rocketmq-namesrv/src/main/java/com/alibaba/rocketmq/namesrv/kvconfig/KVConfigManager.java` and `rocketmq-namesrv/src/main/java/com/alibaba/rocketmq/namesrv/processor/DefaultRequestProcessor.java`); `3cd4c304` #265 Name Server增加获取Namspace下所有配置的功能 (at that commit the files were still `rocketmq-namesrv/src/main/java/com/alibaba/rocketmq/namesrv/kvconfig/KVConfigManager.java` and `rocketmq-namesrv/src/main/java/com/alibaba/rocketmq/namesrv/processor/DefaultRequestProcessor.java`) — run `git show` on any of them.
Change coupling: RemotingClient.java ↔ NettyRemotingAbstract.java remoting/src/main/java/org/apache/rocketmq/remoting/RemotingClient.java:1— `remoting/src/main/java/org/apache/rocketmq/remoting/RemotingClient.java` and `remoting/src/main/java/org/apache/rocketmq/remoting/netty/NettyRemotingAbstract.java` change together 54% of the time (7 of the 13 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) with no explicit dependency — the edge is real but nothing declares it. Read the pair before acting: if one registers itself into the other through a hook or an initialiser, the missing dependency is DELIBERATE — the registration is the link, and it is meant not to be an import — and the thing to add is a comment on each side naming the other, not a merge; if they simply belong together, co-locate them; if neither holds, the coupling is hidden and worth breaking. You can check this without leaving the row: of the 7 shared commits counted here, the most recent 3 are `84156084` [ISSUE #7321] Refector NettyRemotingAbstract with unify future implem…; `bc0c04bf` [ROCKETMQ-355][POLISH]Async send method polish - fix the timeout sema…; `51e1d3f4` 优化以下几点 1、长轮询关闭时,挂起时间改为1s 2、oneway形式流控会打印大量日志,对日志进行优化,改为10s打印一次。 3、通信层… (at that commit the files were still `rocketmq-remoting/src/main/java/com/alibaba/rocketmq/remoting/RemotingClient.java` and `rocketmq-remoting/src/main/java/com/alibaba/rocketmq/remoting/netty/NettyRemotingAbstract.java`) — run `git show` on any of them.
Change coupling: ConsumerOffsetManager.java ↔ AdminBrokerProcessor.java broker/src/main/java/org/apache/rocketmq/broker/offset/ConsumerOffsetManager.java:1— `broker/src/main/java/org/apache/rocketmq/broker/offset/ConsumerOffsetManager.java` and `broker/src/main/java/org/apache/rocketmq/broker/processor/AdminBrokerProcessor.java` change together 53% of the time (25 of the 47 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) with no explicit dependency — the edge is real but nothing declares it. Read the pair before acting: if one registers itself into the other through a hook or an initialiser, the missing dependency is DELIBERATE — the registration is the link, and it is meant not to be an import — and the thing to add is a comment on each side naming the other, not a merge; if they simply belong together, co-locate them; if neither holds, the coupling is hidden and worth breaking. You can check this without leaving the row: of the 25 shared commits counted here, the most recent 3 are `a7c1d494` [ISSUE #5356] [RIP 48] Introduces the concept of ready and inflight m…; `d663bcf6` [ISSUE #5292] [RIP-48] Support reset offset in server-side to improve…; `46459426` [ISSUE #2748] Fix deleteSubscriptionGroup not remove consumer offset — run `git show` on any of them.
Change coupling: LocalFileOffsetStore.java ↔ RemoteBrokerOffsetStore.java client/src/main/java/org/apache/rocketmq/client/consumer/store/LocalFileOffsetStore.java:1— `client/src/main/java/org/apache/rocketmq/client/consumer/store/LocalFileOffsetStore.java` and `client/src/main/java/org/apache/rocketmq/client/consumer/store/RemoteBrokerOffsetStore.java` change together 51% of the time (22 of the 43 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets). They sit in the same directory, and in this ecosystem sibling files there normally share one namespace/package — so a direct reference between them needs no import and this pass cannot see whether one exists. Read the pair before acting: if one file only DECLARES what the other consumes (a constants/types file beside its user), the co-change is definitional and the question is whether the split earns its keep; if they duplicate structure, extract the common part into a shared function or type they both call; if neither holds, the coupling is hidden and worth breaking. You can check this without leaving the row: of the 22 shared commits counted here, the most recent 3 are `455ac6d5` [ISSUE #4327] Init collection size (#4214); `56f12fd8` new interface in DefaultMQPullConsumerImpl : CommitOffsetToBroker. #159 (at that commit the files were still `rocketmq-client/src/main/java/com/alibaba/rocketmq/client/consumer/store/LocalFileOffsetStore.java` and `rocketmq-client/src/main/java/com/alibaba/rocketmq/client/consumer/store/RemoteBrokerOffsetStore.java`); `f2752092` 格式化代码 (at that commit the files were still `rocketmq-client/src/main/java/com/alibaba/rocketmq/client/consumer/store/LocalFileOffsetStore.java` and `rocketmq-client/src/main/java/com/alibaba/rocketmq/client/consumer/store/RemoteBrokerOffsetStore.java`) — run `git show` on any of them.
Change coupling: NettyDecoder.java ↔ NettyEncoder.java remoting/src/main/java/org/apache/rocketmq/remoting/netty/NettyDecoder.java:1— `remoting/src/main/java/org/apache/rocketmq/remoting/netty/NettyDecoder.java` and `remoting/src/main/java/org/apache/rocketmq/remoting/netty/NettyEncoder.java` change together 50% of the time (5 of the 10 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets). They sit in the same directory, and in this ecosystem sibling files there normally share one namespace/package — so a direct reference between them needs no import and this pass cannot see whether one exists. Read the pair before acting: if one file only DECLARES what the other consumes (a constants/types file beside its user), the co-change is definitional and the question is whether the split earns its keep; if they duplicate structure, extract the common part into a shared function or type they both call; if neither holds, the coupling is hidden and worth breaking. You can check this without leaving the row: of the 5 shared commits counted here, the most recent 3 are `3cbb3b8e` [ISSUE 3585] [Part B] Improve encode/decode performance (#3588); `39657024` fixed #102 连接管理优化,增加注释,encode、decode过程中可以直接关闭连接 @qianjinkr // 这里关闭后, … (at that commit the files were still `rocketmq-remoting/src/main/java/com/alibaba/rocketmq/remoting/netty/NettyDecoder.java` and `rocketmq-remoting/src/main/java/com/alibaba/rocketmq/remoting/netty/NettyEncoder.java`); `06ec5b88` fixed #102 连接管理优化,增加注释,encode、decode过程中可以直接关闭连接 @qianjinkr // 这里关闭后, … (at that commit the files were still `rocketmq-remoting/src/main/java/com/alibaba/rocketmq/remoting/netty/NettyDecoder.java` and `rocketmq-remoting/src/main/java/com/alibaba/rocketmq/remoting/netty/NettyEncoder.java`) — run `git show` on any of them.
Duplicated block (9–10 lines × 2) broker/src/main/java/org/apache/rocketmq/broker/out/BrokerOuterAPI.java:1128— broker/src/main/java/org/apache/rocketmq/broker/out/BrokerOuterAPI.java:1128-1137 | client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:1982-1990 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `broker/src/main/java/org/apache/rocketmq/broker/out/BrokerOuterAPI.java:1128` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (9–10 lines × 2) broker/src/main/java/org/apache/rocketmq/broker/processor/AdminBrokerProcessor.java:1708— broker/src/main/java/org/apache/rocketmq/broker/processor/AdminBrokerProcessor.java:1708-1717 | broker/src/main/java/org/apache/rocketmq/broker/processor/AdminBrokerProcessor.java:2348-2356 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `broker/src/main/java/org/apache/rocketmq/broker/processor/AdminBrokerProcessor.java:1708` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `broker/src/main/java/org/apache/rocketmq/broker/processor/AdminBrokerProcessor.java:1706` calls `setPullOffset`, `max` and `broker/src/main/java/org/apache/rocketmq/broker/processor/AdminBrokerProcessor.java:2346` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (9–10 lines × 2) broker/src/main/java/org/apache/rocketmq/broker/processor/AdminBrokerProcessor.java:1793— broker/src/main/java/org/apache/rocketmq/broker/processor/AdminBrokerProcessor.java:1793-1801 | container/src/main/java/org/apache/rocketmq/container/BrokerContainerProcessor.java:296-305 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `container/src/main/java/org/apache/rocketmq/container/BrokerContainerProcessor.java:296` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (9–10 lines × 2) client/src/main/java/org/apache/rocketmq/client/consumer/store/LocalFileOffsetStore.java:173— client/src/main/java/org/apache/rocketmq/client/consumer/store/LocalFileOffsetStore.java:173-182 | client/src/main/java/org/apache/rocketmq/client/consumer/store/RemoteBrokerOffsetStore.java:178-186 — before extracting anything, compare `client/src/main/java/org/apache/rocketmq/client/consumer/store/LocalFileOffsetStore.java` and `client/src/main/java/org/apache/rocketmq/client/consumer/store/RemoteBrokerOffsetStore.java` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 50 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `client/src/main/java/org/apache/rocketmq/client/consumer/store/LocalFileOffsetStore.java:173` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (9–10 lines × 2) remoting/src/main/java/org/apache/rocketmq/remoting/netty/NettyRemotingClient.java:202— remoting/src/main/java/org/apache/rocketmq/remoting/netty/NettyRemotingClient.java:202-210 | remoting/src/main/java/org/apache/rocketmq/remoting/netty/NettyRemotingClient.java:318-327 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (9–10 lines × 2) remoting/src/main/java/org/apache/rocketmq/remoting/protocol/statictopic/TopicQueueMappingUtils.java:495— remoting/src/main/java/org/apache/rocketmq/remoting/protocol/statictopic/TopicQueueMappingUtils.java:495-503 | remoting/src/main/java/org/apache/rocketmq/remoting/protocol/statictopic/TopicQueueMappingUtils.java:605-614 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `remoting/src/main/java/org/apache/rocketmq/remoting/protocol/statictopic/TopicQueueMappingUtils.java:495` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (9–10 lines × 2) store/src/main/java/org/apache/rocketmq/store/CommitLog.java:322— store/src/main/java/org/apache/rocketmq/store/CommitLog.java:322-331 | store/src/main/java/org/apache/rocketmq/store/queue/SparseConsumeQueue.java:55-63 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `store/src/main/java/org/apache/rocketmq/store/CommitLog.java:322` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (9–10 lines × 2) store/src/main/java/org/apache/rocketmq/store/stats/BrokerStatsManager.java:690— store/src/main/java/org/apache/rocketmq/store/stats/BrokerStatsManager.java:690-698 | store/src/main/java/org/apache/rocketmq/store/stats/BrokerStatsManager.java:703-712 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
Duplicated block (9–10 lines × 2) tools/src/main/java/org/apache/rocketmq/tools/command/broker/UpdateBrokerConfigSubCommand.java:74— tools/src/main/java/org/apache/rocketmq/tools/command/broker/UpdateBrokerConfigSubCommand.java:74-83 | tools/src/main/java/org/apache/rocketmq/tools/command/broker/UpdateColdDataFlowCtrGroupConfigSubCommand.java:70-78 — before extracting anything, compare `tools/src/main/java/org/apache/rocketmq/tools/command/broker/UpdateBrokerConfigSubCommand.java` and `tools/src/main/java/org/apache/rocketmq/tools/command/broker/UpdateColdDataFlowCtrGroupConfigSubCommand.java` as WHOLE FILES: this scan already matched 11 separate duplicated blocks between them, totalling at least 103 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `tools/src/main/java/org/apache/rocketmq/tools/command/broker/UpdateBrokerConfigSubCommand.java:74` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (9–10 lines × 2) tools/src/main/java/org/apache/rocketmq/tools/command/connection/ProducerConnectionSubCommand.java:59— tools/src/main/java/org/apache/rocketmq/tools/command/connection/ProducerConnectionSubCommand.java:59-68 | tools/src/main/java/org/apache/rocketmq/tools/command/consumer/ConsumerStatusSubCommand.java:78-86 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `tools/src/main/java/org/apache/rocketmq/tools/command/connection/ProducerConnectionSubCommand.java:59` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (8 lines × 3) broker/src/main/java/org/apache/rocketmq/broker/coldctr/ColdDataCgCtrService.java:90— broker/src/main/java/org/apache/rocketmq/broker/coldctr/ColdDataCgCtrService.java:90-97 | broker/src/main/java/org/apache/rocketmq/broker/coldctr/ColdDataPullRequestHoldService.java:73-80 | store/src/main/java/org/apache/rocketmq/store/CommitLog.java:2283-2290 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 3 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 3 times. Read the line range as the matched WINDOW rather than a finished unit: at `broker/src/main/java/org/apache/rocketmq/broker/coldctr/ColdDataCgCtrService.java:90` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (8 lines × 3) broker/src/main/java/org/apache/rocketmq/broker/offset/ConsumerOffsetManager.java:73— broker/src/main/java/org/apache/rocketmq/broker/offset/ConsumerOffsetManager.java:73-80 | broker/src/main/java/org/apache/rocketmq/broker/offset/ConsumerOffsetManager.java:89-96 | broker/src/main/java/org/apache/rocketmq/broker/offset/ConsumerOffsetManager.java:378-385 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `broker/src/main/java/org/apache/rocketmq/broker/offset/ConsumerOffsetManager.java:73` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (8 lines × 3) broker/src/main/java/org/apache/rocketmq/broker/processor/ConsumerManageProcessor.java:115— broker/src/main/java/org/apache/rocketmq/broker/processor/ConsumerManageProcessor.java:115-122 | broker/src/main/java/org/apache/rocketmq/broker/processor/ConsumerManageProcessor.java:206-213 | broker/src/main/java/org/apache/rocketmq/broker/topic/TopicQueueMappingManager.java:242-249 — there are 3 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 3 sites; resolving a subset leaves the remainder to drift apart. Read the line range as the matched WINDOW rather than a finished unit: at `broker/src/main/java/org/apache/rocketmq/broker/processor/ConsumerManageProcessor.java:115` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. Note first that the copies are not typed on the same thing: the declarations holding them bind `requestHeader` to `UpdateConsumerOffsetRequestHeader` in one and `QueryConsumerOffsetRequestHeader` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
Duplicated block (8 lines × 3) broker/src/main/java/org/apache/rocketmq/broker/processor/NotificationProcessor.java:80— broker/src/main/java/org/apache/rocketmq/broker/processor/NotificationProcessor.java:80-87 | broker/src/main/java/org/apache/rocketmq/broker/processor/PeekMessageProcessor.java:90-97 | broker/src/main/java/org/apache/rocketmq/broker/processor/PollingInfoProcessor.java:68-75 — before extracting anything, compare `broker/src/main/java/org/apache/rocketmq/broker/processor/NotificationProcessor.java` and `broker/src/main/java/org/apache/rocketmq/broker/processor/PeekMessageProcessor.java` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 63 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `broker/src/main/java/org/apache/rocketmq/broker/processor/NotificationProcessor.java:80` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (8 lines × 3) broker/src/main/java/org/apache/rocketmq/broker/schedule/ScheduleMessageService.java:306— broker/src/main/java/org/apache/rocketmq/broker/schedule/ScheduleMessageService.java:306-313 | proxy/src/main/java/org/apache/rocketmq/proxy/config/ProxyConfig.java:302-309 | store/src/main/java/org/apache/rocketmq/store/DefaultMessageStore.java:304-311 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 3 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 3 times. Read the line range as the matched WINDOW rather than a finished unit: at `broker/src/main/java/org/apache/rocketmq/broker/schedule/ScheduleMessageService.java:306` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (8 lines × 3) client/src/main/java/org/apache/rocketmq/client/impl/admin/MqClientAdminImpl.java:93— client/src/main/java/org/apache/rocketmq/client/impl/admin/MqClientAdminImpl.java:93-101 | client/src/main/java/org/apache/rocketmq/client/impl/admin/MqClientAdminImpl.java:111-118 | client/src/main/java/org/apache/rocketmq/client/impl/admin/MqClientAdminImpl.java:263-270 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `client/src/main/java/org/apache/rocketmq/client/impl/admin/MqClientAdminImpl.java:93` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on. Note first that the copies are not typed on the same thing: the declarations holding them bind `requestHeader` to `QueryMessageRequestHeader` in one and `GetTopicStatsInfoRequestHeader` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
Duplicated block (8 lines × 3) client/src/main/java/org/apache/rocketmq/client/impl/producer/DefaultMQProducerImpl.java:1563— client/src/main/java/org/apache/rocketmq/client/impl/producer/DefaultMQProducerImpl.java:1563-1570 | client/src/main/java/org/apache/rocketmq/client/impl/producer/DefaultMQProducerImpl.java:1621-1628 | client/src/main/java/org/apache/rocketmq/client/impl/producer/DefaultMQProducerImpl.java:1691-1698 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (8 lines × 3) tools/src/main/java/org/apache/rocketmq/tools/command/consumer/ConsumerSubCommand.java:56— tools/src/main/java/org/apache/rocketmq/tools/command/consumer/ConsumerSubCommand.java:56-64 | tools/src/main/java/org/apache/rocketmq/tools/command/message/QueryMsgByUniqueKeySubCommand.java:161-170 | tools/src/main/java/org/apache/rocketmq/tools/command/topic/TopicRouteSubCommand.java:51-58 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 3 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 3 times. Read the line range as the matched WINDOW rather than a finished unit: at `tools/src/main/java/org/apache/rocketmq/tools/command/consumer/ConsumerSubCommand.java:56` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
Duplicated block (8 lines × 3) client/src/main/java/org/apache/rocketmq/client/impl/consumer/DefaultMQPullConsumerImpl.java:106— client/src/main/java/org/apache/rocketmq/client/impl/consumer/DefaultMQPullConsumerImpl.java:106-113 | client/src/main/java/org/apache/rocketmq/client/impl/consumer/DefaultMQPushConsumerImpl.java:661-668 | client/src/main/java/org/apache/rocketmq/client/impl/producer/DefaultMQProducerImpl.java:475-482 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 3 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 3 times.
Duplicated block (8 lines × 3) filter/src/main/java/org/apache/rocketmq/filter/expression/BinaryExpression.java:60— filter/src/main/java/org/apache/rocketmq/filter/expression/BinaryExpression.java:60-67 | filter/src/main/java/org/apache/rocketmq/filter/expression/ConstantExpression.java:106-113 | filter/src/main/java/org/apache/rocketmq/filter/expression/UnaryExpression.java:264-271 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 3 call sites, so a change lands once. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
XxxComment broker/src/main/java/org/apache/rocketmq/broker/processor/PullMessageProcessor.java:620— // XXX: warn and notify me — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
XxxComment broker/src/main/java/org/apache/rocketmq/broker/processor/PullMessageProcessor.java:638— // XXX: warn and notify me — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
XxxComment broker/src/main/java/org/apache/rocketmq/broker/schedule/ScheduleMessageService.java:380— // XXX: warn and notify me — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
XxxComment store/src/main/java/org/apache/rocketmq/store/ConsumeQueue.java:709— // XXX: warn and notify me — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
XxxComment store/src/main/java/org/apache/rocketmq/store/ConsumeQueue.java:721— // XXX: warn and notify me — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
XxxComment store/src/main/java/org/apache/rocketmq/store/CommitLog.java:1022— // XXX: warn and notify me — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
XxxComment store/src/main/java/org/apache/rocketmq/store/CommitLog.java:1185— // XXX: warn and notify me — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
XxxComment store/src/main/java/org/apache/rocketmq/store/queue/BatchConsumeQueue.java:522— // XXX: warn and notify me — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
XxxComment store/src/main/java/org/apache/rocketmq/store/queue/BatchConsumeQueue.java:533— // XXX: warn and notify me — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
Duplicated block (15 lines × 2) broker/src/main/java/org/apache/rocketmq/broker/processor/AdminBrokerProcessor.java:421— broker/src/main/java/org/apache/rocketmq/broker/processor/AdminBrokerProcessor.java:421-435 | broker/src/main/java/org/apache/rocketmq/broker/processor/AdminBrokerProcessor.java:487-501 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (15 lines × 2) client/src/main/java/org/apache/rocketmq/client/consumer/store/LocalFileOffsetStore.java:80— client/src/main/java/org/apache/rocketmq/client/consumer/store/LocalFileOffsetStore.java:80-94 | client/src/main/java/org/apache/rocketmq/client/consumer/store/RemoteBrokerOffsetStore.java:61-75 — before extracting anything, compare `client/src/main/java/org/apache/rocketmq/client/consumer/store/LocalFileOffsetStore.java` and `client/src/main/java/org/apache/rocketmq/client/consumer/store/RemoteBrokerOffsetStore.java` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 50 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
Duplicated block (15 lines × 2) client/src/main/java/org/apache/rocketmq/client/impl/consumer/ConsumeMessageOrderlyService.java:252— client/src/main/java/org/apache/rocketmq/client/impl/consumer/ConsumeMessageOrderlyService.java:252-266 | client/src/main/java/org/apache/rocketmq/client/impl/consumer/ConsumeMessagePopOrderlyService.java:233-247 — before extracting anything, compare `client/src/main/java/org/apache/rocketmq/client/impl/consumer/ConsumeMessageOrderlyService.java` and `client/src/main/java/org/apache/rocketmq/client/impl/consumer/ConsumeMessagePopOrderlyService.java` as WHOLE FILES: this scan already matched 11 separate duplicated blocks between them, totalling at least 138 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `client/src/main/java/org/apache/rocketmq/client/impl/consumer/ConsumeMessageOrderlyService.java:252` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (15 lines × 2) client/src/main/java/org/apache/rocketmq/client/impl/consumer/ConsumeMessageOrderlyService.java:361— client/src/main/java/org/apache/rocketmq/client/impl/consumer/ConsumeMessageOrderlyService.java:361-375 | client/src/main/java/org/apache/rocketmq/client/impl/consumer/ConsumeMessagePopOrderlyService.java:278-292 — before extracting anything, compare `client/src/main/java/org/apache/rocketmq/client/impl/consumer/ConsumeMessageOrderlyService.java` and `client/src/main/java/org/apache/rocketmq/client/impl/consumer/ConsumeMessagePopOrderlyService.java` as WHOLE FILES: this scan already matched 11 separate duplicated blocks between them, totalling at least 138 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `client/src/main/java/org/apache/rocketmq/client/impl/consumer/ConsumeMessageOrderlyService.java:361` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
Duplicated block (15 lines × 2) remoting/src/main/java/org/apache/rocketmq/remoting/common/RemotingHelper.java:141— remoting/src/main/java/org/apache/rocketmq/remoting/common/RemotingHelper.java:141-155 | remoting/src/main/java/org/apache/rocketmq/remoting/common/RemotingHelper.java:159-173 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (15 lines × 2) store/src/main/java/org/apache/rocketmq/store/CommitLog.java:937— store/src/main/java/org/apache/rocketmq/store/CommitLog.java:937-951 | store/src/main/java/org/apache/rocketmq/store/CommitLog.java:1102-1116 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `store/src/main/java/org/apache/rocketmq/store/CommitLog.java:937` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `store/src/main/java/org/apache/rocketmq/store/CommitLog.java:934` calls `get`, `updateMaxMessageSize`, `generateKey` and `store/src/main/java/org/apache/rocketmq/store/CommitLog.java:1100` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (15 lines × 2) store/src/main/java/org/apache/rocketmq/store/CommitLog.java:953— store/src/main/java/org/apache/rocketmq/store/CommitLog.java:953-967 | store/src/main/java/org/apache/rocketmq/store/CommitLog.java:1118-1132 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `store/src/main/java/org/apache/rocketmq/store/CommitLog.java:953` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (15 lines × 2) tools/src/main/java/org/apache/rocketmq/tools/command/controller/GetControllerConfigSubCommand.java:56— tools/src/main/java/org/apache/rocketmq/tools/command/controller/GetControllerConfigSubCommand.java:56-70 | tools/src/main/java/org/apache/rocketmq/tools/command/namesrv/GetNamesrvConfigCommand.java:53-67 — before extracting anything, compare `tools/src/main/java/org/apache/rocketmq/tools/command/controller/GetControllerConfigSubCommand.java` and `tools/src/main/java/org/apache/rocketmq/tools/command/namesrv/GetNamesrvConfigCommand.java` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 35 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `tools/src/main/java/org/apache/rocketmq/tools/command/controller/GetControllerConfigSubCommand.java:56` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (15 lines × 2) example/src/main/java/org/apache/rocketmq/example/simple/LitePullConsumerAssign.java:38— example/src/main/java/org/apache/rocketmq/example/simple/LitePullConsumerAssign.java:38-52 | example/src/main/java/org/apache/rocketmq/example/simple/LitePullConsumerAssignWithSubExpression.java:45-59 — before extracting anything, compare `example/src/main/java/org/apache/rocketmq/example/simple/LitePullConsumerAssign.java` and `example/src/main/java/org/apache/rocketmq/example/simple/LitePullConsumerAssignWithSubExpression.java` as WHOLE FILES: 95% of the shorter file's lines also appear in the other, so this reads as one file having been copied from the other rather than as a helper waiting to be extracted. The 1 duplicated block(s) this scan matched between them are fragments of that copy, not the extent of it — treat the file pair as the unit. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `example/src/main/java/org/apache/rocketmq/example/simple/LitePullConsumerAssign.java:38` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (17 lines × 2) broker/src/main/java/org/apache/rocketmq/broker/processor/AdminBrokerProcessor.java:815— broker/src/main/java/org/apache/rocketmq/broker/processor/AdminBrokerProcessor.java:815-831 | broker/src/main/java/org/apache/rocketmq/broker/processor/AdminBrokerProcessor.java:845-861 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `broker/src/main/java/org/apache/rocketmq/broker/processor/AdminBrokerProcessor.java:815` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (17 lines × 2) client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:752— client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:752-768 | proxy/src/main/java/org/apache/rocketmq/proxy/service/message/LocalMessageService.java:130-146 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:752` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (17 lines × 2) client/src/main/java/org/apache/rocketmq/client/impl/consumer/ConsumeMessageConcurrentlyService.java:65— client/src/main/java/org/apache/rocketmq/client/impl/consumer/ConsumeMessageConcurrentlyService.java:65-81 | client/src/main/java/org/apache/rocketmq/client/impl/consumer/ConsumeMessageOrderlyService.java:69-85 — before extracting anything, compare `client/src/main/java/org/apache/rocketmq/client/impl/consumer/ConsumeMessageConcurrentlyService.java` and `client/src/main/java/org/apache/rocketmq/client/impl/consumer/ConsumeMessageOrderlyService.java` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 47 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Note first that the copies are not typed on the same thing: the declarations holding them bind `messageListener` to `MessageListenerConcurrently` in one and `MessageListenerOrderly` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `client/src/main/java/org/apache/rocketmq/client/impl/consumer/ConsumeMessageConcurrentlyService.java:82` calls `newSingleThreadScheduledExecutor`, `ThreadFactoryImpl` and `client/src/main/java/org/apache/rocketmq/client/impl/consumer/ConsumeMessageOrderlyService.java:86` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (17 lines × 2) client/src/main/java/org/apache/rocketmq/client/impl/consumer/ConsumeMessagePopConcurrentlyService.java:66— client/src/main/java/org/apache/rocketmq/client/impl/consumer/ConsumeMessagePopConcurrentlyService.java:66-82 | client/src/main/java/org/apache/rocketmq/client/impl/consumer/ConsumeMessagePopOrderlyService.java:66-82 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit. Note first that the copies are not typed on the same thing: the declarations holding them bind `messageListener` to `MessageListenerConcurrently` in one and `MessageListenerOrderly` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
Duplicated block (17 lines × 2) client/src/main/java/org/apache/rocketmq/client/producer/DefaultMQProducer.java:296— client/src/main/java/org/apache/rocketmq/client/producer/DefaultMQProducer.java:296-312 | client/src/main/java/org/apache/rocketmq/client/producer/DefaultMQProducer.java:331-347 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `client/src/main/java/org/apache/rocketmq/client/producer/DefaultMQProducer.java:296` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (17 lines × 2) proxy/src/main/java/org/apache/rocketmq/proxy/remoting/channel/RemotingChannel.java:161— proxy/src/main/java/org/apache/rocketmq/proxy/remoting/channel/RemotingChannel.java:161-177 | proxy/src/main/java/org/apache/rocketmq/proxy/remoting/channel/RemotingChannel.java:191-207 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `proxy/src/main/java/org/apache/rocketmq/proxy/remoting/channel/RemotingChannel.java:161` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note first that the copies are not typed on the same thing: the declarations holding them bind `responseFuture` to `CompletableFuture<ProxyRelayResult<ConsumerRunningInfo>>` in one and `CompletableFuture<ProxyRelayResult<ConsumeMessageDirectlyResult>>` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
Duplicated block (17 lines × 2) tools/src/main/java/org/apache/rocketmq/tools/command/topic/RemappingStaticTopicSubCommand.java:152— tools/src/main/java/org/apache/rocketmq/tools/command/topic/RemappingStaticTopicSubCommand.java:152-168 | tools/src/main/java/org/apache/rocketmq/tools/command/topic/UpdateStaticTopicSubCommand.java:156-172 — before extracting anything, compare `tools/src/main/java/org/apache/rocketmq/tools/command/topic/RemappingStaticTopicSubCommand.java` and `tools/src/main/java/org/apache/rocketmq/tools/command/topic/UpdateStaticTopicSubCommand.java` as WHOLE FILES: this scan already matched 12 separate duplicated blocks between them, totalling at least 126 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `tools/src/main/java/org/apache/rocketmq/tools/command/topic/RemappingStaticTopicSubCommand.java:150` calls `refreshClusterInfo` and `tools/src/main/java/org/apache/rocketmq/tools/command/topic/UpdateStaticTopicSubCommand.java:154` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (17 lines × 2) remoting/src/main/java/org/apache/rocketmq/remoting/rpc/RpcRequest.java:24— remoting/src/main/java/org/apache/rocketmq/remoting/rpc/RpcRequest.java:24-40 | remoting/src/main/java/org/apache/rocketmq/remoting/rpc/RpcResponse.java:27-68 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (16 lines × 2) client/src/main/java/org/apache/rocketmq/client/impl/mqclient/MQClientAPIExt.java:468— client/src/main/java/org/apache/rocketmq/client/impl/mqclient/MQClientAPIExt.java:468-483 | client/src/main/java/org/apache/rocketmq/client/impl/mqclient/MQClientAPIExt.java:504-519 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `client/src/main/java/org/apache/rocketmq/client/impl/mqclient/MQClientAPIExt.java:468` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
Duplicated block (16 lines × 2) common/src/main/java/org/apache/rocketmq/common/compression/Lz4Compressor.java:37— common/src/main/java/org/apache/rocketmq/common/compression/Lz4Compressor.java:37-52 | common/src/main/java/org/apache/rocketmq/common/compression/ZstdCompressor.java:37-52 — before extracting anything, compare `common/src/main/java/org/apache/rocketmq/common/compression/Lz4Compressor.java` and `common/src/main/java/org/apache/rocketmq/common/compression/ZstdCompressor.java` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 51 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `common/src/main/java/org/apache/rocketmq/common/compression/Lz4Compressor.java:37` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
Duplicated block (16 lines × 2) proxy/src/main/java/org/apache/rocketmq/proxy/remoting/activity/ConsumerManagerActivity.java:136— proxy/src/main/java/org/apache/rocketmq/proxy/remoting/activity/ConsumerManagerActivity.java:136-151 | proxy/src/main/java/org/apache/rocketmq/proxy/remoting/activity/ConsumerManagerActivity.java:157-172 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `proxy/src/main/java/org/apache/rocketmq/proxy/remoting/activity/ConsumerManagerActivity.java:136` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (16 lines × 2) store/src/main/java/org/apache/rocketmq/store/ConsumeQueue.java:317— store/src/main/java/org/apache/rocketmq/store/ConsumeQueue.java:317-332 | store/src/main/java/org/apache/rocketmq/store/ConsumeQueue.java:338-353 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `store/src/main/java/org/apache/rocketmq/store/ConsumeQueue.java:317` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (16 lines × 2) store/src/main/java/org/apache/rocketmq/store/DefaultMessageStore.java:1565— store/src/main/java/org/apache/rocketmq/store/DefaultMessageStore.java:1565-1580 | store/src/main/java/org/apache/rocketmq/store/queue/ConsumeQueueStore.java:462-477 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `store/src/main/java/org/apache/rocketmq/store/DefaultMessageStore.java:1565` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (16 lines × 2) store/src/main/java/org/apache/rocketmq/store/MessageExtEncoder.java:307— store/src/main/java/org/apache/rocketmq/store/MessageExtEncoder.java:307-322 | store/src/main/java/org/apache/rocketmq/store/dledger/DLedgerCommitLog.java:900-915 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `store/src/main/java/org/apache/rocketmq/store/MessageExtEncoder.java:324` calls `get`, `position` and `store/src/main/java/org/apache/rocketmq/store/dledger/DLedgerCommitLog.java:917` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (16 lines × 2) store/src/main/java/org/apache/rocketmq/store/ha/autoswitch/AutoSwitchHAConnection.java:279— store/src/main/java/org/apache/rocketmq/store/ha/autoswitch/AutoSwitchHAConnection.java:279-294 | store/src/main/java/org/apache/rocketmq/store/ha/autoswitch/AutoSwitchHAConnection.java:719-734 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `store/src/main/java/org/apache/rocketmq/store/ha/autoswitch/AutoSwitchHAConnection.java:279` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `store/src/main/java/org/apache/rocketmq/store/ha/autoswitch/AutoSwitchHAConnection.java:277` calls `getConnectionCount`, `decrementAndGet` and `store/src/main/java/org/apache/rocketmq/store/ha/autoswitch/AutoSwitchHAConnection.java:717` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (16 lines × 2) store/src/main/java/org/apache/rocketmq/store/timer/TimerMessageStore.java:794— store/src/main/java/org/apache/rocketmq/store/timer/TimerMessageStore.java:794-809 | store/src/main/java/org/apache/rocketmq/store/timer/TimerMessageStore.java:916-931 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `store/src/main/java/org/apache/rocketmq/store/timer/TimerMessageStore.java:794` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Swallowed exception (caught, then discarded) client/src/main/java/org/apache/rocketmq/client/impl/producer/DefaultMQProducerImpl.java:172— `catch (Exception)` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
Swallowed exception (caught, then discarded) common/src/main/java/org/apache/rocketmq/common/UtilAll.java:69— `catch (Exception)` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
Swallowed exception (caught, then discarded) common/src/main/java/org/apache/rocketmq/common/UtilAll.java:226— `catch (Exception)` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
Swallowed exception (caught, then discarded) common/src/main/java/org/apache/rocketmq/common/UtilAll.java:284— `catch (Exception)` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
Swallowed exception (caught, then discarded) common/src/main/java/org/apache/rocketmq/common/UtilAll.java:436— `catch (Exception)` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
Swallowed exception (caught, then discarded) common/src/main/java/org/apache/rocketmq/common/UtilAll.java:444— `catch (Exception)` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
Swallowed exception (caught, then discarded) common/src/main/java/org/apache/rocketmq/common/MixAll.java:181— `catch (Exception)` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
Swallowed exception (caught, then discarded) common/src/main/java/org/apache/rocketmq/common/config/AbstractRocksDBStorage.java:423— `catch (Exception)` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
D4 · Code Duplication· Members sharing a duplicated core (5 members, 50+ identical tokens) · ×6
Members sharing a duplicated core (5 members, 50+ identical tokens) broker/src/main/java/org/apache/rocketmq/broker/processor/AdminBrokerProcessor.java:727— broker/src/main/java/org/apache/rocketmq/broker/processor/AdminBrokerProcessor.java:727-762 | broker/src/main/java/org/apache/rocketmq/broker/processor/AdminBrokerProcessor.java:1445-1469 | broker/src/main/java/org/apache/rocketmq/broker/processor/AdminBrokerProcessor.java:1732-1757 | broker/src/main/java/org/apache/rocketmq/broker/processor/AdminBrokerProcessor.java:1788-1813 | container/src/main/java/org/apache/rocketmq/container/BrokerContainerProcessor.java:289-312 — These 5 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 5 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 5 times.
Members sharing a duplicated core (5 members, 50+ identical tokens) broker/src/main/java/org/apache/rocketmq/broker/processor/ChangeInvisibleTimeProcessor.java:161— broker/src/main/java/org/apache/rocketmq/broker/processor/ChangeInvisibleTimeProcessor.java:161-200 | broker/src/main/java/org/apache/rocketmq/broker/processor/PopBufferMergeService.java:596-622 | broker/src/main/java/org/apache/rocketmq/broker/processor/PopBufferMergeService.java:624-660 | broker/src/main/java/org/apache/rocketmq/broker/processor/PopBufferMergeService.java:662-699 | broker/src/main/java/org/apache/rocketmq/broker/processor/PopBufferMergeService.java:701-730 — These 5 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 5 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 5 times.
Members sharing a duplicated core (5 members, 50+ identical tokens) broker/src/main/java/org/apache/rocketmq/broker/processor/DefaultPullMessageResultHandler.java:87— broker/src/main/java/org/apache/rocketmq/broker/processor/DefaultPullMessageResultHandler.java:87-224 | broker/src/main/java/org/apache/rocketmq/broker/processor/PeekMessageProcessor.java:82-224 | broker/src/main/java/org/apache/rocketmq/broker/processor/PopMessageProcessor.java:197-490 | broker/src/main/java/org/apache/rocketmq/broker/processor/QueryMessageProcessor.java:77-135 | broker/src/main/java/org/apache/rocketmq/broker/processor/QueryMessageProcessor.java:138-181 — These 5 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 5 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 5 times.
Members sharing a duplicated core (5 members, 50+ identical tokens) remoting/src/main/java/org/apache/rocketmq/remoting/rpc/RpcClientImpl.java:201— remoting/src/main/java/org/apache/rocketmq/remoting/rpc/RpcClientImpl.java:201-219 | remoting/src/main/java/org/apache/rocketmq/remoting/rpc/RpcClientImpl.java:247-265 | remoting/src/main/java/org/apache/rocketmq/remoting/rpc/RpcClientImpl.java:284-303 | remoting/src/main/java/org/apache/rocketmq/remoting/rpc/RpcClientImpl.java:305-324 | remoting/src/main/java/org/apache/rocketmq/remoting/rpc/RpcClientImpl.java:326-345 — These 5 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 5 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 5 times.
Members sharing a duplicated core (5 members, 50+ identical tokens) store/src/main/java/org/apache/rocketmq/store/CommitLog.java:319— store/src/main/java/org/apache/rocketmq/store/CommitLog.java:319-405 | store/src/main/java/org/apache/rocketmq/store/CommitLog.java:692-804 | store/src/main/java/org/apache/rocketmq/store/ConsumeQueue.java:123-189 | store/src/main/java/org/apache/rocketmq/store/queue/BatchConsumeQueue.java:211-265 | store/src/main/java/org/apache/rocketmq/store/queue/SparseConsumeQueue.java:54-111 — These 5 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 5 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 5 times.
Members sharing a duplicated core (5 members, 50+ identical tokens) tools/src/main/java/org/apache/rocketmq/tools/command/acl/DeleteAccessConfigSubCommand.java:70— tools/src/main/java/org/apache/rocketmq/tools/command/acl/DeleteAccessConfigSubCommand.java:70-111 | tools/src/main/java/org/apache/rocketmq/tools/command/acl/UpdateAccessConfigSubCommand.java:96-184 | tools/src/main/java/org/apache/rocketmq/tools/command/consumer/UpdateSubGroupSubCommand.java:113-227 | tools/src/main/java/org/apache/rocketmq/tools/command/topic/UpdateOrderConfCommand.java:61-107 | tools/src/main/java/org/apache/rocketmq/tools/command/topic/UpdateTopicSubCommand.java:98-202 — These 5 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 5 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 5 times.
Duplicated block (11–12 lines × 2) broker/src/main/java/org/apache/rocketmq/broker/filter/ConsumerFilterManager.java:374— broker/src/main/java/org/apache/rocketmq/broker/filter/ConsumerFilterManager.java:374-384 | broker/src/main/java/org/apache/rocketmq/broker/filter/ConsumerFilterManager.java:395-406 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `broker/src/main/java/org/apache/rocketmq/broker/filter/ConsumerFilterManager.java:374` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (11–12 lines × 2) broker/src/main/java/org/apache/rocketmq/broker/processor/AdminBrokerProcessor.java:972— broker/src/main/java/org/apache/rocketmq/broker/processor/AdminBrokerProcessor.java:972-983 | broker/src/main/java/org/apache/rocketmq/broker/processor/AdminBrokerProcessor.java:1763-1773 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `broker/src/main/java/org/apache/rocketmq/broker/processor/AdminBrokerProcessor.java:1763` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (11–12 lines × 2) broker/src/main/java/org/apache/rocketmq/broker/processor/EndTransactionProcessor.java:269— broker/src/main/java/org/apache/rocketmq/broker/processor/EndTransactionProcessor.java:269-280 | broker/src/main/java/org/apache/rocketmq/broker/processor/SendMessageProcessor.java:386-396 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (11–12 lines × 2) client/src/main/java/org/apache/rocketmq/client/impl/consumer/DefaultMQPushConsumerImpl.java:792— client/src/main/java/org/apache/rocketmq/client/impl/consumer/DefaultMQPushConsumerImpl.java:792-803 | client/src/main/java/org/apache/rocketmq/client/impl/consumer/DefaultMQPushConsumerImpl.java:841-851 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `client/src/main/java/org/apache/rocketmq/client/impl/consumer/DefaultMQPushConsumerImpl.java:789` calls `getQueueOffset`, `getTopic` and `client/src/main/java/org/apache/rocketmq/client/impl/consumer/DefaultMQPushConsumerImpl.java:839` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (11–12 lines × 2) store/src/main/java/org/apache/rocketmq/store/queue/BatchConsumeQueue.java:243— store/src/main/java/org/apache/rocketmq/store/queue/BatchConsumeQueue.java:243-253 | store/src/main/java/org/apache/rocketmq/store/queue/SparseConsumeQueue.java:92-103 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `store/src/main/java/org/apache/rocketmq/store/queue/SparseConsumeQueue.java:92` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (11–12 lines × 2) tools/src/main/java/org/apache/rocketmq/tools/command/topic/RemappingStaticTopicSubCommand.java:88— tools/src/main/java/org/apache/rocketmq/tools/command/topic/RemappingStaticTopicSubCommand.java:88-99 | tools/src/main/java/org/apache/rocketmq/tools/command/topic/UpdateStaticTopicSubCommand.java:93-103 — before extracting anything, compare `tools/src/main/java/org/apache/rocketmq/tools/command/topic/RemappingStaticTopicSubCommand.java` and `tools/src/main/java/org/apache/rocketmq/tools/command/topic/UpdateStaticTopicSubCommand.java` as WHOLE FILES: this scan already matched 12 separate duplicated blocks between them, totalling at least 126 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `tools/src/main/java/org/apache/rocketmq/tools/command/topic/RemappingStaticTopicSubCommand.java:88` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `tools/src/main/java/org/apache/rocketmq/tools/command/topic/RemappingStaticTopicSubCommand.java:100` calls `checkAndBuildMappingItems`, `getMappingDetailFromConfig`, `getBrokerConfigMap` and `tools/src/main/java/org/apache/rocketmq/tools/command/topic/UpdateStaticTopicSubCommand.java:104` does not — after which the two agree again for 4 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (10–11 lines × 2) broker/src/main/java/org/apache/rocketmq/broker/out/BrokerOuterAPI.java:838— broker/src/main/java/org/apache/rocketmq/broker/out/BrokerOuterAPI.java:838-848 | client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:2823-2832 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `broker/src/main/java/org/apache/rocketmq/broker/out/BrokerOuterAPI.java:838` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (10–11 lines × 2) client/src/main/java/org/apache/rocketmq/client/consumer/store/RemoteBrokerOffsetStore.java:126— client/src/main/java/org/apache/rocketmq/client/consumer/store/RemoteBrokerOffsetStore.java:126-135 | client/src/main/java/org/apache/rocketmq/client/consumer/store/RemoteBrokerOffsetStore.java:154-164 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `client/src/main/java/org/apache/rocketmq/client/consumer/store/RemoteBrokerOffsetStore.java:154` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (10–11 lines × 2) client/src/main/java/org/apache/rocketmq/client/impl/consumer/ConsumeMessageOrderlyService.java:289— client/src/main/java/org/apache/rocketmq/client/impl/consumer/ConsumeMessageOrderlyService.java:289-298 | client/src/main/java/org/apache/rocketmq/client/impl/consumer/ConsumeMessageOrderlyService.java:321-331 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `client/src/main/java/org/apache/rocketmq/client/impl/consumer/ConsumeMessageOrderlyService.java:289` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `client/src/main/java/org/apache/rocketmq/client/impl/consumer/ConsumeMessageOrderlyService.java:300` calls `getProcessQueue`, `commit` and `client/src/main/java/org/apache/rocketmq/client/impl/consumer/ConsumeMessageOrderlyService.java:331` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (10–11 lines × 2) client/src/main/java/org/apache/rocketmq/client/impl/factory/MQClientInstance.java:586— client/src/main/java/org/apache/rocketmq/client/impl/factory/MQClientInstance.java:586-596 | client/src/main/java/org/apache/rocketmq/client/impl/factory/MQClientInstance.java:637-646 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (10–11 lines × 2) remoting/src/main/java/org/apache/rocketmq/remoting/netty/NettyRemotingClient.java:420— remoting/src/main/java/org/apache/rocketmq/remoting/netty/NettyRemotingClient.java:420-430 | remoting/src/main/java/org/apache/rocketmq/remoting/netty/NettyRemotingClient.java:471-480 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `remoting/src/main/java/org/apache/rocketmq/remoting/netty/NettyRemotingClient.java:420` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `remoting/src/main/java/org/apache/rocketmq/remoting/netty/NettyRemotingClient.java:419` calls `getChannel`, `info` and `remoting/src/main/java/org/apache/rocketmq/remoting/netty/NettyRemotingClient.java:471` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (10–11 lines × 2) store/src/main/java/org/apache/rocketmq/store/DefaultMessageStore.java:942— store/src/main/java/org/apache/rocketmq/store/DefaultMessageStore.java:942-952 | REDACTED:558-567 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `store/src/main/java/org/apache/rocketmq/store/DefaultMessageStore.java:942` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (6 lines × 3) broker/src/main/java/org/apache/rocketmq/broker/BrokerStartup.java:266— broker/src/main/java/org/apache/rocketmq/broker/BrokerStartup.java:266-271 | tools/src/main/java/org/apache/rocketmq/tools/command/export/ExportMetadataCommand.java:62-68 | tools/src/main/java/org/apache/rocketmq/tools/command/offset/ResetOffsetByTimeCommand.java:60-66 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 3 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 3 times.
Duplicated block (6 lines × 3) broker/src/main/java/org/apache/rocketmq/broker/processor/AdminBrokerProcessor.java:605— broker/src/main/java/org/apache/rocketmq/broker/processor/AdminBrokerProcessor.java:605-610 | broker/src/main/java/org/apache/rocketmq/broker/processor/AdminBrokerProcessor.java:639-644 | broker/src/main/java/org/apache/rocketmq/broker/processor/AdminBrokerProcessor.java:674-679 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `broker/src/main/java/org/apache/rocketmq/broker/processor/AdminBrokerProcessor.java:605` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (6 lines × 3) client/src/main/java/org/apache/rocketmq/client/impl/consumer/ConsumeMessageOrderlyService.java:143— client/src/main/java/org/apache/rocketmq/client/impl/consumer/ConsumeMessageOrderlyService.java:143-148 | client/src/main/java/org/apache/rocketmq/client/impl/consumer/ConsumeMessagePopConcurrentlyService.java:121-126 | client/src/main/java/org/apache/rocketmq/client/impl/consumer/ConsumeMessagePopOrderlyService.java:137-142 — before extracting anything, compare `client/src/main/java/org/apache/rocketmq/client/impl/consumer/ConsumeMessageOrderlyService.java` and `client/src/main/java/org/apache/rocketmq/client/impl/consumer/ConsumeMessagePopOrderlyService.java` as WHOLE FILES: this scan already matched 11 separate duplicated blocks between them, totalling at least 138 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `client/src/main/java/org/apache/rocketmq/client/impl/consumer/ConsumeMessagePopConcurrentlyService.java:119` calls `setAutoCommit` and `client/src/main/java/org/apache/rocketmq/client/impl/consumer/ConsumeMessageOrderlyService.java:141` does not — after which the two agree again for 4 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (6 lines × 3) filter/src/main/java/org/apache/rocketmq/filter/util/BitsArray.java:94— filter/src/main/java/org/apache/rocketmq/filter/util/BitsArray.java:94-99 | filter/src/main/java/org/apache/rocketmq/filter/util/BitsArray.java:116-121 | filter/src/main/java/org/apache/rocketmq/filter/util/BitsArray.java:135-140 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `filter/src/main/java/org/apache/rocketmq/filter/util/BitsArray.java:94` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (6 lines × 3) store/src/main/java/org/apache/rocketmq/store/stats/BrokerStatsManager.java:446— store/src/main/java/org/apache/rocketmq/store/stats/BrokerStatsManager.java:446-451 | store/src/main/java/org/apache/rocketmq/store/stats/BrokerStatsManager.java:468-473 | store/src/main/java/org/apache/rocketmq/store/stats/BrokerStatsManager.java:479-484 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (6 lines × 3) tools/src/main/java/org/apache/rocketmq/tools/admin/DefaultMQAdminExtImpl.java:1348— tools/src/main/java/org/apache/rocketmq/tools/admin/DefaultMQAdminExtImpl.java:1348-1353 | tools/src/main/java/org/apache/rocketmq/tools/admin/DefaultMQAdminExtImpl.java:1440-1445 | tools/src/main/java/org/apache/rocketmq/tools/admin/DefaultMQAdminExtImpl.java:1471-1476 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `tools/src/main/java/org/apache/rocketmq/tools/admin/DefaultMQAdminExtImpl.java:1348` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `tools/src/main/java/org/apache/rocketmq/tools/admin/DefaultMQAdminExtImpl.java:1446` calls `countDown` and `tools/src/main/java/org/apache/rocketmq/tools/admin/DefaultMQAdminExtImpl.java:1354` does not — after which the two agree again for 4 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (5 lines × 3) broker/src/main/java/org/apache/rocketmq/broker/offset/ConsumerOffsetManager.java:105— broker/src/main/java/org/apache/rocketmq/broker/offset/ConsumerOffsetManager.java:105-109 | broker/src/main/java/org/apache/rocketmq/broker/offset/ConsumerOffsetManager.java:141-145 | broker/src/main/java/org/apache/rocketmq/broker/offset/ConsumerOffsetManager.java:159-163 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `broker/src/main/java/org/apache/rocketmq/broker/offset/ConsumerOffsetManager.java:105` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (5 lines × 3) broker/src/main/java/org/apache/rocketmq/broker/subscription/RocksDBSubscriptionGroupManager.java:55— broker/src/main/java/org/apache/rocketmq/broker/subscription/RocksDBSubscriptionGroupManager.java:55-59 | broker/src/main/java/org/apache/rocketmq/broker/subscription/RocksDBSubscriptionGroupManager.java:70-74 | broker/src/main/java/org/apache/rocketmq/broker/topic/RocksDBTopicConfigManager.java:68-72 — there are 3 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 3 sites; resolving a subset leaves the remainder to drift apart. Read the line range as the matched WINDOW rather than a finished unit: at `broker/src/main/java/org/apache/rocketmq/broker/subscription/RocksDBSubscriptionGroupManager.java:55` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (5 lines × 3) client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:2840— client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:2840-2844 | client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:3028-3032 | client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:3090-3094 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:2840` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (5 lines × 3) namesrv/src/main/java/org/apache/rocketmq/namesrv/routeinfo/RouteInfoManager.java:1050— namesrv/src/main/java/org/apache/rocketmq/namesrv/routeinfo/RouteInfoManager.java:1050-1054 | namesrv/src/main/java/org/apache/rocketmq/namesrv/routeinfo/RouteInfoManager.java:1071-1075 | namesrv/src/main/java/org/apache/rocketmq/namesrv/routeinfo/RouteInfoManager.java:1092-1096 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `namesrv/src/main/java/org/apache/rocketmq/namesrv/routeinfo/RouteInfoManager.java:1050` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `namesrv/src/main/java/org/apache/rocketmq/namesrv/routeinfo/RouteInfoManager.java:1099` calls `hasUnitFlag`, `values`, `iterator` and `namesrv/src/main/java/org/apache/rocketmq/namesrv/routeinfo/RouteInfoManager.java:1078` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (5 lines × 3) store/src/main/java/org/apache/rocketmq/store/queue/BatchConsumeQueue.java:711— store/src/main/java/org/apache/rocketmq/store/queue/BatchConsumeQueue.java:711-715 | store/src/main/java/org/apache/rocketmq/store/queue/BatchConsumeQueue.java:802-806 | store/src/main/java/org/apache/rocketmq/store/queue/SparseConsumeQueue.java:197-201 — there are 3 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 3 sites; resolving a subset leaves the remainder to drift apart. Read the line range as the matched WINDOW rather than a finished unit: at `store/src/main/java/org/apache/rocketmq/store/queue/BatchConsumeQueue.java:711` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (5 lines × 3) tools/src/main/java/org/apache/rocketmq/tools/command/export/ExportMetadataInRocksDBCommand.java:109— tools/src/main/java/org/apache/rocketmq/tools/command/export/ExportMetadataInRocksDBCommand.java:109-114 | tools/src/main/java/org/apache/rocketmq/tools/command/metadata/RocksDBConfigToJsonCommand.java:81-85 | tools/src/main/java/org/apache/rocketmq/tools/command/metadata/RocksDBConfigToJsonCommand.java:99-103 — there are 3 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 3 sites; resolving a subset leaves the remainder to drift apart. Read the line range as the matched WINDOW rather than a finished unit: at `tools/src/main/java/org/apache/rocketmq/tools/command/export/ExportMetadataInRocksDBCommand.java:109` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Hotspot: store/src/main/java/org/apache/rocketmq/store/CommitLog.java store/src/main/java/org/apache/rocketmq/store/CommitLog.java:900— store/src/main/java/org/apache/rocketmq/store/CommitLog.java changed 6 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 37 in CommitLog.asyncPutMessage at line 900. 1 of those changes was a fix/bug commit, and the other 5 changed it for other reasons — this file is under both repair and feature pressure. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2023-09-08..2023-12-07, the 90 days ending at the analysed commit. Reproduce with `git log --since='2023-09-08 11:25:22 +08:00' --until='2023-12-07 11:25:22 +08:00' --full-history --no-merges -- store/src/main/java/org/apache/rocketmq/store/CommitLog.java`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Hotspot: broker/src/main/java/org/apache/rocketmq/broker/processor/PopMessageProcessor.java broker/src/main/java/org/apache/rocketmq/broker/processor/PopMessageProcessor.java:196— broker/src/main/java/org/apache/rocketmq/broker/processor/PopMessageProcessor.java changed 4 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 46 in PopMessageProcessor.processRequest at line 196. 1 of those changes was a fix/bug commit, and the other 3 changed it for other reasons — this file is under both repair and feature pressure. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2023-09-08..2023-12-07, the 90 days ending at the analysed commit. Reproduce with `git log --since='2023-09-08 11:25:22 +08:00' --until='2023-12-07 11:25:22 +08:00' --full-history --no-merges -- broker/src/main/java/org/apache/rocketmq/broker/processor/PopMessageProcessor.java`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Hotspot: broker/src/main/java/org/apache/rocketmq/broker/processor/PopReviveService.java broker/src/main/java/org/apache/rocketmq/broker/processor/PopReviveService.java:298— broker/src/main/java/org/apache/rocketmq/broker/processor/PopReviveService.java changed 4 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 33 in PopReviveService.consumeReviveMessage at line 298. 1 of those changes was a fix/bug commit, and the other 3 changed it for other reasons — this file is under both repair and feature pressure. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2023-09-08..2023-12-07, the 90 days ending at the analysed commit. Reproduce with `git log --since='2023-09-08 11:25:22 +08:00' --until='2023-12-07 11:25:22 +08:00' --full-history --no-merges -- broker/src/main/java/org/apache/rocketmq/broker/processor/PopReviveService.java`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Hotspot: store/src/main/java/org/apache/rocketmq/store/timer/TimerMessageStore.java store/src/main/java/org/apache/rocketmq/store/timer/TimerMessageStore.java:1068— store/src/main/java/org/apache/rocketmq/store/timer/TimerMessageStore.java changed 5 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 20 in TimerMessageStore.doPut at line 1068. 2 of those changes were fix/bug commits, and the other 3 changed it for other reasons — this file is under both repair and feature pressure. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2023-09-08..2023-12-07, the 90 days ending at the analysed commit. Reproduce with `git log --since='2023-09-08 11:25:22 +08:00' --until='2023-12-07 11:25:22 +08:00' --full-history --no-merges -- store/src/main/java/org/apache/rocketmq/store/timer/TimerMessageStore.java`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Hotspot: store/src/main/java/org/apache/rocketmq/store/MessageExtEncoder.java store/src/main/java/org/apache/rocketmq/store/MessageExtEncoder.java:175— store/src/main/java/org/apache/rocketmq/store/MessageExtEncoder.java changed 2 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 15 in MessageExtEncoder.encode at line 175. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2023-09-08..2023-12-07, the 90 days ending at the analysed commit. Reproduce with `git log --since='2023-09-08 11:25:22 +08:00' --until='2023-12-07 11:25:22 +08:00' --full-history --no-merges -- store/src/main/java/org/apache/rocketmq/store/MessageExtEncoder.java`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
D4 · Code Duplication· Edited copy of a member (30 corresponding lines) · ×5
Edited copy of a member (30 corresponding lines) tools/src/main/java/org/apache/rocketmq/tools/command/acl/UpdateAccessConfigSubCommand.java:47— tools/src/main/java/org/apache/rocketmq/tools/command/acl/UpdateAccessConfigSubCommand.java:47-92 | tools/src/main/java/org/apache/rocketmq/tools/command/message/ConsumeMessageCommand.java:77-115 — These two members are one piece of code written twice and then edited apart: 30 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (30 corresponding lines) tools/src/main/java/org/apache/rocketmq/tools/command/acl/UpdateAccessConfigSubCommand.java:47— tools/src/main/java/org/apache/rocketmq/tools/command/acl/UpdateAccessConfigSubCommand.java:47-92 | tools/src/main/java/org/apache/rocketmq/tools/command/message/SendMessageCommand.java:48-78 — These two members are one piece of code written twice and then edited apart: 30 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (30 corresponding lines) tools/src/main/java/org/apache/rocketmq/tools/command/message/ConsumeMessageCommand.java:77— tools/src/main/java/org/apache/rocketmq/tools/command/message/ConsumeMessageCommand.java:77-115 | tools/src/main/java/org/apache/rocketmq/tools/command/topic/UpdateTopicSubCommand.java:49-94 — These two members are one piece of code written twice and then edited apart: 30 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (30 corresponding lines) tools/src/main/java/org/apache/rocketmq/tools/command/acl/UpdateAccessConfigSubCommand.java:47— tools/src/main/java/org/apache/rocketmq/tools/command/acl/UpdateAccessConfigSubCommand.java:47-92 | tools/src/main/java/org/apache/rocketmq/tools/command/message/PrintMessageSubCommand.java:69-101 — These two members are one piece of code written twice and then edited apart: 30 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (30 corresponding lines) tools/src/main/java/org/apache/rocketmq/tools/command/message/PrintMessageSubCommand.java:69— tools/src/main/java/org/apache/rocketmq/tools/command/message/PrintMessageSubCommand.java:69-101 | tools/src/main/java/org/apache/rocketmq/tools/command/topic/UpdateTopicSubCommand.java:49-94 — These two members are one piece of code written twice and then edited apart: 30 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Duplicated block (20 lines × 2) broker/src/main/java/org/apache/rocketmq/broker/filter/ExpressionForRetryMessageFilter.java:77— broker/src/main/java/org/apache/rocketmq/broker/filter/ExpressionForRetryMessageFilter.java:77-96 | broker/src/main/java/org/apache/rocketmq/broker/filter/ExpressionMessageFilter.java:140-159 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `broker/src/main/java/org/apache/rocketmq/broker/filter/ExpressionForRetryMessageFilter.java:77` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (20 lines × 2) broker/src/main/java/org/apache/rocketmq/broker/topic/TopicConfigManager.java:381— broker/src/main/java/org/apache/rocketmq/broker/topic/TopicConfigManager.java:381-400 | broker/src/main/java/org/apache/rocketmq/broker/topic/TopicConfigManager.java:422-441 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `broker/src/main/java/org/apache/rocketmq/broker/topic/TopicConfigManager.java:381` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
Duplicated block (20 lines × 2) remoting/src/main/java/org/apache/rocketmq/remoting/protocol/body/ConsumerRunningInfo.java:230— remoting/src/main/java/org/apache/rocketmq/remoting/protocol/body/ConsumerRunningInfo.java:230-249 | remoting/src/main/java/org/apache/rocketmq/remoting/protocol/body/ConsumerRunningInfo.java:252-271 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `remoting/src/main/java/org/apache/rocketmq/remoting/protocol/body/ConsumerRunningInfo.java:230` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
Duplicated block (20 lines × 2) tieredstore/src/main/java/org/apache/rocketmq/tieredstore/provider/stream/CommitLogInputStream.java:112— tieredstore/src/main/java/org/apache/rocketmq/tieredstore/provider/stream/CommitLogInputStream.java:112-131 | tieredstore/src/main/java/org/apache/rocketmq/tieredstore/provider/stream/FileSegmentInputStream.java:152-171 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
Duplicated block (20 lines × 2) tools/src/main/java/org/apache/rocketmq/tools/command/controller/UpdateControllerConfigSubCommand.java:65— tools/src/main/java/org/apache/rocketmq/tools/command/controller/UpdateControllerConfigSubCommand.java:65-84 | tools/src/main/java/org/apache/rocketmq/tools/command/namesrv/UpdateNamesrvConfigCommand.java:60-79 — before extracting anything, compare `tools/src/main/java/org/apache/rocketmq/tools/command/controller/UpdateControllerConfigSubCommand.java` and `tools/src/main/java/org/apache/rocketmq/tools/command/namesrv/UpdateNamesrvConfigCommand.java` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 58 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `tools/src/main/java/org/apache/rocketmq/tools/command/controller/UpdateControllerConfigSubCommand.java:65` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (18–19 lines × 2) client/src/main/java/org/apache/rocketmq/client/impl/factory/MQClientInstance.java:616— client/src/main/java/org/apache/rocketmq/client/impl/factory/MQClientInstance.java:616-634 | client/src/main/java/org/apache/rocketmq/client/impl/factory/MQClientInstance.java:694-711 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `client/src/main/java/org/apache/rocketmq/client/impl/factory/MQClientInstance.java:616` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (18–19 lines × 2) store/src/main/java/org/apache/rocketmq/store/CommitLog.java:1034— store/src/main/java/org/apache/rocketmq/store/CommitLog.java:1034-1051 | store/src/main/java/org/apache/rocketmq/store/CommitLog.java:1194-1212 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `store/src/main/java/org/apache/rocketmq/store/CommitLog.java:1034` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (18–19 lines × 2) store/src/main/java/org/apache/rocketmq/store/MessageExtEncoder.java:63— store/src/main/java/org/apache/rocketmq/store/MessageExtEncoder.java:63-81 | store/src/main/java/org/apache/rocketmq/store/MessageExtEncoder.java:88-105 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (18–19 lines × 2) tools/src/main/java/org/apache/rocketmq/tools/command/cluster/ClusterListSubCommand.java:121— tools/src/main/java/org/apache/rocketmq/tools/command/cluster/ClusterListSubCommand.java:121-138 | tools/src/main/java/org/apache/rocketmq/tools/command/cluster/ClusterListSubCommand.java:188-206 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `tools/src/main/java/org/apache/rocketmq/tools/command/cluster/ClusterListSubCommand.java:121` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (17–18 lines × 2) broker/src/main/java/org/apache/rocketmq/broker/processor/PeekMessageProcessor.java:278— broker/src/main/java/org/apache/rocketmq/broker/processor/PeekMessageProcessor.java:278-294 | broker/src/main/java/org/apache/rocketmq/broker/processor/PopMessageProcessor.java:768-785 — before extracting anything, compare `broker/src/main/java/org/apache/rocketmq/broker/processor/PeekMessageProcessor.java` and `broker/src/main/java/org/apache/rocketmq/broker/processor/PopMessageProcessor.java` as WHOLE FILES: this scan already matched 7 separate duplicated blocks between them, totalling at least 78 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
Duplicated block (17–18 lines × 2) store/src/main/java/org/apache/rocketmq/store/ConsumeQueue.java:707— store/src/main/java/org/apache/rocketmq/store/ConsumeQueue.java:707-724 | store/src/main/java/org/apache/rocketmq/store/queue/BatchConsumeQueue.java:520-536 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `store/src/main/java/org/apache/rocketmq/store/ConsumeQueue.java:707` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `store/src/main/java/org/apache/rocketmq/store/ConsumeQueue.java:704` calls `checkMultiDispatchQueue`, `getMessageStoreConfig`, `multiDispatchLmqQueue` and `store/src/main/java/org/apache/rocketmq/store/queue/BatchConsumeQueue.java:519` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (17–18 lines × 2) store/src/main/java/org/apache/rocketmq/store/DefaultMessageStore.java:872— store/src/main/java/org/apache/rocketmq/store/DefaultMessageStore.java:872-888 | REDACTED:519-536 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `store/src/main/java/org/apache/rocketmq/store/DefaultMessageStore.java:872` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (17–18 lines × 2) tools/src/main/java/org/apache/rocketmq/tools/command/namesrv/AddWritePermSubCommand.java:63— tools/src/main/java/org/apache/rocketmq/tools/command/namesrv/AddWritePermSubCommand.java:63-79 | tools/src/main/java/org/apache/rocketmq/tools/command/namesrv/WipeWritePermSubCommand.java:65-82 — before extracting anything, compare `tools/src/main/java/org/apache/rocketmq/tools/command/namesrv/AddWritePermSubCommand.java` and `tools/src/main/java/org/apache/rocketmq/tools/command/namesrv/WipeWritePermSubCommand.java` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 36 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `tools/src/main/java/org/apache/rocketmq/tools/command/namesrv/AddWritePermSubCommand.java:63` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (13–14 lines × 2) broker/src/main/java/org/apache/rocketmq/broker/out/BrokerOuterAPI.java:911— broker/src/main/java/org/apache/rocketmq/broker/out/BrokerOuterAPI.java:911-923 | broker/src/main/java/org/apache/rocketmq/broker/out/BrokerOuterAPI.java:950-963 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `broker/src/main/java/org/apache/rocketmq/broker/out/BrokerOuterAPI.java:911` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note first that the copies are not typed on the same thing: the declarations holding them bind `callback` to `LockCallback` in one and `UnlockCallback` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
Duplicated block (13–14 lines × 2) broker/src/main/java/org/apache/rocketmq/broker/processor/AckMessageProcessor.java:123— broker/src/main/java/org/apache/rocketmq/broker/processor/AckMessageProcessor.java:123-136 | broker/src/main/java/org/apache/rocketmq/broker/processor/ChangeInvisibleTimeProcessor.java:79-91 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `broker/src/main/java/org/apache/rocketmq/broker/processor/AckMessageProcessor.java:123` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (13–14 lines × 2) store/src/main/java/org/apache/rocketmq/store/dledger/DLedgerCommitLog.java:845— store/src/main/java/org/apache/rocketmq/store/dledger/DLedgerCommitLog.java:845-858 | store/src/main/java/org/apache/rocketmq/store/dledger/DLedgerCommitLog.java:943-955 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (13–14 lines × 2) tools/src/main/java/org/apache/rocketmq/tools/command/metadata/RocksDBConfigToJsonCommand.java:81— tools/src/main/java/org/apache/rocketmq/tools/command/metadata/RocksDBConfigToJsonCommand.java:81-93 | tools/src/main/java/org/apache/rocketmq/tools/command/metadata/RocksDBConfigToJsonCommand.java:99-112 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `tools/src/main/java/org/apache/rocketmq/tools/command/metadata/RocksDBConfigToJsonCommand.java:81` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (11 lines × 4) common/src/main/java/org/apache/rocketmq/common/UtilAll.java:369— common/src/main/java/org/apache/rocketmq/common/UtilAll.java:369-379 | common/src/main/java/org/apache/rocketmq/common/compression/Lz4Compressor.java:60-70 | common/src/main/java/org/apache/rocketmq/common/compression/ZlibCompressor.java:64-74 | common/src/main/java/org/apache/rocketmq/common/compression/ZstdCompressor.java:60-70 — before extracting anything, compare `common/src/main/java/org/apache/rocketmq/common/UtilAll.java` and `common/src/main/java/org/apache/rocketmq/common/compression/ZlibCompressor.java` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 72 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `common/src/main/java/org/apache/rocketmq/common/UtilAll.java:369` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `common/src/main/java/org/apache/rocketmq/common/compression/Lz4Compressor.java:71` calls `close` and `common/src/main/java/org/apache/rocketmq/common/UtilAll.java:380` does not — after which the two agree again for 4 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (11 lines × 4) namesrv/src/main/java/org/apache/rocketmq/namesrv/processor/DefaultRequestProcessor.java:531— namesrv/src/main/java/org/apache/rocketmq/namesrv/processor/DefaultRequestProcessor.java:531-542 | namesrv/src/main/java/org/apache/rocketmq/namesrv/processor/DefaultRequestProcessor.java:565-575 | namesrv/src/main/java/org/apache/rocketmq/namesrv/processor/DefaultRequestProcessor.java:585-595 | namesrv/src/main/java/org/apache/rocketmq/namesrv/processor/DefaultRequestProcessor.java:604-614 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `namesrv/src/main/java/org/apache/rocketmq/namesrv/processor/DefaultRequestProcessor.java:531` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
Duplicated block (11 lines × 4) tools/src/main/java/org/apache/rocketmq/tools/command/controller/GetControllerConfigSubCommand.java:60— tools/src/main/java/org/apache/rocketmq/tools/command/controller/GetControllerConfigSubCommand.java:60-70 | tools/src/main/java/org/apache/rocketmq/tools/command/controller/UpdateControllerConfigSubCommand.java:74-84 | tools/src/main/java/org/apache/rocketmq/tools/command/namesrv/GetNamesrvConfigCommand.java:57-67 | tools/src/main/java/org/apache/rocketmq/tools/command/namesrv/UpdateNamesrvConfigCommand.java:69-79 — before extracting anything, compare `tools/src/main/java/org/apache/rocketmq/tools/command/controller/GetControllerConfigSubCommand.java` and `tools/src/main/java/org/apache/rocketmq/tools/command/namesrv/GetNamesrvConfigCommand.java` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 35 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (11 lines × 4) client/src/main/java/org/apache/rocketmq/client/impl/consumer/DefaultLitePullConsumerImpl.java:180— client/src/main/java/org/apache/rocketmq/client/impl/consumer/DefaultLitePullConsumerImpl.java:180-190 | client/src/main/java/org/apache/rocketmq/client/impl/consumer/DefaultLitePullConsumerImpl.java:192-202 | client/src/main/java/org/apache/rocketmq/client/impl/consumer/DefaultMQPushConsumerImpl.java:166-176 | client/src/main/java/org/apache/rocketmq/client/impl/consumer/DefaultMQPushConsumerImpl.java:178-188 — there are 4 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 4 sites; resolving a subset leaves the remainder to drift apart.
Duplicated block (10 lines × 3) client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:1842— client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:1842-1851 | client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:1880-1889 | client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:1898-1907 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:1878` calls `properties2String` and `client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:1896` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (10 lines × 3) client/src/main/java/org/apache/rocketmq/client/impl/consumer/RebalanceImpl.java:487— client/src/main/java/org/apache/rocketmq/client/impl/consumer/RebalanceImpl.java:487-496 | client/src/main/java/org/apache/rocketmq/client/impl/consumer/RebalanceImpl.java:607-616 | client/src/main/java/org/apache/rocketmq/client/impl/consumer/RebalanceImpl.java:641-650 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `client/src/main/java/org/apache/rocketmq/client/impl/consumer/RebalanceImpl.java:487` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (10 lines × 3) remoting/src/main/java/org/apache/rocketmq/remoting/protocol/header/ExtraInfoUtil.java:133— remoting/src/main/java/org/apache/rocketmq/remoting/protocol/header/ExtraInfoUtil.java:133-142 | remoting/src/main/java/org/apache/rocketmq/remoting/protocol/header/ExtraInfoUtil.java:147-156 | remoting/src/main/java/org/apache/rocketmq/remoting/protocol/header/ExtraInfoUtil.java:175-184 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (10 lines × 3) tools/src/main/java/org/apache/rocketmq/tools/command/broker/CommitLogSetReadAheadSubCommand.java:56— tools/src/main/java/org/apache/rocketmq/tools/command/broker/CommitLogSetReadAheadSubCommand.java:56-65 | tools/src/main/java/org/apache/rocketmq/tools/command/broker/RemoveColdDataFlowCtrGroupConfigSubCommand.java:48-57 | tools/src/main/java/org/apache/rocketmq/tools/command/topic/UpdateOrderConfCommand.java:48-57 — before extracting anything, compare `tools/src/main/java/org/apache/rocketmq/tools/command/broker/CommitLogSetReadAheadSubCommand.java` and `tools/src/main/java/org/apache/rocketmq/tools/command/broker/RemoveColdDataFlowCtrGroupConfigSubCommand.java` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 47 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `tools/src/main/java/org/apache/rocketmq/tools/command/broker/CommitLogSetReadAheadSubCommand.java:56` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
Duplicated block (7 lines × 4) client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:2463— client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:2463-2469 | client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:2655-2661 | client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:2685-2691 | client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:2714-2720 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:2463` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (7 lines × 4) tools/src/main/java/org/apache/rocketmq/tools/admin/DefaultMQAdminExtImpl.java:363— tools/src/main/java/org/apache/rocketmq/tools/admin/DefaultMQAdminExtImpl.java:363-369 | tools/src/main/java/org/apache/rocketmq/tools/admin/DefaultMQAdminExtImpl.java:531-537 | tools/src/main/java/org/apache/rocketmq/tools/admin/DefaultMQAdminExtImpl.java:1099-1105 | tools/src/main/java/org/apache/rocketmq/tools/admin/DefaultMQAdminExtImpl.java:1150-1156 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `tools/src/main/java/org/apache/rocketmq/tools/admin/DefaultMQAdminExtImpl.java:363` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (7 lines × 4) tools/src/main/java/org/apache/rocketmq/tools/command/broker/RemoveColdDataFlowCtrGroupConfigSubCommand.java:71— tools/src/main/java/org/apache/rocketmq/tools/command/broker/RemoveColdDataFlowCtrGroupConfigSubCommand.java:71-77 | tools/src/main/java/org/apache/rocketmq/tools/command/broker/UpdateColdDataFlowCtrGroupConfigSubCommand.java:81-87 | tools/src/main/java/org/apache/rocketmq/tools/command/consumer/SetConsumeModeSubCommand.java:106-115 | tools/src/main/java/org/apache/rocketmq/tools/command/consumer/UpdateSubGroupSubCommand.java:200-209 — before extracting anything, compare `tools/src/main/java/org/apache/rocketmq/tools/command/broker/RemoveColdDataFlowCtrGroupConfigSubCommand.java` and `tools/src/main/java/org/apache/rocketmq/tools/command/broker/UpdateColdDataFlowCtrGroupConfigSubCommand.java` as WHOLE FILES: this scan already matched 8 separate duplicated blocks between them, totalling at least 81 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `tools/src/main/java/org/apache/rocketmq/tools/command/broker/RemoveColdDataFlowCtrGroupConfigSubCommand.java:71` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (7 lines × 4) client/src/main/java/org/apache/rocketmq/client/impl/consumer/ConsumeMessageConcurrentlyService.java:107— client/src/main/java/org/apache/rocketmq/client/impl/consumer/ConsumeMessageConcurrentlyService.java:107-113 | client/src/main/java/org/apache/rocketmq/client/impl/consumer/ConsumeMessageOrderlyService.java:117-123 | client/src/main/java/org/apache/rocketmq/client/impl/consumer/ConsumeMessagePopConcurrentlyService.java:93-99 | client/src/main/java/org/apache/rocketmq/client/impl/consumer/ConsumeMessagePopOrderlyService.java:111-117 — before extracting anything, compare `client/src/main/java/org/apache/rocketmq/client/impl/consumer/ConsumeMessageConcurrentlyService.java` and `client/src/main/java/org/apache/rocketmq/client/impl/consumer/ConsumeMessageOrderlyService.java` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 47 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `client/src/main/java/org/apache/rocketmq/client/impl/consumer/ConsumeMessageConcurrentlyService.java:103` calls `shutdown` and `client/src/main/java/org/apache/rocketmq/client/impl/consumer/ConsumeMessagePopConcurrentlyService.java:89` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
X15 · Unvalidated length from an untrusted reader· Length read from the parsed input is spent without ever being bounded · ×4
Length read from the parsed input is spent without ever being bounded common/src/main/java/org/apache/rocketmq/common/message/MessageDecoder.java:508— `bodyLen` is read from the bytes being parsed at line 505 (`getInt`), then used to size a `new byte[]` at line 508 — and nowhere in its scope is `bodyLen` bounded from above — compared to a limit, clamped, or checked against the input that remains (a zero or sign test, or the loop that counts up to it, bounds nothing). Whoever wrote those bytes therefore chooses the allocation directly: a 32-bit length asks for up to 2 GiB before a single byte of the payload is known to exist, which either exhausts the heap with an `OutOfMemoryError` or, negative, throws `NegativeArraySizeException` out of a parser whose failure path was written for malformed input, not for hostile input. Bound `bodyLen` against the bytes actually remaining and a maximum the format allows before allocating.
Length read from the parsed input is spent without ever being bounded common/src/main/java/org/apache/rocketmq/common/message/MessageDecoder.java:719— `bodyLen` is read from the bytes being parsed at line 718 (`getInt`), then used to size a `new byte[]` at line 719 — and nowhere in its scope is `bodyLen` bounded from above — compared to a limit, clamped, or checked against the input that remains (a zero or sign test, or the loop that counts up to it, bounds nothing). Whoever wrote those bytes therefore chooses the allocation directly: a 32-bit length asks for up to 2 GiB before a single byte of the payload is known to exist, which either exhausts the heap with an `OutOfMemoryError` or, negative, throws `NegativeArraySizeException` out of a parser whose failure path was written for malformed input, not for hostile input. Bound `bodyLen` against the bytes actually remaining and a maximum the format allows before allocating.
Length read from the parsed input is spent without ever being bounded remoting/src/main/java/org/apache/rocketmq/remoting/common/RemotingHelper.java:158— `size` is read from the bytes being parsed at line 157 (`getInt`), then used to size a `ByteBuffer.allocate` at line 158 — and nowhere in its scope is `size` bounded from above — compared to a limit, clamped, or checked against the input that remains (a zero or sign test, or the loop that counts up to it, bounds nothing). Whoever wrote those bytes therefore chooses the allocation directly: a 32-bit length asks for up to 2 GiB before a single byte of the payload is known to exist, which either exhausts the heap with an `OutOfMemoryError` or, negative, throws `NegativeArraySizeException` out of a parser whose failure path was written for malformed input, not for hostile input. Bound `size` against the bytes actually remaining and a maximum the format allows before allocating.
Length read from the parsed input is spent without ever being bounded store/src/main/java/org/apache/rocketmq/store/queue/RocksDBConsumeQueueOffsetTable.java:238— `topicLen` is read from the bytes being parsed at line 237 (`getInt`), then used to size a `new byte[]` at line 238 — and nowhere in its scope is `topicLen` bounded from above — compared to a limit, clamped, or checked against the input that remains (a zero or sign test, or the loop that counts up to it, bounds nothing). Whoever wrote those bytes therefore chooses the allocation directly: a 32-bit length asks for up to 2 GiB before a single byte of the payload is known to exist, which either exhausts the heap with an `OutOfMemoryError` or, negative, throws `NegativeArraySizeException` out of a parser whose failure path was written for malformed input, not for hostile input. Bound `topicLen` against the bytes actually remaining and a maximum the format allows before allocating.
D4 · Code Duplication· Edited copy of a member (31 corresponding lines) · ×3
Edited copy of a member (31 corresponding lines) tools/src/main/java/org/apache/rocketmq/tools/command/message/ConsumeMessageCommand.java:77— tools/src/main/java/org/apache/rocketmq/tools/command/message/ConsumeMessageCommand.java:77-115 | tools/src/main/java/org/apache/rocketmq/tools/command/message/SendMessageCommand.java:48-78 — These two members are one piece of code written twice and then edited apart: 31 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (31 corresponding lines) tools/src/main/java/org/apache/rocketmq/tools/command/message/PrintMessageByQueueCommand.java:115— tools/src/main/java/org/apache/rocketmq/tools/command/message/PrintMessageByQueueCommand.java:115-157 | tools/src/main/java/org/apache/rocketmq/tools/command/message/SendMessageCommand.java:48-78 — These two members are one piece of code written twice and then edited apart: 31 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (31 corresponding lines) tools/src/main/java/org/apache/rocketmq/tools/command/message/PrintMessageSubCommand.java:69— tools/src/main/java/org/apache/rocketmq/tools/command/message/PrintMessageSubCommand.java:69-101 | tools/src/main/java/org/apache/rocketmq/tools/command/message/SendMessageCommand.java:48-78 — These two members are one piece of code written twice and then edited apart: 31 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (27 corresponding lines) · ×3
Edited copy of a member (27 corresponding lines) tools/src/main/java/org/apache/rocketmq/tools/command/message/ConsumeMessageCommand.java:77— tools/src/main/java/org/apache/rocketmq/tools/command/message/ConsumeMessageCommand.java:77-115 | tools/src/main/java/org/apache/rocketmq/tools/command/message/QueryMsgByIdSubCommand.java:193-219 — These two members are one piece of code written twice and then edited apart: 27 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (27 corresponding lines) tools/src/main/java/org/apache/rocketmq/tools/command/message/PrintMessageSubCommand.java:69— tools/src/main/java/org/apache/rocketmq/tools/command/message/PrintMessageSubCommand.java:69-101 | tools/src/main/java/org/apache/rocketmq/tools/command/message/QueryMsgByIdSubCommand.java:193-219 — These two members are one piece of code written twice and then edited apart: 27 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (27 corresponding lines) tools/src/main/java/org/apache/rocketmq/tools/command/message/QueryMsgByIdSubCommand.java:193— tools/src/main/java/org/apache/rocketmq/tools/command/message/QueryMsgByIdSubCommand.java:193-219 | tools/src/main/java/org/apache/rocketmq/tools/command/message/SendMessageCommand.java:48-78 — These two members are one piece of code written twice and then edited apart: 27 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Duplicated block (34 lines × 2) client/src/main/java/org/apache/rocketmq/client/impl/consumer/ConsumeMessageConcurrentlyService.java:137— client/src/main/java/org/apache/rocketmq/client/impl/consumer/ConsumeMessageConcurrentlyService.java:137-170 | client/src/main/java/org/apache/rocketmq/client/impl/consumer/ConsumeMessagePopConcurrentlyService.java:121-154 — before extracting anything, compare `client/src/main/java/org/apache/rocketmq/client/impl/consumer/ConsumeMessageConcurrentlyService.java` and `client/src/main/java/org/apache/rocketmq/client/impl/consumer/ConsumeMessagePopConcurrentlyService.java` as WHOLE FILES: this scan already matched 8 separate duplicated blocks between them, totalling at least 122 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `client/src/main/java/org/apache/rocketmq/client/impl/consumer/ConsumeMessageConcurrentlyService.java:137` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `client/src/main/java/org/apache/rocketmq/client/impl/consumer/ConsumeMessageConcurrentlyService.java:136` calls `setBrokerName` and `client/src/main/java/org/apache/rocketmq/client/impl/consumer/ConsumeMessagePopConcurrentlyService.java:119` does not — after which the two agree again for 4 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (34 lines × 2) store/src/main/java/org/apache/rocketmq/store/ConsumeQueue.java:1120— store/src/main/java/org/apache/rocketmq/store/ConsumeQueue.java:1120-1153 | store/src/main/java/org/apache/rocketmq/store/queue/BatchConsumeQueue.java:1098-1131 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `store/src/main/java/org/apache/rocketmq/store/ConsumeQueue.java:1120` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (34 lines × 2) store/src/main/java/org/apache/rocketmq/store/ConsumeQueue.java:1162— store/src/main/java/org/apache/rocketmq/store/ConsumeQueue.java:1162-1195 | store/src/main/java/org/apache/rocketmq/store/queue/BatchConsumeQueue.java:1139-1172 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `store/src/main/java/org/apache/rocketmq/store/ConsumeQueue.java:1162` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (19 lines × 2) broker/src/main/java/org/apache/rocketmq/broker/BrokerController.java:1640— broker/src/main/java/org/apache/rocketmq/broker/BrokerController.java:1640-1658 | container/src/main/java/org/apache/rocketmq/container/InnerBrokerController.java:63-81 — before extracting anything, compare `broker/src/main/java/org/apache/rocketmq/broker/BrokerController.java` and `container/src/main/java/org/apache/rocketmq/container/InnerBrokerController.java` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 44 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `broker/src/main/java/org/apache/rocketmq/broker/BrokerController.java:1640` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (19 lines × 2) proxy/src/main/java/org/apache/rocketmq/proxy/service/message/LocalMessageService.java:350— proxy/src/main/java/org/apache/rocketmq/proxy/service/message/LocalMessageService.java:350-368 | proxy/src/main/java/org/apache/rocketmq/proxy/service/message/LocalMessageService.java:405-423 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `proxy/src/main/java/org/apache/rocketmq/proxy/service/message/LocalMessageService.java:350` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (19 lines × 2) tools/src/main/java/org/apache/rocketmq/tools/command/offset/ResetOffsetByTimeOldCommand.java:48— tools/src/main/java/org/apache/rocketmq/tools/command/offset/ResetOffsetByTimeOldCommand.java:48-66 | tools/src/main/java/org/apache/rocketmq/tools/command/offset/SkipAccumulationSubCommand.java:83-101 — before extracting anything, compare `tools/src/main/java/org/apache/rocketmq/tools/command/offset/ResetOffsetByTimeOldCommand.java` and `tools/src/main/java/org/apache/rocketmq/tools/command/offset/SkipAccumulationSubCommand.java` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 53 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `tools/src/main/java/org/apache/rocketmq/tools/command/offset/ResetOffsetByTimeOldCommand.java:70` calls `commandName` and `tools/src/main/java/org/apache/rocketmq/tools/command/offset/SkipAccumulationSubCommand.java:102` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (18 lines × 2) client/src/main/java/org/apache/rocketmq/client/impl/producer/DefaultMQProducerImpl.java:1542— client/src/main/java/org/apache/rocketmq/client/impl/producer/DefaultMQProducerImpl.java:1542-1559 | client/src/main/java/org/apache/rocketmq/client/impl/producer/DefaultMQProducerImpl.java:1599-1616 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `client/src/main/java/org/apache/rocketmq/client/impl/producer/DefaultMQProducerImpl.java:1542` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (18 lines × 2) store/src/main/java/org/apache/rocketmq/store/CommitLog.java:1054— store/src/main/java/org/apache/rocketmq/store/CommitLog.java:1054-1071 | store/src/main/java/org/apache/rocketmq/store/CommitLog.java:1215-1232 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `store/src/main/java/org/apache/rocketmq/store/CommitLog.java:1054` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (18 lines × 2) store/src/main/java/org/apache/rocketmq/store/CommitLog.java:1675— store/src/main/java/org/apache/rocketmq/store/CommitLog.java:1675-1692 | store/src/main/java/org/apache/rocketmq/store/CommitLog.java:1783-1800 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (16–17 lines × 2) client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:1259— client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:1259-1275 | client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:1293-1308 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:1259` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (16–17 lines × 2) client/src/main/java/org/apache/rocketmq/client/impl/factory/MQClientInstance.java:598— client/src/main/java/org/apache/rocketmq/client/impl/factory/MQClientInstance.java:598-614 | client/src/main/java/org/apache/rocketmq/client/impl/factory/MQClientInstance.java:656-671 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `client/src/main/java/org/apache/rocketmq/client/impl/factory/MQClientInstance.java:598` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (16–17 lines × 2) remoting/src/main/java/org/apache/rocketmq/remoting/protocol/body/ConsumerRunningInfo.java:268— remoting/src/main/java/org/apache/rocketmq/remoting/protocol/body/ConsumerRunningInfo.java:268-284 | remoting/src/main/java/org/apache/rocketmq/remoting/protocol/body/ConsumerRunningInfo.java:290-305 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `remoting/src/main/java/org/apache/rocketmq/remoting/protocol/body/ConsumerRunningInfo.java:268` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
Duplicated block (9 lines × 4) client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:1644— client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:1644-1652 | client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:1843-1851 | client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:1881-1889 | client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:1899-1907 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:1878` calls `properties2String` and `client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:1896` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (9 lines × 4) store/src/main/java/org/apache/rocketmq/store/CommitLog.java:924— store/src/main/java/org/apache/rocketmq/store/CommitLog.java:924-932 | store/src/main/java/org/apache/rocketmq/store/CommitLog.java:1092-1100 | store/src/main/java/org/apache/rocketmq/store/dledger/DLedgerCommitLog.java:409-417 | store/src/main/java/org/apache/rocketmq/store/dledger/DLedgerCommitLog.java:538-546 — there are 4 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 4 sites; resolving a subset leaves the remainder to drift apart. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `store/src/main/java/org/apache/rocketmq/store/CommitLog.java:934` calls `get`, `updateMaxMessageSize`, `generateKey` and `store/src/main/java/org/apache/rocketmq/store/CommitLog.java:1102` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (9 lines × 4) tools/src/main/java/org/apache/rocketmq/tools/command/consumer/ConsumerStatusSubCommand.java:61— tools/src/main/java/org/apache/rocketmq/tools/command/consumer/ConsumerStatusSubCommand.java:61-69 | tools/src/main/java/org/apache/rocketmq/tools/command/controller/CleanControllerBrokerMetaSubCommand.java:56-64 | tools/src/main/java/org/apache/rocketmq/tools/command/export/ExportMetadataCommand.java:60-68 | tools/src/main/java/org/apache/rocketmq/tools/command/offset/ResetOffsetByTimeCommand.java:58-66 — before extracting anything, compare `tools/src/main/java/org/apache/rocketmq/tools/command/consumer/ConsumerStatusSubCommand.java` and `tools/src/main/java/org/apache/rocketmq/tools/command/controller/CleanControllerBrokerMetaSubCommand.java` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 34 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (9 lines × 3) broker/src/main/java/org/apache/rocketmq/broker/out/BrokerOuterAPI.java:408— broker/src/main/java/org/apache/rocketmq/broker/out/BrokerOuterAPI.java:408-417 | broker/src/main/java/org/apache/rocketmq/broker/out/BrokerOuterAPI.java:608-616 | client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:3111-3119 — there are 3 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 3 sites; resolving a subset leaves the remainder to drift apart. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (9 lines × 3) client/src/main/java/org/apache/rocketmq/client/impl/producer/DefaultMQProducerImpl.java:1532— client/src/main/java/org/apache/rocketmq/client/impl/producer/DefaultMQProducerImpl.java:1532-1540 | client/src/main/java/org/apache/rocketmq/client/impl/producer/DefaultMQProducerImpl.java:1589-1597 | client/src/main/java/org/apache/rocketmq/client/impl/producer/DefaultMQProducerImpl.java:1646-1654 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `client/src/main/java/org/apache/rocketmq/client/impl/producer/DefaultMQProducerImpl.java:1532` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (9 lines × 3) tools/src/main/java/org/apache/rocketmq/tools/command/connection/ProducerConnectionSubCommand.java:57— tools/src/main/java/org/apache/rocketmq/tools/command/connection/ProducerConnectionSubCommand.java:57-66 | tools/src/main/java/org/apache/rocketmq/tools/command/consumer/ConsumerProgressSubCommand.java:99-107 | tools/src/main/java/org/apache/rocketmq/tools/command/consumer/ConsumerStatusSubCommand.java:76-85 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 3 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 3 times. Read the line range as the matched WINDOW rather than a finished unit: at `tools/src/main/java/org/apache/rocketmq/tools/command/connection/ProducerConnectionSubCommand.java:57` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (8–9 lines × 2) broker/src/main/java/org/apache/rocketmq/broker/processor/DefaultPullMessageResultHandler.java:114— broker/src/main/java/org/apache/rocketmq/broker/processor/DefaultPullMessageResultHandler.java:114-121 | broker/src/main/java/org/apache/rocketmq/broker/processor/PeekMessageProcessor.java:176-184 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `broker/src/main/java/org/apache/rocketmq/broker/processor/DefaultPullMessageResultHandler.java:114` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (8–9 lines × 2) tools/src/main/java/org/apache/rocketmq/tools/command/export/ExportConfigsCommand.java:101— tools/src/main/java/org/apache/rocketmq/tools/command/export/ExportConfigsCommand.java:101-108 | tools/src/main/java/org/apache/rocketmq/tools/command/export/ExportMetricsCommand.java:136-144 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `tools/src/main/java/org/apache/rocketmq/tools/command/export/ExportConfigsCommand.java:101` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (8–9 lines × 2) example/src/main/java/org/apache/rocketmq/example/filter/SqlFilterProducer.java:29— example/src/main/java/org/apache/rocketmq/example/filter/SqlFilterProducer.java:29-37 | example/src/main/java/org/apache/rocketmq/example/filter/TagFilterProducer.java:28-35 — before extracting anything, compare `example/src/main/java/org/apache/rocketmq/example/filter/SqlFilterProducer.java` and `example/src/main/java/org/apache/rocketmq/example/filter/TagFilterProducer.java` as WHOLE FILES: 84% of the shorter file's lines also appear in the other, so this reads as one file having been copied from the other rather than as a helper waiting to be extracted. The 1 duplicated block(s) this scan matched between them are fragments of that copy, not the extent of it — treat the file pair as the unit. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `example/src/main/java/org/apache/rocketmq/example/filter/SqlFilterProducer.java:29` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (8 lines × 4) broker/src/main/java/org/apache/rocketmq/broker/out/BrokerOuterAPI.java:408— broker/src/main/java/org/apache/rocketmq/broker/out/BrokerOuterAPI.java:408-417 | broker/src/main/java/org/apache/rocketmq/broker/out/BrokerOuterAPI.java:608-616 | client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:3111-3119 | client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:3285-3292 — there are 4 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 4 sites; resolving a subset leaves the remainder to drift apart. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (8 lines × 4) client/src/main/java/org/apache/rocketmq/client/impl/MQAdminImpl.java:193— client/src/main/java/org/apache/rocketmq/client/impl/MQAdminImpl.java:193-200 | client/src/main/java/org/apache/rocketmq/client/impl/MQAdminImpl.java:212-219 | client/src/main/java/org/apache/rocketmq/client/impl/MQAdminImpl.java:230-237 | client/src/main/java/org/apache/rocketmq/client/impl/MQAdminImpl.java:248-255 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `client/src/main/java/org/apache/rocketmq/client/impl/MQAdminImpl.java:193` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (8 lines × 4) controller/src/main/java/org/apache/rocketmq/controller/ControllerStartup.java:151— controller/src/main/java/org/apache/rocketmq/controller/ControllerStartup.java:151-159 | namesrv/src/main/java/org/apache/rocketmq/namesrv/NamesrvStartup.java:227-234 | tools/src/main/java/org/apache/rocketmq/tools/command/consumer/ConsumerStatusSubCommand.java:63-72 | tools/src/main/java/org/apache/rocketmq/tools/command/controller/CleanControllerBrokerMetaSubCommand.java:58-67 — before extracting anything, compare `tools/src/main/java/org/apache/rocketmq/tools/command/consumer/ConsumerStatusSubCommand.java` and `tools/src/main/java/org/apache/rocketmq/tools/command/controller/CleanControllerBrokerMetaSubCommand.java` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 34 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `controller/src/main/java/org/apache/rocketmq/controller/ControllerStartup.java:151` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
Duplicated block (7 lines × 5) broker/src/main/java/org/apache/rocketmq/broker/processor/AdminBrokerProcessor.java:741— broker/src/main/java/org/apache/rocketmq/broker/processor/AdminBrokerProcessor.java:741-747 | broker/src/main/java/org/apache/rocketmq/broker/processor/AdminBrokerProcessor.java:1448-1454 | broker/src/main/java/org/apache/rocketmq/broker/processor/AdminBrokerProcessor.java:1736-1742 | broker/src/main/java/org/apache/rocketmq/broker/processor/AdminBrokerProcessor.java:1792-1798 | container/src/main/java/org/apache/rocketmq/container/BrokerContainerProcessor.java:295-301 — there are 5 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 5 sites; resolving a subset leaves the remainder to drift apart. Read the line range as the matched WINDOW rather than a finished unit: at `broker/src/main/java/org/apache/rocketmq/broker/processor/AdminBrokerProcessor.java:741` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (7 lines × 5) broker/src/main/java/org/apache/rocketmq/broker/processor/DefaultPullMessageResultHandler.java:154— broker/src/main/java/org/apache/rocketmq/broker/processor/DefaultPullMessageResultHandler.java:154-160 | broker/src/main/java/org/apache/rocketmq/broker/processor/PeekMessageProcessor.java:200-206 | broker/src/main/java/org/apache/rocketmq/broker/processor/PopMessageProcessor.java:463-469 | broker/src/main/java/org/apache/rocketmq/broker/processor/QueryMessageProcessor.java:112-118 | broker/src/main/java/org/apache/rocketmq/broker/processor/QueryMessageProcessor.java:157-163 — there are 5 copies across 4 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 5 sites; resolving a subset leaves the remainder to drift apart. Read the line range as the matched WINDOW rather than a finished unit: at `broker/src/main/java/org/apache/rocketmq/broker/processor/DefaultPullMessageResultHandler.java:154` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (7 lines × 5) client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:2490— client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:2490-2496 | client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:2568-2574 | client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:2600-2606 | client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:2771-2777 | client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:2800-2806 — all 5 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:2490` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (7 lines × 3) store/src/main/java/org/apache/rocketmq/store/queue/BatchConsumeQueue.java:225— store/src/main/java/org/apache/rocketmq/store/queue/BatchConsumeQueue.java:225-231 | store/src/main/java/org/apache/rocketmq/store/queue/BatchConsumeQueue.java:394-400 | store/src/main/java/org/apache/rocketmq/store/queue/SparseConsumeQueue.java:68-74 — there are 3 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 3 sites; resolving a subset leaves the remainder to drift apart.
Duplicated block (7 lines × 3) tools/src/main/java/org/apache/rocketmq/tools/admin/DefaultMQAdminExtImpl.java:1441— tools/src/main/java/org/apache/rocketmq/tools/admin/DefaultMQAdminExtImpl.java:1441-1447 | tools/src/main/java/org/apache/rocketmq/tools/admin/DefaultMQAdminExtImpl.java:1464-1470 | tools/src/main/java/org/apache/rocketmq/tools/admin/DefaultMQAdminExtImpl.java:1472-1478 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
Duplicated block (7 lines × 3) example/src/main/java/org/apache/rocketmq/example/broadcast/PushConsumer.java:47— example/src/main/java/org/apache/rocketmq/example/broadcast/PushConsumer.java:47-54 | example/src/main/java/org/apache/rocketmq/example/tracemessage/OpenTracingPushConsumer.java:50-56 | example/src/main/java/org/apache/rocketmq/example/tracemessage/TracePushConsumer.java:42-48 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 3 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 3 times. Read the line range as the matched WINDOW rather than a finished unit: at `example/src/main/java/org/apache/rocketmq/example/broadcast/PushConsumer.java:47` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (6–7 lines × 2) client/src/main/java/org/apache/rocketmq/client/impl/producer/TopicPublishInfo.java:80— client/src/main/java/org/apache/rocketmq/client/impl/producer/TopicPublishInfo.java:80-86 | proxy/src/main/java/org/apache/rocketmq/proxy/service/route/MessageQueueSelector.java:203-208 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `client/src/main/java/org/apache/rocketmq/client/impl/producer/TopicPublishInfo.java:80` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note first that the copies are not typed on the same thing: the declarations holding them bind `sendQueue` to `ThreadLocalIndex` in one and `AtomicInteger` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
Duplicated block (6–7 lines × 2) client/src/main/java/org/apache/rocketmq/client/trace/hook/EndTransactionOpenTracingHookImpl.java:52— client/src/main/java/org/apache/rocketmq/client/trace/hook/EndTransactionOpenTracingHookImpl.java:52-58 | client/src/main/java/org/apache/rocketmq/client/trace/hook/SendMessageOpenTracingHookImpl.java:52-57 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `client/src/main/java/org/apache/rocketmq/client/trace/hook/EndTransactionOpenTracingHookImpl.java:52` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `client/src/main/java/org/apache/rocketmq/client/trace/hook/SendMessageOpenTracingHookImpl.java:58` calls `inject`, `context`, `TextMapAdapter` and `client/src/main/java/org/apache/rocketmq/client/trace/hook/EndTransactionOpenTracingHookImpl.java:59` does not — after which the two agree again for 4 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (6–7 lines × 2) store/src/main/java/org/apache/rocketmq/store/DefaultMessageStore.java:2539— store/src/main/java/org/apache/rocketmq/store/DefaultMessageStore.java:2539-2544 | store/src/main/java/org/apache/rocketmq/store/DefaultMessageStore.java:2554-2560 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `store/src/main/java/org/apache/rocketmq/store/DefaultMessageStore.java:2539` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (6 lines × 5) client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:2012— client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:2012-2017 | client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:2463-2468 | client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:2655-2660 | client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:2685-2690 | client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:2714-2719 — all 5 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:2012` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (6 lines × 5) client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:2443— client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:2443-2448 | client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:2463-2468 | client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:2655-2660 | client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:2685-2690 | client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:2714-2719 — all 5 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:2443` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (6 lines × 5) tools/src/main/java/org/apache/rocketmq/tools/command/acl/ClusterAclConfigVersionListSubCommand.java:83— tools/src/main/java/org/apache/rocketmq/tools/command/acl/ClusterAclConfigVersionListSubCommand.java:83-92 | tools/src/main/java/org/apache/rocketmq/tools/command/broker/RemoveColdDataFlowCtrGroupConfigSubCommand.java:70-75 | tools/src/main/java/org/apache/rocketmq/tools/command/broker/UpdateColdDataFlowCtrGroupConfigSubCommand.java:80-85 | tools/src/main/java/org/apache/rocketmq/tools/command/consumer/UpdateSubGroupSubCommand.java:199-207 | tools/src/main/java/org/apache/rocketmq/tools/command/topic/UpdateTopicSubCommand.java:162-171 — before extracting anything, compare `tools/src/main/java/org/apache/rocketmq/tools/command/broker/RemoveColdDataFlowCtrGroupConfigSubCommand.java` and `tools/src/main/java/org/apache/rocketmq/tools/command/broker/UpdateColdDataFlowCtrGroupConfigSubCommand.java` as WHOLE FILES: this scan already matched 8 separate duplicated blocks between them, totalling at least 81 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `tools/src/main/java/org/apache/rocketmq/tools/command/acl/ClusterAclConfigVersionListSubCommand.java:83` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Low cohesion: ProduceAccumulator (LCOM4 6) client/src/main/java/org/apache/rocketmq/client/producer/ProduceAccumulator.java:45— ProduceAccumulator's methods fall into 6 groups that share no field and call none of each other, against a bar of more than 3 for this run (LCOM4, configurable — your repository's bar is the one quoted here). Each group is a set of methods reachable from one another through shared fields or direct calls, so 6 groups means the type has that many internally-connected clusters with nothing tying them together. Types whose shape makes a high count expected — and which would otherwise dominate this list — are excluded before this row is raised, so this is a genuine split candidate rather than a metric reading. It is still a shape, not a defect: confirm the groups match responsibilities you can name before splitting.
Low cohesion: RemotingChannel (LCOM4 4) proxy/src/main/java/org/apache/rocketmq/proxy/remoting/channel/RemotingChannel.java:61— RemotingChannel's methods fall into 4 groups that share no field and call none of each other, against a bar of more than 3 for this run (LCOM4, configurable — your repository's bar is the one quoted here). Each group is a set of methods reachable from one another through shared fields or direct calls, so 4 groups means the type has that many internally-connected clusters with nothing tying them together. Types whose shape makes a high count expected — and which would otherwise dominate this list — are excluded before this row is raised, so this is a genuine split candidate rather than a metric reading. It is still a shape, not a defect: confirm the groups match responsibilities you can name before splitting.
Low cohesion: TopicRouteService (LCOM4 4) proxy/src/main/java/org/apache/rocketmq/proxy/service/route/TopicRouteService.java:52— TopicRouteService's methods fall into 4 groups that share no field and call none of each other, against a bar of more than 3 for this run (LCOM4, configurable — your repository's bar is the one quoted here). Each group is a set of methods reachable from one another through shared fields or direct calls, so 4 groups means the type has that many internally-connected clusters with nothing tying them together. Types whose shape makes a high count expected — and which would otherwise dominate this list — are excluded before this row is raised, so this is a genuine split candidate rather than a metric reading. It is still a shape, not a defect: confirm the groups match responsibilities you can name before splitting.
IC1 · Incompleteness & stubs· Empty method body · ×3
Empty method body — does nothing with its inputs common/src/main/java/org/apache/rocketmq/common/sysflag/SubscriptionSysFlag.java:45— `main` takes parameters but its body is empty — it accepts inputs and does nothing. Either implement it or remove it.
Empty method body — does nothing with its inputs container/src/main/java/org/apache/rocketmq/container/logback/BrokerLogbackConfigurator.java:39— `doConfigure` takes parameters but its body is empty — it accepts inputs and does nothing. Either implement it or remove it.
Empty method body — does nothing with its inputs tools/src/main/java/org/apache/rocketmq/tools/monitor/MonitorService.java:320— `reportFailedMsgs` takes parameters but its body is empty — it accepts inputs and does nothing. Either implement it or remove it.
Near-duplicate member pair (39 shared lines) broker/src/main/java/org/apache/rocketmq/broker/BrokerController.java:1628— broker/src/main/java/org/apache/rocketmq/broker/BrokerController.java:1628-1699 | container/src/main/java/org/apache/rocketmq/container/InnerBrokerController.java:56-111 — These two members are variants of one another: 39 of their lines are already reported as duplicated blocks below, spread through both bodies rather than gathered into one. Read them as a single construct written twice. The repair is at the members' grain — factor the shared pipeline into one implementation the two call with their differences as parameters or as an injected step, or, where the difference is systematic (sync against async, one transport against another), generate one from the other. Extracting the individual blocks below is not the same fix: it leaves the two bodies in place and the next edit still has to be made twice.
Near-duplicate member pair (39 shared lines) tools/src/main/java/org/apache/rocketmq/tools/command/topic/RemappingStaticTopicSubCommand.java:119— tools/src/main/java/org/apache/rocketmq/tools/command/topic/RemappingStaticTopicSubCommand.java:119-204 | tools/src/main/java/org/apache/rocketmq/tools/command/topic/UpdateStaticTopicSubCommand.java:124-208 — These two members are variants of one another: 39 of their lines are already reported as duplicated blocks below, spread through both bodies rather than gathered into one. Read them as a single construct written twice. The repair is at the members' grain — factor the shared pipeline into one implementation the two call with their differences as parameters or as an injected step, or, where the difference is systematic (sync against async, one transport against another), generate one from the other. Extracting the individual blocks below is not the same fix: it leaves the two bodies in place and the next edit still has to be made twice.
D4 · Code Duplication· Edited copy of a member (26 corresponding lines) · ×2
Edited copy of a member (26 corresponding lines) tools/src/main/java/org/apache/rocketmq/tools/command/acl/UpdateAccessConfigSubCommand.java:47— tools/src/main/java/org/apache/rocketmq/tools/command/acl/UpdateAccessConfigSubCommand.java:47-92 | tools/src/main/java/org/apache/rocketmq/tools/command/message/QueryMsgByIdSubCommand.java:193-219 — These two members are one piece of code written twice and then edited apart: 26 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (26 corresponding lines) tools/src/main/java/org/apache/rocketmq/tools/command/message/QueryMsgByIdSubCommand.java:193— tools/src/main/java/org/apache/rocketmq/tools/command/message/QueryMsgByIdSubCommand.java:193-219 | tools/src/main/java/org/apache/rocketmq/tools/command/topic/UpdateTopicSubCommand.java:49-94 — These two members are one piece of code written twice and then edited apart: 26 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (23 corresponding lines) · ×2
Edited copy of a member (23 corresponding lines) tools/src/main/java/org/apache/rocketmq/tools/command/message/PrintMessageSubCommand.java:69— tools/src/main/java/org/apache/rocketmq/tools/command/message/PrintMessageSubCommand.java:69-101 | tools/src/main/java/org/apache/rocketmq/tools/command/message/QueryMsgByKeySubCommand.java:43-65 — These two members are one piece of code written twice and then edited apart: 23 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (23 corresponding lines) tools/src/main/java/org/apache/rocketmq/tools/command/message/QueryMsgByIdSubCommand.java:193— tools/src/main/java/org/apache/rocketmq/tools/command/message/QueryMsgByIdSubCommand.java:193-219 | tools/src/main/java/org/apache/rocketmq/tools/command/message/QueryMsgByKeySubCommand.java:43-65 — These two members are one piece of code written twice and then edited apart: 23 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (18 corresponding lines) · ×2
Edited copy of a member (18 corresponding lines) example/src/main/java/org/apache/rocketmq/example/operation/Consumer.java:72— example/src/main/java/org/apache/rocketmq/example/operation/Consumer.java:72-110 | tools/src/main/java/org/apache/rocketmq/tools/command/topic/UpdateTopicSubCommand.java:49-94 — These two members are one piece of code written twice and then edited apart: 18 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (18 corresponding lines) example/src/main/java/org/apache/rocketmq/example/operation/Producer.java:66— example/src/main/java/org/apache/rocketmq/example/operation/Producer.java:66-108 | tools/src/main/java/org/apache/rocketmq/tools/command/consumer/SetConsumeModeSubCommand.java:46-72 — These two members are one piece of code written twice and then edited apart: 18 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Members sharing a duplicated core (7 members, 50+ identical tokens) · ×2
Members sharing a duplicated core (7 members, 50+ identical tokens) broker/src/main/java/org/apache/rocketmq/broker/processor/AckMessageProcessor.java:111— broker/src/main/java/org/apache/rocketmq/broker/processor/AckMessageProcessor.java:111-166 | broker/src/main/java/org/apache/rocketmq/broker/processor/ChangeInvisibleTimeProcessor.java:69-129 | broker/src/main/java/org/apache/rocketmq/broker/processor/NotificationProcessor.java:66-174 | broker/src/main/java/org/apache/rocketmq/broker/processor/PeekMessageProcessor.java:82-224 | broker/src/main/java/org/apache/rocketmq/broker/processor/PollingInfoProcessor.java:60-117 | broker/src/main/java/org/apache/rocketmq/broker/processor/PopMessageProcessor.java:197-490 | broker/src/main/java/org/apache/rocketmq/broker/processor/PullMessageProcessor.java:302-581 — These 7 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 7 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 7 times.
Members sharing a duplicated core (7 members, 50+ identical tokens) client/src/main/java/org/apache/rocketmq/client/impl/admin/MqClientAdminImpl.java:273— client/src/main/java/org/apache/rocketmq/client/impl/admin/MqClientAdminImpl.java:273-286 | client/src/main/java/org/apache/rocketmq/client/impl/admin/MqClientAdminImpl.java:290-303 | client/src/main/java/org/apache/rocketmq/client/impl/admin/MqClientAdminImpl.java:307-320 | client/src/main/java/org/apache/rocketmq/client/impl/admin/MqClientAdminImpl.java:342-355 | client/src/main/java/org/apache/rocketmq/client/impl/admin/MqClientAdminImpl.java:359-372 | client/src/main/java/org/apache/rocketmq/client/impl/admin/MqClientAdminImpl.java:376-389 | client/src/main/java/org/apache/rocketmq/client/impl/admin/MqClientAdminImpl.java:393-406 — These 7 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 7 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 7 times.
D4 · Code Duplication· Members sharing a duplicated core (6 members, 50+ identical tokens) · ×2
Members sharing a duplicated core (6 members, 50+ identical tokens) client/src/main/java/org/apache/rocketmq/client/impl/admin/MqClientAdminImpl.java:139— client/src/main/java/org/apache/rocketmq/client/impl/admin/MqClientAdminImpl.java:139-151 | client/src/main/java/org/apache/rocketmq/client/impl/admin/MqClientAdminImpl.java:155-169 | client/src/main/java/org/apache/rocketmq/client/impl/admin/MqClientAdminImpl.java:173-185 | client/src/main/java/org/apache/rocketmq/client/impl/admin/MqClientAdminImpl.java:189-201 | client/src/main/java/org/apache/rocketmq/client/impl/admin/MqClientAdminImpl.java:205-217 | client/src/main/java/org/apache/rocketmq/client/impl/admin/MqClientAdminImpl.java:221-233 — These 6 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 6 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 6 times.
Members sharing a duplicated core (6 members, 50+ identical tokens) filter/src/main/java/org/apache/rocketmq/filter/expression/ComparisonExpression.java:85— filter/src/main/java/org/apache/rocketmq/filter/expression/ComparisonExpression.java:85-102 | filter/src/main/java/org/apache/rocketmq/filter/expression/ComparisonExpression.java:123-140 | filter/src/main/java/org/apache/rocketmq/filter/expression/ComparisonExpression.java:169-186 | filter/src/main/java/org/apache/rocketmq/filter/expression/ComparisonExpression.java:207-224 | filter/src/main/java/org/apache/rocketmq/filter/expression/ComparisonExpression.java:253-270 | filter/src/main/java/org/apache/rocketmq/filter/expression/ComparisonExpression.java:291-308 — These 6 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 6 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 6 times.
Duplicated block (24 lines × 2) client/src/main/java/org/apache/rocketmq/client/impl/producer/DefaultMQProducerImpl.java:645— client/src/main/java/org/apache/rocketmq/client/impl/producer/DefaultMQProducerImpl.java:645-668 | client/src/main/java/org/apache/rocketmq/client/impl/producer/DefaultMQProducerImpl.java:1285-1308 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `client/src/main/java/org/apache/rocketmq/client/impl/producer/DefaultMQProducerImpl.java:645` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (24 lines × 2) common/src/main/java/org/apache/rocketmq/common/compression/Lz4Compressor.java:62— common/src/main/java/org/apache/rocketmq/common/compression/Lz4Compressor.java:62-85 | common/src/main/java/org/apache/rocketmq/common/compression/ZstdCompressor.java:62-85 — before extracting anything, compare `common/src/main/java/org/apache/rocketmq/common/compression/Lz4Compressor.java` and `common/src/main/java/org/apache/rocketmq/common/compression/ZstdCompressor.java` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 51 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `common/src/main/java/org/apache/rocketmq/common/compression/Lz4Compressor.java:62` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (23 lines × 2) common/src/main/java/org/apache/rocketmq/common/UtilAll.java:409— common/src/main/java/org/apache/rocketmq/common/UtilAll.java:409-431 | common/src/main/java/org/apache/rocketmq/common/compression/ZlibCompressor.java:34-56 — before extracting anything, compare `common/src/main/java/org/apache/rocketmq/common/UtilAll.java` and `common/src/main/java/org/apache/rocketmq/common/compression/ZlibCompressor.java` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 72 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
Duplicated block (23 lines × 2) example/src/main/java/org/apache/rocketmq/example/operation/Consumer.java:88— example/src/main/java/org/apache/rocketmq/example/operation/Consumer.java:88-110 | example/src/main/java/org/apache/rocketmq/example/operation/Producer.java:86-108 — before extracting anything, compare `example/src/main/java/org/apache/rocketmq/example/operation/Consumer.java` and `example/src/main/java/org/apache/rocketmq/example/operation/Producer.java` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 55 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `example/src/main/java/org/apache/rocketmq/example/operation/Consumer.java:88` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (22 lines × 2) store/src/main/java/org/apache/rocketmq/store/MessageExtEncoder.java:149— store/src/main/java/org/apache/rocketmq/store/MessageExtEncoder.java:149-170 | store/src/main/java/org/apache/rocketmq/store/MessageExtEncoder.java:245-266 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (22 lines × 2) store/src/main/java/org/apache/rocketmq/store/dledger/DLedgerCommitLog.java:492— store/src/main/java/org/apache/rocketmq/store/dledger/DLedgerCommitLog.java:492-513 | store/src/main/java/org/apache/rocketmq/store/dledger/DLedgerCommitLog.java:636-657 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `store/src/main/java/org/apache/rocketmq/store/dledger/DLedgerCommitLog.java:492` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (19–20 lines × 2) client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:2182— client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:2182-2201 | client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:2211-2229 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:2182` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:2178` calls `setValue` and `client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:2207` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (19–20 lines × 2) client/src/main/java/org/apache/rocketmq/client/impl/consumer/RebalanceImpl.java:489— client/src/main/java/org/apache/rocketmq/client/impl/consumer/RebalanceImpl.java:489-508 | client/src/main/java/org/apache/rocketmq/client/impl/consumer/RebalanceImpl.java:609-627 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `client/src/main/java/org/apache/rocketmq/client/impl/consumer/RebalanceImpl.java:489` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (19 lines × 3) controller/src/main/java/org/apache/rocketmq/controller/ControllerStartup.java:125— controller/src/main/java/org/apache/rocketmq/controller/ControllerStartup.java:125-143 | namesrv/src/main/java/org/apache/rocketmq/namesrv/NamesrvStartup.java:158-176 | namesrv/src/main/java/org/apache/rocketmq/namesrv/NamesrvStartup.java:197-215 — there are 3 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 3 sites; resolving a subset leaves the remainder to drift apart. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit. Note first that the copies are not typed on the same thing: the declarations holding them bind `controller` to `ControllerManager` in one and `NamesrvController` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
Duplicated block (19 lines × 3) store/src/main/java/org/apache/rocketmq/store/MessageExtEncoder.java:138— store/src/main/java/org/apache/rocketmq/store/MessageExtEncoder.java:138-156 | store/src/main/java/org/apache/rocketmq/store/MessageExtEncoder.java:234-252 | store/src/main/java/org/apache/rocketmq/store/MessageExtEncoder.java:350-368 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (16 lines × 3) remoting/src/main/java/org/apache/rocketmq/remoting/netty/NettyLogger.java:92— remoting/src/main/java/org/apache/rocketmq/remoting/netty/NettyLogger.java:92-107 | remoting/src/main/java/org/apache/rocketmq/remoting/netty/NettyLogger.java:130-145 | remoting/src/main/java/org/apache/rocketmq/remoting/netty/NettyLogger.java:149-164 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
Duplicated block (16 lines × 3) remoting/src/main/java/org/apache/rocketmq/remoting/protocol/header/ExtraInfoUtil.java:201— remoting/src/main/java/org/apache/rocketmq/remoting/protocol/header/ExtraInfoUtil.java:201-216 | remoting/src/main/java/org/apache/rocketmq/remoting/protocol/header/ExtraInfoUtil.java:232-247 | remoting/src/main/java/org/apache/rocketmq/remoting/protocol/header/ExtraInfoUtil.java:259-274 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `remoting/src/main/java/org/apache/rocketmq/remoting/protocol/header/ExtraInfoUtil.java:201` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (14–16 lines × 2) client/src/main/java/org/apache/rocketmq/client/impl/consumer/RebalanceLitePullImpl.java:96— client/src/main/java/org/apache/rocketmq/client/impl/consumer/RebalanceLitePullImpl.java:96-109 | client/src/main/java/org/apache/rocketmq/client/impl/consumer/RebalancePushImpl.java:182-197 — before extracting anything, compare `client/src/main/java/org/apache/rocketmq/client/impl/consumer/RebalanceLitePullImpl.java` and `client/src/main/java/org/apache/rocketmq/client/impl/consumer/RebalancePushImpl.java` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 37 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `client/src/main/java/org/apache/rocketmq/client/impl/consumer/RebalanceLitePullImpl.java:96` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (14–16 lines × 2) store/src/main/java/org/apache/rocketmq/store/stats/BrokerStatsManager.java:653— store/src/main/java/org/apache/rocketmq/store/stats/BrokerStatsManager.java:653-666 | store/src/main/java/org/apache/rocketmq/store/stats/BrokerStatsManager.java:670-685 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
Duplicated block (14 lines × 4) broker/src/main/java/org/apache/rocketmq/broker/processor/AdminBrokerProcessor.java:749— broker/src/main/java/org/apache/rocketmq/broker/processor/AdminBrokerProcessor.java:749-762 | broker/src/main/java/org/apache/rocketmq/broker/processor/AdminBrokerProcessor.java:1456-1469 | broker/src/main/java/org/apache/rocketmq/broker/processor/AdminBrokerProcessor.java:1744-1757 | broker/src/main/java/org/apache/rocketmq/broker/processor/AdminBrokerProcessor.java:1800-1813 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `broker/src/main/java/org/apache/rocketmq/broker/processor/AdminBrokerProcessor.java:749` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (14 lines × 4) client/src/main/java/org/apache/rocketmq/client/impl/consumer/ConsumeMessageConcurrentlyService.java:160— client/src/main/java/org/apache/rocketmq/client/impl/consumer/ConsumeMessageConcurrentlyService.java:160-173 | client/src/main/java/org/apache/rocketmq/client/impl/consumer/ConsumeMessageOrderlyService.java:172-185 | client/src/main/java/org/apache/rocketmq/client/impl/consumer/ConsumeMessagePopConcurrentlyService.java:144-157 | client/src/main/java/org/apache/rocketmq/client/impl/consumer/ConsumeMessagePopOrderlyService.java:166-179 — before extracting anything, compare `client/src/main/java/org/apache/rocketmq/client/impl/consumer/ConsumeMessageConcurrentlyService.java` and `client/src/main/java/org/apache/rocketmq/client/impl/consumer/ConsumeMessageOrderlyService.java` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 47 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `client/src/main/java/org/apache/rocketmq/client/impl/consumer/ConsumeMessageConcurrentlyService.java:160` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (13–14 lines × 3) store/src/main/java/org/apache/rocketmq/store/CommitLog.java:351— store/src/main/java/org/apache/rocketmq/store/CommitLog.java:351-363 | store/src/main/java/org/apache/rocketmq/store/CommitLog.java:745-758 | store/src/main/java/org/apache/rocketmq/store/ConsumeQueue.java:158-170 — there are 3 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 3 sites; resolving a subset leaves the remainder to drift apart. Read the line range as the matched WINDOW rather than a finished unit: at `store/src/main/java/org/apache/rocketmq/store/CommitLog.java:351` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (13–14 lines × 3) tools/src/main/java/org/apache/rocketmq/tools/command/broker/RemoveColdDataFlowCtrGroupConfigSubCommand.java:80— tools/src/main/java/org/apache/rocketmq/tools/command/broker/RemoveColdDataFlowCtrGroupConfigSubCommand.java:80-92 | tools/src/main/java/org/apache/rocketmq/tools/command/broker/UpdateBrokerConfigSubCommand.java:106-119 | tools/src/main/java/org/apache/rocketmq/tools/command/broker/UpdateColdDataFlowCtrGroupConfigSubCommand.java:90-102 — before extracting anything, compare `tools/src/main/java/org/apache/rocketmq/tools/command/broker/RemoveColdDataFlowCtrGroupConfigSubCommand.java` and `tools/src/main/java/org/apache/rocketmq/tools/command/broker/UpdateBrokerConfigSubCommand.java` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 51 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `tools/src/main/java/org/apache/rocketmq/tools/command/broker/RemoveColdDataFlowCtrGroupConfigSubCommand.java:80` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (13 lines × 3) broker/src/main/java/org/apache/rocketmq/broker/offset/BroadcastOffsetStore.java:30— broker/src/main/java/org/apache/rocketmq/broker/offset/BroadcastOffsetStore.java:30-42 | client/src/main/java/org/apache/rocketmq/client/consumer/store/LocalFileOffsetStore.java:81-93 | client/src/main/java/org/apache/rocketmq/client/consumer/store/RemoteBrokerOffsetStore.java:62-74 — before extracting anything, compare `client/src/main/java/org/apache/rocketmq/client/consumer/store/LocalFileOffsetStore.java` and `client/src/main/java/org/apache/rocketmq/client/consumer/store/RemoteBrokerOffsetStore.java` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 50 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `client/src/main/java/org/apache/rocketmq/client/consumer/store/LocalFileOffsetStore.java:81` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (13 lines × 3) client/src/main/java/org/apache/rocketmq/client/impl/mqclient/MQClientAPIExt.java:437— client/src/main/java/org/apache/rocketmq/client/impl/mqclient/MQClientAPIExt.java:437-449 | client/src/main/java/org/apache/rocketmq/client/impl/mqclient/MQClientAPIExt.java:473-485 | client/src/main/java/org/apache/rocketmq/client/impl/mqclient/MQClientAPIExt.java:509-521 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `client/src/main/java/org/apache/rocketmq/client/impl/mqclient/MQClientAPIExt.java:437` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
Duplicated block (12 lines × 3) client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:2512— client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:2512-2523 | client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:2528-2539 | client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:2545-2556 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:2512` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (12 lines × 3) example/src/main/java/org/apache/rocketmq/example/tracemessage/OpenTracingProducer.java:66— example/src/main/java/org/apache/rocketmq/example/tracemessage/OpenTracingProducer.java:66-77 | example/src/main/java/org/apache/rocketmq/example/tracemessage/OpenTracingPushConsumer.java:59-70 | example/src/main/java/org/apache/rocketmq/example/tracemessage/OpenTracingTransactionProducer.java:85-96 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 3 call sites, so a change lands once. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
Duplicated block (11 lines × 3) client/src/main/java/org/apache/rocketmq/client/impl/producer/DefaultMQProducerImpl.java:1542— client/src/main/java/org/apache/rocketmq/client/impl/producer/DefaultMQProducerImpl.java:1542-1552 | client/src/main/java/org/apache/rocketmq/client/impl/producer/DefaultMQProducerImpl.java:1599-1609 | client/src/main/java/org/apache/rocketmq/client/impl/producer/DefaultMQProducerImpl.java:1656-1666 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (11 lines × 3) namesrv/src/main/java/org/apache/rocketmq/namesrv/routeinfo/RouteInfoManager.java:1058— namesrv/src/main/java/org/apache/rocketmq/namesrv/routeinfo/RouteInfoManager.java:1058-1068 | namesrv/src/main/java/org/apache/rocketmq/namesrv/routeinfo/RouteInfoManager.java:1079-1089 | namesrv/src/main/java/org/apache/rocketmq/namesrv/routeinfo/RouteInfoManager.java:1101-1111 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `namesrv/src/main/java/org/apache/rocketmq/namesrv/routeinfo/RouteInfoManager.java:1058` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `namesrv/src/main/java/org/apache/rocketmq/namesrv/routeinfo/RouteInfoManager.java:1099` calls `hasUnitFlag`, `values`, `iterator` and `namesrv/src/main/java/org/apache/rocketmq/namesrv/routeinfo/RouteInfoManager.java:1077` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (9–11 lines × 2) store/src/main/java/org/apache/rocketmq/store/ha/DefaultHAConnection.java:186— store/src/main/java/org/apache/rocketmq/store/ha/DefaultHAConnection.java:186-194 | store/src/main/java/org/apache/rocketmq/store/ha/autoswitch/AutoSwitchHAConnection.java:277-287 — before extracting anything, compare `store/src/main/java/org/apache/rocketmq/store/ha/DefaultHAConnection.java` and `store/src/main/java/org/apache/rocketmq/store/ha/autoswitch/AutoSwitchHAConnection.java` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 36 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `store/src/main/java/org/apache/rocketmq/store/ha/DefaultHAConnection.java:186` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (9–11 lines × 2) tools/src/main/java/org/apache/rocketmq/tools/command/namesrv/AddWritePermSubCommand.java:50— tools/src/main/java/org/apache/rocketmq/tools/command/namesrv/AddWritePermSubCommand.java:50-58 | tools/src/main/java/org/apache/rocketmq/tools/command/namesrv/WipeWritePermSubCommand.java:50-60 — before extracting anything, compare `tools/src/main/java/org/apache/rocketmq/tools/command/namesrv/AddWritePermSubCommand.java` and `tools/src/main/java/org/apache/rocketmq/tools/command/namesrv/WipeWritePermSubCommand.java` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 36 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `tools/src/main/java/org/apache/rocketmq/tools/command/namesrv/AddWritePermSubCommand.java:50` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (9–10 lines × 6) tools/src/main/java/org/apache/rocketmq/tools/command/acl/ClusterAclConfigVersionListSubCommand.java:55— tools/src/main/java/org/apache/rocketmq/tools/command/acl/ClusterAclConfigVersionListSubCommand.java:55-64 | tools/src/main/java/org/apache/rocketmq/tools/command/acl/DeleteAccessConfigSubCommand.java:50-59 | tools/src/main/java/org/apache/rocketmq/tools/command/acl/UpdateAccessConfigSubCommand.java:48-57 | tools/src/main/java/org/apache/rocketmq/tools/command/acl/UpdateGlobalWhiteAddrSubCommand.java:46-55 | tools/src/main/java/org/apache/rocketmq/tools/command/broker/BrokerStatusSubCommand.java:52-60 | tools/src/main/java/org/apache/rocketmq/tools/command/topic/UpdateTopicSubCommand.java:50-59 — before extracting anything, compare `tools/src/main/java/org/apache/rocketmq/tools/command/acl/DeleteAccessConfigSubCommand.java` and `tools/src/main/java/org/apache/rocketmq/tools/command/acl/UpdateAccessConfigSubCommand.java` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 53 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `tools/src/main/java/org/apache/rocketmq/tools/command/acl/DeleteAccessConfigSubCommand.java:61` calls `Option`, `setRequired`, `addOption` and `tools/src/main/java/org/apache/rocketmq/tools/command/acl/ClusterAclConfigVersionListSubCommand.java:66` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (9–10 lines × 6) tools/src/main/java/org/apache/rocketmq/tools/command/acl/DeleteAccessConfigSubCommand.java:53— tools/src/main/java/org/apache/rocketmq/tools/command/acl/DeleteAccessConfigSubCommand.java:53-61 | tools/src/main/java/org/apache/rocketmq/tools/command/acl/UpdateAccessConfigSubCommand.java:51-59 | tools/src/main/java/org/apache/rocketmq/tools/command/acl/UpdateGlobalWhiteAddrSubCommand.java:49-57 | tools/src/main/java/org/apache/rocketmq/tools/command/topic/RemappingStaticTopicSubCommand.java:59-68 | tools/src/main/java/org/apache/rocketmq/tools/command/topic/UpdateStaticTopicSubCommand.java:60-69 | tools/src/main/java/org/apache/rocketmq/tools/command/topic/UpdateTopicSubCommand.java:53-61 — before extracting anything, compare `tools/src/main/java/org/apache/rocketmq/tools/command/acl/DeleteAccessConfigSubCommand.java` and `tools/src/main/java/org/apache/rocketmq/tools/command/acl/UpdateAccessConfigSubCommand.java` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 53 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (7–8 lines × 3) broker/src/main/java/org/apache/rocketmq/broker/processor/AdminBrokerProcessor.java:796— broker/src/main/java/org/apache/rocketmq/broker/processor/AdminBrokerProcessor.java:796-802 | broker/src/main/java/org/apache/rocketmq/broker/processor/AdminBrokerProcessor.java:835-841 | container/src/main/java/org/apache/rocketmq/container/BrokerContainerProcessor.java:240-247 — there are 3 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 3 sites; resolving a subset leaves the remainder to drift apart. Read the line range as the matched WINDOW rather than a finished unit: at `broker/src/main/java/org/apache/rocketmq/broker/processor/AdminBrokerProcessor.java:796` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `broker/src/main/java/org/apache/rocketmq/broker/processor/AdminBrokerProcessor.java:803` calls `string2Properties` and `broker/src/main/java/org/apache/rocketmq/broker/processor/AdminBrokerProcessor.java:842` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (7–8 lines × 3) client/src/main/java/org/apache/rocketmq/client/impl/factory/MQClientInstance.java:598— client/src/main/java/org/apache/rocketmq/client/impl/factory/MQClientInstance.java:598-604 | client/src/main/java/org/apache/rocketmq/client/impl/factory/MQClientInstance.java:656-662 | client/src/main/java/org/apache/rocketmq/client/impl/factory/MQClientInstance.java:937-944 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `client/src/main/java/org/apache/rocketmq/client/impl/factory/MQClientInstance.java:598` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (7–8 lines × 2) store/src/main/java/org/apache/rocketmq/store/AllocateMappedFileService.java:62— store/src/main/java/org/apache/rocketmq/store/AllocateMappedFileService.java:62-69 | store/src/main/java/org/apache/rocketmq/store/AllocateMappedFileService.java:79-85 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `store/src/main/java/org/apache/rocketmq/store/AllocateMappedFileService.java:62` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (7–8 lines × 2) tieredstore/src/main/java/org/apache/rocketmq/tieredstore/provider/posix/PosixFileSegment.java:176— tieredstore/src/main/java/org/apache/rocketmq/tieredstore/provider/posix/PosixFileSegment.java:176-182 | tieredstore/src/main/java/org/apache/rocketmq/tieredstore/provider/posix/PosixFileSegment.java:222-229 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `tieredstore/src/main/java/org/apache/rocketmq/tieredstore/provider/posix/PosixFileSegment.java:176` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (5 lines × 4) broker/src/main/java/org/apache/rocketmq/broker/processor/PopMessageProcessor.java:362— broker/src/main/java/org/apache/rocketmq/broker/processor/PopMessageProcessor.java:362-366 | broker/src/main/java/org/apache/rocketmq/broker/processor/PopMessageProcessor.java:372-376 | broker/src/main/java/org/apache/rocketmq/broker/processor/PopMessageProcessor.java:397-401 | broker/src/main/java/org/apache/rocketmq/broker/processor/PopMessageProcessor.java:407-411 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `broker/src/main/java/org/apache/rocketmq/broker/processor/PopMessageProcessor.java:362` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (5 lines × 4) tools/src/main/java/org/apache/rocketmq/tools/command/message/QueryMsgByOffsetSubCommand.java:75— tools/src/main/java/org/apache/rocketmq/tools/command/message/QueryMsgByOffsetSubCommand.java:75-80 | tools/src/main/java/org/apache/rocketmq/tools/command/namesrv/UpdateKvConfigCommand.java:57-64 | tools/src/main/java/org/apache/rocketmq/tools/command/offset/ResetOffsetByTimeCommand.java:86-90 | tools/src/main/java/org/apache/rocketmq/tools/command/offset/ResetOffsetByTimeOldCommand.java:102-106 — before extracting anything, compare `tools/src/main/java/org/apache/rocketmq/tools/command/message/QueryMsgByOffsetSubCommand.java` and `tools/src/main/java/org/apache/rocketmq/tools/command/namesrv/UpdateKvConfigCommand.java` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 32 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `tools/src/main/java/org/apache/rocketmq/tools/command/message/QueryMsgByOffsetSubCommand.java:75` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `tools/src/main/java/org/apache/rocketmq/tools/command/message/QueryMsgByOffsetSubCommand.java:72` calls `DefaultMQPullConsumer`, `setInstanceName`, `toString` and `tools/src/main/java/org/apache/rocketmq/tools/command/namesrv/UpdateKvConfigCommand.java:56` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (48 lines × 3) remoting/src/main/java/org/apache/rocketmq/remoting/protocol/header/QueryConsumeTimeSpanRequestHeader.java:1— remoting/src/main/java/org/apache/rocketmq/remoting/protocol/header/QueryConsumeTimeSpanRequestHeader.java:1-48 | remoting/src/main/java/org/apache/rocketmq/remoting/protocol/header/ResetOffsetRequestHeader.java:1-93 | remoting/src/main/java/org/apache/rocketmq/remoting/protocol/header/UpdateGroupForbiddenRequestHeader.java:1-62 — before extracting anything, compare `remoting/src/main/java/org/apache/rocketmq/remoting/protocol/header/QueryConsumeTimeSpanRequestHeader.java` and `remoting/src/main/java/org/apache/rocketmq/remoting/protocol/header/ResetOffsetRequestHeader.java` as WHOLE FILES: 91% of the shorter file's lines also appear in the other, so this reads as one file having been copied from the other rather than as a helper waiting to be extracted. The 1 duplicated block(s) this scan matched between them are fragments of that copy, not the extent of it — treat the file pair as the unit. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `remoting/src/main/java/org/apache/rocketmq/remoting/protocol/header/QueryConsumeTimeSpanRequestHeader.java:1` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (48 lines × 3) remoting/src/main/java/org/apache/rocketmq/remoting/protocol/header/namesrv/DeleteKVConfigRequestHeader.java:1— remoting/src/main/java/org/apache/rocketmq/remoting/protocol/header/namesrv/DeleteKVConfigRequestHeader.java:1-48 | remoting/src/main/java/org/apache/rocketmq/remoting/protocol/header/namesrv/GetKVConfigRequestHeader.java:1-48 | remoting/src/main/java/org/apache/rocketmq/remoting/protocol/header/namesrv/PutKVConfigRequestHeader.java:1-58 — before extracting anything, compare `remoting/src/main/java/org/apache/rocketmq/remoting/protocol/header/namesrv/DeleteKVConfigRequestHeader.java` and `remoting/src/main/java/org/apache/rocketmq/remoting/protocol/header/namesrv/GetKVConfigRequestHeader.java` as WHOLE FILES: 97% of the shorter file's lines also appear in the other, so this reads as one file having been copied from the other rather than as a helper waiting to be extracted. The 1 duplicated block(s) this scan matched between them are fragments of that copy, not the extent of it — treat the file pair as the unit. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `remoting/src/main/java/org/apache/rocketmq/remoting/protocol/header/namesrv/DeleteKVConfigRequestHeader.java:1` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
ComparisonExpression.__compare (cyclomatic 54) filter/src/main/java/org/apache/rocketmq/filter/expression/ComparisonExpression.java:530— ComparisonExpression.__compare has cyclomatic complexity 54 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
PopMessageProcessor.processRequest (cyclomatic 46) broker/src/main/java/org/apache/rocketmq/broker/processor/PopMessageProcessor.java:196— PopMessageProcessor.processRequest has cyclomatic complexity 46 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
BrokerController.shutdownBasicService (cyclomatic 45) broker/src/main/java/org/apache/rocketmq/broker/BrokerController.java:1293— BrokerController.shutdownBasicService has cyclomatic complexity 45 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
RouteInfoManager.registerBroker (cyclomatic 42) namesrv/src/main/java/org/apache/rocketmq/namesrv/routeinfo/RouteInfoManager.java:226— RouteInfoManager.registerBroker has cyclomatic complexity 42 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
TransactionalMessageServiceImpl.check (cyclomatic 42) broker/src/main/java/org/apache/rocketmq/broker/transaction/queue/TransactionalMessageServiceImpl.java:144— TransactionalMessageServiceImpl.check has cyclomatic complexity 42 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
PullMessageProcessor.processRequest (cyclomatic 39) broker/src/main/java/org/apache/rocketmq/broker/processor/PullMessageProcessor.java:301— PullMessageProcessor.processRequest has cyclomatic complexity 39 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
DefaultMQPushConsumerImpl.checkConfig (cyclomatic 38) client/src/main/java/org/apache/rocketmq/client/impl/consumer/DefaultMQPushConsumerImpl.java:996— DefaultMQPushConsumerImpl.checkConfig has cyclomatic complexity 38 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
CommitLog.asyncPutMessage (cyclomatic 37) store/src/main/java/org/apache/rocketmq/store/CommitLog.java:900— CommitLog.asyncPutMessage has cyclomatic complexity 37 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
DefaultMessageStore.getMessage (cyclomatic 36) store/src/main/java/org/apache/rocketmq/store/DefaultMessageStore.java:782— DefaultMessageStore.getMessage has cyclomatic complexity 36 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
RebalanceImpl.updateMessageQueueAssignment (cyclomatic 36) client/src/main/java/org/apache/rocketmq/client/impl/consumer/RebalanceImpl.java:555— RebalanceImpl.updateMessageQueueAssignment has cyclomatic complexity 36 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
PopBufferMergeService.scan (cyclomatic 33) broker/src/main/java/org/apache/rocketmq/broker/processor/PopBufferMergeService.java:217— PopBufferMergeService.scan has cyclomatic complexity 33 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
PopReviveService.consumeReviveMessage (cyclomatic 33) broker/src/main/java/org/apache/rocketmq/broker/processor/PopReviveService.java:298— PopReviveService.consumeReviveMessage has cyclomatic complexity 33 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
CommitLog.asyncPutMessages (cyclomatic 31) store/src/main/java/org/apache/rocketmq/store/CommitLog.java:1077— CommitLog.asyncPutMessages has cyclomatic complexity 31 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
DefaultMQProducerImpl.sendDefaultImpl (cyclomatic 31) client/src/main/java/org/apache/rocketmq/client/impl/producer/DefaultMQProducerImpl.java:697— DefaultMQProducerImpl.sendDefaultImpl has cyclomatic complexity 31 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
CommitLog.checkMessageAndReturnSize (cyclomatic 30) store/src/main/java/org/apache/rocketmq/store/CommitLog.java:423— CommitLog.checkMessageAndReturnSize has cyclomatic complexity 30 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
PullTaskImpl.run (cyclomatic 29) client/src/main/java/org/apache/rocketmq/client/impl/consumer/DefaultLitePullConsumerImpl.java:880— PullTaskImpl.run has cyclomatic complexity 29 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
AbstractSendMessageProcessor.consumerSendMsgBack (cyclomatic 29) broker/src/main/java/org/apache/rocketmq/broker/processor/AbstractSendMessageProcessor.java:91— AbstractSendMessageProcessor.consumerSendMsgBack has cyclomatic complexity 29 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
PlainAccessResource.parse (cyclomatic 29) acl/src/main/java/org/apache/rocketmq/acl/plain/PlainAccessResource.java:199— PlainAccessResource.parse has cyclomatic complexity 29 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
ConsumeQueue.binarySearchInQueueByTime (cyclomatic 28) store/src/main/java/org/apache/rocketmq/store/ConsumeQueue.java:220— ConsumeQueue.binarySearchInQueueByTime has cyclomatic complexity 28 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
ConsumeRequest.run (cyclomatic 28) client/src/main/java/org/apache/rocketmq/client/impl/consumer/ConsumeMessageOrderlyService.java:426— ConsumeRequest.run has cyclomatic complexity 28 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
TopicQueueMappingCleanService.cleanItemListMoreThanSecondGen (cyclomatic 28) broker/src/main/java/org/apache/rocketmq/broker/topic/TopicQueueMappingCleanService.java:212— TopicQueueMappingCleanService.cleanItemListMoreThanSecondGen has cyclomatic complexity 28 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
DefaultMQProducerImpl.sendKernelImpl (cyclomatic 27) client/src/main/java/org/apache/rocketmq/client/impl/producer/DefaultMQProducerImpl.java:864— DefaultMQProducerImpl.sendKernelImpl has cyclomatic complexity 27 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
TimerMessageStore.dequeue (cyclomatic 26) store/src/main/java/org/apache/rocketmq/store/timer/TimerMessageStore.java:888— TimerMessageStore.dequeue has cyclomatic complexity 26 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
BrokerController.startBasicService (cyclomatic 26) broker/src/main/java/org/apache/rocketmq/broker/BrokerController.java:1526— BrokerController.startBasicService has cyclomatic complexity 26 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
TimerMessageStore.checkAndReviseMetrics (cyclomatic 25) store/src/main/java/org/apache/rocketmq/store/timer/TimerMessageStore.java:1170— TimerMessageStore.checkAndReviseMetrics has cyclomatic complexity 25 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
PopMessageProcessor.popMsgFromQueue (cyclomatic 25) broker/src/main/java/org/apache/rocketmq/broker/processor/PopMessageProcessor.java:492— PopMessageProcessor.popMsgFromQueue has cyclomatic complexity 25 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
TopicQueueMappingCleanService.cleanItemExpired (cyclomatic 25) broker/src/main/java/org/apache/rocketmq/broker/topic/TopicQueueMappingCleanService.java:103— TopicQueueMappingCleanService.cleanItemExpired has cyclomatic complexity 25 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
RemotingCommand.decodeCommandCustomHeaderDirectly (cyclomatic 24) remoting/src/main/java/org/apache/rocketmq/remoting/protocol/RemotingCommand.java:276— RemotingCommand.decodeCommandCustomHeaderDirectly has cyclomatic complexity 24 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
PolishExpr.participle (cyclomatic 24) common/src/main/java/org/apache/rocketmq/common/filter/impl/PolishExpr.java:89— PolishExpr.participle has cyclomatic complexity 24 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
MQAdminImpl.queryMessage (cyclomatic 24) client/src/main/java/org/apache/rocketmq/client/impl/MQAdminImpl.java:320— MQAdminImpl.queryMessage has cyclomatic complexity 24 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
SendMessageProcessor.handlePutMessageResult (cyclomatic 24) broker/src/main/java/org/apache/rocketmq/broker/processor/SendMessageProcessor.java:352— SendMessageProcessor.handlePutMessageResult has cyclomatic complexity 24 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
BrokerStartup.buildBrokerController (cyclomatic 24) broker/src/main/java/org/apache/rocketmq/broker/BrokerStartup.java:82— BrokerStartup.buildBrokerController has cyclomatic complexity 24 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
ConsumerProgressSubCommand.execute (cyclomatic 23) tools/src/main/java/org/apache/rocketmq/tools/command/consumer/ConsumerProgressSubCommand.java:98— ConsumerProgressSubCommand.execute has cyclomatic complexity 23 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
CompositeFlatFile.getOffsetInConsumeQueueByTime (cyclomatic 23) tieredstore/src/main/java/org/apache/rocketmq/tieredstore/file/CompositeFlatFile.java:159— CompositeFlatFile.getOffsetInConsumeQueueByTime has cyclomatic complexity 23 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
DLedgerCommitLog.asyncPutMessages (cyclomatic 23) store/src/main/java/org/apache/rocketmq/store/dledger/DLedgerCommitLog.java:523— DLedgerCommitLog.asyncPutMessages has cyclomatic complexity 23 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
RouteInfoManager.pickupTopicRouteData (cyclomatic 23) namesrv/src/main/java/org/apache/rocketmq/namesrv/routeinfo/RouteInfoManager.java:698— RouteInfoManager.pickupTopicRouteData has cyclomatic complexity 23 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
DefaultMQPushConsumerImpl.pullMessage (cyclomatic 23) client/src/main/java/org/apache/rocketmq/client/impl/consumer/DefaultMQPushConsumerImpl.java:246— DefaultMQPushConsumerImpl.pullMessage has cyclomatic complexity 23 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
NotificationProcessor.processRequest (cyclomatic 23) broker/src/main/java/org/apache/rocketmq/broker/processor/NotificationProcessor.java:65— NotificationProcessor.processRequest has cyclomatic complexity 23 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
PlainAccessResource.parse (cyclomatic 23) acl/src/main/java/org/apache/rocketmq/acl/plain/PlainAccessResource.java:100— PlainAccessResource.parse has cyclomatic complexity 23 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
ConsumeQueue.correctMinOffset (cyclomatic 22) store/src/main/java/org/apache/rocketmq/store/ConsumeQueue.java:540— ConsumeQueue.correctMinOffset has cyclomatic complexity 22 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
MQClientInstance.sendHeartbeatToAllBrokerV2 (cyclomatic 22) client/src/main/java/org/apache/rocketmq/client/impl/factory/MQClientInstance.java:636— MQClientInstance.sendHeartbeatToAllBrokerV2 has cyclomatic complexity 22 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
FilterDataMapByTopic.register (cyclomatic 22) broker/src/main/java/org/apache/rocketmq/broker/filter/ConsumerFilterManager.java:355— FilterDataMapByTopic.register has cyclomatic complexity 22 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
ConsumerLagCalculator.processAllGroup (cyclomatic 22) broker/src/main/java/org/apache/rocketmq/broker/metrics/ConsumerLagCalculator.java:130— ConsumerLagCalculator.processAllGroup has cyclomatic complexity 22 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
HAClientReader.processReadResult (cyclomatic 21) store/src/main/java/org/apache/rocketmq/store/ha/autoswitch/AutoSwitchHAClient.java:481— HAClientReader.processReadResult has cyclomatic complexity 21 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
TimerMessageStore.warmDequeue (cyclomatic 21) store/src/main/java/org/apache/rocketmq/store/timer/TimerMessageStore.java:763— TimerMessageStore.warmDequeue has cyclomatic complexity 21 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
SubscriptionData.equals (cyclomatic 21) remoting/src/main/java/org/apache/rocketmq/remoting/protocol/heartbeat/SubscriptionData.java:129— SubscriptionData.equals has cyclomatic complexity 21 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
BrokerContainerProcessor.addBroker (cyclomatic 21) container/src/main/java/org/apache/rocketmq/container/BrokerContainerProcessor.java:88— BrokerContainerProcessor.addBroker has cyclomatic complexity 21 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
MQClientInstance.updateTopicRouteInfoFromNameServer (cyclomatic 21) client/src/main/java/org/apache/rocketmq/client/impl/factory/MQClientInstance.java:713— MQClientInstance.updateTopicRouteInfoFromNameServer has cyclomatic complexity 21 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
MQClientAPIImpl.processPopResponse (cyclomatic 21) client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:1074— MQClientAPIImpl.processPopResponse has cyclomatic complexity 21 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
PeekMessageProcessor.processRequest (cyclomatic 21) broker/src/main/java/org/apache/rocketmq/broker/processor/PeekMessageProcessor.java:81— PeekMessageProcessor.processRequest has cyclomatic complexity 21 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
PullMessageProcessor.rewriteResponseForStaticTopic (cyclomatic 21) broker/src/main/java/org/apache/rocketmq/broker/processor/PullMessageProcessor.java:156— PullMessageProcessor.rewriteResponseForStaticTopic has cyclomatic complexity 21 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
UpdateTopicPermSubCommand.execute (cyclomatic 20) tools/src/main/java/org/apache/rocketmq/tools/command/topic/UpdateTopicPermSubCommand.java:72— UpdateTopicPermSubCommand.execute has cyclomatic complexity 20 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
GroupTransferService.doWaitTransfer (cyclomatic 20) store/src/main/java/org/apache/rocketmq/store/ha/GroupTransferService.java:79— GroupTransferService.doWaitTransfer has cyclomatic complexity 20 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
CompactionLog.getMessage (cyclomatic 20) REDACTED:448— CompactionLog.getMessage has cyclomatic complexity 20 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
TimerMessageStore.doPut (cyclomatic 20) store/src/main/java/org/apache/rocketmq/store/timer/TimerMessageStore.java:1068— TimerMessageStore.doPut has cyclomatic complexity 20 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
PullMessageRequestHeader.decode (cyclomatic 20) remoting/src/main/java/org/apache/rocketmq/remoting/protocol/header/PullMessageRequestHeader.java:97— PullMessageRequestHeader.decode has cyclomatic complexity 20 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
GrpcConverter.buildSystemProperties (cyclomatic 20) proxy/src/main/java/org/apache/rocketmq/proxy/grpc/v2/common/GrpcConverter.java:125— GrpcConverter.buildSystemProperties has cyclomatic complexity 20 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
DefaultMQAdminExtImpl.messageTrackDetail (cyclomatic 19) tools/src/main/java/org/apache/rocketmq/tools/admin/DefaultMQAdminExtImpl.java:1334— DefaultMQAdminExtImpl.messageTrackDetail has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
ConsumeMessageCommand.execute (cyclomatic 19) tools/src/main/java/org/apache/rocketmq/tools/command/message/ConsumeMessageCommand.java:118— ConsumeMessageCommand.execute has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
TieredDispatcher.dispatchFlatFile (cyclomatic 19) tieredstore/src/main/java/org/apache/rocketmq/tieredstore/TieredDispatcher.java:228— TieredDispatcher.dispatchFlatFile has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
TimerDequeueGetMessageService.run (cyclomatic 19) store/src/main/java/org/apache/rocketmq/store/timer/TimerMessageStore.java:1534— TimerDequeueGetMessageService.run has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
CleanCommitLogService.isSpaceToDelete (cyclomatic 19) store/src/main/java/org/apache/rocketmq/store/DefaultMessageStore.java:2312— CleanCommitLogService.isSpaceToDelete has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
ReputMessageService.doReput (cyclomatic 19) store/src/main/java/org/apache/rocketmq/store/DefaultMessageStore.java:2815— ReputMessageService.doReput has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
TopicRouteData.equals (cyclomatic 19) remoting/src/main/java/org/apache/rocketmq/remoting/protocol/route/TopicRouteData.java:185— TopicRouteData.equals has cyclomatic complexity 19 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
ProxyMetricsManager.start (cyclomatic 19) proxy/src/main/java/org/apache/rocketmq/proxy/metrics/ProxyMetricsManager.java:137— ProxyMetricsManager.start has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
LocalMessageService.popMessage (cyclomatic 19) proxy/src/main/java/org/apache/rocketmq/proxy/service/message/LocalMessageService.java:196— LocalMessageService.popMessage has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
ControllerMetricsManager.init (cyclomatic 19) controller/src/main/java/org/apache/rocketmq/controller/metrics/ControllerMetricsManager.java:285— ControllerMetricsManager.init has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
PullAPIWrapper.processPullResult (cyclomatic 19) client/src/main/java/org/apache/rocketmq/client/impl/consumer/PullAPIWrapper.java:73— PullAPIWrapper.processPullResult has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
RebalancePushImpl.computePullFromWhereWithException (cyclomatic 19) client/src/main/java/org/apache/rocketmq/client/impl/consumer/RebalancePushImpl.java:172— RebalancePushImpl.computePullFromWhereWithException has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
PopLongPollingService.run (cyclomatic 19) broker/src/main/java/org/apache/rocketmq/broker/longpolling/PopLongPollingService.java:73— PopLongPollingService.run has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
BrokerMetricsManager.init (cyclomatic 19) broker/src/main/java/org/apache/rocketmq/broker/metrics/BrokerMetricsManager.java:243— BrokerMetricsManager.init has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
DefaultPullMessageResultHandler.handle (cyclomatic 19) broker/src/main/java/org/apache/rocketmq/broker/processor/DefaultPullMessageResultHandler.java:78— DefaultPullMessageResultHandler.handle has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
PullMessageProcessor.composeResponseHeader (cyclomatic 19) broker/src/main/java/org/apache/rocketmq/broker/processor/PullMessageProcessor.java:596— PullMessageProcessor.composeResponseHeader has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
PlainPermissionManager.load (cyclomatic 19) acl/src/main/java/org/apache/rocketmq/acl/plain/PlainPermissionManager.java:111— PlainPermissionManager.load has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
AbstractWriteSocketService.run (cyclomatic 18) store/src/main/java/org/apache/rocketmq/store/ha/autoswitch/AutoSwitchHAConnection.java:626— AbstractWriteSocketService.run has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
WriteSocketService.run (cyclomatic 18) store/src/main/java/org/apache/rocketmq/store/ha/DefaultHAConnection.java:275— WriteSocketService.run has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
CommitLog.recoverAbnormally (cyclomatic 18) store/src/main/java/org/apache/rocketmq/store/CommitLog.java:692— CommitLog.recoverAbnormally has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
MappedFileQueue.getConsumeQueueMappedFileByTime (cyclomatic 18) store/src/main/java/org/apache/rocketmq/store/MappedFileQueue.java:83— MappedFileQueue.getConsumeQueueMappedFileByTime has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
ReceiveMessageActivity.receiveMessage (cyclomatic 18) proxy/src/main/java/org/apache/rocketmq/proxy/grpc/v2/consumer/ReceiveMessageActivity.java:57— ReceiveMessageActivity.receiveMessage has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
MixAll.properties2Object (cyclomatic 18) common/src/main/java/org/apache/rocketmq/common/MixAll.java:352— MixAll.properties2Object has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
ConsumeRequest.run (cyclomatic 18) client/src/main/java/org/apache/rocketmq/client/impl/consumer/ConsumeMessagePopConcurrentlyService.java:385— ConsumeRequest.run has cyclomatic complexity 18 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
EndTransactionProcessor.processRequest (cyclomatic 18) broker/src/main/java/org/apache/rocketmq/broker/processor/EndTransactionProcessor.java:55— EndTransactionProcessor.processRequest has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
DefaultMQAdminExtImpl.examineConsumeStats (cyclomatic 17) tools/src/main/java/org/apache/rocketmq/tools/admin/DefaultMQAdminExtImpl.java:418— DefaultMQAdminExtImpl.examineConsumeStats has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
CLusterSendMsgRTCommand.execute (cyclomatic 17) tools/src/main/java/org/apache/rocketmq/tools/command/cluster/CLusterSendMsgRTCommand.java:84— CLusterSendMsgRTCommand.execute has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
ClusterListSubCommand.printClusterBaseInfo (cyclomatic 17) tools/src/main/java/org/apache/rocketmq/tools/command/cluster/ClusterListSubCommand.java:179— ClusterListSubCommand.printClusterBaseInfo has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
UpdateSubGroupSubCommand.execute (cyclomatic 17) tools/src/main/java/org/apache/rocketmq/tools/command/consumer/UpdateSubGroupSubCommand.java:112— UpdateSubGroupSubCommand.execute has cyclomatic complexity 17 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
ResetOffsetByTimeCommand.execute (cyclomatic 17) tools/src/main/java/org/apache/rocketmq/tools/command/offset/ResetOffsetByTimeCommand.java:84— ResetOffsetByTimeCommand.execute has cyclomatic complexity 17 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
StatsAllSubCommand.printTopicDetail (cyclomatic 17) tools/src/main/java/org/apache/rocketmq/tools/command/stats/StatsAllSubCommand.java:41— StatsAllSubCommand.printTopicDetail has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
RemappingStaticTopicSubCommand.execute (cyclomatic 17) tools/src/main/java/org/apache/rocketmq/tools/command/topic/RemappingStaticTopicSubCommand.java:118— RemappingStaticTopicSubCommand.execute has cyclomatic complexity 17 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
TieredDispatcher.dispatch (cyclomatic 17) tieredstore/src/main/java/org/apache/rocketmq/tieredstore/TieredDispatcher.java:102— TieredDispatcher.dispatch has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
BatchConsumeQueue.estimateMessageCount (cyclomatic 17) store/src/main/java/org/apache/rocketmq/store/queue/BatchConsumeQueue.java:1076— BatchConsumeQueue.estimateMessageCount has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
TimerMessageStore.recoverAndRevise (cyclomatic 17) store/src/main/java/org/apache/rocketmq/store/timer/TimerMessageStore.java:387— TimerMessageStore.recoverAndRevise has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
RemotingHelper.invokeSync (cyclomatic 17) remoting/src/main/java/org/apache/rocketmq/remoting/common/RemotingHelper.java:105— RemotingHelper.invokeSync has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
SendMessageActivity.buildMessageProperty (cyclomatic 17) proxy/src/main/java/org/apache/rocketmq/proxy/grpc/v2/producer/SendMessageActivity.java:194— SendMessageActivity.buildMessageProperty has cyclomatic complexity 17 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
UtilAll.getIP (cyclomatic 17) common/src/main/java/org/apache/rocketmq/common/UtilAll.java:605— UtilAll.getIP has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
DefaultMQProducerImpl.sendMessageInTransaction (cyclomatic 17) client/src/main/java/org/apache/rocketmq/client/impl/producer/DefaultMQProducerImpl.java:1382— DefaultMQProducerImpl.sendMessageInTransaction has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
SendMessageProcessor.sendMessage (cyclomatic 17) broker/src/main/java/org/apache/rocketmq/broker/processor/SendMessageProcessor.java:239— SendMessageProcessor.sendMessage has cyclomatic complexity 17 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
PlainPermissionManager.updateAccessConfig (cyclomatic 17) acl/src/main/java/org/apache/rocketmq/acl/plain/PlainPermissionManager.java:301— PlainPermissionManager.updateAccessConfig has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
7.run (cyclomatic 16) tools/src/main/java/org/apache/rocketmq/tools/admin/DefaultMQAdminExtImpl.java:1433— 7.run has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
UpdateAccessConfigSubCommand.execute (cyclomatic 16) tools/src/main/java/org/apache/rocketmq/tools/command/acl/UpdateAccessConfigSubCommand.java:95— UpdateAccessConfigSubCommand.execute has cyclomatic complexity 16 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
UpdateStaticTopicSubCommand.execute (cyclomatic 16) tools/src/main/java/org/apache/rocketmq/tools/command/topic/UpdateStaticTopicSubCommand.java:123— UpdateStaticTopicSubCommand.execute has cyclomatic complexity 16 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
DLedgerCommitLog.asyncPutMessage (cyclomatic 16) store/src/main/java/org/apache/rocketmq/store/dledger/DLedgerCommitLog.java:421— DLedgerCommitLog.asyncPutMessage has cyclomatic complexity 16 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
ConsumeQueue.estimateMessageCount (cyclomatic 16) store/src/main/java/org/apache/rocketmq/store/ConsumeQueue.java:1111— ConsumeQueue.estimateMessageCount has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
StoreStatsService.setPutMessageEntireTimeMax (cyclomatic 16) store/src/main/java/org/apache/rocketmq/store/StoreStatsService.java:170— StoreStatsService.setPutMessageEntireTimeMax has cyclomatic complexity 16 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
TopicQueueMappingUtils.checkLogicQueueMappingItemOffset (cyclomatic 16) remoting/src/main/java/org/apache/rocketmq/remoting/protocol/statictopic/TopicQueueMappingUtils.java:249— TopicQueueMappingUtils.checkLogicQueueMappingItemOffset has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
TopicQueueMappingUtils.checkNameEpochNumConsistence (cyclomatic 16) remoting/src/main/java/org/apache/rocketmq/remoting/protocol/statictopic/TopicQueueMappingUtils.java:143— TopicQueueMappingUtils.checkNameEpochNumConsistence has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
RouteInfoManager.unRegisterBroker (cyclomatic 16) namesrv/src/main/java/org/apache/rocketmq/namesrv/routeinfo/RouteInfoManager.java:569— RouteInfoManager.unRegisterBroker has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
PolishExpr.reversePolish (cyclomatic 16) common/src/main/java/org/apache/rocketmq/common/filter/impl/PolishExpr.java:40— PolishExpr.reversePolish has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
ConsumeRequest.run (cyclomatic 16) client/src/main/java/org/apache/rocketmq/client/impl/consumer/ConsumeMessageConcurrentlyService.java:378— ConsumeRequest.run has cyclomatic complexity 16 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
AckMessageProcessor.appendAck (cyclomatic 16) broker/src/main/java/org/apache/rocketmq/broker/processor/AckMessageProcessor.java:168— AckMessageProcessor.appendAck has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
PopBufferMergeService.addAk (cyclomatic 16) broker/src/main/java/org/apache/rocketmq/broker/processor/PopBufferMergeService.java:519— PopBufferMergeService.addAk has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
FixmeComment broker/src/main/java/org/apache/rocketmq/broker/processor/PopReviveService.java:331— // Fixme: why sleep is useful here? — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
TransactionalMessageServiceImpl.check (cognitive 126) broker/src/main/java/org/apache/rocketmq/broker/transaction/queue/TransactionalMessageServiceImpl.java:144— TransactionalMessageServiceImpl.check has cognitive complexity 126 (threshold 15). Drivers by points: if/else 29 (92 pts), ternaries 5 (15 pts), boolean chains 9, error handling 2 (7 pts), loops 2 (3 pts) (nesting depth added 79). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
DefaultMessageStore.getMessage (cognitive 109) store/src/main/java/org/apache/rocketmq/store/DefaultMessageStore.java:782— DefaultMessageStore.getMessage has cognitive complexity 109 (threshold 15). Drivers by points: if/else 29 (92 pts), loops 2 (7 pts), boolean chains 6, error handling 1 (4 pts) (nesting depth added 71). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
PopReviveService.consumeReviveMessage (cognitive 104) broker/src/main/java/org/apache/rocketmq/broker/processor/PopReviveService.java:298— PopReviveService.consumeReviveMessage has cognitive complexity 104 (threshold 15). Drivers by points: if/else 29 (88 pts), loops 3 (8 pts), boolean chains 5, error handling 1 (3 pts) (nesting depth added 66). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
DefaultMQProducerImpl.sendDefaultImpl (cognitive 97) client/src/main/java/org/apache/rocketmq/client/impl/producer/DefaultMQProducerImpl.java:697— DefaultMQProducerImpl.sendDefaultImpl has cognitive complexity 97 (threshold 15). Drivers by points: if/else 22 (69 pts), error handling 4 (16 pts), ternaries 2 (5 pts), match/switch 1 (4 pts), loops 1 (2 pts), boolean chains 1 (nesting depth added 66). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
MQAdminImpl.queryMessage (cognitive 88) client/src/main/java/org/apache/rocketmq/client/impl/MQAdminImpl.java:320— MQAdminImpl.queryMessage has cognitive complexity 88 (threshold 15). Drivers by points: if/else 18 (59 pts), loops 6 (23 pts), error handling 1 (4 pts), boolean chains 2 (nesting depth added 61). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
PopBufferMergeService.scan (cognitive 84) broker/src/main/java/org/apache/rocketmq/broker/processor/PopBufferMergeService.java:217— PopBufferMergeService.scan has cognitive complexity 84 (threshold 15). Drivers by points: if/else 23 (63 pts), loops 4 (15 pts), boolean chains 6 (nesting depth added 51). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
ConsumeQueue.binarySearchInQueueByTime (cognitive 82) store/src/main/java/org/apache/rocketmq/store/ConsumeQueue.java:220— ConsumeQueue.binarySearchInQueueByTime has cognitive complexity 82 (threshold 15). Drivers by points: if/else 16 (50 pts), match/switch 4 (16 pts), loops 3 (13 pts), ternaries 1 (2 pts), boolean chains 1 (nesting depth added 57). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
RouteInfoManager.registerBroker (cognitive 81) namesrv/src/main/java/org/apache/rocketmq/namesrv/routeinfo/RouteInfoManager.java:226— RouteInfoManager.registerBroker has cognitive complexity 81 (threshold 15). Drivers by points: if/else 24 (55 pts), boolean chains 12, loops 3 (11 pts), ternaries 2, error handling 1 (nesting depth added 39). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
ComparisonExpression.__compare (cognitive 80) filter/src/main/java/org/apache/rocketmq/filter/expression/ComparisonExpression.java:530— ComparisonExpression.__compare has cognitive complexity 80 (threshold 15). Drivers by points: if/else 53 (70 pts), boolean chains 8, error handling 1 (2 pts) (nesting depth added 18). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
PopMessageProcessor.processRequest (cognitive 80) broker/src/main/java/org/apache/rocketmq/broker/processor/PopMessageProcessor.java:196— PopMessageProcessor.processRequest has cognitive complexity 80 (threshold 15). Drivers by points: if/else 38 (52 pts), loops 5 (16 pts), error handling 3 (7 pts), boolean chains 4, match/switch 1 (nesting depth added 29). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ConsumeRequest.run (cognitive 70) client/src/main/java/org/apache/rocketmq/client/impl/consumer/ConsumeMessageOrderlyService.java:426— ConsumeRequest.run has cognitive complexity 70 (threshold 15). Drivers by points: if/else 22 (58 pts), boolean chains 6, error handling 1 (4 pts), loops 1 (2 pts) (nesting depth added 40). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
GroupTransferService.doWaitTransfer (cognitive 68) store/src/main/java/org/apache/rocketmq/store/ha/GroupTransferService.java:79— GroupTransferService.doWaitTransfer has cognitive complexity 68 (threshold 15). Drivers by points: if/else 11 (46 pts), loops 4 (15 pts), boolean chains 4, ternaries 1 (3 pts) (nesting depth added 48). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
RebalanceImpl.updateMessageQueueAssignment (cognitive 67) client/src/main/java/org/apache/rocketmq/client/impl/consumer/RebalanceImpl.java:555— RebalanceImpl.updateMessageQueueAssignment has cognitive complexity 67 (threshold 15). Drivers by points: if/else 24 (46 pts), error handling 3 (9 pts), loops 7, boolean chains 5 (nesting depth added 28). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
CompactionLog.getMessage (cognitive 66) REDACTED:448— CompactionLog.getMessage has cognitive complexity 66 (threshold 15). Drivers by points: if/else 19 (57 pts), loops 2 (7 pts), boolean chains 2 (nesting depth added 43). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
CommitLog.checkMessageAndReturnSize (cognitive 65) store/src/main/java/org/apache/rocketmq/store/CommitLog.java:423— CommitLog.checkMessageAndReturnSize has cognitive complexity 65 (threshold 15). Drivers by points: if/else 25 (55 pts), loops 1 (5 pts), boolean chains 3, error handling 1, match/switch 1 (nesting depth added 34). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
ConsumerProgressSubCommand.execute (cognitive 64) tools/src/main/java/org/apache/rocketmq/tools/command/consumer/ConsumerProgressSubCommand.java:98— ConsumerProgressSubCommand.execute has cognitive complexity 64 (threshold 15). Drivers by points: if/else 16 (33 pts), error handling 5 (16 pts), ternaries 3 (10 pts), loops 2 (4 pts), boolean chains 1 (nesting depth added 37). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
MQClientInstance.updateTopicRouteInfoFromNameServer (cognitive 64) client/src/main/java/org/apache/rocketmq/client/impl/factory/MQClientInstance.java:713— MQClientInstance.updateTopicRouteInfoFromNameServer has cognitive complexity 64 (threshold 15). Drivers by points: if/else 15 (40 pts), loops 4 (17 pts), error handling 3 (5 pts), boolean chains 2 (nesting depth added 40). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
PullMessageProcessor.processRequest (cognitive 64) broker/src/main/java/org/apache/rocketmq/broker/processor/PullMessageProcessor.java:301— PullMessageProcessor.processRequest has cognitive complexity 64 (threshold 15). Drivers by points: if/else 34 (56 pts), boolean chains 5, error handling 1 (2 pts), match/switch 1 (nesting depth added 23). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
HAClientReader.processReadResult (cognitive 60) store/src/main/java/org/apache/rocketmq/store/ha/autoswitch/AutoSwitchHAClient.java:481— HAClientReader.processReadResult has cognitive complexity 60 (threshold 15). Drivers by points: if/else 13 (46 pts), loops 2 (5 pts), ternaries 1 (4 pts), match/switch 1 (3 pts), boolean chains 1, error handling 1 (nesting depth added 41). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
TopicQueueMappingCleanService.cleanItemListMoreThanSecondGen (cognitive 59) broker/src/main/java/org/apache/rocketmq/broker/topic/TopicQueueMappingCleanService.java:212— TopicQueueMappingCleanService.cleanItemListMoreThanSecondGen has cognitive complexity 59 (threshold 15). Drivers by points: if/else 16 (40 pts), loops 6 (11 pts), error handling 3 (6 pts), boolean chains 2 (nesting depth added 32). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
PullTaskImpl.run (cognitive 58) client/src/main/java/org/apache/rocketmq/client/impl/consumer/DefaultLitePullConsumerImpl.java:880— PullTaskImpl.run has cognitive complexity 58 (threshold 15). Drivers by points: if/else 20 (42 pts), error handling 3 (6 pts), boolean chains 5, ternaries 1 (3 pts), match/switch 1 (2 pts) (nesting depth added 28). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ConsumerLagCalculator.processAllGroup (cognitive 58) broker/src/main/java/org/apache/rocketmq/broker/metrics/ConsumerLagCalculator.java:130— ConsumerLagCalculator.processAllGroup has cognitive complexity 58 (threshold 15). Drivers by points: if/else 16 (50 pts), boolean chains 5, loops 2 (3 pts) (nesting depth added 35). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
ClusterListSubCommand.printClusterBaseInfo (cognitive 57) tools/src/main/java/org/apache/rocketmq/tools/command/cluster/ClusterListSubCommand.java:179— ClusterListSubCommand.printClusterBaseInfo has cognitive complexity 57 (threshold 15). Drivers by points: if/else 8 (37 pts), error handling 2 (10 pts), loops 3 (7 pts), boolean chains 3 (nesting depth added 41). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
TimerMessageStore.checkAndReviseMetrics (cognitive 57) store/src/main/java/org/apache/rocketmq/store/timer/TimerMessageStore.java:1170— TimerMessageStore.checkAndReviseMetrics has cognitive complexity 57 (threshold 15). Drivers by points: if/else 18 (39 pts), loops 8 (12 pts), ternaries 1 (4 pts), boolean chains 1, error handling 1 (nesting depth added 28). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
DefaultMQAdminExtImpl.messageTrackDetail (cognitive 56) tools/src/main/java/org/apache/rocketmq/tools/admin/DefaultMQAdminExtImpl.java:1334— DefaultMQAdminExtImpl.messageTrackDetail has cognitive complexity 56 (threshold 15). Drivers by points: if/else 10 (35 pts), error handling 5 (13 pts), loops 2 (5 pts), match/switch 1 (2 pts), boolean chains 1 (nesting depth added 37). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
RemotingHelper.invokeSync (cognitive 55) remoting/src/main/java/org/apache/rocketmq/remoting/common/RemotingHelper.java:105— RemotingHelper.invokeSync has cognitive complexity 55 (threshold 15). Drivers by points: if/else 16 (45 pts), loops 3 (6 pts), error handling 2 (4 pts) (nesting depth added 34). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
DefaultMQProducerImpl.sendKernelImpl (cognitive 55) client/src/main/java/org/apache/rocketmq/client/impl/producer/DefaultMQProducerImpl.java:864— DefaultMQProducerImpl.sendKernelImpl has cognitive complexity 55 (threshold 15). Drivers by points: if/else 20 (49 pts), boolean chains 2, error handling 1 (2 pts), match/switch 1 (2 pts) (nesting depth added 31). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
TimerDequeueGetMessageService.run (cognitive 54) store/src/main/java/org/apache/rocketmq/store/timer/TimerMessageStore.java:1534— TimerDequeueGetMessageService.run has cognitive complexity 54 (threshold 15). Drivers by points: if/else 12 (35 pts), loops 3 (9 pts), boolean chains 5, error handling 2 (5 pts) (nesting depth added 32). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
TopicQueueMappingCleanService.cleanItemExpired (cognitive 53) broker/src/main/java/org/apache/rocketmq/broker/topic/TopicQueueMappingCleanService.java:103— TopicQueueMappingCleanService.cleanItemExpired has cognitive complexity 53 (threshold 15). Drivers by points: if/else 15 (38 pts), loops 4 (7 pts), error handling 3 (6 pts), boolean chains 2 (nesting depth added 29). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
CommitLog.recoverAbnormally (cognitive 52) store/src/main/java/org/apache/rocketmq/store/CommitLog.java:692— CommitLog.recoverAbnormally has cognitive complexity 52 (threshold 15). Drivers by points: if/else 19 (47 pts), loops 2 (4 pts), boolean chains 1 (nesting depth added 30). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
AbstractWriteSocketService.run (cognitive 51) store/src/main/java/org/apache/rocketmq/store/ha/autoswitch/AutoSwitchHAConnection.java:626— AbstractWriteSocketService.run has cognitive complexity 51 (threshold 15). Drivers by points: if/else 14 (45 pts), error handling 2 (3 pts), match/switch 1 (2 pts), loops 1 (nesting depth added 33). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
ConsumeQueue.truncateDirtyLogicFiles (cognitive 50) store/src/main/java/org/apache/rocketmq/store/ConsumeQueue.java:406— ConsumeQueue.truncateDirtyLogicFiles has cognitive complexity 50 (threshold 15). Drivers by points: if/else 15 (45 pts), loops 2 (4 pts), boolean chains 1 (nesting depth added 32). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
MQClientInstance.sendHeartbeatToAllBrokerV2 (cognitive 50) client/src/main/java/org/apache/rocketmq/client/impl/factory/MQClientInstance.java:636— MQClientInstance.sendHeartbeatToAllBrokerV2 has cognitive complexity 50 (threshold 15). Drivers by points: if/else 16 (40 pts), boolean chains 4, error handling 1 (3 pts), loops 2 (3 pts) (nesting depth added 27). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
PlainAccessResource.parse (cognitive 50) acl/src/main/java/org/apache/rocketmq/acl/plain/PlainAccessResource.java:199— PlainAccessResource.parse has cognitive complexity 50 (threshold 15). Drivers by points: if/else 22 (35 pts), loops 3 (10 pts), boolean chains 3, error handling 2 (nesting depth added 20). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
PullMessageProcessor.rewriteResponseForStaticTopic (cognitive 49) broker/src/main/java/org/apache/rocketmq/broker/processor/PullMessageProcessor.java:156— PullMessageProcessor.rewriteResponseForStaticTopic has cognitive complexity 49 (threshold 15). Drivers by points: if/else 25 (46 pts), boolean chains 2, error handling 1 (nesting depth added 21). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
RemotingCommand.decodeCommandCustomHeaderDirectly (cognitive 48) remoting/src/main/java/org/apache/rocketmq/remoting/protocol/RemotingCommand.java:276— RemotingCommand.decodeCommandCustomHeaderDirectly has cognitive complexity 48 (threshold 15). Drivers by points: if/else 13 (32 pts), error handling 5 (9 pts), boolean chains 5, loops 1 (2 pts) (nesting depth added 24). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
RouteInfoManager.pickupTopicRouteData (cognitive 48) namesrv/src/main/java/org/apache/rocketmq/namesrv/routeinfo/RouteInfoManager.java:698— RouteInfoManager.pickupTopicRouteData has cognitive complexity 48 (threshold 15). Drivers by points: if/else 12 (31 pts), loops 5 (12 pts), boolean chains 4, error handling 1 (nesting depth added 26). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
PopLongPollingService.run (cognitive 47) broker/src/main/java/org/apache/rocketmq/broker/longpolling/PopLongPollingService.java:73— PopLongPollingService.run has cognitive complexity 47 (threshold 15). Drivers by points: if/else 11 (34 pts), loops 5 (9 pts), error handling 2 (3 pts), boolean chains 1 (nesting depth added 28). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
PullAPIWrapper.processPullResult (cognitive 46) client/src/main/java/org/apache/rocketmq/client/impl/consumer/PullAPIWrapper.java:73— PullAPIWrapper.processPullResult has cognitive complexity 46 (threshold 15). Drivers by points: if/else 11 (30 pts), loops 4 (10 pts), boolean chains 3, error handling 1 (3 pts) (nesting depth added 27). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
MQClientAPIImpl.processPopResponse (cognitive 46) client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:1074— MQClientAPIImpl.processPopResponse has cognitive complexity 46 (threshold 15). Drivers by points: if/else 13 (41 pts), boolean chains 3, loops 1, match/switch 1 (nesting depth added 28). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
NotificationProcessor.processRequest (cognitive 46) broker/src/main/java/org/apache/rocketmq/broker/processor/NotificationProcessor.java:65— NotificationProcessor.processRequest has cognitive complexity 46 (threshold 15). Drivers by points: if/else 19 (35 pts), loops 3 (10 pts), boolean chains 1 (nesting depth added 23). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
AbstractSendMessageProcessor.consumerSendMsgBack (cognitive 45) broker/src/main/java/org/apache/rocketmq/broker/processor/AbstractSendMessageProcessor.java:91— AbstractSendMessageProcessor.consumerSendMsgBack has cognitive complexity 45 (threshold 15). Drivers by points: if/else 23 (34 pts), ternaries 3 (5 pts), boolean chains 2, error handling 1 (2 pts), match/switch 1 (2 pts) (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
BrokerController.shutdownBasicService (cognitive 45) broker/src/main/java/org/apache/rocketmq/broker/BrokerController.java:1293— BrokerController.shutdownBasicService has cognitive complexity 45 (threshold 15). Drivers by points: if/else 42 (43 pts), boolean chains 1, loops 1 (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
WriteSocketService.run (cognitive 44) store/src/main/java/org/apache/rocketmq/store/ha/DefaultHAConnection.java:275— WriteSocketService.run has cognitive complexity 44 (threshold 15). Drivers by points: if/else 17 (40 pts), error handling 2 (3 pts), loops 1 (nesting depth added 24). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
UtilAll.getIP (cognitive 44) common/src/main/java/org/apache/rocketmq/common/UtilAll.java:605— UtilAll.getIP has cognitive complexity 44 (threshold 15). Drivers by points: if/else 11 (37 pts), boolean chains 3, loops 2 (3 pts), error handling 1 (nesting depth added 27). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
UpdateTopicPermSubCommand.execute (cognitive 43) tools/src/main/java/org/apache/rocketmq/tools/command/topic/UpdateTopicPermSubCommand.java:72— UpdateTopicPermSubCommand.execute has cognitive complexity 43 (threshold 15). Drivers by points: if/else 13 (28 pts), loops 4 (10 pts), boolean chains 4, error handling 1 (nesting depth added 21). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
PullRequestHoldService.notifyMessageArriving (cognitive 43) broker/src/main/java/org/apache/rocketmq/broker/longpolling/PullRequestHoldService.java:122— PullRequestHoldService.notifyMessageArriving has cognitive complexity 43 (threshold 15). Drivers by points: if/else 8 (28 pts), error handling 2 (11 pts), loops 1 (3 pts), boolean chains 1 (nesting depth added 31). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
ReputMessageService.doReput (cognitive 42) store/src/main/java/org/apache/rocketmq/store/DefaultMessageStore.java:2815— ReputMessageService.doReput has cognitive complexity 42 (threshold 15). Drivers by points: if/else 11 (30 pts), boolean chains 4, loops 2 (3 pts), ternaries 1 (3 pts), error handling 1 (2 pts) (nesting depth added 23). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
FilterDataMapByTopic.register (cognitive 42) broker/src/main/java/org/apache/rocketmq/broker/filter/ConsumerFilterManager.java:355— FilterDataMapByTopic.register has cognitive complexity 42 (threshold 15). Drivers by points: if/else 17 (35 pts), boolean chains 7 (nesting depth added 18). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
CompositeFlatFile.getOffsetInConsumeQueueByTime (cognitive 41) tieredstore/src/main/java/org/apache/rocketmq/tieredstore/file/CompositeFlatFile.java:159— CompositeFlatFile.getOffsetInConsumeQueueByTime has cognitive complexity 41 (threshold 15). Drivers by points: if/else 12 (25 pts), match/switch 4 (8 pts), loops 3 (7 pts), boolean chains 1 (nesting depth added 21). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
CommitLog.asyncPutMessage (cognitive 40) store/src/main/java/org/apache/rocketmq/store/CommitLog.java:900— CommitLog.asyncPutMessage has cognitive complexity 40 (threshold 15). Drivers by points: if/else 25 (32 pts), boolean chains 6, error handling 1, match/switch 1 (nesting depth added 7). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
ConsumeQueue.correctMinOffset (cognitive 40) store/src/main/java/org/apache/rocketmq/store/ConsumeQueue.java:540— ConsumeQueue.correctMinOffset has cognitive complexity 40 (threshold 15). Drivers by points: if/else 18 (33 pts), loops 2 (4 pts), error handling 1 (2 pts), boolean chains 1 (nesting depth added 18). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
PlainPermissionManager.updateAccessConfig (cognitive 40) acl/src/main/java/org/apache/rocketmq/acl/plain/PlainPermissionManager.java:301— PlainPermissionManager.updateAccessConfig has cognitive complexity 40 (threshold 15). Drivers by points: if/else 16 (30 pts), loops 2 (6 pts), error handling 1 (3 pts), boolean chains 1 (nesting depth added 20). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
MappedFileQueue.getConsumeQueueMappedFileByTime (cognitive 39) store/src/main/java/org/apache/rocketmq/store/MappedFileQueue.java:83— MappedFileQueue.getConsumeQueueMappedFileByTime has cognitive complexity 39 (threshold 15). Drivers by points: if/else 11 (32 pts), loops 3 (5 pts), boolean chains 1, match/switch 1 (nesting depth added 23). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
PolishExpr.participle (cognitive 39) common/src/main/java/org/apache/rocketmq/common/filter/impl/PolishExpr.java:89— PolishExpr.participle has cognitive complexity 39 (threshold 15). Drivers by points: if/else 14 (29 pts), boolean chains 9, loops 1 (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
DefaultMQPushConsumerImpl.checkConfig (cognitive 39) client/src/main/java/org/apache/rocketmq/client/impl/consumer/DefaultMQPushConsumerImpl.java:996— DefaultMQPushConsumerImpl.checkConfig has cognitive complexity 39 (threshold 15). Drivers by points: if/else 24 (26 pts), boolean chains 13 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
DefaultMQPushConsumerImpl.processPopResult (cognitive 39) client/src/main/java/org/apache/rocketmq/client/impl/consumer/DefaultMQPushConsumerImpl.java:616— DefaultMQPushConsumerImpl.processPopResult has cognitive complexity 39 (threshold 15). Drivers by points: if/else 8 (23 pts), loops 3 (10 pts), error handling 1 (5 pts), boolean chains 1 (nesting depth added 26). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
StatsAllSubCommand.printTopicDetail (cognitive 38) tools/src/main/java/org/apache/rocketmq/tools/command/stats/StatsAllSubCommand.java:41— StatsAllSubCommand.printTopicDetail has cognitive complexity 38 (threshold 15). Drivers by points: if/else 7 (18 pts), error handling 3 (11 pts), loops 3 (6 pts), boolean chains 3 (nesting depth added 22). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
CLusterSendMsgRTCommand.execute (cognitive 37) tools/src/main/java/org/apache/rocketmq/tools/command/cluster/CLusterSendMsgRTCommand.java:84— CLusterSendMsgRTCommand.execute has cognitive complexity 37 (threshold 15). Drivers by points: if/else 7 (16 pts), loops 4 (10 pts), error handling 2 (6 pts), ternaries 4, boolean chains 1 (nesting depth added 19). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ConsumeQueue.estimateMessageCount (cognitive 37) store/src/main/java/org/apache/rocketmq/store/ConsumeQueue.java:1111— ConsumeQueue.estimateMessageCount has cognitive complexity 37 (threshold 15). Drivers by points: if/else 13 (32 pts), loops 2 (4 pts), boolean chains 1 (nesting depth added 21). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
DefaultMQPushConsumerImpl.pullMessage (cognitive 37) client/src/main/java/org/apache/rocketmq/client/impl/consumer/DefaultMQPushConsumerImpl.java:246— DefaultMQPushConsumerImpl.pullMessage has cognitive complexity 37 (threshold 15). Drivers by points: if/else 19 (31 pts), error handling 3 (5 pts), boolean chains 1 (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
TimerMessageStore.dequeue (cognitive 36) store/src/main/java/org/apache/rocketmq/store/timer/TimerMessageStore.java:888— TimerMessageStore.dequeue has cognitive complexity 36 (threshold 15). Drivers by points: if/else 15 (22 pts), loops 6 (8 pts), boolean chains 3, error handling 2 (3 pts) (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
MessageUtils.deleteProperty (cognitive 36) common/src/main/java/org/apache/rocketmq/common/utils/MessageUtils.java:54— MessageUtils.deleteProperty has cognitive complexity 36 (threshold 15). Drivers by points: if/else 7 (27 pts), loops 2 (7 pts), boolean chains 2 (nesting depth added 25). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
MQClientInstance.topicRouteData2TopicPublishInfo (cognitive 36) client/src/main/java/org/apache/rocketmq/client/impl/factory/MQClientInstance.java:218— MQClientInstance.topicRouteData2TopicPublishInfo has cognitive complexity 36 (threshold 15). Drivers by points: if/else 7 (19 pts), loops 5 (15 pts), boolean chains 2 (nesting depth added 22). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
AdminBrokerProcessor.lockBatchMQ (cognitive 36) broker/src/main/java/org/apache/rocketmq/broker/processor/AdminBrokerProcessor.java:1279— AdminBrokerProcessor.lockBatchMQ has cognitive complexity 36 (threshold 15). Drivers by points: if/else 7 (16 pts), loops 3 (10 pts), error handling 2 (9 pts), boolean chains 1 (nesting depth added 23). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ConsumerStatusSubCommand.execute (cognitive 35) tools/src/main/java/org/apache/rocketmq/tools/command/consumer/ConsumerStatusSubCommand.java:75— ConsumerStatusSubCommand.execute has cognitive complexity 35 (threshold 15). Drivers by points: if/else 9 (19 pts), loops 2 (6 pts), ternaries 2 (5 pts), error handling 2 (4 pts), boolean chains 1 (nesting depth added 19). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
BatchConsumeQueue.estimateMessageCount (cognitive 35) store/src/main/java/org/apache/rocketmq/store/queue/BatchConsumeQueue.java:1076— BatchConsumeQueue.estimateMessageCount has cognitive complexity 35 (threshold 15). Drivers by points: if/else 14 (30 pts), loops 2 (4 pts), boolean chains 1 (nesting depth added 18). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
MappedFileQueue.deleteExpiredFileByTime (cognitive 35) store/src/main/java/org/apache/rocketmq/store/MappedFileQueue.java:473— MappedFileQueue.deleteExpiredFileByTime has cognitive complexity 35 (threshold 15). Drivers by points: if/else 9 (25 pts), error handling 1 (6 pts), boolean chains 2, loops 1 (2 pts) (nesting depth added 22). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
7.run (cognitive 34) tools/src/main/java/org/apache/rocketmq/tools/admin/DefaultMQAdminExtImpl.java:1433— 7.run has cognitive complexity 34 (threshold 15). Drivers by points: if/else 8 (21 pts), error handling 5 (8 pts), loops 1 (3 pts), boolean chains 1, match/switch 1 (nesting depth added 18). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
TieredDispatcher.buildConsumeQueueAndIndexFile (cognitive 34) tieredstore/src/main/java/org/apache/rocketmq/tieredstore/TieredDispatcher.java:465— TieredDispatcher.buildConsumeQueueAndIndexFile has cognitive complexity 34 (threshold 15). Drivers by points: if/else 11 (31 pts), loops 2 (3 pts) (nesting depth added 21). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
LocalMessageService.popMessage (cognitive 34) proxy/src/main/java/org/apache/rocketmq/proxy/service/message/LocalMessageService.java:196— LocalMessageService.popMessage has cognitive complexity 34 (threshold 15). Drivers by points: if/else 9 (26 pts), loops 2 (4 pts), boolean chains 2, error handling 1, match/switch 1 (nesting depth added 19). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
BrokerContainerProcessor.addBroker (cognitive 34) container/src/main/java/org/apache/rocketmq/container/BrokerContainerProcessor.java:88— BrokerContainerProcessor.addBroker has cognitive complexity 34 (threshold 15). Drivers by points: if/else 12 (19 pts), error handling 3 (5 pts), loops 2 (4 pts), boolean chains 3, match/switch 1 (3 pts) (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
RebalancePushImpl.computePullFromWhereWithException (cognitive 34) client/src/main/java/org/apache/rocketmq/client/impl/consumer/RebalancePushImpl.java:172— RebalancePushImpl.computePullFromWhereWithException has cognitive complexity 34 (threshold 15). Drivers by points: if/else 14 (21 pts), error handling 3 (12 pts), match/switch 1 (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ConsumerLagCalculator.calculateMessageCount (cognitive 34) broker/src/main/java/org/apache/rocketmq/broker/metrics/ConsumerLagCalculator.java:440— ConsumerLagCalculator.calculateMessageCount has cognitive complexity 34 (threshold 15). Drivers by points: if/else 9 (21 pts), error handling 1 (6 pts), loops 1 (4 pts), boolean chains 2, ternaries 1 (nesting depth added 20). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
AdminBrokerProcessor.fetchAllConsumeStatsInBroker (cognitive 34) broker/src/main/java/org/apache/rocketmq/broker/processor/AdminBrokerProcessor.java:2284— AdminBrokerProcessor.fetchAllConsumeStatsInBroker has cognitive complexity 34 (threshold 15). Drivers by points: if/else 7 (26 pts), loops 3 (6 pts), boolean chains 2 (nesting depth added 22). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ConsumerSubCommand.execute (cognitive 33) tools/src/main/java/org/apache/rocketmq/tools/command/consumer/ConsumerSubCommand.java:67— ConsumerSubCommand.execute has cognitive complexity 33 (threshold 15). Drivers by points: if/else 8 (18 pts), loops 2 (6 pts), error handling 2 (4 pts), ternaries 1 (4 pts), boolean chains 1 (nesting depth added 19). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
TimerMessageStore.warmDequeue (cognitive 33) store/src/main/java/org/apache/rocketmq/store/timer/TimerMessageStore.java:763— TimerMessageStore.warmDequeue has cognitive complexity 33 (threshold 15). Drivers by points: if/else 14 (24 pts), loops 3 (5 pts), boolean chains 2, error handling 1 (2 pts) (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
CommitLog.asyncPutMessages (cognitive 33) store/src/main/java/org/apache/rocketmq/store/CommitLog.java:1077— CommitLog.asyncPutMessages has cognitive complexity 33 (threshold 15). Drivers by points: if/else 20 (26 pts), boolean chains 5, error handling 1, match/switch 1 (nesting depth added 6). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
NettyRemotingClient.updateNameServerAddressList (cognitive 33) remoting/src/main/java/org/apache/rocketmq/remoting/netty/NettyRemotingClient.java:497— NettyRemotingClient.updateNameServerAddressList has cognitive complexity 33 (threshold 15). Drivers by points: if/else 9 (25 pts), loops 2 (7 pts), boolean chains 1 (nesting depth added 21). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
RouteInfoManager.unRegisterBroker (cognitive 33) namesrv/src/main/java/org/apache/rocketmq/namesrv/routeinfo/RouteInfoManager.java:569— RouteInfoManager.unRegisterBroker has cognitive complexity 33 (threshold 15). Drivers by points: if/else 9 (20 pts), ternaries 3 (9 pts), boolean chains 2, error handling 1, loops 1 (nesting depth added 17). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
RebalanceLitePullImpl.computePullFromWhereWithException (cognitive 33) client/src/main/java/org/apache/rocketmq/client/impl/consumer/RebalanceLitePullImpl.java:90— RebalanceLitePullImpl.computePullFromWhereWithException has cognitive complexity 33 (threshold 15). Drivers by points: if/else 13 (20 pts), error handling 3 (12 pts), match/switch 1 (nesting depth added 16). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
ConsumerFilterManager.decode (cognitive 33) broker/src/main/java/org/apache/rocketmq/broker/filter/ConsumerFilterManager.java:229— ConsumerFilterManager.decode has cognitive complexity 33 (threshold 15). Drivers by points: if/else 6 (18 pts), loops 2 (5 pts), ternaries 1 (5 pts), error handling 1 (4 pts), boolean chains 1 (nesting depth added 22). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
PeekMessageProcessor.processRequest (cognitive 33) broker/src/main/java/org/apache/rocketmq/broker/processor/PeekMessageProcessor.java:81— PeekMessageProcessor.processRequest has cognitive complexity 33 (threshold 15). Drivers by points: if/else 17 (20 pts), loops 3 (8 pts), error handling 1 (3 pts), boolean chains 1, match/switch 1 (nesting depth added 10). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
PopMessageProcessor.popMsgFromQueue (cognitive 32) broker/src/main/java/org/apache/rocketmq/broker/processor/PopMessageProcessor.java:492— PopMessageProcessor.popMsgFromQueue has cognitive complexity 32 (threshold 15). Drivers by points: if/else 14 (16 pts), boolean chains 6, error handling 2 (5 pts), loops 2 (4 pts), ternaries 1 (nesting depth added 7). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
PlainPermissionManager.load (cognitive 32) acl/src/main/java/org/apache/rocketmq/acl/plain/PlainPermissionManager.java:111— PlainPermissionManager.load has cognitive complexity 32 (threshold 15). Drivers by points: if/else 11 (20 pts), loops 3 (7 pts), boolean chains 5 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
TimerDequeuePutMessageService.run (cognitive 31) store/src/main/java/org/apache/rocketmq/store/timer/TimerMessageStore.java:1463— TimerDequeuePutMessageService.run has cognitive complexity 31 (threshold 15). Drivers by points: if/else 6 (17 pts), loops 3 (6 pts), error handling 2 (5 pts), boolean chains 3 (nesting depth added 17). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
CommitLog.recoverNormally (cognitive 31) store/src/main/java/org/apache/rocketmq/store/CommitLog.java:319— CommitLog.recoverNormally has cognitive complexity 31 (threshold 15). Drivers by points: if/else 14 (27 pts), boolean chains 2, loops 1 (2 pts) (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
CleanCommitLogService.isSpaceToDelete (cognitive 31) store/src/main/java/org/apache/rocketmq/store/DefaultMessageStore.java:2312— CleanCommitLogService.isSpaceToDelete has cognitive complexity 31 (threshold 15). Drivers by points: if/else 18 (28 pts), boolean chains 2, loops 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
MQAdminImpl.createTopic (cognitive 31) client/src/main/java/org/apache/rocketmq/client/impl/MQAdminImpl.java:83— MQAdminImpl.createTopic has cognitive complexity 31 (threshold 15). Drivers by points: if/else 6 (17 pts), error handling 2 (6 pts), loops 2 (6 pts), boolean chains 2 (nesting depth added 19). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
BatchConsumeQueue.truncateDirtyLogicFiles (cognitive 30) store/src/main/java/org/apache/rocketmq/store/queue/BatchConsumeQueue.java:375— BatchConsumeQueue.truncateDirtyLogicFiles has cognitive complexity 30 (threshold 15). Drivers by points: if/else 9 (25 pts), loops 2 (4 pts), boolean chains 1 (nesting depth added 18). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ConsumeQueue.recover (cognitive 30) store/src/main/java/org/apache/rocketmq/store/ConsumeQueue.java:123— ConsumeQueue.recover has cognitive complexity 30 (threshold 15). Drivers by points: if/else 10 (24 pts), loops 2 (5 pts), boolean chains 1 (nesting depth added 17). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
TlsHelper.buildSslContext (cognitive 30) remoting/src/main/java/org/apache/rocketmq/remoting/netty/TlsHelper.java:91— TlsHelper.buildSslContext has cognitive complexity 30 (threshold 15). Drivers by points: if/else 11 (15 pts), ternaries 6 (15 pts) (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ProxyMetricsManager.start (cognitive 30) proxy/src/main/java/org/apache/rocketmq/proxy/metrics/ProxyMetricsManager.java:137— ProxyMetricsManager.start has cognitive complexity 30 (threshold 15). Drivers by points: if/else 13 (21 pts), loops 2 (5 pts), boolean chains 2, ternaries 1 (2 pts) (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ControllerMetricsManager.init (cognitive 30) controller/src/main/java/org/apache/rocketmq/controller/metrics/ControllerMetricsManager.java:285— ControllerMetricsManager.init has cognitive complexity 30 (threshold 15). Drivers by points: if/else 13 (21 pts), loops 2 (5 pts), boolean chains 2, ternaries 1 (2 pts) (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
MixAll.properties2Object (cognitive 30) common/src/main/java/org/apache/rocketmq/common/MixAll.java:352— MixAll.properties2Object has cognitive complexity 30 (threshold 15). Drivers by points: if/else 10 (20 pts), boolean chains 6, error handling 1 (3 pts), loops 1 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
BrokerMetricsManager.init (cognitive 30) broker/src/main/java/org/apache/rocketmq/broker/metrics/BrokerMetricsManager.java:243— BrokerMetricsManager.init has cognitive complexity 30 (threshold 15). Drivers by points: if/else 13 (21 pts), loops 2 (5 pts), boolean chains 2, ternaries 1 (2 pts) (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
DefaultMQAdminExtImpl.examineConsumeStats (cognitive 29) tools/src/main/java/org/apache/rocketmq/tools/admin/DefaultMQAdminExtImpl.java:418— DefaultMQAdminExtImpl.examineConsumeStats has cognitive complexity 29 (threshold 15). Drivers by points: if/else 8 (17 pts), loops 5 (7 pts), error handling 2 (4 pts), boolean chains 1 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
BrokerConsumeStatsSubCommad.execute (cognitive 29) tools/src/main/java/org/apache/rocketmq/tools/command/broker/BrokerConsumeStatsSubCommad.java:89— BrokerConsumeStatsSubCommad.execute has cognitive complexity 29 (threshold 15). Drivers by points: if/else 5 (13 pts), loops 4 (10 pts), error handling 2 (6 pts) (nesting depth added 18). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
QueryMsgByIdSubCommand.execute (cognitive 29) tools/src/main/java/org/apache/rocketmq/tools/command/message/QueryMsgByIdSubCommand.java:222— QueryMsgByIdSubCommand.execute has cognitive complexity 29 (threshold 15). Drivers by points: if/else 10 (20 pts), loops 3 (7 pts), boolean chains 1, error handling 1 (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
IndexFile.selectPhyOffset (cognitive 29) store/src/main/java/org/apache/rocketmq/store/index/IndexFile.java:201— IndexFile.selectPhyOffset has cognitive complexity 29 (threshold 15). Drivers by points: if/else 7 (20 pts), boolean chains 4, loops 1 (3 pts), error handling 1 (2 pts) (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
CompactionStore.load (cognitive 29) REDACTED:85— CompactionStore.load has cognitive complexity 29 (threshold 15). Drivers by points: if/else 6 (18 pts), loops 2 (6 pts), error handling 1 (5 pts) (nesting depth added 20). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ConcurrentReputMessageService.doReput (cognitive 29) store/src/main/java/org/apache/rocketmq/store/DefaultMessageStore.java:3106— ConcurrentReputMessageService.doReput has cognitive complexity 29 (threshold 15). Drivers by points: if/else 7 (19 pts), loops 3 (5 pts), error handling 1 (3 pts), boolean chains 2 (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ClientMetadata.topicRouteData2EndpointsForStaticTopic (cognitive 29) remoting/src/main/java/org/apache/rocketmq/remoting/rpc/ClientMetadata.java:98— ClientMetadata.topicRouteData2EndpointsForStaticTopic has cognitive complexity 29 (threshold 15). Drivers by points: if/else 7 (17 pts), loops 5 (9 pts), boolean chains 3 (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ReceiveMessageActivity.receiveMessage (cognitive 29) proxy/src/main/java/org/apache/rocketmq/proxy/grpc/v2/consumer/ReceiveMessageActivity.java:57— ReceiveMessageActivity.receiveMessage has cognitive complexity 29 (threshold 15). Drivers by points: if/else 12 (17 pts), ternaries 2 (4 pts), boolean chains 3, loops 1 (3 pts), error handling 2 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
MQClientInstance.sendHeartbeatToAllBroker (cognitive 29) client/src/main/java/org/apache/rocketmq/client/impl/factory/MQClientInstance.java:585— MQClientInstance.sendHeartbeatToAllBroker has cognitive complexity 29 (threshold 15). Drivers by points: if/else 9 (21 pts), error handling 1 (3 pts), loops 2 (3 pts), boolean chains 2 (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
EndTransactionProcessor.processRequest (cognitive 29) broker/src/main/java/org/apache/rocketmq/broker/processor/EndTransactionProcessor.java:55— EndTransactionProcessor.processRequest has cognitive complexity 29 (threshold 15). Drivers by points: if/else 12 (25 pts), match/switch 2 (4 pts) (nesting depth added 15). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
ExportMetadataCommand.execute (cognitive 28) tools/src/main/java/org/apache/rocketmq/tools/command/export/ExportMetadataCommand.java:81— ExportMetadataCommand.execute has cognitive complexity 28 (threshold 15). Drivers by points: if/else 10 (18 pts), loops 3 (8 pts), error handling 1, ternaries 1 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ConsumeQueueStore.recoverOffsetTable (cognitive 28) store/src/main/java/org/apache/rocketmq/store/queue/ConsumeQueueStore.java:438— ConsumeQueueStore.recoverOffsetTable has cognitive complexity 28 (threshold 15). Drivers by points: if/else 9 (21 pts), loops 3 (5 pts), ternaries 1 (2 pts) (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
TimerMessageStore.recoverAndRevise (cognitive 28) store/src/main/java/org/apache/rocketmq/store/timer/TimerMessageStore.java:387— TimerMessageStore.recoverAndRevise has cognitive complexity 28 (threshold 15). Drivers by points: if/else 8 (16 pts), loops 3 (4 pts), boolean chains 3, error handling 1 (3 pts), ternaries 1 (2 pts) (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
DefaultMessageStore.getMessageIds (cognitive 28) store/src/main/java/org/apache/rocketmq/store/DefaultMessageStore.java:1439— DefaultMessageStore.getMessageIds has cognitive complexity 28 (threshold 15). Drivers by points: if/else 7 (16 pts), loops 2 (6 pts), ternaries 1 (5 pts), boolean chains 1 (nesting depth added 17). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
RebalanceImpl.updateProcessQueueTableInRebalance (cognitive 28) client/src/main/java/org/apache/rocketmq/client/impl/consumer/RebalanceImpl.java:473— RebalanceImpl.updateProcessQueueTableInRebalance has cognitive complexity 28 (threshold 15). Drivers by points: if/else 11 (23 pts), loops 3, boolean chains 2 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Broker2Client.resetOffset (cognitive 28) broker/src/main/java/org/apache/rocketmq/broker/client/net/Broker2Client.java:108— Broker2Client.resetOffset has cognitive complexity 28 (threshold 15). Drivers by points: if/else 13 (19 pts), error handling 1 (4 pts), loops 2 (3 pts), boolean chains 2 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
AckMessageProcessor.appendAck (cognitive 28) broker/src/main/java/org/apache/rocketmq/broker/processor/AckMessageProcessor.java:168— AckMessageProcessor.appendAck has cognitive complexity 28 (threshold 15). Drivers by points: if/else 13 (22 pts), boolean chains 4, loops 1 (2 pts) (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
TopicConfigManager.createTopicInSendMessageMethod (cognitive 28) broker/src/main/java/org/apache/rocketmq/broker/topic/TopicConfigManager.java:228— TopicConfigManager.createTopicInSendMessageMethod has cognitive complexity 28 (threshold 15). Drivers by points: if/else 11 (24 pts), ternaries 1 (3 pts), error handling 1 (nesting depth added 15). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
MappedFileQueue.deleteExpiredFileByOffsetForTimerLog (cognitive 27) store/src/main/java/org/apache/rocketmq/store/MappedFileQueue.java:570— MappedFileQueue.deleteExpiredFileByOffsetForTimerLog has cognitive complexity 27 (threshold 15). Drivers by points: if/else 10 (23 pts), boolean chains 2, loops 1 (2 pts) (nesting depth added 14). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
PolishExpr.reversePolish (cognitive 27) common/src/main/java/org/apache/rocketmq/common/filter/impl/PolishExpr.java:40— PolishExpr.reversePolish has cognitive complexity 27 (threshold 15). Drivers by points: if/else 9 (18 pts), loops 3 (5 pts), boolean chains 4 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
MixAll.printObjectProperties (cognitive 27) common/src/main/java/org/apache/rocketmq/common/MixAll.java:258— MixAll.printObjectProperties has cognitive complexity 27 (threshold 15). Drivers by points: if/else 6 (22 pts), error handling 1 (4 pts), loops 1 (nesting depth added 19). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
RebalanceImpl.lockAll (cognitive 27) client/src/main/java/org/apache/rocketmq/client/impl/consumer/RebalanceImpl.java:187— RebalanceImpl.lockAll has cognitive complexity 27 (threshold 15). Drivers by points: if/else 6 (20 pts), loops 2 (4 pts), error handling 1 (3 pts) (nesting depth added 18). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
AdminBrokerProcessor.getConsumeStats (cognitive 27) broker/src/main/java/org/apache/rocketmq/broker/processor/AdminBrokerProcessor.java:1639— AdminBrokerProcessor.getConsumeStats has cognitive complexity 27 (threshold 15). Drivers by points: if/else 9 (23 pts), loops 2 (3 pts), boolean chains 1 (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
DefaultPullMessageResultHandler.handle (cognitive 27) broker/src/main/java/org/apache/rocketmq/broker/processor/DefaultPullMessageResultHandler.java:78— DefaultPullMessageResultHandler.handle has cognitive complexity 27 (threshold 15). Drivers by points: if/else 10 (17 pts), error handling 2 (4 pts), boolean chains 3, ternaries 1 (2 pts), match/switch 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
BrokerController.startBasicService (cognitive 27) broker/src/main/java/org/apache/rocketmq/broker/BrokerController.java:1526— BrokerController.startBasicService has cognitive complexity 27 (threshold 15). Drivers by points: if/else 23 (25 pts), boolean chains 1, loops 1 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
BrokerStartup.buildBrokerController (cognitive 27) broker/src/main/java/org/apache/rocketmq/broker/BrokerStartup.java:82— BrokerStartup.buildBrokerController has cognitive complexity 27 (threshold 15). Drivers by points: if/else 16 (19 pts), boolean chains 2, error handling 1 (2 pts), loops 1 (2 pts), match/switch 1 (2 pts) (nesting depth added 6). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
HAServerReader.processReadResult (cognitive 26) store/src/main/java/org/apache/rocketmq/store/ha/autoswitch/AutoSwitchHAConnection.java:306— HAServerReader.processReadResult has cognitive complexity 26 (threshold 15). Drivers by points: if/else 7 (22 pts), match/switch 1 (3 pts), loops 1 (nesting depth added 17). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
IndexService.buildIndex (cognitive 26) store/src/main/java/org/apache/rocketmq/store/index/IndexService.java:210— IndexService.buildIndex has cognitive complexity 26 (threshold 15). Drivers by points: if/else 8 (20 pts), loops 1 (3 pts), match/switch 1 (2 pts), boolean chains 1 (nesting depth added 15). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
BatchConsumeQueue.binarySearchRight (cognitive 26) store/src/main/java/org/apache/rocketmq/store/queue/BatchConsumeQueue.java:852— BatchConsumeQueue.binarySearchRight has cognitive complexity 26 (threshold 15). Drivers by points: if/else 11 (22 pts), match/switch 1 (3 pts), loops 1 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
TimerMessageStore.enqueue (cognitive 26) store/src/main/java/org/apache/rocketmq/store/timer/TimerMessageStore.java:640— TimerMessageStore.enqueue has cognitive complexity 26 (threshold 15). Drivers by points: if/else 12 (19 pts), loops 2 (4 pts), error handling 2 (3 pts) (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
TopicQueueMappingUtils.checkNameEpochNumConsistence (cognitive 26) remoting/src/main/java/org/apache/rocketmq/remoting/protocol/statictopic/TopicQueueMappingUtils.java:143— TopicQueueMappingUtils.checkNameEpochNumConsistence has cognitive complexity 26 (threshold 15). Drivers by points: if/else 12 (20 pts), boolean chains 5, loops 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
DefaultPromise.get (cognitive 26) openmessaging/src/main/java/io/openmessaging/rocketmq/promise/DefaultPromise.java:65— DefaultPromise.get has cognitive complexity 26 (threshold 15). Drivers by points: if/else 8 (17 pts), error handling 2 (6 pts), loops 1 (3 pts) (nesting depth added 15). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
RebalanceImpl.rebalanceByTopic (cognitive 26) client/src/main/java/org/apache/rocketmq/client/impl/consumer/RebalanceImpl.java:299— RebalanceImpl.rebalanceByTopic has cognitive complexity 26 (threshold 15). Drivers by points: if/else 9 (21 pts), error handling 1 (3 pts), boolean chains 1, match/switch 1 (nesting depth added 14). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
BrokerFastFailure.cleanExpiredRequestInQueue (cognitive 26) broker/src/main/java/org/apache/rocketmq/broker/latency/BrokerFastFailure.java:120— BrokerFastFailure.cleanExpiredRequestInQueue has cognitive complexity 26 (threshold 15). Drivers by points: if/else 8 (22 pts), error handling 1 (2 pts), boolean chains 1, loops 1 (nesting depth added 15). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
ConsumerOffsetManager.queryMinOffsetInAllGroup (cognitive 26) broker/src/main/java/org/apache/rocketmq/broker/offset/ConsumerOffsetManager.java:317— ConsumerOffsetManager.queryMinOffsetInAllGroup has cognitive complexity 26 (threshold 15). Drivers by points: if/else 6 (17 pts), loops 4 (9 pts) (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
MQAdminStartup.main0 (cognitive 25) tools/src/main/java/org/apache/rocketmq/tools/command/MQAdminStartup.java:117— MQAdminStartup.main0 has cognitive complexity 25 (threshold 15). Drivers by points: if/else 10 (23 pts), error handling 1, match/switch 1 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
TieredDispatcher.dispatch (cognitive 25) tieredstore/src/main/java/org/apache/rocketmq/tieredstore/TieredDispatcher.java:102— TieredDispatcher.dispatch has cognitive complexity 25 (threshold 15). Drivers by points: if/else 12 (19 pts), error handling 2 (4 pts), boolean chains 2 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
SubscriptionData.equals (cognitive 25) remoting/src/main/java/org/apache/rocketmq/remoting/protocol/heartbeat/SubscriptionData.java:129— SubscriptionData.equals has cognitive complexity 25 (threshold 15). Drivers by points: if/else 20 (25 pts) (nesting depth added 5). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
MessageQueueSelector.buildWrite (cognitive 25) proxy/src/main/java/org/apache/rocketmq/proxy/service/route/MessageQueueSelector.java:91— MessageQueueSelector.buildWrite has cognitive complexity 25 (threshold 15). Drivers by points: if/else 6 (14 pts), loops 4 (11 pts) (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
MessageDecoder.decode (cognitive 25) common/src/main/java/org/apache/rocketmq/common/message/MessageDecoder.java:430— MessageDecoder.decode has cognitive complexity 25 (threshold 15). Drivers by points: if/else 12 (21 pts), ternaries 2, boolean chains 1, error handling 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
PopBufferMergeService.addAk (cognitive 25) broker/src/main/java/org/apache/rocketmq/broker/processor/PopBufferMergeService.java:519— PopBufferMergeService.addAk has cognitive complexity 25 (threshold 15). Drivers by points: if/else 16 (22 pts), loops 1 (2 pts), error handling 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
AcceptSocketService.run (cognitive 24) store/src/main/java/org/apache/rocketmq/store/ha/DefaultHAService.java:335— AcceptSocketService.run has cognitive complexity 24 (threshold 15). Drivers by points: if/else 4 (12 pts), error handling 2 (8 pts), loops 2 (4 pts) (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
TimerMessageStore.doPut (cognitive 24) store/src/main/java/org/apache/rocketmq/store/timer/TimerMessageStore.java:1068— TimerMessageStore.doPut has cognitive complexity 24 (threshold 15). Drivers by points: if/else 9 (18 pts), match/switch 1 (3 pts), boolean chains 2, loops 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
MappedFileQueue.findMappedFileByOffset (cognitive 24) store/src/main/java/org/apache/rocketmq/store/MappedFileQueue.java:665— MappedFileQueue.findMappedFileByOffset has cognitive complexity 24 (threshold 15). Drivers by points: if/else 6 (13 pts), boolean chains 4, error handling 2 (4 pts), loops 1 (3 pts) (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
NettyRemotingClient.getAndCreateNameserverChannel (cognitive 24) remoting/src/main/java/org/apache/rocketmq/remoting/netty/NettyRemotingClient.java:628— NettyRemotingClient.getAndCreateNameserverChannel has cognitive complexity 24 (threshold 15). Drivers by points: if/else 8 (16 pts), boolean chains 3, loops 1 (3 pts), error handling 1 (2 pts) (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
NettyRemotingClient.invokeImpl (cognitive 24) remoting/src/main/java/org/apache/rocketmq/remoting/netty/NettyRemotingClient.java:803— NettyRemotingClient.invokeImpl has cognitive complexity 24 (threshold 15). Drivers by points: if/else 8 (22 pts), boolean chains 1, error handling 1 (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
TopicQueueMappingUtils.checkAndBuildMappingItems (cognitive 24) remoting/src/main/java/org/apache/rocketmq/remoting/protocol/statictopic/TopicQueueMappingUtils.java:340— TopicQueueMappingUtils.checkAndBuildMappingItems has cognitive complexity 24 (threshold 15). Drivers by points: if/else 8 (19 pts), loops 3 (5 pts) (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
TopicQueueMappingUtils.checkLogicQueueMappingItemOffset (cognitive 24) remoting/src/main/java/org/apache/rocketmq/remoting/protocol/statictopic/TopicQueueMappingUtils.java:249— TopicQueueMappingUtils.checkLogicQueueMappingItemOffset has cognitive complexity 24 (threshold 15). Drivers by points: if/else 8 (17 pts), boolean chains 6, loops 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ClientManageProcessor.heartBeatV2 (cognitive 24) broker/src/main/java/org/apache/rocketmq/broker/processor/ClientManageProcessor.java:152— ClientManageProcessor.heartBeatV2 has cognitive complexity 24 (threshold 15). Drivers by points: if/else 9 (19 pts), loops 3 (4 pts), boolean chains 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ConsumerManageProcessor.rewriteRequestForStaticTopic (cognitive 24) broker/src/main/java/org/apache/rocketmq/broker/processor/ConsumerManageProcessor.java:204— ConsumerManageProcessor.rewriteRequestForStaticTopic has cognitive complexity 24 (threshold 15). Drivers by points: if/else 14 (21 pts), boolean chains 1, error handling 1, loops 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
QueryAssignmentProcessor.doLoadBalance (cognitive 24) broker/src/main/java/org/apache/rocketmq/broker/processor/QueryAssignmentProcessor.java:162— QueryAssignmentProcessor.doLoadBalance has cognitive complexity 24 (threshold 15). Drivers by points: if/else 10 (20 pts), error handling 1 (2 pts), boolean chains 1, match/switch 1 (nesting depth added 11). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
DefaultMQAdminExtImpl.consumedConcurrent (cognitive 23) tools/src/main/java/org/apache/rocketmq/tools/admin/DefaultMQAdminExtImpl.java:1544— DefaultMQAdminExtImpl.consumedConcurrent has cognitive complexity 23 (threshold 15). Drivers by points: if/else 6 (20 pts), loops 1 (2 pts), boolean chains 1 (nesting depth added 15). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
WriteSocketService.transferData (cognitive 23) store/src/main/java/org/apache/rocketmq/store/ha/DefaultHAConnection.java:408— WriteSocketService.transferData has cognitive complexity 23 (threshold 15). Drivers by points: if/else 11 (19 pts), loops 2 (3 pts), boolean chains 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
BatchConsumeQueue.recover (cognitive 23) store/src/main/java/org/apache/rocketmq/store/queue/BatchConsumeQueue.java:211— BatchConsumeQueue.recover has cognitive complexity 23 (threshold 15). Drivers by points: if/else 8 (17 pts), loops 2 (5 pts), boolean chains 1 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
SparseConsumeQueue.recover (cognitive 23) store/src/main/java/org/apache/rocketmq/store/queue/SparseConsumeQueue.java:54— SparseConsumeQueue.recover has cognitive complexity 23 (threshold 15). Drivers by points: if/else 7 (17 pts), loops 2 (5 pts), boolean chains 1 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
AllocateMappedFileService.mmapOperation (cognitive 23) store/src/main/java/org/apache/rocketmq/store/AllocateMappedFileService.java:153— AllocateMappedFileService.mmapOperation has cognitive complexity 23 (threshold 15). Drivers by points: if/else 9 (13 pts), error handling 4 (8 pts), boolean chains 2 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
AllocateMappedFileService.putRequestAndReturnMappedFile (cognitive 23) store/src/main/java/org/apache/rocketmq/store/AllocateMappedFileService.java:53— AllocateMappedFileService.putRequestAndReturnMappedFile has cognitive complexity 23 (threshold 15). Drivers by points: if/else 14 (21 pts), boolean chains 1, error handling 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
GroupCommitService.doCommit (cognitive 23) store/src/main/java/org/apache/rocketmq/store/CommitLog.java:1637— GroupCommitService.doCommit has cognitive complexity 23 (threshold 15). Drivers by points: if/else 5 (9 pts), error handling 1 (5 pts), loops 2 (5 pts), ternaries 1 (3 pts), boolean chains 1 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
NettyRemotingClient.closeChannel (cognitive 23) remoting/src/main/java/org/apache/rocketmq/remoting/netty/NettyRemotingClient.java:447— NettyRemotingClient.closeChannel has cognitive complexity 23 (threshold 15). Drivers by points: if/else 8 (17 pts), error handling 2 (3 pts), loops 1 (2 pts), boolean chains 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
TopicRouteData.equals (cognitive 23) remoting/src/main/java/org/apache/rocketmq/remoting/protocol/route/TopicRouteData.java:185— TopicRouteData.equals has cognitive complexity 23 (threshold 15). Drivers by points: if/else 18 (23 pts) (nesting depth added 5). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
GrpcConverter.buildSystemProperties (cognitive 23) proxy/src/main/java/org/apache/rocketmq/proxy/grpc/v2/common/GrpcConverter.java:125— GrpcConverter.buildSystemProperties has cognitive complexity 23 (threshold 15). Drivers by points: if/else 20 (21 pts), boolean chains 2 (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
ControllerEventHandler.run (cognitive 23) controller/src/main/java/org/apache/rocketmq/controller/impl/DLedgerController.java:448— ControllerEventHandler.run has cognitive complexity 23 (threshold 15). Drivers by points: if/else 10 (19 pts), boolean chains 2, loops 1 (2 pts) (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
NetworkUtil.getLocalAddress (cognitive 23) common/src/main/java/org/apache/rocketmq/common/utils/NetworkUtil.java:91— NetworkUtil.getLocalAddress has cognitive complexity 23 (threshold 15). Drivers by points: if/else 7 (15 pts), loops 3 (5 pts), boolean chains 2, error handling 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
MixAll.object2Properties (cognitive 23) common/src/main/java/org/apache/rocketmq/common/MixAll.java:319— MixAll.object2Properties has cognitive complexity 23 (threshold 15). Drivers by points: if/else 4 (14 pts), error handling 1 (5 pts), loops 2 (3 pts), boolean chains 1 (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
SendMessageProcessor.sendMessage (cognitive 23) broker/src/main/java/org/apache/rocketmq/broker/processor/SendMessageProcessor.java:239— SendMessageProcessor.sendMessage has cognitive complexity 23 (threshold 15). Drivers by points: if/else 15 (19 pts), boolean chains 3, ternaries 1 (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
SlaveSynchronize.syncTopicConfig (cognitive 23) broker/src/main/java/org/apache/rocketmq/broker/slave/SlaveSynchronize.java:73— SlaveSynchronize.syncTopicConfig has cognitive complexity 23 (threshold 15). Drivers by points: if/else 5 (13 pts), loops 2 (6 pts), boolean chains 2, error handling 1 (2 pts) (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
PlainAccessResource.parse (cognitive 23) acl/src/main/java/org/apache/rocketmq/acl/plain/PlainAccessResource.java:100— PlainAccessResource.parse has cognitive complexity 23 (threshold 15). Drivers by points: if/else 9 (13 pts), loops 3 (6 pts), boolean chains 2, error handling 1, match/switch 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
MQAdminUtils.remappingStaticTopic (cognitive 22) tools/src/main/java/org/apache/rocketmq/tools/admin/MQAdminUtils.java:146— MQAdminUtils.remappingStaticTopic has cognitive complexity 22 (threshold 15). Drivers by points: if/else 5 (14 pts), loops 6 (7 pts), boolean chains 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
UpdateAccessConfigSubCommand.execute (cognitive 22) tools/src/main/java/org/apache/rocketmq/tools/command/acl/UpdateAccessConfigSubCommand.java:95— UpdateAccessConfigSubCommand.execute has cognitive complexity 22 (threshold 15). Drivers by points: if/else 11 (13 pts), loops 3 (8 pts), error handling 1 (nesting depth added 7). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
ConsumeMessageCommand.execute (cognitive 22) tools/src/main/java/org/apache/rocketmq/tools/command/message/ConsumeMessageCommand.java:118— ConsumeMessageCommand.execute has cognitive complexity 22 (threshold 15). Drivers by points: if/else 14 (20 pts), error handling 1, match/switch 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
DumpCompactionLogCommand.execute (cognitive 22) tools/src/main/java/org/apache/rocketmq/tools/command/message/DumpCompactionLogCommand.java:59— DumpCompactionLogCommand.execute has cognitive complexity 22 (threshold 15). Drivers by points: if/else 8 (14 pts), error handling 2 (5 pts), loops 1 (2 pts), boolean chains 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
MonitorService.computeUndoneMsgs (cognitive 22) tools/src/main/java/org/apache/rocketmq/tools/monitor/MonitorService.java:269— MonitorService.computeUndoneMsgs has cognitive complexity 22 (threshold 15). Drivers by points: if/else 5 (14 pts), match/switch 1 (4 pts), error handling 1 (3 pts), loops 1 (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
TieredDispatcher.dispatchFlatFile (cognitive 22) tieredstore/src/main/java/org/apache/rocketmq/tieredstore/TieredDispatcher.java:228— TieredDispatcher.dispatchFlatFile has cognitive complexity 22 (threshold 15). Drivers by points: if/else 12 (16 pts), boolean chains 2, match/switch 1 (2 pts), error handling 1, loops 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
TopicQueueMappingUtils.remappingStaticTopic (cognitive 22) remoting/src/main/java/org/apache/rocketmq/remoting/protocol/statictopic/TopicQueueMappingUtils.java:511— TopicQueueMappingUtils.remappingStaticTopic has cognitive complexity 22 (threshold 15). Drivers by points: if/else 8 (14 pts), loops 7 (8 pts) (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
RemotingCommand.makeCustomHeaderToNet (cognitive 22) remoting/src/main/java/org/apache/rocketmq/remoting/protocol/RemotingCommand.java:430— RemotingCommand.makeCustomHeaderToNet has cognitive complexity 22 (threshold 15). Drivers by points: if/else 5 (15 pts), error handling 1 (5 pts), loops 1 (2 pts) (nesting depth added 15). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
RouteActivity.queryAssignment (cognitive 22) proxy/src/main/java/org/apache/rocketmq/proxy/grpc/v2/route/RouteActivity.java:99— RouteActivity.queryAssignment has cognitive complexity 22 (threshold 15). Drivers by points: if/else 7 (13 pts), loops 2 (6 pts), boolean chains 2, error handling 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
RouteInfoManager.cleanTopicByUnRegisterRequests (cognitive 22) namesrv/src/main/java/org/apache/rocketmq/namesrv/routeinfo/RouteInfoManager.java:650— RouteInfoManager.cleanTopicByUnRegisterRequests has cognitive complexity 22 (threshold 15). Drivers by points: if/else 5 (17 pts), loops 3 (5 pts) (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ConsumeRequest.run (cognitive 22) client/src/main/java/org/apache/rocketmq/client/impl/consumer/ConsumeMessagePopConcurrentlyService.java:385— ConsumeRequest.run has cognitive complexity 22 (threshold 15). Drivers by points: if/else 15 (17 pts), boolean chains 2, loops 1 (2 pts), error handling 1 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
ProcessQueue.cleanExpiredMsg (cognitive 22) client/src/main/java/org/apache/rocketmq/client/impl/consumer/ProcessQueue.java:77— ProcessQueue.cleanExpiredMsg has cognitive complexity 22 (threshold 15). Drivers by points: if/else 5 (10 pts), error handling 4 (9 pts), boolean chains 2, loops 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
MQClientInstance.checkClientInBroker (cognitive 22) client/src/main/java/org/apache/rocketmq/client/impl/factory/MQClientInstance.java:471— MQClientInstance.checkClientInBroker has cognitive complexity 22 (threshold 15). Drivers by points: if/else 5 (14 pts), error handling 1 (4 pts), loops 2 (3 pts), boolean chains 1 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
PopBufferMergeService.scanCommitOffset (cognitive 22) broker/src/main/java/org/apache/rocketmq/broker/processor/PopBufferMergeService.java:134— PopBufferMergeService.scanCommitOffset has cognitive complexity 22 (threshold 15). Drivers by points: if/else 6 (15 pts), boolean chains 4, loops 2 (3 pts) (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
DeliverDelayedMessageTimerTask.executeOnTimeUp (cognitive 22) broker/src/main/java/org/apache/rocketmq/broker/schedule/ScheduleMessageService.java:398— DeliverDelayedMessageTimerTask.executeOnTimeUp has cognitive complexity 22 (threshold 15). Drivers by points: if/else 12 (19 pts), boolean chains 1, error handling 1, loops 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
BrokerController.<init> (cognitive 22) broker/src/main/java/org/apache/rocketmq/broker/BrokerController.java:299— BrokerController.<init> has cognitive complexity 22 (threshold 15). Drivers by points: ternaries 8 (14 pts), if/else 6, boolean chains 2 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
MQAdminUtils.convertPhysicalConsumeStats (cognitive 21) tools/src/main/java/org/apache/rocketmq/tools/admin/MQAdminUtils.java:298— MQAdminUtils.convertPhysicalConsumeStats has cognitive complexity 21 (threshold 15). Drivers by points: if/else 5 (14 pts), boolean chains 4, loops 2 (3 pts) (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
RemappingStaticTopicSubCommand.execute (cognitive 21) tools/src/main/java/org/apache/rocketmq/tools/command/topic/RemappingStaticTopicSubCommand.java:118— RemappingStaticTopicSubCommand.execute has cognitive complexity 21 (threshold 15). Drivers by points: if/else 10 (13 pts), loops 3 (5 pts), boolean chains 2, error handling 1 (nesting depth added 5). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
TopicListSubCommand.execute (cognitive 21) tools/src/main/java/org/apache/rocketmq/tools/command/topic/TopicListSubCommand.java:60— TopicListSubCommand.execute has cognitive complexity 21 (threshold 15). Drivers by points: if/else 4 (8 pts), loops 3 (7 pts), error handling 2 (4 pts), boolean chains 2 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
HAConnectionStateNotificationService.doWaitConnectionState (cognitive 21) store/src/main/java/org/apache/rocketmq/store/ha/HAConnectionStateNotificationService.java:63— HAConnectionStateNotificationService.doWaitConnectionState has cognitive complexity 21 (threshold 15). Drivers by points: if/else 10 (17 pts), boolean chains 2, loops 1 (2 pts) (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
GroupCheckService.doCommit (cognitive 21) store/src/main/java/org/apache/rocketmq/store/CommitLog.java:1750— GroupCheckService.doCommit has cognitive complexity 21 (threshold 15). Drivers by points: if/else 4 (8 pts), error handling 1 (5 pts), loops 2 (5 pts), ternaries 1 (3 pts) (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ConsumeQueue.putMessagePositionInfoWrapper (cognitive 21) store/src/main/java/org/apache/rocketmq/store/ConsumeQueue.java:677— ConsumeQueue.putMessagePositionInfoWrapper has cognitive complexity 21 (threshold 15). Drivers by points: if/else 7 (15 pts), error handling 1 (3 pts), boolean chains 2, loops 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
CorrectLogicOffsetService.needCorrect (cognitive 21) store/src/main/java/org/apache/rocketmq/store/DefaultMessageStore.java:2511— CorrectLogicOffsetService.needCorrect has cognitive complexity 21 (threshold 15). Drivers by points: if/else 13 (19 pts), boolean chains 2 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
AclFileWatchService.run (cognitive 21) REDACTED:95— AclFileWatchService.run has cognitive complexity 21 (threshold 15). Drivers by points: if/else 5 (11 pts), loops 3 (7 pts), error handling 1 (2 pts), boolean chains 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
RemotingProtocolServer.cleanExpiredRequestInQueue (cognitive 21) proxy/src/main/java/org/apache/rocketmq/proxy/remoting/RemotingProtocolServer.java:328— RemotingProtocolServer.cleanExpiredRequestInQueue has cognitive complexity 21 (threshold 15). Drivers by points: if/else 7 (17 pts), error handling 1 (2 pts), boolean chains 1, loops 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
AbstractOMSProducer.checkProducerException (cognitive 21) openmessaging/src/main/java/io/openmessaging/rocketmq/producer/AbstractOMSProducer.java:92— AbstractOMSProducer.checkProducerException has cognitive complexity 21 (threshold 15). Drivers by points: if/else 9 (20 pts), boolean chains 1 (nesting depth added 11). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
ConsumeMessageConcurrentlyService.submitConsumeRequest (cognitive 21) client/src/main/java/org/apache/rocketmq/client/impl/consumer/ConsumeMessageConcurrentlyService.java:187— ConsumeMessageConcurrentlyService.submitConsumeRequest has cognitive complexity 21 (threshold 15). Drivers by points: loops 3 (9 pts), if/else 4 (7 pts), error handling 2 (5 pts) (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ConsumeMessagePopConcurrentlyService.submitPopConsumeRequest (cognitive 21) client/src/main/java/org/apache/rocketmq/client/impl/consumer/ConsumeMessagePopConcurrentlyService.java:177— ConsumeMessagePopConcurrentlyService.submitPopConsumeRequest has cognitive complexity 21 (threshold 15). Drivers by points: loops 3 (9 pts), if/else 4 (7 pts), error handling 2 (5 pts) (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
TraceDataEncoder.decoderFromTraceDataString (cognitive 21) client/src/main/java/org/apache/rocketmq/client/trace/TraceDataEncoder.java:39— TraceDataEncoder.decoderFromTraceDataString has cognitive complexity 21 (threshold 15). Drivers by points: if/else 10 (19 pts), boolean chains 1, loops 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Broker2Client.getConsumeStatus (cognitive 21) broker/src/main/java/org/apache/rocketmq/broker/client/net/Broker2Client.java:230— Broker2Client.getConsumeStatus has cognitive complexity 21 (threshold 15). Drivers by points: if/else 5 (11 pts), boolean chains 3, error handling 1 (3 pts), match/switch 1 (3 pts), loops 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ReplicasManager.startBasicService (cognitive 21) broker/src/main/java/org/apache/rocketmq/broker/controller/ReplicasManager.java:163— ReplicasManager.startBasicService has cognitive complexity 21 (threshold 15). Drivers by points: if/else 10 (15 pts), error handling 1 (3 pts), loops 1 (2 pts), boolean chains 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
AdminBrokerProcessor.queryConsumeQueue (cognitive 21) broker/src/main/java/org/apache/rocketmq/broker/processor/AdminBrokerProcessor.java:2502— AdminBrokerProcessor.queryConsumeQueue has cognitive complexity 21 (threshold 15). Drivers by points: if/else 11 (19 pts), boolean chains 1, loops 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
AdminBrokerProcessor.rewriteRequestForStaticTopic (cognitive 21) broker/src/main/java/org/apache/rocketmq/broker/processor/AdminBrokerProcessor.java:992— AdminBrokerProcessor.rewriteRequestForStaticTopic has cognitive complexity 21 (threshold 15). Drivers by points: if/else 9 (17 pts), boolean chains 2, error handling 1, loops 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
PopReviveService.run (cognitive 21) broker/src/main/java/org/apache/rocketmq/broker/processor/PopReviveService.java:615— PopReviveService.run has cognitive complexity 21 (threshold 15). Drivers by points: if/else 8 (16 pts), boolean chains 2, error handling 1 (2 pts), loops 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
TransactionalMessageServiceImpl.batchSendOpMessage (cognitive 21) broker/src/main/java/org/apache/rocketmq/broker/transaction/queue/TransactionalMessageServiceImpl.java:679— TransactionalMessageServiceImpl.batchSendOpMessage has cognitive complexity 21 (threshold 15). Drivers by points: if/else 7 (13 pts), boolean chains 3, loops 2 (3 pts), error handling 1, ternaries 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
TransactionalMessageServiceImpl.fillOpRemoveMap (cognitive 21) broker/src/main/java/org/apache/rocketmq/broker/transaction/queue/TransactionalMessageServiceImpl.java:361— TransactionalMessageServiceImpl.fillOpRemoveMap has cognitive complexity 21 (threshold 15). Drivers by points: if/else 10 (16 pts), loops 2 (4 pts), boolean chains 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
TieredStoreMetricsManager.init (cognitive 20) tieredstore/src/main/java/org/apache/rocketmq/tieredstore/metrics/TieredStoreMetricsManager.java:147— TieredStoreMetricsManager.init has cognitive complexity 20 (threshold 15). Drivers by points: if/else 7 (12 pts), boolean chains 4, loops 3, error handling 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
TieredMessageFetcher.getMessageFromCacheAsync (cognitive 20) tieredstore/src/main/java/org/apache/rocketmq/tieredstore/TieredMessageFetcher.java:217— TieredMessageFetcher.getMessageFromCacheAsync has cognitive complexity 20 (threshold 15). Drivers by points: if/else 10 (15 pts), loops 3, boolean chains 1, ternaries 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
AbstractWriteSocketService.transferToSlave (cognitive 20) store/src/main/java/org/apache/rocketmq/store/ha/autoswitch/AutoSwitchHAConnection.java:564— AbstractWriteSocketService.transferToSlave has cognitive complexity 20 (threshold 15). Drivers by points: if/else 11 (19 pts), boolean chains 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
BatchConsumeQueue.getBatchMsgIndexBuffer (cognitive 20) store/src/main/java/org/apache/rocketmq/store/queue/BatchConsumeQueue.java:648— BatchConsumeQueue.getBatchMsgIndexBuffer has cognitive complexity 20 (threshold 15). Drivers by points: if/else 10 (17 pts), boolean chains 3 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
BatchConsumeQueue.getOffsetInQueueByTime (cognitive 20) store/src/main/java/org/apache/rocketmq/store/queue/BatchConsumeQueue.java:739— BatchConsumeQueue.getOffsetInQueueByTime has cognitive complexity 20 (threshold 15). Drivers by points: if/else 10 (17 pts), boolean chains 3 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ConsumeQueueStore.loadConsumeQueues (cognitive 20) store/src/main/java/org/apache/rocketmq/store/queue/ConsumeQueueStore.java:197— ConsumeQueueStore.loadConsumeQueues has cognitive complexity 20 (threshold 15). Drivers by points: if/else 3 (9 pts), loops 2 (6 pts), error handling 1 (5 pts) (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
DefaultMessageStore.resetWriteOffset (cognitive 20) store/src/main/java/org/apache/rocketmq/store/DefaultMessageStore.java:1559— DefaultMessageStore.resetWriteOffset has cognitive complexity 20 (threshold 15). Drivers by points: if/else 9 (15 pts), error handling 1 (2 pts), boolean chains 1, loops 1, ternaries 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
TopicQueueMappingUtils.checkPhysicalQueueConsistence (cognitive 20) remoting/src/main/java/org/apache/rocketmq/remoting/protocol/statictopic/TopicQueueMappingUtils.java:313— TopicQueueMappingUtils.checkPhysicalQueueConsistence has cognitive complexity 20 (threshold 15). Drivers by points: if/else 4 (14 pts), loops 3 (6 pts) (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
SendMessageActivity.buildMessageProperty (cognitive 20) proxy/src/main/java/org/apache/rocketmq/proxy/grpc/v2/producer/SendMessageActivity.java:194— SendMessageActivity.buildMessageProperty has cognitive complexity 20 (threshold 15). Drivers by points: if/else 14 (18 pts), loops 2 (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
LocalMessageCache.cleanExpireMsg (cognitive 20) openmessaging/src/main/java/io/openmessaging/rocketmq/consumer/LocalMessageCache.java:157— LocalMessageCache.cleanExpireMsg has cognitive complexity 20 (threshold 15). Drivers by points: if/else 5 (11 pts), error handling 2 (6 pts), loops 2 (3 pts) (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
AllocateMachineRoomNearby.allocate (cognitive 20) client/src/main/java/org/apache/rocketmq/client/consumer/rebalance/AllocateMachineRoomNearby.java:56— AllocateMachineRoomNearby.allocate has cognitive complexity 20 (threshold 15). Drivers by points: if/else 9 (16 pts), loops 3, boolean chains 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
MQClientInstance.unregisterClient (cognitive 20) client/src/main/java/org/apache/rocketmq/client/impl/factory/MQClientInstance.java:936— MQClientInstance.unregisterClient has cognitive complexity 20 (threshold 15). Drivers by points: error handling 3 (12 pts), if/else 2 (5 pts), loops 2 (3 pts) (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
DefaultMQProducerImpl.sendMessageInTransaction (cognitive 20) client/src/main/java/org/apache/rocketmq/client/impl/producer/DefaultMQProducerImpl.java:1382— DefaultMQProducerImpl.sendMessageInTransaction has cognitive complexity 20 (threshold 15). Drivers by points: if/else 8 (13 pts), error handling 3 (4 pts), boolean chains 2, match/switch 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
RebalanceLockManager.tryLockBatch (cognitive 20) broker/src/main/java/org/apache/rocketmq/broker/client/rebalance/RebalanceLockManager.java:125— RebalanceLockManager.tryLockBatch has cognitive complexity 20 (threshold 15). Drivers by points: if/else 7 (15 pts), loops 2 (3 pts), error handling 1 (2 pts) (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
PlainPermissionManager.load (cognitive 20) acl/src/main/java/org/apache/rocketmq/acl/plain/PlainPermissionManager.java:208— PlainPermissionManager.load has cognitive complexity 20 (threshold 15). Drivers by points: if/else 8 (10 pts), loops 3 (6 pts), boolean chains 4 (nesting depth added 5). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
UpdateSubGroupSubCommand.execute (cognitive 19) tools/src/main/java/org/apache/rocketmq/tools/command/consumer/UpdateSubGroupSubCommand.java:112— UpdateSubGroupSubCommand.execute has cognitive complexity 19 (threshold 15). Drivers by points: if/else 13, error handling 2 (4 pts), loops 1 (2 pts) (nesting depth added 3). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
ResetOffsetByTimeCommand.execute (cognitive 19) tools/src/main/java/org/apache/rocketmq/tools/command/offset/ResetOffsetByTimeCommand.java:84— ResetOffsetByTimeCommand.execute has cognitive complexity 19 (threshold 15). Drivers by points: if/else 9 (11 pts), error handling 3, ternaries 2 (3 pts), boolean chains 1, loops 1 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
UpdateStaticTopicSubCommand.execute (cognitive 19) tools/src/main/java/org/apache/rocketmq/tools/command/topic/UpdateStaticTopicSubCommand.java:123— UpdateStaticTopicSubCommand.execute has cognitive complexity 19 (threshold 15). Drivers by points: if/else 9 (11 pts), loops 2 (4 pts), boolean chains 3, error handling 1 (nesting depth added 4). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
UpdateTopicSubCommand.execute (cognitive 19) tools/src/main/java/org/apache/rocketmq/tools/command/topic/UpdateTopicSubCommand.java:97— UpdateTopicSubCommand.execute has cognitive complexity 19 (threshold 15). Drivers by points: if/else 11 (13 pts), loops 2 (5 pts), error handling 1 (nesting depth added 5). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
CommitLogInputStream.read (cognitive 19) tieredstore/src/main/java/org/apache/rocketmq/tieredstore/provider/stream/CommitLogInputStream.java:111— CommitLogInputStream.read has cognitive complexity 19 (threshold 15). Drivers by points: if/else 10 (13 pts), loops 2 (4 pts), boolean chains 2 (nesting depth added 5). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
TieredMessageFetcher.prefetchMessage (cognitive 19) tieredstore/src/main/java/org/apache/rocketmq/tieredstore/TieredMessageFetcher.java:120— TieredMessageFetcher.prefetchMessage has cognitive complexity 19 (threshold 15). Drivers by points: if/else 8 (11 pts), boolean chains 3, ternaries 1 (3 pts), loops 1 (2 pts) (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
DLedgerCommitLog.asyncPutMessages (cognitive 19) store/src/main/java/org/apache/rocketmq/store/dledger/DLedgerCommitLog.java:523— DLedgerCommitLog.asyncPutMessages has cognitive complexity 19 (threshold 15). Drivers by points: if/else 12 (14 pts), boolean chains 1, error handling 1, loops 1, match/switch 1, ternaries 1 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
DefaultHAClient.dispatchReadRequest (cognitive 19) store/src/main/java/org/apache/rocketmq/store/ha/DefaultHAClient.java:184— DefaultHAClient.dispatchReadRequest has cognitive complexity 19 (threshold 15). Drivers by points: if/else 6 (18 pts), loops 1 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Ticks.run (cognitive 19) store/src/main/java/org/apache/rocketmq/store/util/PerfCounter.java:324— Ticks.run has cognitive complexity 19 (threshold 15). Drivers by points: if/else 3 (8 pts), error handling 2 (5 pts), loops 3 (5 pts), boolean chains 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ConsumerRunningInfo.analyzeProcessQueue (cognitive 19) remoting/src/main/java/org/apache/rocketmq/remoting/protocol/body/ConsumerRunningInfo.java:111— ConsumerRunningInfo.analyzeProcessQueue has cognitive complexity 19 (threshold 15). Drivers by points: if/else 7 (15 pts), boolean chains 2, loops 1 (2 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
PullMessageRequestHeader.decode (cognitive 19) remoting/src/main/java/org/apache/rocketmq/remoting/protocol/header/PullMessageRequestHeader.java:97— PullMessageRequestHeader.decode has cognitive complexity 19 (threshold 15). Drivers by points: if/else 19. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
HAProxyMessageForwarder.forwardHAProxyMessage (cognitive 19) proxy/src/main/java/org/apache/rocketmq/proxy/remoting/protocol/http2proxy/HAProxyMessageForwarder.java:74— HAProxyMessageForwarder.forwardHAProxyMessage has cognitive complexity 19 (threshold 15). Drivers by points: if/else 10 (17 pts), loops 1, ternaries 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
DefaultAdminService.createTopicOnBroker (cognitive 19) proxy/src/main/java/org/apache/rocketmq/proxy/service/admin/DefaultAdminService.java:94— DefaultAdminService.createTopicOnBroker has cognitive complexity 19 (threshold 15). Drivers by points: if/else 6 (10 pts), loops 3 (5 pts), error handling 1 (2 pts), ternaries 1 (2 pts) (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
RoleChangeHandler.handle (cognitive 19) controller/src/main/java/org/apache/rocketmq/controller/impl/DLedgerController.java:524— RoleChangeHandler.handle has cognitive complexity 19 (threshold 15). Drivers by points: if/else 4 (13 pts), error handling 1 (3 pts), loops 1 (2 pts), match/switch 1 (nesting depth added 12). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
ConsumeMessageConcurrentlyService.processConsumeResult (cognitive 19) client/src/main/java/org/apache/rocketmq/client/impl/consumer/ConsumeMessageConcurrentlyService.java:242— ConsumeMessageConcurrentlyService.processConsumeResult has cognitive complexity 19 (threshold 15). Drivers by points: if/else 6 (12 pts), loops 2 (4 pts), match/switch 2, boolean chains 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ConsumeRequest.run (cognitive 19) client/src/main/java/org/apache/rocketmq/client/impl/consumer/ConsumeMessageConcurrentlyService.java:378— ConsumeRequest.run has cognitive complexity 19 (threshold 15). Drivers by points: if/else 14 (15 pts), loops 1 (2 pts), boolean chains 1, error handling 1 (nesting depth added 2). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
DefaultConsumerIdsChangeListener.handle (cognitive 19) broker/src/main/java/org/apache/rocketmq/broker/client/DefaultConsumerIdsChangeListener.java:61— DefaultConsumerIdsChangeListener.handle has cognitive complexity 19 (threshold 15). Drivers by points: if/else 6 (11 pts), loops 1 (4 pts), boolean chains 3, match/switch 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ReplicasManager.schedulingSyncBrokerMetadata (cognitive 19) broker/src/main/java/org/apache/rocketmq/broker/controller/ReplicasManager.java:641— ReplicasManager.schedulingSyncBrokerMetadata has cognitive complexity 19 (threshold 15). Drivers by points: if/else 8 (13 pts), error handling 3 (5 pts), boolean chains 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ExpressionMessageFilter.isMatchedByConsumeQueue (cognitive 19) broker/src/main/java/org/apache/rocketmq/broker/filter/ExpressionMessageFilter.java:60— ExpressionMessageFilter.isMatchedByConsumeQueue has cognitive complexity 19 (threshold 15). Drivers by points: if/else 9 (14 pts), boolean chains 3, error handling 1 (2 pts) (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
PopLongPollingService.polling (cognitive 19) broker/src/main/java/org/apache/rocketmq/broker/longpolling/PopLongPollingService.java:227— PopLongPollingService.polling has cognitive complexity 19 (threshold 15). Drivers by points: if/else 13 (18 pts), boolean chains 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
OrderInfo.getLockFreeTimestamp (cognitive 19) broker/src/main/java/org/apache/rocketmq/broker/offset/ConsumerOrderInfoManager.java:520— OrderInfo.getLockFreeTimestamp has cognitive complexity 19 (threshold 15). Drivers by points: if/else 6 (16 pts), boolean chains 2, loops 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
OrderInfo.needBlock (cognitive 19) broker/src/main/java/org/apache/rocketmq/broker/offset/ConsumerOrderInfoManager.java:489— OrderInfo.needBlock has cognitive complexity 19 (threshold 15). Drivers by points: if/else 7 (15 pts), boolean chains 3, loops 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
AbstractSendMessageProcessor.msgCheck (cognitive 19) broker/src/main/java/org/apache/rocketmq/broker/processor/AbstractSendMessageProcessor.java:459— AbstractSendMessageProcessor.msgCheck has cognitive complexity 19 (threshold 15). Drivers by points: if/else 11 (18 pts), boolean chains 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
AdminBrokerProcessor.resetOffsetInner (cognitive 19) broker/src/main/java/org/apache/rocketmq/broker/processor/AdminBrokerProcessor.java:1863— AdminBrokerProcessor.resetOffsetInner has cognitive complexity 19 (threshold 15). Drivers by points: if/else 9 (12 pts), loops 3 (4 pts), boolean chains 3 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ClientManageProcessor.heartBeat (cognitive 19) broker/src/main/java/org/apache/rocketmq/broker/processor/ClientManageProcessor.java:78— ClientManageProcessor.heartBeat has cognitive complexity 19 (threshold 15). Drivers by points: if/else 7 (15 pts), loops 3 (4 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
PopReviveService.mergeAndRevive (cognitive 19) broker/src/main/java/org/apache/rocketmq/broker/processor/PopReviveService.java:457— PopReviveService.mergeAndRevive has cognitive complexity 19 (threshold 15). Drivers by points: if/else 8 (15 pts), loops 2 (3 pts), boolean chains 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
RemoteAddressStrategyFactory.getRemoteAddressStrategy (cognitive 19) acl/src/main/java/org/apache/rocketmq/acl/plain/RemoteAddressStrategyFactory.java:41— RemoteAddressStrategyFactory.getRemoteAddressStrategy has cognitive complexity 19 (threshold 15). Drivers by points: if/else 10 (17 pts), boolean chains 2 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ClusterListSubCommand.printClusterMoreStats (cognitive 18) tools/src/main/java/org/apache/rocketmq/tools/command/cluster/ClusterListSubCommand.java:117— ClusterListSubCommand.printClusterMoreStats has cognitive complexity 18 (threshold 15). Drivers by points: loops 3 (7 pts), error handling 1 (5 pts), if/else 2 (5 pts), boolean chains 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
CommandUtil.fetchMasterAndSlaveDistinguish (cognitive 18) tools/src/main/java/org/apache/rocketmq/tools/command/CommandUtil.java:43— CommandUtil.fetchMasterAndSlaveDistinguish has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (13 pts), loops 2 (3 pts), boolean chains 2 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ReadSocketService.processReadEvent (cognitive 18) store/src/main/java/org/apache/rocketmq/store/ha/DefaultHAConnection.java:211— ReadSocketService.processReadEvent has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (15 pts), error handling 1 (2 pts), loops 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
RocksDBConsumeQueueTable.binarySearchInCQ (cognitive 18) store/src/main/java/org/apache/rocketmq/store/queue/RocksDBConsumeQueueTable.java:233— RocksDBConsumeQueueTable.binarySearchInCQ has cognitive complexity 18 (threshold 15). Drivers by points: if/else 8 (17 pts), loops 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
FlushRealTimeService.run (cognitive 18) store/src/main/java/org/apache/rocketmq/store/CommitLog.java:1489— FlushRealTimeService.run has cognitive complexity 18 (threshold 15). Drivers by points: if/else 6 (11 pts), error handling 1 (2 pts), loops 2, ternaries 1 (2 pts), boolean chains 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
DefaultMessageStore.queryMessage (cognitive 18) store/src/main/java/org/apache/rocketmq/store/DefaultMessageStore.java:1257— DefaultMessageStore.queryMessage has cognitive complexity 18 (threshold 15). Drivers by points: if/else 5 (12 pts), error handling 1 (3 pts), loops 2 (3 pts) (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
MessageExtEncoder.encode (cognitive 18) store/src/main/java/org/apache/rocketmq/store/MessageExtEncoder.java:282— MessageExtEncoder.encode has cognitive complexity 18 (threshold 15). Drivers by points: if/else 8 (14 pts), ternaries 1 (2 pts), boolean chains 1, loops 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
TopicQueueMappingUtils.findNext (cognitive 18) remoting/src/main/java/org/apache/rocketmq/remoting/protocol/statictopic/TopicQueueMappingUtils.java:649— TopicQueueMappingUtils.findNext has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (14 pts), boolean chains 3, loops 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
AttributeUtil.alterCurrentAttributes (cognitive 18) common/src/main/java/org/apache/rocketmq/common/attribute/AttributeUtil.java:32— AttributeUtil.alterCurrentAttributes has cognitive complexity 18 (threshold 15). Drivers by points: if/else 9 (16 pts), loops 2 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
LocalFileOffsetStore.readOffset (cognitive 18) client/src/main/java/org/apache/rocketmq/client/consumer/store/LocalFileOffsetStore.java:97— LocalFileOffsetStore.readOffset has cognitive complexity 18 (threshold 15). Drivers by points: if/else 5 (12 pts), error handling 1 (3 pts), match/switch 1 (2 pts), boolean chains 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
RebalanceImpl.truncateMessageQueueNotMyTopic (cognitive 18) client/src/main/java/org/apache/rocketmq/client/impl/consumer/RebalanceImpl.java:433— RebalanceImpl.truncateMessageQueueNotMyTopic has cognitive complexity 18 (threshold 15). Drivers by points: if/else 6 (14 pts), loops 4 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
1.run (cognitive 18) broker/src/main/java/org/apache/rocketmq/broker/dledger/DLedgerRoleChangeHandler.java:60— 1.run has cognitive complexity 18 (threshold 15). Drivers by points: if/else 5 (13 pts), loops 1 (2 pts), boolean chains 1, error handling 1, match/switch 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
PopLongPollingService.cleanUnusedResource (cognitive 18) broker/src/main/java/org/apache/rocketmq/broker/longpolling/PopLongPollingService.java:289— PopLongPollingService.cleanUnusedResource has cognitive complexity 18 (threshold 15). Drivers by points: if/else 6 (13 pts), loops 3 (4 pts), error handling 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ConsumerOrderInfoManager.autoClean (cognitive 18) broker/src/main/java/org/apache/rocketmq/broker/offset/ConsumerOrderInfoManager.java:259— ConsumerOrderInfoManager.autoClean has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (15 pts), loops 2 (3 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
BrokerOuterAPI.processSendResponse (cognitive 18) broker/src/main/java/org/apache/rocketmq/broker/out/BrokerOuterAPI.java:1056— BrokerOuterAPI.processSendResponse has cognitive complexity 18 (threshold 15). Drivers by points: if/else 5 (8 pts), ternaries 1 (4 pts), loops 1 (3 pts), boolean chains 2, match/switch 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
AckMessageProcessor.processRequest (cognitive 18) broker/src/main/java/org/apache/rocketmq/broker/processor/AckMessageProcessor.java:110— AckMessageProcessor.processRequest has cognitive complexity 18 (threshold 15). Drivers by points: if/else 8 (13 pts), boolean chains 3, loops 1 (2 pts) (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
SendMessageProcessor.handleRetryAndDLQ (cognitive 18) broker/src/main/java/org/apache/rocketmq/broker/processor/SendMessageProcessor.java:177— SendMessageProcessor.handleRetryAndDLQ has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (13 pts), boolean chains 3, ternaries 1 (2 pts) (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
SendMessageProcessor.sendBatchMessage (cognitive 18) broker/src/main/java/org/apache/rocketmq/broker/processor/SendMessageProcessor.java:531— SendMessageProcessor.sendBatchMessage has cognitive complexity 18 (threshold 15). Drivers by points: if/else 13 (15 pts), boolean chains 2, ternaries 1 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
TopicQueueMappingManager.updateTopicQueueMapping (cognitive 18) broker/src/main/java/org/apache/rocketmq/broker/topic/TopicQueueMappingManager.java:61— TopicQueueMappingManager.updateTopicQueueMapping has cognitive complexity 18 (threshold 15). Drivers by points: if/else 13 (16 pts), boolean chains 1, loops 1 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
merge_rocketmq_pr.main (cognitive 18) dev/merge_rocketmq_pr.py:355— merge_rocketmq_pr.main has cognitive complexity 18 (threshold 15). Drivers by points: if/else 12 (15 pts), boolean chains 2, loops 1 (nesting depth added 3). This file's own header attributes it to another copyright holder, so it is code this repository carries rather than code it wrote: restructuring the body in place forks it from upstream and turns every future re-sync into a manual merge. The performable moves are to leave the body as close to its upstream form as possible and keep it behind a narrow interface of your own, and to re-sync it when upstream changes — or, if it has already diverged far enough that you maintain it here, adopt it deliberately and then split the body into named stages.
PrintMessageSubCommand.execute (cognitive 17) tools/src/main/java/org/apache/rocketmq/tools/command/message/PrintMessageSubCommand.java:104— PrintMessageSubCommand.execute has cognitive complexity 17 (threshold 15). Drivers by points: error handling 2 (4 pts), if/else 2 (4 pts), loops 2 (3 pts), match/switch 1 (3 pts), ternaries 2, boolean chains 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
CompactionLog.getOffsetMap (cognitive 17) REDACTED:641— CompactionLog.getOffsetMap has cognitive complexity 17 (threshold 15). Drivers by points: if/else 4 (11 pts), error handling 1 (3 pts), loops 2 (3 pts) (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
CommitLog.isMappedFileMatchedRecover (cognitive 17) store/src/main/java/org/apache/rocketmq/store/CommitLog.java:825— CommitLog.isMappedFileMatchedRecover has cognitive complexity 17 (threshold 15). Drivers by points: if/else 8 (13 pts), boolean chains 2, ternaries 1 (2 pts) (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
MappedFileQueue.deleteExpiredFileByOffset (cognitive 17) store/src/main/java/org/apache/rocketmq/store/MappedFileQueue.java:527— MappedFileQueue.deleteExpiredFileByOffset has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (14 pts), loops 1 (2 pts), boolean chains 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
StoreStatsService.setPutMessageEntireTimeMax (cognitive 17) store/src/main/java/org/apache/rocketmq/store/StoreStatsService.java:170— StoreStatsService.setPutMessageEntireTimeMax has cognitive complexity 17 (threshold 15). Drivers by points: if/else 15, ternaries 1 (2 pts) (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
NettyRemotingClient.createChannel (cognitive 17) remoting/src/main/java/org/apache/rocketmq/remoting/netty/NettyRemotingClient.java:676— NettyRemotingClient.createChannel has cognitive complexity 17 (threshold 15). Drivers by points: if/else 10 (14 pts), error handling 1 (2 pts), boolean chains 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
TopicQueueMappingUtils.makeSureLogicQueueMappingItemImmutable (cognitive 17) remoting/src/main/java/org/apache/rocketmq/remoting/protocol/statictopic/TopicQueueMappingUtils.java:206— TopicQueueMappingUtils.makeSureLogicQueueMappingItemImmutable has cognitive complexity 17 (threshold 15). Drivers by points: if/else 8 (12 pts), boolean chains 4, loops 1 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
MessageQueueSelector.selectOneByPipeline (cognitive 17) proxy/src/main/java/org/apache/rocketmq/proxy/service/route/MessageQueueSelector.java:162— MessageQueueSelector.selectOneByPipeline has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (10 pts), ternaries 3 (6 pts), boolean chains 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ReplicasInfoManager.cleanBrokerData (cognitive 17) controller/src/main/java/org/apache/rocketmq/controller/impl/manager/ReplicasInfoManager.java:393— ReplicasInfoManager.cleanBrokerData has cognitive complexity 17 (threshold 15). Drivers by points: if/else 5 (10 pts), error handling 1 (3 pts), loops 1 (3 pts), boolean chains 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
BrokerContainerStartup.createBrokerContainer (cognitive 17) container/src/main/java/org/apache/rocketmq/container/BrokerContainerStartup.java:244— BrokerContainerStartup.createBrokerContainer has cognitive complexity 17 (threshold 15). Drivers by points: if/else 11 (12 pts), error handling 2 (3 pts), loops 1 (2 pts) (nesting depth added 3). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
DefaultTopAddressing.fetchNSAddr (cognitive 17) common/src/main/java/org/apache/rocketmq/common/namesrv/DefaultTopAddressing.java:109— DefaultTopAddressing.fetchNSAddr has cognitive complexity 17 (threshold 15). Drivers by points: if/else 10 (13 pts), loops 1 (2 pts), boolean chains 1, error handling 1 (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
1.onSuccess (cognitive 17) client/src/main/java/org/apache/rocketmq/client/impl/consumer/DefaultMQPushConsumerImpl.java:346— 1.onSuccess has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (13 pts), boolean chains 2, match/switch 1 (2 pts) (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
MQClientInstance.cleanOfflineBroker (cognitive 17) client/src/main/java/org/apache/rocketmq/client/impl/factory/MQClientInstance.java:427— MQClientInstance.cleanOfflineBroker has cognitive complexity 17 (threshold 15). Drivers by points: if/else 5 (11 pts), loops 2 (5 pts), error handling 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
PullMessageProcessor.composeResponseHeader (cognitive 17) broker/src/main/java/org/apache/rocketmq/broker/processor/PullMessageProcessor.java:596— PullMessageProcessor.composeResponseHeader has cognitive complexity 17 (threshold 15). Drivers by points: if/else 9 (14 pts), boolean chains 2, match/switch 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
HookUtils.handleScheduleMessage (cognitive 17) broker/src/main/java/org/apache/rocketmq/broker/util/HookUtils.java:129— HookUtils.handleScheduleMessage has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (16 pts), boolean chains 1 (nesting depth added 10). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
DefaultMQAdminExtImpl.consumed (cognitive 16) tools/src/main/java/org/apache/rocketmq/tools/admin/DefaultMQAdminExtImpl.java:1517— DefaultMQAdminExtImpl.consumed has cognitive complexity 16 (threshold 15). Drivers by points: if/else 4 (14 pts), boolean chains 1, loops 1 (nesting depth added 10). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
TieredFileSegment.commitAsync (cognitive 16) tieredstore/src/main/java/org/apache/rocketmq/tieredstore/provider/TieredFileSegment.java:353— TieredFileSegment.commitAsync has cognitive complexity 16 (threshold 15). Drivers by points: if/else 11 (13 pts), ternaries 1 (2 pts), error handling 1 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
AutoSwitchHAClient.run (cognitive 16) store/src/main/java/org/apache/rocketmq/store/ha/autoswitch/AutoSwitchHAClient.java:380— AutoSwitchHAClient.run has cognitive complexity 16 (threshold 15). Drivers by points: if/else 4 (11 pts), error handling 1 (2 pts), match/switch 1 (2 pts), loops 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
AutoSwitchHAService.truncateInvalidMsg (cognitive 16) store/src/main/java/org/apache/rocketmq/store/ha/autoswitch/AutoSwitchHAService.java:495— AutoSwitchHAService.truncateInvalidMsg has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (12 pts), loops 2 (3 pts), boolean chains 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
IndexService.load (cognitive 16) store/src/main/java/org/apache/rocketmq/store/index/IndexService.java:58— IndexService.load has cognitive complexity 16 (threshold 15). Drivers by points: if/else 3 (8 pts), error handling 2 (6 pts), loops 1 (2 pts) (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
IndexService.queryOffset (cognitive 16) store/src/main/java/org/apache/rocketmq/store/index/IndexService.java:166— IndexService.queryOffset has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (13 pts), loops 1 (2 pts), error handling 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
BatchConsumeQueue.correctMinOffset (cognitive 16) store/src/main/java/org/apache/rocketmq/store/queue/BatchConsumeQueue.java:458— BatchConsumeQueue.correctMinOffset has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (10 pts), error handling 1 (3 pts), loops 1 (3 pts) (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
RocksDBConsumeQueueTable.binarySearchInCQByTime (cognitive 16) store/src/main/java/org/apache/rocketmq/store/queue/RocksDBConsumeQueueTable.java:182— RocksDBConsumeQueueTable.binarySearchInCQByTime has cognitive complexity 16 (threshold 15). Drivers by points: if/else 10 (13 pts), ternaries 1 (2 pts), loops 1 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
TimerMessageStore.reviseQueueOffset (cognitive 16) store/src/main/java/org/apache/rocketmq/store/timer/TimerMessageStore.java:321— TimerMessageStore.reviseQueueOffset has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (11 pts), boolean chains 2, error handling 1 (2 pts), loops 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
CleanConsumeQueueService.deleteExpiredFiles (cognitive 16) store/src/main/java/org/apache/rocketmq/store/DefaultMessageStore.java:2470— CleanConsumeQueueService.deleteExpiredFiles has cognitive complexity 16 (threshold 15). Drivers by points: error handling 1 (5 pts), if/else 2 (5 pts), loops 2 (5 pts), boolean chains 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
StoreStatsService.findPutMessageEntireTimePX (cognitive 16) store/src/main/java/org/apache/rocketmq/store/StoreStatsService.java:126— StoreStatsService.findPutMessageEntireTimePX has cognitive complexity 16 (threshold 15). Drivers by points: ternaries 2 (8 pts), if/else 4 (7 pts), loops 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
NettyRemotingClient.closeChannel (cognitive 16) remoting/src/main/java/org/apache/rocketmq/remoting/netty/NettyRemotingClient.java:401— NettyRemotingClient.closeChannel has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (11 pts), error handling 2 (3 pts), boolean chains 1, ternaries 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ProducerProcessor.sendMessage (cognitive 16) proxy/src/main/java/org/apache/rocketmq/proxy/processor/ProducerProcessor.java:67— ProducerProcessor.sendMessage has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (11 pts), boolean chains 2, loops 2, error handling 1 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
DefaultElectPolicy.tryElect (cognitive 16) controller/src/main/java/org/apache/rocketmq/controller/elect/impl/DefaultElectPolicy.java:91— DefaultElectPolicy.tryElect has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (11 pts), ternaries 1 (3 pts), boolean chains 2 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
DefaultJoranConfiguratorExt.findConfigFileURLFromSystemProperties (cognitive 16) common/src/main/java/org/apache/rocketmq/common/logging/DefaultJoranConfiguratorExt.java:110— DefaultJoranConfiguratorExt.findConfigFileURLFromSystemProperties has cognitive complexity 16 (threshold 15). Drivers by points: if/else 4 (9 pts), error handling 2 (6 pts), boolean chains 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
NetworkUtil.openSelector (cognitive 16) common/src/main/java/org/apache/rocketmq/common/utils/NetworkUtil.java:56— NetworkUtil.openSelector has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (11 pts), error handling 2 (5 pts) (nesting depth added 9). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
RemoteBrokerOffsetStore.persistAll (cognitive 16) client/src/main/java/org/apache/rocketmq/client/consumer/store/RemoteBrokerOffsetStore.java:115— RemoteBrokerOffsetStore.persistAll has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (8 pts), error handling 1 (4 pts), loops 2 (3 pts), boolean chains 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
DefaultMQPushConsumerImpl.start (cognitive 16) client/src/main/java/org/apache/rocketmq/client/impl/consumer/DefaultMQPushConsumerImpl.java:901— DefaultMQPushConsumerImpl.start has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (12 pts), match/switch 2 (4 pts) (nesting depth added 7). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
AsyncRunnable.run (cognitive 16) client/src/main/java/org/apache/rocketmq/client/trace/AsyncTraceDispatcher.java:253— AsyncRunnable.run has cognitive complexity 16 (threshold 15). Drivers by points: if/else 3 (9 pts), error handling 1 (3 pts), loops 2 (3 pts), boolean chains 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
AdminBrokerProcessor.updateBrokerConfig (cognitive 16) broker/src/main/java/org/apache/rocketmq/broker/processor/AdminBrokerProcessor.java:920— AdminBrokerProcessor.updateBrokerConfig has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (10 pts), ternaries 1 (4 pts), error handling 1 (2 pts) (nesting depth added 9). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
PopReviveService.reviveMsgFromCk (cognitive 16) broker/src/main/java/org/apache/rocketmq/broker/processor/PopReviveService.java:512— PopReviveService.reviveMsgFromCk has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8 (11 pts), loops 3, match/switch 1 (2 pts) (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ScheduleMessageService.start (cognitive 16) broker/src/main/java/org/apache/rocketmq/broker/schedule/ScheduleMessageService.java:133— ScheduleMessageService.start has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (13 pts), loops 1 (2 pts), error handling 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
TopicRouteInfoManager.updateTopicRouteInfoFromNameServer (cognitive 16) broker/src/main/java/org/apache/rocketmq/broker/topic/TopicRouteInfoManager.java:92— TopicRouteInfoManager.updateTopicRouteInfoFromNameServer has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (10 pts), error handling 3 (5 pts), boolean chains 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
PlainPermissionManager.getAllAclConfig (cognitive 16) acl/src/main/java/org/apache/rocketmq/acl/plain/PlainPermissionManager.java:508— PlainPermissionManager.getAllAclConfig has cognitive complexity 16 (threshold 15). Drivers by points: if/else 4 (10 pts), loops 2 (4 pts), boolean chains 2 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Change-coupling hub: ReplicasInfoManager.java → Controller.java, ControllerManager.java, DefaultBrokerHeartbeatManager.java, ControllerRequestProcessor.java controller/src/main/java/org/apache/rocketmq/controller/impl/manager/ReplicasInfoManager.java— `controller/src/main/java/org/apache/rocketmq/controller/impl/manager/ReplicasInfoManager.java` changes together with 4 other files — `controller/src/main/java/org/apache/rocketmq/controller/Controller.java`, `controller/src/main/java/org/apache/rocketmq/controller/ControllerManager.java`, `controller/src/main/java/org/apache/rocketmq/controller/impl/heartbeat/DefaultBrokerHeartbeatManager.java`, `controller/src/main/java/org/apache/rocketmq/controller/processor/ControllerRequestProcessor.java` — none of which declares a dependency on it: one file is the hub of 4 separate couplings, not 4 unrelated pairs. Read the hub first: if the others each duplicate a part of what it does, the shared concern belongs in ONE unit and extracting it clears every edge at once; if the hub is a registry, dispatcher or barrel that must name each of them, the coupling is structural and the question is whether that list can be discovered instead of enumerated. Fixing the hub is one change; breaking the couplings one pair at a time is 4.
Near-duplicate member pair (54 shared lines) client/src/main/java/org/apache/rocketmq/client/impl/consumer/RebalanceImpl.java:474— client/src/main/java/org/apache/rocketmq/client/impl/consumer/RebalanceImpl.java:474-553 | client/src/main/java/org/apache/rocketmq/client/impl/consumer/RebalanceImpl.java:556-740 — These two members are variants of one another: 54 of their lines are already reported as duplicated blocks below, spread through both bodies rather than gathered into one. Read them as a single construct written twice. The repair is at the members' grain — factor the shared pipeline into one implementation the two call with their differences as parameters or as an injected step, or, where the difference is systematic (sync against async, one transport against another), generate one from the other. Extracting the individual blocks below is not the same fix: it leaves the two bodies in place and the next edit still has to be made twice.
Near-duplicate member pair (44 shared lines) client/src/main/java/org/apache/rocketmq/client/impl/factory/MQClientInstance.java:585— client/src/main/java/org/apache/rocketmq/client/impl/factory/MQClientInstance.java:585-634 | client/src/main/java/org/apache/rocketmq/client/impl/factory/MQClientInstance.java:636-711 — These two members are variants of one another: 44 of their lines are already reported as duplicated blocks below, spread through both bodies rather than gathered into one. Read them as a single construct written twice. The repair is at the members' grain — factor the shared pipeline into one implementation the two call with their differences as parameters or as an injected step, or, where the difference is systematic (sync against async, one transport against another), generate one from the other. Extracting the individual blocks below is not the same fix: it leaves the two bodies in place and the next edit still has to be made twice.
Near-duplicate member pair (37 shared lines) tools/src/main/java/org/apache/rocketmq/tools/command/acl/UpdateAccessConfigSubCommand.java:47— tools/src/main/java/org/apache/rocketmq/tools/command/acl/UpdateAccessConfigSubCommand.java:47-92 | tools/src/main/java/org/apache/rocketmq/tools/command/topic/UpdateTopicSubCommand.java:49-94 — These two members are variants of one another: 37 of their lines are already reported as duplicated blocks below, spread through both bodies rather than gathered into one. Read them as a single construct written twice. The repair is at the members' grain — factor the shared pipeline into one implementation the two call with their differences as parameters or as an injected step, or, where the difference is systematic (sync against async, one transport against another), generate one from the other. Extracting the individual blocks below is not the same fix: it leaves the two bodies in place and the next edit still has to be made twice.
Near-duplicate member pair (25 shared lines) tools/src/main/java/org/apache/rocketmq/tools/admin/DefaultMQAdminExtImpl.java:1335— tools/src/main/java/org/apache/rocketmq/tools/admin/DefaultMQAdminExtImpl.java:1335-1418 | tools/src/main/java/org/apache/rocketmq/tools/admin/DefaultMQAdminExtImpl.java:1433-1508 — These two members are variants of one another: 25 of their lines are already reported as duplicated blocks below, spread through both bodies rather than gathered into one. Read them as a single construct written twice. The repair is at the members' grain — factor the shared pipeline into one implementation the two call with their differences as parameters or as an injected step, or, where the difference is systematic (sync against async, one transport against another), generate one from the other. Extracting the individual blocks below is not the same fix: it leaves the two bodies in place and the next edit still has to be made twice.
D4 · Code Duplication· Edited copy of a member (29 corresponding lines) · ×1
Edited copy of a member (29 corresponding lines) tools/src/main/java/org/apache/rocketmq/tools/command/message/SendMessageCommand.java:48— tools/src/main/java/org/apache/rocketmq/tools/command/message/SendMessageCommand.java:48-78 | tools/src/main/java/org/apache/rocketmq/tools/command/topic/UpdateTopicSubCommand.java:49-94 — These two members are one piece of code written twice and then edited apart: 29 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (33 corresponding lines) · ×1
Edited copy of a member (33 corresponding lines) tools/src/main/java/org/apache/rocketmq/tools/command/message/ConsumeMessageCommand.java:77— tools/src/main/java/org/apache/rocketmq/tools/command/message/ConsumeMessageCommand.java:77-115 | tools/src/main/java/org/apache/rocketmq/tools/command/message/PrintMessageSubCommand.java:69-101 — These two members are one piece of code written twice and then edited apart: 33 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (20 corresponding lines) · ×1
Edited copy of a member (20 corresponding lines) tools/src/main/java/org/apache/rocketmq/tools/command/broker/UpdateBrokerConfigSubCommand.java:44— tools/src/main/java/org/apache/rocketmq/tools/command/broker/UpdateBrokerConfigSubCommand.java:44-66 | tools/src/main/java/org/apache/rocketmq/tools/command/consumer/SetConsumeModeSubCommand.java:46-72 — These two members are one piece of code written twice and then edited apart: 20 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (19 corresponding lines) · ×1
Edited copy of a member (19 corresponding lines) example/src/main/java/org/apache/rocketmq/example/operation/Consumer.java:72— example/src/main/java/org/apache/rocketmq/example/operation/Consumer.java:72-110 | tools/src/main/java/org/apache/rocketmq/tools/command/consumer/SetConsumeModeSubCommand.java:46-72 — These two members are one piece of code written twice and then edited apart: 19 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (21 corresponding lines) · ×1
Edited copy of a member (21 corresponding lines) tools/src/main/java/org/apache/rocketmq/tools/command/message/QueryMsgByKeySubCommand.java:43— tools/src/main/java/org/apache/rocketmq/tools/command/message/QueryMsgByKeySubCommand.java:43-65 | tools/src/main/java/org/apache/rocketmq/tools/command/topic/UpdateTopicSubCommand.java:49-94 — These two members are one piece of code written twice and then edited apart: 21 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Members sharing a duplicated core (11 members, 50+ identical tokens) · ×1
Members sharing a duplicated core (11 members, 50+ identical tokens) client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:362— client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:362-381 | client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:385-413 | client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:417-442 | client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:445-463 | client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:467-486 | client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:1442-1457 | client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:1583-1607 | client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:2073-2089 | client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:2131-2149 | client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:2742-2761 | client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:3048-3074 — These 11 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 11 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 11 times.
D4 · Code Duplication· Members sharing a duplicated core (10 members, 50+ identical tokens) · ×1
Members sharing a duplicated core (10 members, 50+ identical tokens) tools/src/main/java/org/apache/rocketmq/tools/command/acl/ClusterAclConfigVersionListSubCommand.java:71— tools/src/main/java/org/apache/rocketmq/tools/command/acl/ClusterAclConfigVersionListSubCommand.java:71-115 | tools/src/main/java/org/apache/rocketmq/tools/command/acl/DeleteAccessConfigSubCommand.java:70-111 | tools/src/main/java/org/apache/rocketmq/tools/command/acl/UpdateAccessConfigSubCommand.java:96-184 | tools/src/main/java/org/apache/rocketmq/tools/command/acl/UpdateGlobalWhiteAddrSubCommand.java:70-115 | tools/src/main/java/org/apache/rocketmq/tools/command/broker/RemoveColdDataFlowCtrGroupConfigSubCommand.java:60-92 | tools/src/main/java/org/apache/rocketmq/tools/command/broker/UpdateColdDataFlowCtrGroupConfigSubCommand.java:67-102 | tools/src/main/java/org/apache/rocketmq/tools/command/consumer/DeleteSubscriptionGroupCommand.java:64-114 | tools/src/main/java/org/apache/rocketmq/tools/command/consumer/SetConsumeModeSubCommand.java:77-134 | tools/src/main/java/org/apache/rocketmq/tools/command/consumer/UpdateSubGroupSubCommand.java:113-227 | tools/src/main/java/org/apache/rocketmq/tools/command/topic/UpdateTopicSubCommand.java:98-202 — These 10 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 10 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 10 times.
D4 · Code Duplication· Members sharing a duplicated core (9 members, 50+ identical tokens) · ×1
Members sharing a duplicated core (9 members, 50+ identical tokens) proxy/src/main/java/org/apache/rocketmq/proxy/grpc/v2/GrpcMessagingApplication.java:196— proxy/src/main/java/org/apache/rocketmq/proxy/grpc/v2/GrpcMessagingApplication.java:196-211 | proxy/src/main/java/org/apache/rocketmq/proxy/grpc/v2/GrpcMessagingApplication.java:214-229 | proxy/src/main/java/org/apache/rocketmq/proxy/grpc/v2/GrpcMessagingApplication.java:232-247 | proxy/src/main/java/org/apache/rocketmq/proxy/grpc/v2/GrpcMessagingApplication.java:251-266 | proxy/src/main/java/org/apache/rocketmq/proxy/grpc/v2/GrpcMessagingApplication.java:286-301 | proxy/src/main/java/org/apache/rocketmq/proxy/grpc/v2/GrpcMessagingApplication.java:305-320 | proxy/src/main/java/org/apache/rocketmq/proxy/grpc/v2/GrpcMessagingApplication.java:323-338 | proxy/src/main/java/org/apache/rocketmq/proxy/grpc/v2/GrpcMessagingApplication.java:342-357 | proxy/src/main/java/org/apache/rocketmq/proxy/grpc/v2/GrpcMessagingApplication.java:361-376 — These 9 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 9 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 9 times.
Duplicated block (58 lines × 2) common/src/main/java/org/apache/rocketmq/common/stats/StatsItem.java:94— common/src/main/java/org/apache/rocketmq/common/stats/StatsItem.java:94-151 | common/src/main/java/org/apache/rocketmq/common/stats/StatsItemSet.java:47-104 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `common/src/main/java/org/apache/rocketmq/common/stats/StatsItem.java:94` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (3–54 lines × 3) tools/src/main/java/org/apache/rocketmq/tools/command/consumer/ConsumerStatusSubCommand.java:100— tools/src/main/java/org/apache/rocketmq/tools/command/consumer/ConsumerStatusSubCommand.java:100-153 | tools/src/main/java/org/apache/rocketmq/tools/command/consumer/ConsumerSubCommand.java:84-137 | tools/src/main/java/org/apache/rocketmq/tools/monitor/DefaultMonitorListener.java:68-70 — before extracting anything, compare `tools/src/main/java/org/apache/rocketmq/tools/command/consumer/ConsumerStatusSubCommand.java` and `tools/src/main/java/org/apache/rocketmq/tools/command/consumer/ConsumerSubCommand.java` as WHOLE FILES: 86% of the shorter file's lines also appear in the other, so this reads as one file having been copied from the other rather than as a helper waiting to be extracted. The 1 duplicated block(s) this scan matched between them are fragments of that copy, not the extent of it — treat the file pair as the unit. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `tools/src/main/java/org/apache/rocketmq/tools/command/consumer/ConsumerStatusSubCommand.java:100` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (43 lines × 2) client/src/main/java/org/apache/rocketmq/client/impl/consumer/ConsumeMessageOrderlyService.java:140— client/src/main/java/org/apache/rocketmq/client/impl/consumer/ConsumeMessageOrderlyService.java:140-182 | client/src/main/java/org/apache/rocketmq/client/impl/consumer/ConsumeMessagePopOrderlyService.java:134-176 — before extracting anything, compare `client/src/main/java/org/apache/rocketmq/client/impl/consumer/ConsumeMessageOrderlyService.java` and `client/src/main/java/org/apache/rocketmq/client/impl/consumer/ConsumeMessagePopOrderlyService.java` as WHOLE FILES: this scan already matched 11 separate duplicated blocks between them, totalling at least 138 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `client/src/main/java/org/apache/rocketmq/client/impl/consumer/ConsumeMessageOrderlyService.java:140` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (39–41 lines × 2) common/src/main/java/org/apache/rocketmq/common/message/MessageDecoder.java:235— common/src/main/java/org/apache/rocketmq/common/message/MessageDecoder.java:235-273 | common/src/main/java/org/apache/rocketmq/common/message/MessageDecoder.java:349-389 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `common/src/main/java/org/apache/rocketmq/common/message/MessageDecoder.java:235` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (38 lines × 2) common/src/main/java/org/apache/rocketmq/common/UtilAll.java:365— common/src/main/java/org/apache/rocketmq/common/UtilAll.java:365-402 | common/src/main/java/org/apache/rocketmq/common/compression/ZlibCompressor.java:60-97 — before extracting anything, compare `common/src/main/java/org/apache/rocketmq/common/UtilAll.java` and `common/src/main/java/org/apache/rocketmq/common/compression/ZlibCompressor.java` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 72 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
Duplicated block (32–36 lines × 2) common/src/main/java/org/apache/rocketmq/common/config/ConfigRocksDBStorage.java:136— common/src/main/java/org/apache/rocketmq/common/config/ConfigRocksDBStorage.java:136-171 | store/src/main/java/org/apache/rocketmq/store/rocksdb/RocksDBOptionsFactory.java:93-124 — before extracting anything, compare `common/src/main/java/org/apache/rocketmq/common/config/ConfigRocksDBStorage.java` and `store/src/main/java/org/apache/rocketmq/store/rocksdb/RocksDBOptionsFactory.java` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 56 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
Duplicated block (32 lines × 2) client/src/main/java/org/apache/rocketmq/client/impl/consumer/ConsumeMessageConcurrentlyService.java:192— client/src/main/java/org/apache/rocketmq/client/impl/consumer/ConsumeMessageConcurrentlyService.java:192-223 | client/src/main/java/org/apache/rocketmq/client/impl/consumer/ConsumeMessagePopConcurrentlyService.java:181-212 — before extracting anything, compare `client/src/main/java/org/apache/rocketmq/client/impl/consumer/ConsumeMessageConcurrentlyService.java` and `client/src/main/java/org/apache/rocketmq/client/impl/consumer/ConsumeMessagePopConcurrentlyService.java` as WHOLE FILES: this scan already matched 8 separate duplicated blocks between them, totalling at least 122 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit. Note first that the copies are not typed on the same thing: the declarations holding them bind `processQueue` to `ProcessQueue` in one and `PopProcessQueue` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
Duplicated block (28 lines × 3) tools/src/main/java/org/apache/rocketmq/tools/command/broker/GetBrokerEpochSubCommand.java:64— tools/src/main/java/org/apache/rocketmq/tools/command/broker/GetBrokerEpochSubCommand.java:64-91 | tools/src/main/java/org/apache/rocketmq/tools/command/ha/GetSyncStateSetSubCommand.java:69-96 | tools/src/main/java/org/apache/rocketmq/tools/command/ha/HAStatusSubCommand.java:66-93 — before extracting anything, compare `tools/src/main/java/org/apache/rocketmq/tools/command/broker/GetBrokerEpochSubCommand.java` and `tools/src/main/java/org/apache/rocketmq/tools/command/ha/GetSyncStateSetSubCommand.java` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 73 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `tools/src/main/java/org/apache/rocketmq/tools/command/ha/GetSyncStateSetSubCommand.java:100` calls `getOptionValue`, `trim`, `split` and `tools/src/main/java/org/apache/rocketmq/tools/command/broker/GetBrokerEpochSubCommand.java:95` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (27–28 lines × 2) store/src/main/java/org/apache/rocketmq/store/CommitLog.java:379— store/src/main/java/org/apache/rocketmq/store/CommitLog.java:379-405 | store/src/main/java/org/apache/rocketmq/store/CommitLog.java:777-804 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `store/src/main/java/org/apache/rocketmq/store/CommitLog.java:379` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (25–26 lines × 2) broker/src/main/java/org/apache/rocketmq/broker/out/BrokerOuterAPI.java:1412— broker/src/main/java/org/apache/rocketmq/broker/out/BrokerOuterAPI.java:1412-1437 | client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:1048-1072 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
Duplicated block (24–26 lines × 2) client/src/main/java/org/apache/rocketmq/client/impl/consumer/RebalanceImpl.java:525— client/src/main/java/org/apache/rocketmq/client/impl/consumer/RebalanceImpl.java:525-550 | client/src/main/java/org/apache/rocketmq/client/impl/consumer/RebalanceImpl.java:687-710 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `client/src/main/java/org/apache/rocketmq/client/impl/consumer/RebalanceImpl.java:525` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (25 lines × 2) common/src/main/java/org/apache/rocketmq/common/message/MessageDecoder.java:281— common/src/main/java/org/apache/rocketmq/common/message/MessageDecoder.java:281-305 | common/src/main/java/org/apache/rocketmq/common/message/MessageDecoder.java:388-412 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `common/src/main/java/org/apache/rocketmq/common/message/MessageDecoder.java:281` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
Duplicated block (23–24 lines × 3) client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:2657— client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:2657-2680 | client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:2687-2709 | client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:2716-2738 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:2657` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (19–24 lines × 2) broker/src/main/java/org/apache/rocketmq/broker/processor/ClientManageProcessor.java:99— broker/src/main/java/org/apache/rocketmq/broker/processor/ClientManageProcessor.java:99-122 | broker/src/main/java/org/apache/rocketmq/broker/processor/ClientManageProcessor.java:165-183 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `broker/src/main/java/org/apache/rocketmq/broker/processor/ClientManageProcessor.java:99` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (20–22 lines × 2) proxy/src/main/java/org/apache/rocketmq/proxy/remoting/RemotingProtocolServer.java:244— proxy/src/main/java/org/apache/rocketmq/proxy/remoting/RemotingProtocolServer.java:244-263 | remoting/src/main/java/org/apache/rocketmq/remoting/RemotingClient.java:54-75 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `proxy/src/main/java/org/apache/rocketmq/proxy/remoting/RemotingProtocolServer.java:244` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
Duplicated block (20–21 lines × 2) client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:889— client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:889-909 | proxy/src/main/java/org/apache/rocketmq/proxy/service/message/LocalMessageService.java:381-400 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:889` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (17–18 lines × 3) broker/src/main/java/org/apache/rocketmq/broker/processor/AdminBrokerProcessor.java:1562— broker/src/main/java/org/apache/rocketmq/broker/processor/AdminBrokerProcessor.java:1562-1579 | broker/src/main/java/org/apache/rocketmq/broker/processor/AdminBrokerProcessor.java:1616-1632 | proxy/src/main/java/org/apache/rocketmq/proxy/remoting/activity/ConsumerManagerActivity.java:108-125 — there are 3 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 3 sites; resolving a subset leaves the remainder to drift apart. Read the line range as the matched WINDOW rather than a finished unit: at `broker/src/main/java/org/apache/rocketmq/broker/processor/AdminBrokerProcessor.java:1562` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
Duplicated block (16–17 lines × 4) client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:2184— client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:2184-2200 | client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:2213-2228 | client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:2888-2904 | client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:3227-3243 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:2184` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (17 lines × 3) broker/src/main/java/org/apache/rocketmq/broker/processor/AdminBrokerProcessor.java:742— broker/src/main/java/org/apache/rocketmq/broker/processor/AdminBrokerProcessor.java:742-758 | broker/src/main/java/org/apache/rocketmq/broker/processor/AdminBrokerProcessor.java:1449-1465 | broker/src/main/java/org/apache/rocketmq/broker/processor/AdminBrokerProcessor.java:1737-1753 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `broker/src/main/java/org/apache/rocketmq/broker/processor/AdminBrokerProcessor.java:742` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (4–17 lines × 3) tools/src/main/java/org/apache/rocketmq/tools/command/broker/CommitLogSetReadAheadSubCommand.java:83— tools/src/main/java/org/apache/rocketmq/tools/command/broker/CommitLogSetReadAheadSubCommand.java:83-86 | tools/src/main/java/org/apache/rocketmq/tools/command/broker/GetBrokerConfigCommand.java:67-83 | tools/src/main/java/org/apache/rocketmq/tools/command/broker/GetColdDataFlowCtrInfoSubCommand.java:69-79 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 3 call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `tools/src/main/java/org/apache/rocketmq/tools/command/broker/CommitLogSetReadAheadSubCommand.java:83` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `tools/src/main/java/org/apache/rocketmq/tools/command/broker/GetColdDataFlowCtrInfoSubCommand.java:79` calls `start` and `tools/src/main/java/org/apache/rocketmq/tools/command/broker/CommitLogSetReadAheadSubCommand.java:86` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (13–16 lines × 2) broker/src/main/java/org/apache/rocketmq/broker/BrokerStartup.java:266— broker/src/main/java/org/apache/rocketmq/broker/BrokerStartup.java:266-278 | tools/src/main/java/org/apache/rocketmq/tools/command/export/ExportMetadataCommand.java:63-78 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `broker/src/main/java/org/apache/rocketmq/broker/BrokerStartup.java:266` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
Duplicated block (15–16 lines × 2) client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:2444— client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:2444-2458 | client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:2491-2506 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:2444` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (12–14 lines × 2) broker/src/main/java/org/apache/rocketmq/broker/processor/ClientManageProcessor.java:134— broker/src/main/java/org/apache/rocketmq/broker/processor/ClientManageProcessor.java:134-147 | broker/src/main/java/org/apache/rocketmq/broker/processor/ClientManageProcessor.java:191-202 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `broker/src/main/java/org/apache/rocketmq/broker/processor/ClientManageProcessor.java:134` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (8–13 lines × 31) proxy/src/main/java/org/apache/rocketmq/proxy/ProxyStartup.java:153— proxy/src/main/java/org/apache/rocketmq/proxy/ProxyStartup.java:153-160 | tools/src/main/java/org/apache/rocketmq/tools/command/acl/UpdateAccessConfigSubCommand.java:68-75 | tools/src/main/java/org/apache/rocketmq/tools/command/broker/BrokerConsumeStatsSubCommad.java:74-81 | tools/src/main/java/org/apache/rocketmq/tools/command/broker/CommitLogSetReadAheadSubCommand.java:53-60 | tools/src/main/java/org/apache/rocketmq/tools/command/broker/DeleteExpiredCommitLogSubCommand.java:46-53 | tools/src/main/java/org/apache/rocketmq/tools/command/broker/GetBrokerEpochSubCommand.java:47-54 | tools/src/main/java/org/apache/rocketmq/tools/command/broker/RemoveColdDataFlowCtrGroupConfigSubCommand.java:45-52 | tools/src/main/java/org/apache/rocketmq/tools/command/broker/UpdateBrokerConfigSubCommand.java:46-53 | tools/src/main/java/org/apache/rocketmq/tools/command/broker/UpdateColdDataFlowCtrGroupConfigSubCommand.java:48-55 | tools/src/main/java/org/apache/rocketmq/tools/command/cluster/CLusterSendMsgRTCommand.java:57-64 | tools/src/main/java/org/apache/rocketmq/tools/command/cluster/ClusterListSubCommand.java:50-57 | tools/src/main/java/org/apache/rocketmq/tools/command/consumer/DeleteSubscriptionGroupCommand.java:45-52 | tools/src/main/java/org/apache/rocketmq/tools/command/consumer/SetConsumeModeSubCommand.java:48-55 | tools/src/main/java/org/apache/rocketmq/tools/command/consumer/UpdateSubGroupSubCommand.java:50-57 | tools/src/main/java/org/apache/rocketmq/tools/command/consumer/UpdateSubGroupSubCommand.java:62-69 | tools/src/main/java/org/apache/rocketmq/tools/command/consumer/UpdateSubGroupSubCommand.java:88-100 | tools/src/main/java/org/apache/rocketmq/tools/command/export/ExportMetadataCommand.java:55-62 | tools/src/main/java/org/apache/rocketmq/tools/command/ha/GetSyncStateSetSubCommand.java:53-60 | tools/src/main/java/org/apache/rocketmq/tools/command/ha/HAStatusSubCommand.java:50-57 | tools/src/main/java/org/apache/rocketmq/tools/command/message/ConsumeMessageCommand.java:83-90 | tools/src/main/java/org/apache/rocketmq/tools/command/message/PrintMessageByQueueCommand.java:129-136 | tools/src/main/java/org/apache/rocketmq/tools/command/message/PrintMessageSubCommand.java:75-84 | tools/src/main/java/org/apache/rocketmq/tools/command/message/QueryMsgByIdSubCommand.java:199-206 | tools/src/main/java/org/apache/rocketmq/tools/command/message/QueryMsgByKeySubCommand.java:53-60 | tools/src/main/java/org/apache/rocketmq/tools/command/message/QueryMsgByUniqueKeySubCommand.java:154-161 | tools/src/main/java/org/apache/rocketmq/tools/command/message/QueryMsgTraceByIdSubCommand.java:48-55 | tools/src/main/java/org/apache/rocketmq/tools/command/message/SendMessageCommand.java:58-65 | tools/src/main/java/org/apache/rocketmq/tools/command/offset/ResetOffsetByTimeCommand.java:65-72 | tools/src/main/java/org/apache/rocketmq/tools/command/queue/QueryConsumeQueueCommand.java:72-79 | tools/src/main/java/org/apache/rocketmq/tools/command/topic/UpdateTopicPermSubCommand.java:53-60 | tools/src/main/java/org/apache/rocketmq/tools/command/topic/UpdateTopicSubCommand.java:70-77 — there are 31 copies across 29 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 31 sites; resolving a subset leaves the remainder to drift apart. Read the line range as the matched WINDOW rather than a finished unit: at `tools/src/main/java/org/apache/rocketmq/tools/command/consumer/UpdateSubGroupSubCommand.java:88` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `tools/src/main/java/org/apache/rocketmq/tools/command/broker/BrokerConsumeStatsSubCommad.java:70` calls `setRequired`, `addOption`, `Option` and `tools/src/main/java/org/apache/rocketmq/tools/command/broker/CommitLogSetReadAheadSubCommand.java:52` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (13 lines × 6) filter/src/main/java/org/apache/rocketmq/filter/expression/ComparisonExpression.java:87— filter/src/main/java/org/apache/rocketmq/filter/expression/ComparisonExpression.java:87-99 | filter/src/main/java/org/apache/rocketmq/filter/expression/ComparisonExpression.java:125-137 | filter/src/main/java/org/apache/rocketmq/filter/expression/ComparisonExpression.java:171-183 | filter/src/main/java/org/apache/rocketmq/filter/expression/ComparisonExpression.java:209-221 | filter/src/main/java/org/apache/rocketmq/filter/expression/ComparisonExpression.java:255-267 | filter/src/main/java/org/apache/rocketmq/filter/expression/ComparisonExpression.java:293-305 — all 6 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (11–13 lines × 5) broker/src/main/java/org/apache/rocketmq/broker/processor/NotificationProcessor.java:106— broker/src/main/java/org/apache/rocketmq/broker/processor/NotificationProcessor.java:106-117 | broker/src/main/java/org/apache/rocketmq/broker/processor/PeekMessageProcessor.java:116-126 | broker/src/main/java/org/apache/rocketmq/broker/processor/PollingInfoProcessor.java:94-104 | broker/src/main/java/org/apache/rocketmq/broker/processor/PopMessageProcessor.java:275-287 | broker/src/main/java/org/apache/rocketmq/broker/processor/PullMessageProcessor.java:325-337 — before extracting anything, compare `broker/src/main/java/org/apache/rocketmq/broker/processor/NotificationProcessor.java` and `broker/src/main/java/org/apache/rocketmq/broker/processor/PeekMessageProcessor.java` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 63 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `broker/src/main/java/org/apache/rocketmq/broker/processor/NotificationProcessor.java:106` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `broker/src/main/java/org/apache/rocketmq/broker/processor/PullMessageProcessor.java:338` calls `setForbiddenType` and `broker/src/main/java/org/apache/rocketmq/broker/processor/NotificationProcessor.java:118` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (10–13 lines × 2) broker/src/main/java/org/apache/rocketmq/broker/processor/AdminBrokerProcessor.java:1677— broker/src/main/java/org/apache/rocketmq/broker/processor/AdminBrokerProcessor.java:1677-1689 | broker/src/main/java/org/apache/rocketmq/broker/processor/AdminBrokerProcessor.java:2329-2338 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `broker/src/main/java/org/apache/rocketmq/broker/processor/AdminBrokerProcessor.java:1677` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (12–13 lines × 2) broker/src/main/java/org/apache/rocketmq/broker/processor/QueryMessageProcessor.java:118— broker/src/main/java/org/apache/rocketmq/broker/processor/QueryMessageProcessor.java:118-130 | broker/src/main/java/org/apache/rocketmq/broker/processor/QueryMessageProcessor.java:163-174 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `broker/src/main/java/org/apache/rocketmq/broker/processor/QueryMessageProcessor.java:118` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (12 lines × 8) client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:369— client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:369-381 | client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:402-413 | client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:431-442 | client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:452-463 | client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:475-486 | client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:2078-2089 | client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:2138-2149 | client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:2750-2761 — all 8 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:369` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (11–12 lines × 5) tools/src/main/java/org/apache/rocketmq/tools/command/acl/DeleteAccessConfigSubCommand.java:101— tools/src/main/java/org/apache/rocketmq/tools/command/acl/DeleteAccessConfigSubCommand.java:101-111 | tools/src/main/java/org/apache/rocketmq/tools/command/acl/UpdateAccessConfigSubCommand.java:174-184 | tools/src/main/java/org/apache/rocketmq/tools/command/consumer/UpdateSubGroupSubCommand.java:217-227 | tools/src/main/java/org/apache/rocketmq/tools/command/topic/UpdateOrderConfCommand.java:96-107 | tools/src/main/java/org/apache/rocketmq/tools/command/topic/UpdateTopicSubCommand.java:192-202 — before extracting anything, compare `tools/src/main/java/org/apache/rocketmq/tools/command/acl/DeleteAccessConfigSubCommand.java` and `tools/src/main/java/org/apache/rocketmq/tools/command/acl/UpdateAccessConfigSubCommand.java` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 53 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `tools/src/main/java/org/apache/rocketmq/tools/command/acl/DeleteAccessConfigSubCommand.java:101` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (11–12 lines × 4) broker/src/main/java/org/apache/rocketmq/broker/processor/NotificationProcessor.java:90— broker/src/main/java/org/apache/rocketmq/broker/processor/NotificationProcessor.java:90-100 | broker/src/main/java/org/apache/rocketmq/broker/processor/PeekMessageProcessor.java:100-110 | broker/src/main/java/org/apache/rocketmq/broker/processor/PollingInfoProcessor.java:78-88 | broker/src/main/java/org/apache/rocketmq/broker/processor/PopMessageProcessor.java:256-267 — before extracting anything, compare `broker/src/main/java/org/apache/rocketmq/broker/processor/NotificationProcessor.java` and `broker/src/main/java/org/apache/rocketmq/broker/processor/PeekMessageProcessor.java` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 63 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `broker/src/main/java/org/apache/rocketmq/broker/processor/NotificationProcessor.java:90` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (4–12 lines × 5) broker/src/main/java/org/apache/rocketmq/broker/processor/ChangeInvisibleTimeProcessor.java:193— broker/src/main/java/org/apache/rocketmq/broker/processor/ChangeInvisibleTimeProcessor.java:193-196 | broker/src/main/java/org/apache/rocketmq/broker/processor/PopBufferMergeService.java:603-606 | broker/src/main/java/org/apache/rocketmq/broker/processor/PopBufferMergeService.java:649-660 | broker/src/main/java/org/apache/rocketmq/broker/processor/PopBufferMergeService.java:688-699 | broker/src/main/java/org/apache/rocketmq/broker/processor/PopBufferMergeService.java:719-722 — there are 5 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 5 sites; resolving a subset leaves the remainder to drift apart. Read the line range as the matched WINDOW rather than a finished unit: at `broker/src/main/java/org/apache/rocketmq/broker/processor/ChangeInvisibleTimeProcessor.java:193` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `broker/src/main/java/org/apache/rocketmq/broker/processor/PopBufferMergeService.java:647` calls `incPopReviveAckPutCount`, `getPutMessageStatus` and `broker/src/main/java/org/apache/rocketmq/broker/processor/PopBufferMergeService.java:686` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (10–12 lines × 2) srvutil/src/main/java/org/apache/rocketmq/srvutil/ServerUtil.java:30— srvutil/src/main/java/org/apache/rocketmq/srvutil/ServerUtil.java:30-41 | tools/src/main/java/org/apache/rocketmq/tools/command/stats/StatsAllSubCommand.java:152-161 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
Duplicated block (8–11 lines × 3) tools/src/main/java/org/apache/rocketmq/tools/command/acl/DeleteAccessConfigSubCommand.java:72— tools/src/main/java/org/apache/rocketmq/tools/command/acl/DeleteAccessConfigSubCommand.java:72-82 | tools/src/main/java/org/apache/rocketmq/tools/command/broker/RemoveColdDataFlowCtrGroupConfigSubCommand.java:61-68 | tools/src/main/java/org/apache/rocketmq/tools/command/topic/DeleteTopicSubCommand.java:80-88 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 3 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 3 times. Read the line range as the matched WINDOW rather than a finished unit: at `tools/src/main/java/org/apache/rocketmq/tools/command/acl/DeleteAccessConfigSubCommand.java:72` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (10–11 lines × 3) tools/src/main/java/org/apache/rocketmq/tools/command/acl/DeleteAccessConfigSubCommand.java:86— tools/src/main/java/org/apache/rocketmq/tools/command/acl/DeleteAccessConfigSubCommand.java:86-96 | tools/src/main/java/org/apache/rocketmq/tools/command/acl/UpdateAccessConfigSubCommand.java:160-169 | tools/src/main/java/org/apache/rocketmq/tools/command/acl/UpdateGlobalWhiteAddrSubCommand.java:93-102 — before extracting anything, compare `tools/src/main/java/org/apache/rocketmq/tools/command/acl/DeleteAccessConfigSubCommand.java` and `tools/src/main/java/org/apache/rocketmq/tools/command/acl/UpdateAccessConfigSubCommand.java` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 53 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `tools/src/main/java/org/apache/rocketmq/tools/command/acl/DeleteAccessConfigSubCommand.java:86` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (10 lines × 11) client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:368— client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:368-377 | client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:401-410 | client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:430-439 | client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:451-460 | client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:474-483 | client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:1445-1454 | client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:1595-1604 | client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:2077-2086 | client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:2137-2146 | client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:2749-2758 | client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:3062-3071 — all 11 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (9–10 lines × 4) tools/src/main/java/org/apache/rocketmq/tools/command/acl/DeleteAccessConfigSubCommand.java:85— tools/src/main/java/org/apache/rocketmq/tools/command/acl/DeleteAccessConfigSubCommand.java:85-94 | tools/src/main/java/org/apache/rocketmq/tools/command/acl/UpdateAccessConfigSubCommand.java:159-167 | tools/src/main/java/org/apache/rocketmq/tools/command/consumer/UpdateSubGroupSubCommand.java:198-206 | tools/src/main/java/org/apache/rocketmq/tools/command/topic/UpdateTopicSubCommand.java:161-170 — before extracting anything, compare `tools/src/main/java/org/apache/rocketmq/tools/command/acl/DeleteAccessConfigSubCommand.java` and `tools/src/main/java/org/apache/rocketmq/tools/command/acl/UpdateAccessConfigSubCommand.java` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 53 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `tools/src/main/java/org/apache/rocketmq/tools/command/acl/DeleteAccessConfigSubCommand.java:85` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (7–10 lines × 3) broker/src/main/java/org/apache/rocketmq/broker/processor/NotificationProcessor.java:82— broker/src/main/java/org/apache/rocketmq/broker/processor/NotificationProcessor.java:82-88 | broker/src/main/java/org/apache/rocketmq/broker/processor/PollingInfoProcessor.java:70-76 | broker/src/main/java/org/apache/rocketmq/broker/processor/PopMessageProcessor.java:245-254 — before extracting anything, compare `broker/src/main/java/org/apache/rocketmq/broker/processor/NotificationProcessor.java` and `broker/src/main/java/org/apache/rocketmq/broker/processor/PollingInfoProcessor.java` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 58 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `broker/src/main/java/org/apache/rocketmq/broker/processor/NotificationProcessor.java:82` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (9–10 lines × 3) common/src/main/java/org/apache/rocketmq/common/config/ConfigRocksDBStorage.java:141— common/src/main/java/org/apache/rocketmq/common/config/ConfigRocksDBStorage.java:141-150 | store/src/main/java/org/apache/rocketmq/store/rocksdb/RocksDBOptionsFactory.java:51-59 | store/src/main/java/org/apache/rocketmq/store/rocksdb/RocksDBOptionsFactory.java:98-106 — before extracting anything, compare `common/src/main/java/org/apache/rocketmq/common/config/ConfigRocksDBStorage.java` and `store/src/main/java/org/apache/rocketmq/store/rocksdb/RocksDBOptionsFactory.java` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 56 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (2–10 lines × 6) broker/src/main/java/org/apache/rocketmq/broker/processor/NotificationProcessor.java:126— broker/src/main/java/org/apache/rocketmq/broker/processor/NotificationProcessor.java:126-135 | broker/src/main/java/org/apache/rocketmq/broker/processor/NotificationProcessor.java:154-163 | broker/src/main/java/org/apache/rocketmq/broker/processor/PeekMessageProcessor.java:137-138 | broker/src/main/java/org/apache/rocketmq/broker/processor/PeekMessageProcessor.java:157-158 | broker/src/main/java/org/apache/rocketmq/broker/processor/PopMessageProcessor.java:358-360 | broker/src/main/java/org/apache/rocketmq/broker/processor/PopMessageProcessor.java:393-395 — before extracting anything, compare `broker/src/main/java/org/apache/rocketmq/broker/processor/NotificationProcessor.java` and `broker/src/main/java/org/apache/rocketmq/broker/processor/PeekMessageProcessor.java` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 63 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `broker/src/main/java/org/apache/rocketmq/broker/processor/NotificationProcessor.java:126` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (3–10 lines × 3) broker/src/main/java/org/apache/rocketmq/broker/processor/DefaultPullMessageResultHandler.java:142— broker/src/main/java/org/apache/rocketmq/broker/processor/DefaultPullMessageResultHandler.java:142-144 | broker/src/main/java/org/apache/rocketmq/broker/processor/PeekMessageProcessor.java:189-197 | broker/src/main/java/org/apache/rocketmq/broker/processor/PopMessageProcessor.java:452-461 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 3 call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `broker/src/main/java/org/apache/rocketmq/broker/processor/DefaultPullMessageResultHandler.java:142` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `broker/src/main/java/org/apache/rocketmq/broker/processor/PeekMessageProcessor.java:189` calls `getBrokerStatsManager`, `incGroupGetLatency`, `getConsumerGroup` and `broker/src/main/java/org/apache/rocketmq/broker/processor/DefaultPullMessageResultHandler.java:142` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (8–10 lines × 2) client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:2970— client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:2970-2979 | client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:3012-3019 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:2970` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (7–10 lines × 2) tools/src/main/java/org/apache/rocketmq/tools/command/CommandUtil.java:92— tools/src/main/java/org/apache/rocketmq/tools/command/CommandUtil.java:92-101 | tools/src/main/java/org/apache/rocketmq/tools/command/CommandUtil.java:119-125 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `tools/src/main/java/org/apache/rocketmq/tools/command/CommandUtil.java:92` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (9 lines × 29) proxy/src/main/java/org/apache/rocketmq/proxy/ProxyStartup.java:154— proxy/src/main/java/org/apache/rocketmq/proxy/ProxyStartup.java:154-162 | tools/src/main/java/org/apache/rocketmq/tools/command/acl/UpdateAccessConfigSubCommand.java:65-73 | tools/src/main/java/org/apache/rocketmq/tools/command/broker/BrokerConsumeStatsSubCommad.java:71-79 | tools/src/main/java/org/apache/rocketmq/tools/command/broker/DeleteExpiredCommitLogSubCommand.java:47-55 | tools/src/main/java/org/apache/rocketmq/tools/command/broker/GetBrokerEpochSubCommand.java:48-56 | tools/src/main/java/org/apache/rocketmq/tools/command/broker/SendMsgStatusCommand.java:59-67 | tools/src/main/java/org/apache/rocketmq/tools/command/broker/UpdateBrokerConfigSubCommand.java:47-55 | tools/src/main/java/org/apache/rocketmq/tools/command/cluster/CLusterSendMsgRTCommand.java:58-66 | tools/src/main/java/org/apache/rocketmq/tools/command/cluster/ClusterListSubCommand.java:51-59 | tools/src/main/java/org/apache/rocketmq/tools/command/consumer/ConsumerStatusSubCommand.java:57-65 | tools/src/main/java/org/apache/rocketmq/tools/command/consumer/UpdateSubGroupSubCommand.java:59-67 | tools/src/main/java/org/apache/rocketmq/tools/command/consumer/UpdateSubGroupSubCommand.java:90-98 | tools/src/main/java/org/apache/rocketmq/tools/command/export/ExportMetadataCommand.java:56-64 | tools/src/main/java/org/apache/rocketmq/tools/command/ha/GetSyncStateSetSubCommand.java:50-58 | tools/src/main/java/org/apache/rocketmq/tools/command/ha/HAStatusSubCommand.java:51-59 | tools/src/main/java/org/apache/rocketmq/tools/command/message/CheckMsgSendRTCommand.java:50-58 | tools/src/main/java/org/apache/rocketmq/tools/command/message/ConsumeMessageCommand.java:80-88 | tools/src/main/java/org/apache/rocketmq/tools/command/message/PrintMessageByQueueCommand.java:126-134 | tools/src/main/java/org/apache/rocketmq/tools/command/message/PrintMessageSubCommand.java:72-80 | tools/src/main/java/org/apache/rocketmq/tools/command/message/QueryMsgByIdSubCommand.java:196-204 | tools/src/main/java/org/apache/rocketmq/tools/command/message/QueryMsgByKeySubCommand.java:50-58 | tools/src/main/java/org/apache/rocketmq/tools/command/message/QueryMsgByUniqueKeySubCommand.java:151-159 | tools/src/main/java/org/apache/rocketmq/tools/command/message/QueryMsgTraceByIdSubCommand.java:45-53 | tools/src/main/java/org/apache/rocketmq/tools/command/message/SendMessageCommand.java:55-63 | tools/src/main/java/org/apache/rocketmq/tools/command/offset/ResetOffsetByTimeCommand.java:66-74 | tools/src/main/java/org/apache/rocketmq/tools/command/queue/QueryConsumeQueueCommand.java:69-77 | tools/src/main/java/org/apache/rocketmq/tools/command/topic/RemappingStaticTopicSubCommand.java:70-78 | tools/src/main/java/org/apache/rocketmq/tools/command/topic/UpdateStaticTopicSubCommand.java:75-83 | tools/src/main/java/org/apache/rocketmq/tools/command/topic/UpdateTopicSubCommand.java:67-75 — there are 29 copies across 28 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 29 sites; resolving a subset leaves the remainder to drift apart. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `tools/src/main/java/org/apache/rocketmq/tools/command/broker/BrokerConsumeStatsSubCommad.java:81` calls `Option`, `setRequired`, `addOption` and `proxy/src/main/java/org/apache/rocketmq/proxy/ProxyStartup.java:164` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (9 lines × 28) proxy/src/main/java/org/apache/rocketmq/proxy/ProxyStartup.java:156— proxy/src/main/java/org/apache/rocketmq/proxy/ProxyStartup.java:156-165 | tools/src/main/java/org/apache/rocketmq/tools/command/acl/UpdateAccessConfigSubCommand.java:83-92 | tools/src/main/java/org/apache/rocketmq/tools/command/broker/BrokerConsumeStatsSubCommad.java:77-86 | tools/src/main/java/org/apache/rocketmq/tools/command/broker/CleanExpiredCQSubCommand.java:43-51 | tools/src/main/java/org/apache/rocketmq/tools/command/broker/CleanUnusedTopicCommand.java:43-51 | tools/src/main/java/org/apache/rocketmq/tools/command/broker/DeleteExpiredCommitLogSubCommand.java:49-58 | tools/src/main/java/org/apache/rocketmq/tools/command/broker/GetBrokerConfigCommand.java:54-62 | tools/src/main/java/org/apache/rocketmq/tools/command/broker/GetBrokerEpochSubCommand.java:50-59 | tools/src/main/java/org/apache/rocketmq/tools/command/broker/GetColdDataFlowCtrInfoSubCommand.java:56-64 | tools/src/main/java/org/apache/rocketmq/tools/command/broker/ResetMasterFlushOffsetSubCommand.java:42-50 | tools/src/main/java/org/apache/rocketmq/tools/command/broker/SendMsgStatusCommand.java:61-70 | tools/src/main/java/org/apache/rocketmq/tools/command/cluster/CLusterSendMsgRTCommand.java:72-81 | tools/src/main/java/org/apache/rocketmq/tools/command/cluster/ClusterListSubCommand.java:53-62 | tools/src/main/java/org/apache/rocketmq/tools/command/ha/GetSyncStateSetSubCommand.java:56-65 | tools/src/main/java/org/apache/rocketmq/tools/command/ha/HAStatusSubCommand.java:53-62 | tools/src/main/java/org/apache/rocketmq/tools/command/message/CheckMsgSendRTCommand.java:52-60 | tools/src/main/java/org/apache/rocketmq/tools/command/message/ConsumeMessageCommand.java:103-115 | tools/src/main/java/org/apache/rocketmq/tools/command/message/PrintMessageByQueueCommand.java:148-157 | tools/src/main/java/org/apache/rocketmq/tools/command/message/PrintMessageSubCommand.java:88-101 | tools/src/main/java/org/apache/rocketmq/tools/command/message/QueryMsgByIdSubCommand.java:210-219 | tools/src/main/java/org/apache/rocketmq/tools/command/message/QueryMsgByKeySubCommand.java:56-65 | tools/src/main/java/org/apache/rocketmq/tools/command/message/QueryMsgTraceByIdSubCommand.java:55-64 | tools/src/main/java/org/apache/rocketmq/tools/command/message/SendMessageCommand.java:69-78 | tools/src/main/java/org/apache/rocketmq/tools/command/offset/ResetOffsetByTimeCommand.java:72-81 | tools/src/main/java/org/apache/rocketmq/tools/command/queue/QueryConsumeQueueCommand.java:75-84 | tools/src/main/java/org/apache/rocketmq/tools/command/topic/RemappingStaticTopicSubCommand.java:72-81 | tools/src/main/java/org/apache/rocketmq/tools/command/topic/UpdateStaticTopicSubCommand.java:77-86 | tools/src/main/java/org/apache/rocketmq/tools/command/topic/UpdateTopicSubCommand.java:85-94 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 28 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 28 times. Read the line range as the matched WINDOW rather than a finished unit: at `proxy/src/main/java/org/apache/rocketmq/proxy/ProxyStartup.java:156` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `proxy/src/main/java/org/apache/rocketmq/proxy/ProxyStartup.java:154` calls `addOption`, `Option` and `tools/src/main/java/org/apache/rocketmq/tools/command/broker/CleanExpiredCQSubCommand.java:43` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (8–9 lines × 18) example/src/main/java/org/apache/rocketmq/example/operation/Consumer.java:78— example/src/main/java/org/apache/rocketmq/example/operation/Consumer.java:78-86 | example/src/main/java/org/apache/rocketmq/example/operation/Producer.java:72-80 | tools/src/main/java/org/apache/rocketmq/tools/command/acl/UpdateAccessConfigSubCommand.java:59-67 | tools/src/main/java/org/apache/rocketmq/tools/command/consumer/SetConsumeModeSubCommand.java:55-63 | tools/src/main/java/org/apache/rocketmq/tools/command/controller/ReElectMasterSubCommand.java:46-53 | tools/src/main/java/org/apache/rocketmq/tools/command/controller/UpdateControllerConfigSubCommand.java:46-53 | tools/src/main/java/org/apache/rocketmq/tools/command/message/PrintMessageByQueueCommand.java:117-124 | tools/src/main/java/org/apache/rocketmq/tools/command/message/QueryMsgByKeySubCommand.java:45-52 | tools/src/main/java/org/apache/rocketmq/tools/command/message/QueryMsgByOffsetSubCommand.java:48-55 | tools/src/main/java/org/apache/rocketmq/tools/command/message/SendMessageCommand.java:50-57 | tools/src/main/java/org/apache/rocketmq/tools/command/namesrv/UpdateKvConfigCommand.java:41-48 | tools/src/main/java/org/apache/rocketmq/tools/command/offset/CloneGroupOffsetCommand.java:47-54 | tools/src/main/java/org/apache/rocketmq/tools/command/offset/GetConsumerStatusCommand.java:45-52 | tools/src/main/java/org/apache/rocketmq/tools/command/offset/ResetOffsetByTimeCommand.java:49-56 | tools/src/main/java/org/apache/rocketmq/tools/command/offset/ResetOffsetByTimeOldCommand.java:82-89 | tools/src/main/java/org/apache/rocketmq/tools/command/offset/SkipAccumulationSubCommand.java:50-57 | tools/src/main/java/org/apache/rocketmq/tools/command/queue/QueryConsumeQueueCommand.java:60-67 | tools/src/main/java/org/apache/rocketmq/tools/command/topic/UpdateStaticTopicSubCommand.java:69-77 — before extracting anything, compare `example/src/main/java/org/apache/rocketmq/example/operation/Consumer.java` and `example/src/main/java/org/apache/rocketmq/example/operation/Producer.java` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 55 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `example/src/main/java/org/apache/rocketmq/example/operation/Consumer.java:76` calls `addOption`, `Option` and `tools/src/main/java/org/apache/rocketmq/tools/command/controller/ReElectMasterSubCommand.java:46` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (9 lines × 10) tools/src/main/java/org/apache/rocketmq/tools/command/acl/UpdateGlobalWhiteAddrSubCommand.java:57— tools/src/main/java/org/apache/rocketmq/tools/command/acl/UpdateGlobalWhiteAddrSubCommand.java:57-66 | tools/src/main/java/org/apache/rocketmq/tools/command/connection/ConsumerConnectionSubCommand.java:48-56 | tools/src/main/java/org/apache/rocketmq/tools/command/consumer/DeleteSubscriptionGroupCommand.java:52-61 | tools/src/main/java/org/apache/rocketmq/tools/command/consumer/SetConsumeModeSubCommand.java:63-72 | tools/src/main/java/org/apache/rocketmq/tools/command/export/ExportConfigsCommand.java:52-60 | tools/src/main/java/org/apache/rocketmq/tools/command/export/ExportMetricsCommand.java:65-73 | tools/src/main/java/org/apache/rocketmq/tools/command/message/QueryMsgByOffsetSubCommand.java:59-67 | tools/src/main/java/org/apache/rocketmq/tools/command/offset/GetConsumerStatusCommand.java:48-57 | tools/src/main/java/org/apache/rocketmq/tools/command/offset/ResetOffsetByTimeOldCommand.java:89-97 | tools/src/main/java/org/apache/rocketmq/tools/command/offset/SkipAccumulationSubCommand.java:53-61 — before extracting anything, compare `tools/src/main/java/org/apache/rocketmq/tools/command/consumer/DeleteSubscriptionGroupCommand.java` and `tools/src/main/java/org/apache/rocketmq/tools/command/consumer/SetConsumeModeSubCommand.java` as WHOLE FILES: this scan already matched 9 separate duplicated blocks between them, totalling at least 80 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `tools/src/main/java/org/apache/rocketmq/tools/command/acl/UpdateGlobalWhiteAddrSubCommand.java:57` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `tools/src/main/java/org/apache/rocketmq/tools/command/offset/GetConsumerStatusCommand.java:46` calls `addOption`, `Option` and `tools/src/main/java/org/apache/rocketmq/tools/command/connection/ConsumerConnectionSubCommand.java:48` does not — after which the two agree again for 4 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (9 lines × 5) remoting/src/main/java/org/apache/rocketmq/remoting/rpc/RpcClientImpl.java:211— remoting/src/main/java/org/apache/rocketmq/remoting/rpc/RpcClientImpl.java:211-219 | remoting/src/main/java/org/apache/rocketmq/remoting/rpc/RpcClientImpl.java:257-265 | remoting/src/main/java/org/apache/rocketmq/remoting/rpc/RpcClientImpl.java:295-303 | remoting/src/main/java/org/apache/rocketmq/remoting/rpc/RpcClientImpl.java:316-324 | remoting/src/main/java/org/apache/rocketmq/remoting/rpc/RpcClientImpl.java:337-345 — all 5 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `remoting/src/main/java/org/apache/rocketmq/remoting/rpc/RpcClientImpl.java:211` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (7–9 lines × 4) tools/src/main/java/org/apache/rocketmq/tools/command/broker/UpdateBrokerConfigSubCommand.java:70— tools/src/main/java/org/apache/rocketmq/tools/command/broker/UpdateBrokerConfigSubCommand.java:70-78 | tools/src/main/java/org/apache/rocketmq/tools/command/broker/UpdateColdDataFlowCtrGroupConfigSubCommand.java:68-74 | tools/src/main/java/org/apache/rocketmq/tools/command/controller/UpdateControllerConfigSubCommand.java:63-71 | tools/src/main/java/org/apache/rocketmq/tools/command/namesrv/UpdateNamesrvConfigCommand.java:58-66 — before extracting anything, compare `tools/src/main/java/org/apache/rocketmq/tools/command/broker/UpdateBrokerConfigSubCommand.java` and `tools/src/main/java/org/apache/rocketmq/tools/command/broker/UpdateColdDataFlowCtrGroupConfigSubCommand.java` as WHOLE FILES: this scan already matched 11 separate duplicated blocks between them, totalling at least 103 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `tools/src/main/java/org/apache/rocketmq/tools/command/broker/UpdateBrokerConfigSubCommand.java:70` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (8 lines × 22) example/src/main/java/org/apache/rocketmq/example/operation/Consumer.java:83— example/src/main/java/org/apache/rocketmq/example/operation/Consumer.java:83-90 | tools/src/main/java/org/apache/rocketmq/tools/command/acl/UpdateAccessConfigSubCommand.java:64-71 | tools/src/main/java/org/apache/rocketmq/tools/command/broker/BrokerConsumeStatsSubCommad.java:70-77 | tools/src/main/java/org/apache/rocketmq/tools/command/broker/SendMsgStatusCommand.java:58-65 | tools/src/main/java/org/apache/rocketmq/tools/command/consumer/ConsumerStatusSubCommand.java:56-63 | tools/src/main/java/org/apache/rocketmq/tools/command/consumer/UpdateSubGroupSubCommand.java:58-65 | tools/src/main/java/org/apache/rocketmq/tools/command/controller/CleanControllerBrokerMetaSubCommand.java:47-54 | tools/src/main/java/org/apache/rocketmq/tools/command/ha/GetSyncStateSetSubCommand.java:49-56 | tools/src/main/java/org/apache/rocketmq/tools/command/message/CheckMsgSendRTCommand.java:49-56 | tools/src/main/java/org/apache/rocketmq/tools/command/message/ConsumeMessageCommand.java:79-86 | tools/src/main/java/org/apache/rocketmq/tools/command/message/PrintMessageByQueueCommand.java:125-132 | tools/src/main/java/org/apache/rocketmq/tools/command/message/PrintMessageSubCommand.java:71-78 | tools/src/main/java/org/apache/rocketmq/tools/command/message/QueryMsgByIdSubCommand.java:195-202 | tools/src/main/java/org/apache/rocketmq/tools/command/message/QueryMsgByKeySubCommand.java:49-56 | tools/src/main/java/org/apache/rocketmq/tools/command/message/QueryMsgByUniqueKeySubCommand.java:150-157 | tools/src/main/java/org/apache/rocketmq/tools/command/message/QueryMsgTraceByIdSubCommand.java:44-51 | tools/src/main/java/org/apache/rocketmq/tools/command/message/SendMessageCommand.java:54-61 | tools/src/main/java/org/apache/rocketmq/tools/command/queue/QueryConsumeQueueCommand.java:68-75 | tools/src/main/java/org/apache/rocketmq/tools/command/topic/RemappingStaticTopicSubCommand.java:69-76 | tools/src/main/java/org/apache/rocketmq/tools/command/topic/UpdateOrderConfCommand.java:45-52 | tools/src/main/java/org/apache/rocketmq/tools/command/topic/UpdateStaticTopicSubCommand.java:74-81 | tools/src/main/java/org/apache/rocketmq/tools/command/topic/UpdateTopicSubCommand.java:66-73 — before extracting anything, compare `example/src/main/java/org/apache/rocketmq/example/operation/Consumer.java` and `tools/src/main/java/org/apache/rocketmq/tools/command/acl/UpdateAccessConfigSubCommand.java` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 46 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `tools/src/main/java/org/apache/rocketmq/tools/command/message/QueryMsgByKeySubCommand.java:45` calls `setRequired`, `addOption`, `Option` and `tools/src/main/java/org/apache/rocketmq/tools/command/broker/BrokerConsumeStatsSubCommad.java:69` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (8 lines × 18) example/src/main/java/org/apache/rocketmq/example/operation/Consumer.java:80— example/src/main/java/org/apache/rocketmq/example/operation/Consumer.java:80-87 | tools/src/main/java/org/apache/rocketmq/tools/command/acl/UpdateAccessConfigSubCommand.java:61-68 | tools/src/main/java/org/apache/rocketmq/tools/command/consumer/DeleteSubscriptionGroupCommand.java:50-57 | tools/src/main/java/org/apache/rocketmq/tools/command/consumer/SetConsumeModeSubCommand.java:61-68 | tools/src/main/java/org/apache/rocketmq/tools/command/consumer/UpdateSubGroupSubCommand.java:55-62 | tools/src/main/java/org/apache/rocketmq/tools/command/controller/CleanControllerBrokerMetaSubCommand.java:52-59 | tools/src/main/java/org/apache/rocketmq/tools/command/message/PrintMessageByQueueCommand.java:122-129 | tools/src/main/java/org/apache/rocketmq/tools/command/message/QueryMsgByKeySubCommand.java:46-53 | tools/src/main/java/org/apache/rocketmq/tools/command/message/QueryMsgByOffsetSubCommand.java:57-64 | tools/src/main/java/org/apache/rocketmq/tools/command/message/SendMessageCommand.java:51-58 | tools/src/main/java/org/apache/rocketmq/tools/command/offset/CloneGroupOffsetCommand.java:52-59 | tools/src/main/java/org/apache/rocketmq/tools/command/offset/GetConsumerStatusCommand.java:46-53 | tools/src/main/java/org/apache/rocketmq/tools/command/offset/ResetOffsetByTimeCommand.java:54-61 | tools/src/main/java/org/apache/rocketmq/tools/command/offset/ResetOffsetByTimeOldCommand.java:87-94 | tools/src/main/java/org/apache/rocketmq/tools/command/offset/SkipAccumulationSubCommand.java:51-58 | tools/src/main/java/org/apache/rocketmq/tools/command/queue/QueryConsumeQueueCommand.java:65-72 | tools/src/main/java/org/apache/rocketmq/tools/command/topic/UpdateStaticTopicSubCommand.java:71-78 | tools/src/main/java/org/apache/rocketmq/tools/command/topic/UpdateTopicSubCommand.java:63-70 — before extracting anything, compare `example/src/main/java/org/apache/rocketmq/example/operation/Consumer.java` and `tools/src/main/java/org/apache/rocketmq/tools/command/acl/UpdateAccessConfigSubCommand.java` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 46 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `tools/src/main/java/org/apache/rocketmq/tools/command/offset/CloneGroupOffsetCommand.java:62` calls `addOption` and `tools/src/main/java/org/apache/rocketmq/tools/command/consumer/DeleteSubscriptionGroupCommand.java:60` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (8 lines × 15) example/src/main/java/org/apache/rocketmq/example/operation/Consumer.java:76— example/src/main/java/org/apache/rocketmq/example/operation/Consumer.java:76-83 | example/src/main/java/org/apache/rocketmq/example/operation/Producer.java:70-77 | tools/src/main/java/org/apache/rocketmq/tools/command/broker/UpdateBrokerConfigSubCommand.java:55-62 | tools/src/main/java/org/apache/rocketmq/tools/command/broker/UpdateColdDataFlowCtrGroupConfigSubCommand.java:53-60 | tools/src/main/java/org/apache/rocketmq/tools/command/consumer/SetConsumeModeSubCommand.java:53-60 | tools/src/main/java/org/apache/rocketmq/tools/command/controller/ReElectMasterSubCommand.java:47-54 | tools/src/main/java/org/apache/rocketmq/tools/command/controller/UpdateControllerConfigSubCommand.java:47-54 | tools/src/main/java/org/apache/rocketmq/tools/command/message/PrintMessageByQueueCommand.java:118-125 | tools/src/main/java/org/apache/rocketmq/tools/command/message/QueryMsgByOffsetSubCommand.java:49-56 | tools/src/main/java/org/apache/rocketmq/tools/command/namesrv/UpdateKvConfigCommand.java:42-49 | tools/src/main/java/org/apache/rocketmq/tools/command/offset/CloneGroupOffsetCommand.java:48-55 | tools/src/main/java/org/apache/rocketmq/tools/command/offset/ResetOffsetByTimeCommand.java:50-57 | tools/src/main/java/org/apache/rocketmq/tools/command/offset/ResetOffsetByTimeOldCommand.java:83-90 | tools/src/main/java/org/apache/rocketmq/tools/command/queue/QueryConsumeQueueCommand.java:61-68 | tools/src/main/java/org/apache/rocketmq/tools/command/topic/UpdateTopicPermSubCommand.java:58-65 — before extracting anything, compare `example/src/main/java/org/apache/rocketmq/example/operation/Consumer.java` and `example/src/main/java/org/apache/rocketmq/example/operation/Producer.java` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 55 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (8 lines × 13) tools/src/main/java/org/apache/rocketmq/tools/command/broker/UpdateBrokerConfigSubCommand.java:57— tools/src/main/java/org/apache/rocketmq/tools/command/broker/UpdateBrokerConfigSubCommand.java:57-66 | tools/src/main/java/org/apache/rocketmq/tools/command/broker/UpdateColdDataFlowCtrGroupConfigSubCommand.java:55-64 | tools/src/main/java/org/apache/rocketmq/tools/command/connection/ProducerConnectionSubCommand.java:45-53 | tools/src/main/java/org/apache/rocketmq/tools/command/container/AddBrokerSubCommand.java:42-50 | tools/src/main/java/org/apache/rocketmq/tools/command/container/RemoveBrokerSubCommand.java:42-50 | tools/src/main/java/org/apache/rocketmq/tools/command/controller/ReElectMasterSubCommand.java:53-62 | tools/src/main/java/org/apache/rocketmq/tools/command/controller/UpdateControllerConfigSubCommand.java:49-58 | tools/src/main/java/org/apache/rocketmq/tools/command/namesrv/DeleteKvConfigCommand.java:41-48 | tools/src/main/java/org/apache/rocketmq/tools/command/namesrv/UpdateKvConfigCommand.java:44-52 | tools/src/main/java/org/apache/rocketmq/tools/command/namesrv/UpdateNamesrvConfigCommand.java:45-53 | tools/src/main/java/org/apache/rocketmq/tools/command/topic/AllocateMQSubCommand.java:50-58 | tools/src/main/java/org/apache/rocketmq/tools/command/topic/DeleteTopicSubCommand.java:68-76 | tools/src/main/java/org/apache/rocketmq/tools/command/topic/UpdateTopicPermSubCommand.java:60-69 — before extracting anything, compare `tools/src/main/java/org/apache/rocketmq/tools/command/broker/UpdateBrokerConfigSubCommand.java` and `tools/src/main/java/org/apache/rocketmq/tools/command/broker/UpdateColdDataFlowCtrGroupConfigSubCommand.java` as WHOLE FILES: this scan already matched 11 separate duplicated blocks between them, totalling at least 103 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `tools/src/main/java/org/apache/rocketmq/tools/command/broker/UpdateBrokerConfigSubCommand.java:57` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `tools/src/main/java/org/apache/rocketmq/tools/command/controller/UpdateControllerConfigSubCommand.java:47` calls `addOption`, `Option` and `tools/src/main/java/org/apache/rocketmq/tools/command/connection/ProducerConnectionSubCommand.java:45` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (8 lines × 12) example/src/main/java/org/apache/rocketmq/example/operation/Consumer.java:84— example/src/main/java/org/apache/rocketmq/example/operation/Consumer.java:84-91 | tools/src/main/java/org/apache/rocketmq/tools/command/broker/CommitLogSetReadAheadSubCommand.java:54-61 | tools/src/main/java/org/apache/rocketmq/tools/command/broker/RemoveColdDataFlowCtrGroupConfigSubCommand.java:46-53 | tools/src/main/java/org/apache/rocketmq/tools/command/broker/UpdateBrokerConfigSubCommand.java:51-58 | tools/src/main/java/org/apache/rocketmq/tools/command/broker/UpdateColdDataFlowCtrGroupConfigSubCommand.java:49-56 | tools/src/main/java/org/apache/rocketmq/tools/command/consumer/DeleteSubscriptionGroupCommand.java:46-53 | tools/src/main/java/org/apache/rocketmq/tools/command/consumer/SetConsumeModeSubCommand.java:49-56 | tools/src/main/java/org/apache/rocketmq/tools/command/consumer/UpdateSubGroupSubCommand.java:51-58 | tools/src/main/java/org/apache/rocketmq/tools/command/controller/CleanControllerBrokerMetaSubCommand.java:48-55 | tools/src/main/java/org/apache/rocketmq/tools/command/message/QueryMsgByUniqueKeySubCommand.java:155-162 | tools/src/main/java/org/apache/rocketmq/tools/command/topic/UpdateOrderConfCommand.java:46-53 | tools/src/main/java/org/apache/rocketmq/tools/command/topic/UpdateTopicPermSubCommand.java:54-61 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 12 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 12 times.
Duplicated block (8 lines × 10) example/src/main/java/org/apache/rocketmq/example/operation/Consumer.java:75— example/src/main/java/org/apache/rocketmq/example/operation/Consumer.java:75-82 | example/src/main/java/org/apache/rocketmq/example/operation/Producer.java:69-76 | tools/src/main/java/org/apache/rocketmq/tools/command/broker/UpdateBrokerConfigSubCommand.java:54-61 | tools/src/main/java/org/apache/rocketmq/tools/command/broker/UpdateColdDataFlowCtrGroupConfigSubCommand.java:52-59 | tools/src/main/java/org/apache/rocketmq/tools/command/consumer/DeleteSubscriptionGroupCommand.java:49-56 | tools/src/main/java/org/apache/rocketmq/tools/command/consumer/SetConsumeModeSubCommand.java:52-59 | tools/src/main/java/org/apache/rocketmq/tools/command/consumer/UpdateSubGroupSubCommand.java:54-61 | tools/src/main/java/org/apache/rocketmq/tools/command/controller/CleanControllerBrokerMetaSubCommand.java:51-58 | tools/src/main/java/org/apache/rocketmq/tools/command/topic/UpdateTopicPermSubCommand.java:57-64 | tools/src/main/java/org/apache/rocketmq/tools/command/topic/UpdateTopicSubCommand.java:62-69 — before extracting anything, compare `example/src/main/java/org/apache/rocketmq/example/operation/Consumer.java` and `example/src/main/java/org/apache/rocketmq/example/operation/Producer.java` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 55 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (8 lines × 7) client/src/main/java/org/apache/rocketmq/client/impl/admin/MqClientAdminImpl.java:279— client/src/main/java/org/apache/rocketmq/client/impl/admin/MqClientAdminImpl.java:279-286 | client/src/main/java/org/apache/rocketmq/client/impl/admin/MqClientAdminImpl.java:296-303 | client/src/main/java/org/apache/rocketmq/client/impl/admin/MqClientAdminImpl.java:313-320 | client/src/main/java/org/apache/rocketmq/client/impl/admin/MqClientAdminImpl.java:348-355 | client/src/main/java/org/apache/rocketmq/client/impl/admin/MqClientAdminImpl.java:365-372 | client/src/main/java/org/apache/rocketmq/client/impl/admin/MqClientAdminImpl.java:382-389 | client/src/main/java/org/apache/rocketmq/client/impl/admin/MqClientAdminImpl.java:399-406 — all 7 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `client/src/main/java/org/apache/rocketmq/client/impl/admin/MqClientAdminImpl.java:279` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
Duplicated block (8 lines × 6) client/src/main/java/org/apache/rocketmq/client/impl/admin/MqClientAdminImpl.java:144— client/src/main/java/org/apache/rocketmq/client/impl/admin/MqClientAdminImpl.java:144-151 | client/src/main/java/org/apache/rocketmq/client/impl/admin/MqClientAdminImpl.java:162-169 | client/src/main/java/org/apache/rocketmq/client/impl/admin/MqClientAdminImpl.java:178-185 | client/src/main/java/org/apache/rocketmq/client/impl/admin/MqClientAdminImpl.java:194-201 | client/src/main/java/org/apache/rocketmq/client/impl/admin/MqClientAdminImpl.java:210-217 | client/src/main/java/org/apache/rocketmq/client/impl/admin/MqClientAdminImpl.java:226-233 — all 6 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `client/src/main/java/org/apache/rocketmq/client/impl/admin/MqClientAdminImpl.java:144` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on. Note first that the copies are not typed on the same thing: the declarations holding them bind `requestHeader` to `CreateTopicRequestHeader` in one and `DeleteTopicRequestHeader` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
Duplicated block (7–8 lines × 5) broker/src/main/java/org/apache/rocketmq/broker/processor/NotificationProcessor.java:89— broker/src/main/java/org/apache/rocketmq/broker/processor/NotificationProcessor.java:89-95 | broker/src/main/java/org/apache/rocketmq/broker/processor/PeekMessageProcessor.java:99-105 | broker/src/main/java/org/apache/rocketmq/broker/processor/PollingInfoProcessor.java:77-83 | broker/src/main/java/org/apache/rocketmq/broker/processor/PopMessageProcessor.java:255-262 | broker/src/main/java/org/apache/rocketmq/broker/processor/PullMessageProcessor.java:346-352 — before extracting anything, compare `broker/src/main/java/org/apache/rocketmq/broker/processor/NotificationProcessor.java` and `broker/src/main/java/org/apache/rocketmq/broker/processor/PeekMessageProcessor.java` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 63 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `broker/src/main/java/org/apache/rocketmq/broker/processor/NotificationProcessor.java:89` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `broker/src/main/java/org/apache/rocketmq/broker/processor/PullMessageProcessor.java:353` calls `setForbiddenType` and `broker/src/main/java/org/apache/rocketmq/broker/processor/NotificationProcessor.java:96` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (7–8 lines × 4) tools/src/main/java/org/apache/rocketmq/tools/command/container/AddBrokerSubCommand.java:55— tools/src/main/java/org/apache/rocketmq/tools/command/container/AddBrokerSubCommand.java:55-61 | tools/src/main/java/org/apache/rocketmq/tools/command/topic/AllocateMQSubCommand.java:62-68 | tools/src/main/java/org/apache/rocketmq/tools/command/topic/RemappingStaticTopicSubCommand.java:87-94 | tools/src/main/java/org/apache/rocketmq/tools/command/topic/UpdateStaticTopicSubCommand.java:92-98 — before extracting anything, compare `tools/src/main/java/org/apache/rocketmq/tools/command/topic/RemappingStaticTopicSubCommand.java` and `tools/src/main/java/org/apache/rocketmq/tools/command/topic/UpdateStaticTopicSubCommand.java` as WHOLE FILES: this scan already matched 12 separate duplicated blocks between them, totalling at least 126 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `tools/src/main/java/org/apache/rocketmq/tools/command/container/AddBrokerSubCommand.java:55` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (5–8 lines × 2) remoting/src/main/java/org/apache/rocketmq/remoting/protocol/header/ExtraInfoUtil.java:111— remoting/src/main/java/org/apache/rocketmq/remoting/protocol/header/ExtraInfoUtil.java:111-115 | remoting/src/main/java/org/apache/rocketmq/remoting/protocol/header/ExtraInfoUtil.java:121-128 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (7 lines × 20) example/src/main/java/org/apache/rocketmq/example/operation/Consumer.java:82— example/src/main/java/org/apache/rocketmq/example/operation/Consumer.java:82-88 | tools/src/main/java/org/apache/rocketmq/tools/command/acl/UpdateAccessConfigSubCommand.java:63-69 | tools/src/main/java/org/apache/rocketmq/tools/command/acl/UpdateGlobalWhiteAddrSubCommand.java:57-63 | tools/src/main/java/org/apache/rocketmq/tools/command/consumer/DeleteSubscriptionGroupCommand.java:52-58 | tools/src/main/java/org/apache/rocketmq/tools/command/consumer/SetConsumeModeSubCommand.java:63-69 | tools/src/main/java/org/apache/rocketmq/tools/command/consumer/UpdateSubGroupSubCommand.java:57-63 | tools/src/main/java/org/apache/rocketmq/tools/command/controller/CleanControllerBrokerMetaSubCommand.java:54-60 | tools/src/main/java/org/apache/rocketmq/tools/command/message/PrintMessageByQueueCommand.java:124-130 | tools/src/main/java/org/apache/rocketmq/tools/command/message/QueryMsgByKeySubCommand.java:48-54 | tools/src/main/java/org/apache/rocketmq/tools/command/message/QueryMsgByOffsetSubCommand.java:59-65 | tools/src/main/java/org/apache/rocketmq/tools/command/message/SendMessageCommand.java:53-59 | tools/src/main/java/org/apache/rocketmq/tools/command/offset/CloneGroupOffsetCommand.java:54-60 | tools/src/main/java/org/apache/rocketmq/tools/command/offset/GetConsumerStatusCommand.java:48-54 | tools/src/main/java/org/apache/rocketmq/tools/command/offset/ResetOffsetByTimeCommand.java:56-62 | tools/src/main/java/org/apache/rocketmq/tools/command/offset/ResetOffsetByTimeOldCommand.java:89-95 | tools/src/main/java/org/apache/rocketmq/tools/command/offset/SkipAccumulationSubCommand.java:53-59 | tools/src/main/java/org/apache/rocketmq/tools/command/queue/QueryConsumeQueueCommand.java:67-73 | tools/src/main/java/org/apache/rocketmq/tools/command/topic/RemappingStaticTopicSubCommand.java:68-74 | tools/src/main/java/org/apache/rocketmq/tools/command/topic/UpdateStaticTopicSubCommand.java:73-79 | tools/src/main/java/org/apache/rocketmq/tools/command/topic/UpdateTopicSubCommand.java:65-71 — before extracting anything, compare `example/src/main/java/org/apache/rocketmq/example/operation/Consumer.java` and `tools/src/main/java/org/apache/rocketmq/tools/command/acl/UpdateAccessConfigSubCommand.java` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 46 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `tools/src/main/java/org/apache/rocketmq/tools/command/acl/UpdateAccessConfigSubCommand.java:59` calls `Option`, `setRequired`, `addOption` and `tools/src/main/java/org/apache/rocketmq/tools/command/acl/UpdateGlobalWhiteAddrSubCommand.java:55` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (7 lines × 17) example/src/main/java/org/apache/rocketmq/example/operation/Consumer.java:78— example/src/main/java/org/apache/rocketmq/example/operation/Consumer.java:78-84 | example/src/main/java/org/apache/rocketmq/example/operation/Producer.java:72-78 | tools/src/main/java/org/apache/rocketmq/tools/command/acl/UpdateAccessConfigSubCommand.java:59-65 | tools/src/main/java/org/apache/rocketmq/tools/command/broker/UpdateBrokerConfigSubCommand.java:57-63 | tools/src/main/java/org/apache/rocketmq/tools/command/broker/UpdateColdDataFlowCtrGroupConfigSubCommand.java:55-61 | tools/src/main/java/org/apache/rocketmq/tools/command/consumer/SetConsumeModeSubCommand.java:55-61 | tools/src/main/java/org/apache/rocketmq/tools/command/controller/ReElectMasterSubCommand.java:49-55 | tools/src/main/java/org/apache/rocketmq/tools/command/controller/UpdateControllerConfigSubCommand.java:49-55 | tools/src/main/java/org/apache/rocketmq/tools/command/message/PrintMessageByQueueCommand.java:120-126 | tools/src/main/java/org/apache/rocketmq/tools/command/message/QueryMsgByOffsetSubCommand.java:51-57 | tools/src/main/java/org/apache/rocketmq/tools/command/namesrv/UpdateKvConfigCommand.java:44-50 | tools/src/main/java/org/apache/rocketmq/tools/command/offset/CloneGroupOffsetCommand.java:50-56 | tools/src/main/java/org/apache/rocketmq/tools/command/offset/ResetOffsetByTimeCommand.java:52-58 | tools/src/main/java/org/apache/rocketmq/tools/command/offset/ResetOffsetByTimeOldCommand.java:85-91 | tools/src/main/java/org/apache/rocketmq/tools/command/queue/QueryConsumeQueueCommand.java:63-69 | tools/src/main/java/org/apache/rocketmq/tools/command/topic/UpdateStaticTopicSubCommand.java:69-75 | tools/src/main/java/org/apache/rocketmq/tools/command/topic/UpdateTopicPermSubCommand.java:60-66 — before extracting anything, compare `example/src/main/java/org/apache/rocketmq/example/operation/Consumer.java` and `example/src/main/java/org/apache/rocketmq/example/operation/Producer.java` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 55 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `tools/src/main/java/org/apache/rocketmq/tools/command/controller/ReElectMasterSubCommand.java:57` calls `Option`, `setRequired`, `addOption` and `tools/src/main/java/org/apache/rocketmq/tools/command/broker/UpdateBrokerConfigSubCommand.java:65` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (7 lines × 13) example/src/main/java/org/apache/rocketmq/example/operation/Consumer.java:86— example/src/main/java/org/apache/rocketmq/example/operation/Consumer.java:86-92 | tools/src/main/java/org/apache/rocketmq/tools/command/broker/CommitLogSetReadAheadSubCommand.java:56-62 | tools/src/main/java/org/apache/rocketmq/tools/command/broker/RemoveColdDataFlowCtrGroupConfigSubCommand.java:48-54 | tools/src/main/java/org/apache/rocketmq/tools/command/broker/UpdateBrokerConfigSubCommand.java:53-59 | tools/src/main/java/org/apache/rocketmq/tools/command/broker/UpdateColdDataFlowCtrGroupConfigSubCommand.java:51-57 | tools/src/main/java/org/apache/rocketmq/tools/command/consumer/DeleteSubscriptionGroupCommand.java:48-54 | tools/src/main/java/org/apache/rocketmq/tools/command/consumer/SetConsumeModeSubCommand.java:51-57 | tools/src/main/java/org/apache/rocketmq/tools/command/consumer/UpdateSubGroupSubCommand.java:53-59 | tools/src/main/java/org/apache/rocketmq/tools/command/controller/CleanControllerBrokerMetaSubCommand.java:50-56 | tools/src/main/java/org/apache/rocketmq/tools/command/message/QueryMsgByUniqueKeySubCommand.java:157-163 | tools/src/main/java/org/apache/rocketmq/tools/command/topic/UpdateOrderConfCommand.java:48-54 | tools/src/main/java/org/apache/rocketmq/tools/command/topic/UpdateTopicPermSubCommand.java:56-62 | tools/src/main/java/org/apache/rocketmq/tools/command/topic/UpdateTopicSubCommand.java:61-67 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 13 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 13 times. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `tools/src/main/java/org/apache/rocketmq/tools/command/broker/UpdateBrokerConfigSubCommand.java:61` calls `Option`, `setRequired`, `addOption` and `tools/src/main/java/org/apache/rocketmq/tools/command/broker/CommitLogSetReadAheadSubCommand.java:64` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (7 lines × 9) proxy/src/main/java/org/apache/rocketmq/proxy/grpc/v2/GrpcMessagingApplication.java:205— proxy/src/main/java/org/apache/rocketmq/proxy/grpc/v2/GrpcMessagingApplication.java:205-211 | proxy/src/main/java/org/apache/rocketmq/proxy/grpc/v2/GrpcMessagingApplication.java:223-229 | proxy/src/main/java/org/apache/rocketmq/proxy/grpc/v2/GrpcMessagingApplication.java:241-247 | proxy/src/main/java/org/apache/rocketmq/proxy/grpc/v2/GrpcMessagingApplication.java:260-266 | proxy/src/main/java/org/apache/rocketmq/proxy/grpc/v2/GrpcMessagingApplication.java:295-301 | proxy/src/main/java/org/apache/rocketmq/proxy/grpc/v2/GrpcMessagingApplication.java:314-320 | proxy/src/main/java/org/apache/rocketmq/proxy/grpc/v2/GrpcMessagingApplication.java:332-338 | proxy/src/main/java/org/apache/rocketmq/proxy/grpc/v2/GrpcMessagingApplication.java:351-357 | proxy/src/main/java/org/apache/rocketmq/proxy/grpc/v2/GrpcMessagingApplication.java:370-376 — all 9 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `proxy/src/main/java/org/apache/rocketmq/proxy/grpc/v2/GrpcMessagingApplication.java:205` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note first that the copies are not typed on the same thing: the declarations holding them bind `request` to `QueryRouteRequest` in one and `HeartbeatRequest` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
Duplicated block (6 lines × 31) proxy/src/main/java/org/apache/rocketmq/proxy/ProxyStartup.java:153— proxy/src/main/java/org/apache/rocketmq/proxy/ProxyStartup.java:153-158 | tools/src/main/java/org/apache/rocketmq/tools/command/acl/UpdateAccessConfigSubCommand.java:67-73 | tools/src/main/java/org/apache/rocketmq/tools/command/broker/BrokerConsumeStatsSubCommad.java:73-79 | tools/src/main/java/org/apache/rocketmq/tools/command/broker/CommitLogSetReadAheadSubCommand.java:53-58 | tools/src/main/java/org/apache/rocketmq/tools/command/broker/DeleteExpiredCommitLogSubCommand.java:46-51 | tools/src/main/java/org/apache/rocketmq/tools/command/broker/GetBrokerEpochSubCommand.java:47-52 | tools/src/main/java/org/apache/rocketmq/tools/command/broker/RemoveColdDataFlowCtrGroupConfigSubCommand.java:45-50 | tools/src/main/java/org/apache/rocketmq/tools/command/broker/UpdateBrokerConfigSubCommand.java:46-51 | tools/src/main/java/org/apache/rocketmq/tools/command/broker/UpdateColdDataFlowCtrGroupConfigSubCommand.java:48-53 | tools/src/main/java/org/apache/rocketmq/tools/command/cluster/CLusterSendMsgRTCommand.java:57-62 | tools/src/main/java/org/apache/rocketmq/tools/command/consumer/ConsumerStatusSubCommand.java:59-65 | tools/src/main/java/org/apache/rocketmq/tools/command/consumer/DeleteSubscriptionGroupCommand.java:45-50 | tools/src/main/java/org/apache/rocketmq/tools/command/consumer/SetConsumeModeSubCommand.java:48-53 | tools/src/main/java/org/apache/rocketmq/tools/command/consumer/UpdateSubGroupSubCommand.java:50-55 | tools/src/main/java/org/apache/rocketmq/tools/command/consumer/UpdateSubGroupSubCommand.java:61-67 | tools/src/main/java/org/apache/rocketmq/tools/command/consumer/UpdateSubGroupSubCommand.java:92-98 | tools/src/main/java/org/apache/rocketmq/tools/command/export/ExportMetadataCommand.java:55-60 | tools/src/main/java/org/apache/rocketmq/tools/command/ha/GetSyncStateSetSubCommand.java:52-58 | tools/src/main/java/org/apache/rocketmq/tools/command/ha/HAStatusSubCommand.java:50-55 | tools/src/main/java/org/apache/rocketmq/tools/command/message/ConsumeMessageCommand.java:82-88 | tools/src/main/java/org/apache/rocketmq/tools/command/message/PrintMessageByQueueCommand.java:128-134 | tools/src/main/java/org/apache/rocketmq/tools/command/message/PrintMessageSubCommand.java:74-82 | tools/src/main/java/org/apache/rocketmq/tools/command/message/QueryMsgByIdSubCommand.java:198-204 | tools/src/main/java/org/apache/rocketmq/tools/command/message/QueryMsgByKeySubCommand.java:52-58 | tools/src/main/java/org/apache/rocketmq/tools/command/message/QueryMsgByUniqueKeySubCommand.java:153-159 | tools/src/main/java/org/apache/rocketmq/tools/command/message/QueryMsgTraceByIdSubCommand.java:47-53 | tools/src/main/java/org/apache/rocketmq/tools/command/message/SendMessageCommand.java:57-63 | tools/src/main/java/org/apache/rocketmq/tools/command/offset/ResetOffsetByTimeCommand.java:68-74 | tools/src/main/java/org/apache/rocketmq/tools/command/queue/QueryConsumeQueueCommand.java:71-77 | tools/src/main/java/org/apache/rocketmq/tools/command/topic/UpdateTopicPermSubCommand.java:53-58 | tools/src/main/java/org/apache/rocketmq/tools/command/topic/UpdateTopicSubCommand.java:69-75 — there are 31 copies across 29 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 31 sites; resolving a subset leaves the remainder to drift apart. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `tools/src/main/java/org/apache/rocketmq/tools/command/broker/BrokerConsumeStatsSubCommad.java:71` calls `addOption`, `Option` and `proxy/src/main/java/org/apache/rocketmq/proxy/ProxyStartup.java:153` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (6 lines × 23) example/src/main/java/org/apache/rocketmq/example/operation/Consumer.java:82— example/src/main/java/org/apache/rocketmq/example/operation/Consumer.java:82-88 | tools/src/main/java/org/apache/rocketmq/tools/command/acl/UpdateAccessConfigSubCommand.java:63-69 | tools/src/main/java/org/apache/rocketmq/tools/command/broker/BrokerConsumeStatsSubCommad.java:70-75 | tools/src/main/java/org/apache/rocketmq/tools/command/broker/SendMsgStatusCommand.java:58-63 | tools/src/main/java/org/apache/rocketmq/tools/command/consumer/ConsumerStatusSubCommand.java:56-61 | tools/src/main/java/org/apache/rocketmq/tools/command/consumer/UpdateSubGroupSubCommand.java:57-63 | tools/src/main/java/org/apache/rocketmq/tools/command/controller/CleanControllerBrokerMetaSubCommand.java:47-52 | tools/src/main/java/org/apache/rocketmq/tools/command/ha/GetSyncStateSetSubCommand.java:49-54 | tools/src/main/java/org/apache/rocketmq/tools/command/message/CheckMsgSendRTCommand.java:49-54 | tools/src/main/java/org/apache/rocketmq/tools/command/message/ConsumeMessageCommand.java:79-84 | tools/src/main/java/org/apache/rocketmq/tools/command/message/PrintMessageByQueueCommand.java:124-130 | tools/src/main/java/org/apache/rocketmq/tools/command/message/PrintMessageSubCommand.java:71-76 | tools/src/main/java/org/apache/rocketmq/tools/command/message/QueryMsgByIdSubCommand.java:195-200 | tools/src/main/java/org/apache/rocketmq/tools/command/message/QueryMsgByKeySubCommand.java:48-54 | tools/src/main/java/org/apache/rocketmq/tools/command/message/QueryMsgByUniqueKeySubCommand.java:150-155 | tools/src/main/java/org/apache/rocketmq/tools/command/message/QueryMsgTraceByIdSubCommand.java:44-49 | tools/src/main/java/org/apache/rocketmq/tools/command/message/SendMessageCommand.java:53-59 | tools/src/main/java/org/apache/rocketmq/tools/command/offset/ResetOffsetByTimeCommand.java:56-62 | tools/src/main/java/org/apache/rocketmq/tools/command/queue/QueryConsumeQueueCommand.java:67-73 | tools/src/main/java/org/apache/rocketmq/tools/command/topic/RemappingStaticTopicSubCommand.java:68-74 | tools/src/main/java/org/apache/rocketmq/tools/command/topic/UpdateOrderConfCommand.java:45-50 | tools/src/main/java/org/apache/rocketmq/tools/command/topic/UpdateStaticTopicSubCommand.java:73-79 | tools/src/main/java/org/apache/rocketmq/tools/command/topic/UpdateTopicSubCommand.java:65-71 — before extracting anything, compare `example/src/main/java/org/apache/rocketmq/example/operation/Consumer.java` and `tools/src/main/java/org/apache/rocketmq/tools/command/acl/UpdateAccessConfigSubCommand.java` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 46 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `tools/src/main/java/org/apache/rocketmq/tools/command/acl/UpdateAccessConfigSubCommand.java:59` calls `Option`, `setRequired`, `addOption` and `tools/src/main/java/org/apache/rocketmq/tools/command/topic/RemappingStaticTopicSubCommand.java:66` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (6 lines × 6) tools/src/main/java/org/apache/rocketmq/tools/command/broker/RemoveColdDataFlowCtrGroupConfigSubCommand.java:71— tools/src/main/java/org/apache/rocketmq/tools/command/broker/RemoveColdDataFlowCtrGroupConfigSubCommand.java:71-76 | tools/src/main/java/org/apache/rocketmq/tools/command/broker/UpdateColdDataFlowCtrGroupConfigSubCommand.java:81-86 | tools/src/main/java/org/apache/rocketmq/tools/command/consumer/DeleteSubscriptionGroupCommand.java:84-92 | tools/src/main/java/org/apache/rocketmq/tools/command/consumer/SetConsumeModeSubCommand.java:106-114 | tools/src/main/java/org/apache/rocketmq/tools/command/consumer/UpdateSubGroupSubCommand.java:200-208 | tools/src/main/java/org/apache/rocketmq/tools/command/topic/UpdateTopicSubCommand.java:163-172 — before extracting anything, compare `tools/src/main/java/org/apache/rocketmq/tools/command/broker/RemoveColdDataFlowCtrGroupConfigSubCommand.java` and `tools/src/main/java/org/apache/rocketmq/tools/command/broker/UpdateColdDataFlowCtrGroupConfigSubCommand.java` as WHOLE FILES: this scan already matched 8 separate duplicated blocks between them, totalling at least 81 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `tools/src/main/java/org/apache/rocketmq/tools/command/broker/RemoveColdDataFlowCtrGroupConfigSubCommand.java:71` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (6 lines × 4) client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:1344— client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:1344-1349 | client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:2305-2310 | client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:2332-2337 | client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:2635-2640 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:1344` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (5 lines × 5) broker/src/main/java/org/apache/rocketmq/broker/processor/AckMessageProcessor.java:121— broker/src/main/java/org/apache/rocketmq/broker/processor/AckMessageProcessor.java:121-125 | broker/src/main/java/org/apache/rocketmq/broker/processor/ChangeInvisibleTimeProcessor.java:77-81 | broker/src/main/java/org/apache/rocketmq/broker/processor/NotificationProcessor.java:88-92 | broker/src/main/java/org/apache/rocketmq/broker/processor/PollingInfoProcessor.java:76-80 | broker/src/main/java/org/apache/rocketmq/broker/processor/PopMessageProcessor.java:253-259 — before extracting anything, compare `broker/src/main/java/org/apache/rocketmq/broker/processor/NotificationProcessor.java` and `broker/src/main/java/org/apache/rocketmq/broker/processor/PollingInfoProcessor.java` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 58 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `broker/src/main/java/org/apache/rocketmq/broker/processor/AckMessageProcessor.java:121` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
Duplicated block (3–5 lines × 3) broker/src/main/java/org/apache/rocketmq/broker/processor/ReplyMessageProcessor.java:301— broker/src/main/java/org/apache/rocketmq/broker/processor/ReplyMessageProcessor.java:301-305 | broker/src/main/java/org/apache/rocketmq/broker/processor/SendMessageProcessor.java:456-460 | broker/src/main/java/org/apache/rocketmq/broker/schedule/ScheduleMessageService.java:739-741 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 3 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 3 times. Read the line range as the matched WINDOW rather than a finished unit: at `broker/src/main/java/org/apache/rocketmq/broker/schedule/ScheduleMessageService.java:739` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `broker/src/main/java/org/apache/rocketmq/broker/processor/SendMessageProcessor.java:452` calls `getBrokerStatsManager`, `incTopicPutLatency`, `getTopic` and `broker/src/main/java/org/apache/rocketmq/broker/processor/ReplyMessageProcessor.java:298` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (21 lines × 2) broker/src/main/java/org/apache/rocketmq/broker/subscription/LmqSubscriptionGroupManager.java:25— broker/src/main/java/org/apache/rocketmq/broker/subscription/LmqSubscriptionGroupManager.java:25-45 | broker/src/main/java/org/apache/rocketmq/broker/subscription/RocksDBLmqSubscriptionGroupManager.java:25-45 — before extracting anything, compare `broker/src/main/java/org/apache/rocketmq/broker/subscription/LmqSubscriptionGroupManager.java` and `broker/src/main/java/org/apache/rocketmq/broker/subscription/RocksDBLmqSubscriptionGroupManager.java` as WHOLE FILES: 94% of the shorter file's lines also appear in the other, so this reads as one file having been copied from the other rather than as a helper waiting to be extracted. The 1 duplicated block(s) this scan matched between them are fragments of that copy, not the extent of it — treat the file pair as the unit. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (31 lines × 2) broker/src/main/java/org/apache/rocketmq/broker/topic/LmqTopicConfigManager.java:25— broker/src/main/java/org/apache/rocketmq/broker/topic/LmqTopicConfigManager.java:25-55 | broker/src/main/java/org/apache/rocketmq/broker/topic/RocksDBLmqTopicConfigManager.java:26-56 — before extracting anything, compare `broker/src/main/java/org/apache/rocketmq/broker/topic/LmqTopicConfigManager.java` and `broker/src/main/java/org/apache/rocketmq/broker/topic/RocksDBLmqTopicConfigManager.java` as WHOLE FILES: 90% of the shorter file's lines also appear in the other, so this reads as one file having been copied from the other rather than as a helper waiting to be extracted. The 1 duplicated block(s) this scan matched between them are fragments of that copy, not the extent of it — treat the file pair as the unit. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (47 lines × 2) common/src/main/java/org/apache/rocketmq/common/stats/StatsSnapshot.java:1— common/src/main/java/org/apache/rocketmq/common/stats/StatsSnapshot.java:1-57 | remoting/src/main/java/org/apache/rocketmq/remoting/protocol/body/BrokerStatsItem.java:1-47 — before extracting anything, compare `common/src/main/java/org/apache/rocketmq/common/stats/StatsSnapshot.java` and `remoting/src/main/java/org/apache/rocketmq/remoting/protocol/body/BrokerStatsItem.java` as WHOLE FILES: 87% of the shorter file's lines also appear in the other, so this reads as one file having been copied from the other rather than as a helper waiting to be extracted. The 1 duplicated block(s) this scan matched between them are fragments of that copy, not the extent of it — treat the file pair as the unit. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `common/src/main/java/org/apache/rocketmq/common/stats/StatsSnapshot.java:1` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (72 lines × 2) remoting/src/main/java/org/apache/rocketmq/remoting/protocol/body/LockBatchRequestBody.java:1— remoting/src/main/java/org/apache/rocketmq/remoting/protocol/body/LockBatchRequestBody.java:1-72 | remoting/src/main/java/org/apache/rocketmq/remoting/protocol/body/UnlockBatchRequestBody.java:1-72 — before extracting anything, compare `remoting/src/main/java/org/apache/rocketmq/remoting/protocol/body/LockBatchRequestBody.java` and `remoting/src/main/java/org/apache/rocketmq/remoting/protocol/body/UnlockBatchRequestBody.java` as WHOLE FILES: 98% of the shorter file's lines also appear in the other, so this reads as one file having been copied from the other rather than as a helper waiting to be extracted. The 1 duplicated block(s) this scan matched between them are fragments of that copy, not the extent of it — treat the file pair as the unit. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `remoting/src/main/java/org/apache/rocketmq/remoting/protocol/body/LockBatchRequestBody.java:1` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (60 lines × 2) remoting/src/main/java/org/apache/rocketmq/remoting/protocol/header/ChangeInvisibleTimeResponseHeader.java:1— remoting/src/main/java/org/apache/rocketmq/remoting/protocol/header/ChangeInvisibleTimeResponseHeader.java:1-60 | remoting/src/main/java/org/apache/rocketmq/remoting/protocol/header/PopMessageResponseHeader.java:1-101 — before extracting anything, compare `remoting/src/main/java/org/apache/rocketmq/remoting/protocol/header/ChangeInvisibleTimeResponseHeader.java` and `remoting/src/main/java/org/apache/rocketmq/remoting/protocol/header/PopMessageResponseHeader.java` as WHOLE FILES: 97% of the shorter file's lines also appear in the other, so this reads as one file having been copied from the other rather than as a helper waiting to be extracted. The 1 duplicated block(s) this scan matched between them are fragments of that copy, not the extent of it — treat the file pair as the unit. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `remoting/src/main/java/org/apache/rocketmq/remoting/protocol/header/ChangeInvisibleTimeResponseHeader.java:1` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (61 lines × 2) remoting/src/main/java/org/apache/rocketmq/remoting/protocol/header/ExchangeHAInfoRequestHeader.java:1— remoting/src/main/java/org/apache/rocketmq/remoting/protocol/header/ExchangeHAInfoRequestHeader.java:1-61 | remoting/src/main/java/org/apache/rocketmq/remoting/protocol/header/ExchangeHAInfoResponseHeader.java:1-61 — before extracting anything, compare `remoting/src/main/java/org/apache/rocketmq/remoting/protocol/header/ExchangeHAInfoRequestHeader.java` and `remoting/src/main/java/org/apache/rocketmq/remoting/protocol/header/ExchangeHAInfoResponseHeader.java` as WHOLE FILES: 97% of the shorter file's lines also appear in the other, so this reads as one file having been copied from the other rather than as a helper waiting to be extracted. The 1 duplicated block(s) this scan matched between them are fragments of that copy, not the extent of it — treat the file pair as the unit. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `remoting/src/main/java/org/apache/rocketmq/remoting/protocol/header/ExchangeHAInfoRequestHeader.java:1` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (55 lines × 3) remoting/src/main/java/org/apache/rocketmq/remoting/protocol/header/GetEarliestMsgStoretimeRequestHeader.java:1— remoting/src/main/java/org/apache/rocketmq/remoting/protocol/header/GetEarliestMsgStoretimeRequestHeader.java:1-55 | remoting/src/main/java/org/apache/rocketmq/remoting/protocol/header/QueryConsumeQueueRequestHeader.java:1-74 | remoting/src/main/java/org/apache/rocketmq/remoting/protocol/header/ResetOffsetRequestHeader.java:1-93 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 3 call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `remoting/src/main/java/org/apache/rocketmq/remoting/protocol/header/GetEarliestMsgStoretimeRequestHeader.java:1` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (62 lines × 2) remoting/src/main/java/org/apache/rocketmq/remoting/protocol/header/PollingInfoRequestHeader.java:1— remoting/src/main/java/org/apache/rocketmq/remoting/protocol/header/PollingInfoRequestHeader.java:1-62 | remoting/src/main/java/org/apache/rocketmq/remoting/protocol/header/StatisticsMessagesRequestHeader.java:1-80 — before extracting anything, compare `remoting/src/main/java/org/apache/rocketmq/remoting/protocol/header/PollingInfoRequestHeader.java` and `remoting/src/main/java/org/apache/rocketmq/remoting/protocol/header/StatisticsMessagesRequestHeader.java` as WHOLE FILES: 83% of the shorter file's lines also appear in the other, so this reads as one file having been copied from the other rather than as a helper waiting to be extracted. The 1 duplicated block(s) this scan matched between them are fragments of that copy, not the extent of it — treat the file pair as the unit. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `remoting/src/main/java/org/apache/rocketmq/remoting/protocol/header/PollingInfoRequestHeader.java:1` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (37 lines × 2) remoting/src/main/java/org/apache/rocketmq/remoting/protocol/header/controller/register/ApplyBrokerIdResponseHeader.java:29— remoting/src/main/java/org/apache/rocketmq/remoting/protocol/header/controller/register/ApplyBrokerIdResponseHeader.java:29-65 | remoting/src/main/java/org/apache/rocketmq/remoting/protocol/header/controller/register/GetNextBrokerIdRequestHeader.java:29-65 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
Duplicated block (69 lines × 3) remoting/src/main/java/org/apache/rocketmq/remoting/protocol/header/namesrv/QueryDataVersionRequestHeader.java:1— remoting/src/main/java/org/apache/rocketmq/remoting/protocol/header/namesrv/QueryDataVersionRequestHeader.java:1-69 | remoting/src/main/java/org/apache/rocketmq/remoting/protocol/header/namesrv/RegisterBrokerRequestHeader.java:1-122 | remoting/src/main/java/org/apache/rocketmq/remoting/protocol/header/namesrv/UnRegisterBrokerRequestHeader.java:1-71 — before extracting anything, compare `remoting/src/main/java/org/apache/rocketmq/remoting/protocol/header/namesrv/QueryDataVersionRequestHeader.java` and `remoting/src/main/java/org/apache/rocketmq/remoting/protocol/header/namesrv/RegisterBrokerRequestHeader.java` as WHOLE FILES: 93% of the shorter file's lines also appear in the other, so this reads as one file having been copied from the other rather than as a helper waiting to be extracted. The 1 duplicated block(s) this scan matched between them are fragments of that copy, not the extent of it — treat the file pair as the unit. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `remoting/src/main/java/org/apache/rocketmq/remoting/protocol/header/namesrv/QueryDataVersionRequestHeader.java:1` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (6 lines × 8) tools/src/main/java/org/apache/rocketmq/tools/command/consumer/GetConsumerConfigSubCommand.java:50— tools/src/main/java/org/apache/rocketmq/tools/command/consumer/GetConsumerConfigSubCommand.java:50-55 | tools/src/main/java/org/apache/rocketmq/tools/command/controller/GetControllerConfigSubCommand.java:45-51 | tools/src/main/java/org/apache/rocketmq/tools/command/controller/GetControllerMetaDataSubCommand.java:41-46 | tools/src/main/java/org/apache/rocketmq/tools/command/namesrv/AddWritePermSubCommand.java:41-46 | tools/src/main/java/org/apache/rocketmq/tools/command/namesrv/WipeWritePermSubCommand.java:41-46 | tools/src/main/java/org/apache/rocketmq/tools/command/producer/ProducerSubCommand.java:50-56 | tools/src/main/java/org/apache/rocketmq/tools/command/topic/TopicClusterSubCommand.java:41-46 | tools/src/main/java/org/apache/rocketmq/tools/command/topic/TopicStatusSubCommand.java:47-52 — before extracting anything, compare `tools/src/main/java/org/apache/rocketmq/tools/command/namesrv/AddWritePermSubCommand.java` and `tools/src/main/java/org/apache/rocketmq/tools/command/namesrv/WipeWritePermSubCommand.java` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 36 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (11–14 lines × 3) example/src/main/java/org/apache/rocketmq/example/filter/SqlFilterConsumer.java:39— example/src/main/java/org/apache/rocketmq/example/filter/SqlFilterConsumer.java:39-51 | example/src/main/java/org/apache/rocketmq/example/filter/TagFilterConsumer.java:35-48 | example/src/main/java/org/apache/rocketmq/example/simple/PushConsumer.java:43-53 — before extracting anything, compare `example/src/main/java/org/apache/rocketmq/example/filter/SqlFilterConsumer.java` and `example/src/main/java/org/apache/rocketmq/example/filter/TagFilterConsumer.java` as WHOLE FILES: 83% of the shorter file's lines also appear in the other, so this reads as one file having been copied from the other rather than as a helper waiting to be extracted. The 1 duplicated block(s) this scan matched between them are fragments of that copy, not the extent of it — treat the file pair as the unit. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `example/src/main/java/org/apache/rocketmq/example/filter/SqlFilterConsumer.java:39` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Off the main sequence: rocketmq-remoting — rocketmq-remoting: abstractness 0.08, instability 0.17, distance 0.76 — zone of pain — concrete and depended on by 5 project(s), so it's rigid to change.
Skeleton type — most members are unfinished proxy/src/main/java/org/apache/rocketmq/proxy/service/channel/SimpleChannelHandlerContext.java:34— `SimpleChannelHandlerContext` has 36 unfinished members out of 41 declared methods (whether or not each carries a body) — a scaffolded class that was never implemented.
Orphaned file store/src/main/java/org/apache/rocketmq/store/CommitLog.java:1— No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
Orphaned file broker/src/main/java/org/apache/rocketmq/broker/BrokerController.java:1— No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
Orphaned file tools/src/main/java/org/apache/rocketmq/tools/admin/DefaultMQAdminExtImpl.java:1— No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
Orphaned file client/src/main/java/org/apache/rocketmq/client/impl/producer/DefaultMQProducerImpl.java:1— No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
Orphaned file store/src/main/java/org/apache/rocketmq/store/timer/TimerMessageStore.java:1— No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
Orphaned file client/src/main/java/org/apache/rocketmq/client/impl/consumer/DefaultMQPushConsumerImpl.java:1— No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
Orphaned file broker/src/main/java/org/apache/rocketmq/broker/out/BrokerOuterAPI.java:1— No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
Orphaned file client/src/main/java/org/apache/rocketmq/client/producer/DefaultMQProducer.java:1— No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
Orphaned file client/src/main/java/org/apache/rocketmq/client/impl/factory/MQClientInstance.java:1— No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
Orphaned file store/src/main/java/org/apache/rocketmq/store/config/MessageStoreConfig.java:1— No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
Orphaned file common/src/main/java/org/apache/rocketmq/common/BrokerConfig.java:1— No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
Orphaned file client/src/main/java/org/apache/rocketmq/client/impl/consumer/DefaultLitePullConsumerImpl.java:1— No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
Orphaned file namesrv/src/main/java/org/apache/rocketmq/namesrv/routeinfo/RouteInfoManager.java:1— No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
Orphaned file remoting/src/main/java/org/apache/rocketmq/remoting/netty/NettyRemotingClient.java:1— No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
Orphaned file proxy/src/main/java/org/apache/rocketmq/proxy/config/ProxyConfig.java:1— No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
Orphaned file store/src/main/java/org/apache/rocketmq/store/ConsumeQueue.java:1— No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
Orphaned file broker/src/main/java/org/apache/rocketmq/broker/processor/PopMessageProcessor.java:1— No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
Orphaned file REDACTED:1— No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
Orphaned file store/src/main/java/org/apache/rocketmq/store/queue/BatchConsumeQueue.java:1— No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
Orphaned file broker/src/main/java/org/apache/rocketmq/broker/processor/PullMessageProcessor.java:1— No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
Orphaned file store/src/main/java/org/apache/rocketmq/store/dledger/DLedgerCommitLog.java:1— No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
Orphaned file broker/src/main/java/org/apache/rocketmq/broker/controller/ReplicasManager.java:1— No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
Orphaned file tools/src/main/java/org/apache/rocketmq/tools/admin/DefaultMQAdminExt.java:1— No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
Orphaned file broker/src/main/java/org/apache/rocketmq/broker/processor/PopBufferMergeService.java:1— No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
Orphaned file store/src/main/java/org/apache/rocketmq/store/stats/BrokerStatsManager.java:1— No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
No direct assertions: testContainsAllInOne filter/src/test/java/org/apache/rocketmq/filter/ExpressionTest.java:383— No conventional assertion call was detected, and 61 of 81 tests in `rocketmq-filter` read the same way — so this is treated as that project's convention rather than a broken test, and it does not drag the score. Two things look like this: verification that happens indirectly (an approval/verifier harness or BDD step methods), or a project of runnable samples compiled as tests, where a run that does not throw is the only check. If it is the latter, these methods genuinely verify nothing.
No direct assertions: testContains_StartsWith_EndsWith_boolean_has filter/src/test/java/org/apache/rocketmq/filter/ExpressionTest.java:171— No conventional assertion call was detected, and 61 of 81 tests in `rocketmq-filter` read the same way — so this is treated as that project's convention rather than a broken test, and it does not drag the score. Two things look like this: verification that happens indirectly (an approval/verifier harness or BDD step methods), or a project of runnable samples compiled as tests, where a run that does not throw is the only check. If it is the latter, these methods genuinely verify nothing.
No direct assertions: testContains_StartsWith_EndsWith_has filter/src/test/java/org/apache/rocketmq/filter/ExpressionTest.java:51— No conventional assertion call was detected, and 61 of 81 tests in `rocketmq-filter` read the same way — so this is treated as that project's convention rather than a broken test, and it does not drag the score. Two things look like this: verification that happens indirectly (an approval/verifier harness or BDD step methods), or a project of runnable samples compiled as tests, where a run that does not throw is the only check. If it is the latter, these methods genuinely verify nothing.
No direct assertions: testContains_StartsWith_EndsWith_hasEmpty filter/src/test/java/org/apache/rocketmq/filter/ExpressionTest.java:91— No conventional assertion call was detected, and 61 of 81 tests in `rocketmq-filter` read the same way — so this is treated as that project's convention rather than a broken test, and it does not drag the score. Two things look like this: verification that happens indirectly (an approval/verifier harness or BDD step methods), or a project of runnable samples compiled as tests, where a run that does not throw is the only check. If it is the latter, these methods genuinely verify nothing.
No direct assertions: testContains_StartsWith_EndsWith_has_not filter/src/test/java/org/apache/rocketmq/filter/ExpressionTest.java:71— No conventional assertion call was detected, and 61 of 81 tests in `rocketmq-filter` read the same way — so this is treated as that project's convention rather than a broken test, and it does not drag the score. Two things look like this: verification that happens indirectly (an approval/verifier harness or BDD step methods), or a project of runnable samples compiled as tests, where a run that does not throw is the only check. If it is the latter, these methods genuinely verify nothing.
No direct assertions: testContains_StartsWith_EndsWith_null_has_1 filter/src/test/java/org/apache/rocketmq/filter/ExpressionTest.java:111— No conventional assertion call was detected, and 61 of 81 tests in `rocketmq-filter` read the same way — so this is treated as that project's convention rather than a broken test, and it does not drag the score. Two things look like this: verification that happens indirectly (an approval/verifier harness or BDD step methods), or a project of runnable samples compiled as tests, where a run that does not throw is the only check. If it is the latter, these methods genuinely verify nothing.
No direct assertions: testContains_StartsWith_EndsWith_null_has_2 filter/src/test/java/org/apache/rocketmq/filter/ExpressionTest.java:131— No conventional assertion call was detected, and 61 of 81 tests in `rocketmq-filter` read the same way — so this is treated as that project's convention rather than a broken test, and it does not drag the score. Two things look like this: verification that happens indirectly (an approval/verifier harness or BDD step methods), or a project of runnable samples compiled as tests, where a run that does not throw is the only check. If it is the latter, these methods genuinely verify nothing.
No direct assertions: testContains_StartsWith_EndsWith_number_has filter/src/test/java/org/apache/rocketmq/filter/ExpressionTest.java:151— No conventional assertion call was detected, and 61 of 81 tests in `rocketmq-filter` read the same way — so this is treated as that project's convention rather than a broken test, and it does not drag the score. Two things look like this: verification that happens indirectly (an approval/verifier harness or BDD step methods), or a project of runnable samples compiled as tests, where a run that does not throw is the only check. If it is the latter, these methods genuinely verify nothing.
No direct assertions: testContains_StartsWith_EndsWith_object_has filter/src/test/java/org/apache/rocketmq/filter/ExpressionTest.java:191— No conventional assertion call was detected, and 61 of 81 tests in `rocketmq-filter` read the same way — so this is treated as that project's convention rather than a broken test, and it does not drag the score. Two things look like this: verification that happens indirectly (an approval/verifier harness or BDD step methods), or a project of runnable samples compiled as tests, where a run that does not throw is the only check. If it is the latter, these methods genuinely verify nothing.
No direct assertions: testContains_StartsWith_EndsWith_string_has_empty filter/src/test/java/org/apache/rocketmq/filter/ExpressionTest.java:289— No conventional assertion call was detected, and 61 of 81 tests in `rocketmq-filter` read the same way — so this is treated as that project's convention rather than a broken test, and it does not drag the score. Two things look like this: verification that happens indirectly (an approval/verifier harness or BDD step methods), or a project of runnable samples compiled as tests, where a run that does not throw is the only check. If it is the latter, these methods genuinely verify nothing.
No direct assertions: testContains_StartsWith_EndsWith_string_has_space filter/src/test/java/org/apache/rocketmq/filter/ExpressionTest.java:309— No conventional assertion call was detected, and 61 of 81 tests in `rocketmq-filter` read the same way — so this is treated as that project's convention rather than a broken test, and it does not drag the score. Two things look like this: verification that happens indirectly (an approval/verifier harness or BDD step methods), or a project of runnable samples compiled as tests, where a run that does not throw is the only check. If it is the latter, these methods genuinely verify nothing.
No direct assertions: testContains_StartsWith_EndsWith_string_has_special_1 filter/src/test/java/org/apache/rocketmq/filter/ExpressionTest.java:353— No conventional assertion call was detected, and 61 of 81 tests in `rocketmq-filter` read the same way — so this is treated as that project's convention rather than a broken test, and it does not drag the score. Two things look like this: verification that happens indirectly (an approval/verifier harness or BDD step methods), or a project of runnable samples compiled as tests, where a run that does not throw is the only check. If it is the latter, these methods genuinely verify nothing.
No direct assertions: testContains_StartsWith_EndsWith_string_has_special_2 filter/src/test/java/org/apache/rocketmq/filter/ExpressionTest.java:373— No conventional assertion call was detected, and 61 of 81 tests in `rocketmq-filter` read the same way — so this is treated as that project's convention rather than a broken test, and it does not drag the score. Two things look like this: verification that happens indirectly (an approval/verifier harness or BDD step methods), or a project of runnable samples compiled as tests, where a run that does not throw is the only check. If it is the latter, these methods genuinely verify nothing.
No direct assertions: testContains_StartsWith_EndsWith_string_has_string filter/src/test/java/org/apache/rocketmq/filter/ExpressionTest.java:249— No conventional assertion call was detected, and 61 of 81 tests in `rocketmq-filter` read the same way — so this is treated as that project's convention rather than a broken test, and it does not drag the score. Two things look like this: verification that happens indirectly (an approval/verifier harness or BDD step methods), or a project of runnable samples compiled as tests, where a run that does not throw is the only check. If it is the latter, these methods genuinely verify nothing.
No direct assertions: testContains_has_not_string_1 filter/src/test/java/org/apache/rocketmq/filter/ExpressionTest.java:201— No conventional assertion call was detected, and 61 of 81 tests in `rocketmq-filter` read the same way — so this is treated as that project's convention rather than a broken test, and it does not drag the score. Two things look like this: verification that happens indirectly (an approval/verifier harness or BDD step methods), or a project of runnable samples compiled as tests, where a run that does not throw is the only check. If it is the latter, these methods genuinely verify nothing.
No direct assertions: testContains_has_not_string_2 filter/src/test/java/org/apache/rocketmq/filter/ExpressionTest.java:225— No conventional assertion call was detected, and 61 of 81 tests in `rocketmq-filter` read the same way — so this is treated as that project's convention rather than a broken test, and it does not drag the score. Two things look like this: verification that happens indirectly (an approval/verifier harness or BDD step methods), or a project of runnable samples compiled as tests, where a run that does not throw is the only check. If it is the latter, these methods genuinely verify nothing.
No direct assertions: testContains_startsWith_endsWith_string_has_not_string filter/src/test/java/org/apache/rocketmq/filter/ExpressionTest.java:269— No conventional assertion call was detected, and 61 of 81 tests in `rocketmq-filter` read the same way — so this is treated as that project's convention rather than a broken test, and it does not drag the score. Two things look like this: verification that happens indirectly (an approval/verifier harness or BDD step methods), or a project of runnable samples compiled as tests, where a run that does not throw is the only check. If it is the latter, these methods genuinely verify nothing.
No direct assertions: testContains_string_has_nothing filter/src/test/java/org/apache/rocketmq/filter/ExpressionTest.java:329— No conventional assertion call was detected, and 61 of 81 tests in `rocketmq-filter` read the same way — so this is treated as that project's convention rather than a broken test, and it does not drag the score. Two things look like this: verification that happens indirectly (an approval/verifier harness or BDD step methods), or a project of runnable samples compiled as tests, where a run that does not throw is the only check. If it is the latter, these methods genuinely verify nothing.
No direct assertions: testEndsWithAllInOne filter/src/test/java/org/apache/rocketmq/filter/ExpressionTest.java:405— No conventional assertion call was detected, and 61 of 81 tests in `rocketmq-filter` read the same way — so this is treated as that project's convention rather than a broken test, and it does not drag the score. Two things look like this: verification that happens indirectly (an approval/verifier harness or BDD step methods), or a project of runnable samples compiled as tests, where a run that does not throw is the only check. If it is the latter, these methods genuinely verify nothing.
No direct assertions: testEvaluate_andFalse filter/src/test/java/org/apache/rocketmq/filter/ExpressionTest.java:651— No conventional assertion call was detected, and 61 of 81 tests in `rocketmq-filter` read the same way — so this is treated as that project's convention rather than a broken test, and it does not drag the score. Two things look like this: verification that happens indirectly (an approval/verifier harness or BDD step methods), or a project of runnable samples compiled as tests, where a run that does not throw is the only check. If it is the latter, these methods genuinely verify nothing.
No direct assertions: testEvaluate_andTrue filter/src/test/java/org/apache/rocketmq/filter/ExpressionTest.java:618— No conventional assertion call was detected, and 61 of 81 tests in `rocketmq-filter` read the same way — so this is treated as that project's convention rather than a broken test, and it does not drag the score. Two things look like this: verification that happens indirectly (an approval/verifier harness or BDD step methods), or a project of runnable samples compiled as tests, where a run that does not throw is the only check. If it is the latter, these methods genuinely verify nothing.
No direct assertions: testEvaluate_betweenFalse filter/src/test/java/org/apache/rocketmq/filter/ExpressionTest.java:803— No conventional assertion call was detected, and 61 of 81 tests in `rocketmq-filter` read the same way — so this is treated as that project's convention rather than a broken test, and it does not drag the score. Two things look like this: verification that happens indirectly (an approval/verifier harness or BDD step methods), or a project of runnable samples compiled as tests, where a run that does not throw is the only check. If it is the latter, these methods genuinely verify nothing.
No direct assertions: testEvaluate_betweenTrue filter/src/test/java/org/apache/rocketmq/filter/ExpressionTest.java:783— No conventional assertion call was detected, and 61 of 81 tests in `rocketmq-filter` read the same way — so this is treated as that project's convention rather than a broken test, and it does not drag the score. Two things look like this: verification that happens indirectly (an approval/verifier harness or BDD step methods), or a project of runnable samples compiled as tests, where a run that does not throw is the only check. If it is the latter, these methods genuinely verify nothing.
No direct assertions: testEvaluate_boolean filter/src/test/java/org/apache/rocketmq/filter/ExpressionTest.java:583— No conventional assertion call was detected, and 61 of 81 tests in `rocketmq-filter` read the same way — so this is treated as that project's convention rather than a broken test, and it does not drag the score. Two things look like this: verification that happens indirectly (an approval/verifier harness or BDD step methods), or a project of runnable samples compiled as tests, where a run that does not throw is the only check. If it is the latter, these methods genuinely verify nothing.
No direct assertions: testEvaluate_equal filter/src/test/java/org/apache/rocketmq/filter/ExpressionTest.java:602— No conventional assertion call was detected, and 61 of 81 tests in `rocketmq-filter` read the same way — so this is treated as that project's convention rather than a broken test, and it does not drag the score. Two things look like this: verification that happens indirectly (an approval/verifier harness or BDD step methods), or a project of runnable samples compiled as tests, where a run that does not throw is the only check. If it is the latter, these methods genuinely verify nothing.
Interpolated log message defeats structured logging acl/src/main/java/org/apache/rocketmq/acl/plain/PlainPermissionManager.java:202— `error` at line 202 is handed a message assembled at the call — a string concatenated with a value, or `String.format` — through SLF4J or log4j 2, so the logger receives one finished string: the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the level is filtered out. Pass a constant pattern and the values beside it instead: `log.error("Order {} moved to {}", orderId, status)`, which keeps the pattern and its arguments apart on the event for a structured encoder (logstash-logback-encoder, log4j 2's JsonTemplateLayout, OpenTelemetry), or `log.atInfo().addKeyValue("order_id", orderId).log("order moved")` with SLF4J 2's fluent API. An exception goes last, as the throwable argument, not into the text.
Interpolated log message defeats structured logging acl/src/main/java/org/apache/rocketmq/acl/plain/PlainPermissionManager.java:483— `error` at line 483 is handed a message assembled at the call — a string concatenated with a value, or `String.format` — through SLF4J or log4j 2, so the logger receives one finished string: the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the level is filtered out. Pass a constant pattern and the values beside it instead: `log.error("Order {} moved to {}", orderId, status)`, which keeps the pattern and its arguments apart on the event for a structured encoder (logstash-logback-encoder, log4j 2's JsonTemplateLayout, OpenTelemetry), or `log.atInfo().addKeyValue("order_id", orderId).log("order moved")` with SLF4J 2's fluent API. An exception goes last, as the throwable argument, not into the text.
Interpolated log message defeats structured logging acl/src/main/java/org/apache/rocketmq/acl/plain/PlainPermissionManager.java:488— `error` at line 488 is handed a message assembled at the call — a string concatenated with a value, or `String.format` — through SLF4J or log4j 2, so the logger receives one finished string: the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the level is filtered out. Pass a constant pattern and the values beside it instead: `log.error("Order {} moved to {}", orderId, status)`, which keeps the pattern and its arguments apart on the event for a structured encoder (logstash-logback-encoder, log4j 2's JsonTemplateLayout, OpenTelemetry), or `log.atInfo().addKeyValue("order_id", orderId).log("order moved")` with SLF4J 2's fluent API. An exception goes last, as the throwable argument, not into the text.
Interpolated log message defeats structured logging acl/src/main/java/org/apache/rocketmq/acl/plain/PlainPermissionManager.java:493— `error` at line 493 is handed a message assembled at the call — a string concatenated with a value, or `String.format` — through SLF4J or log4j 2, so the logger receives one finished string: the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the level is filtered out. Pass a constant pattern and the values beside it instead: `log.error("Order {} moved to {}", orderId, status)`, which keeps the pattern and its arguments apart on the event for a structured encoder (logstash-logback-encoder, log4j 2's JsonTemplateLayout, OpenTelemetry), or `log.atInfo().addKeyValue("order_id", orderId).log("order moved")` with SLF4J 2's fluent API. An exception goes last, as the throwable argument, not into the text.
Interpolated log message defeats structured logging broker/src/main/java/org/apache/rocketmq/broker/BrokerPreOnlineService.java:63— `info` at line 63 is handed a message assembled at the call — a string concatenated with a value, or `String.format` — through SLF4J or log4j 2, so the logger receives one finished string: the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the level is filtered out. Pass a constant pattern and the values beside it instead: `log.info("Order {} moved to {}", orderId, status)`, which keeps the pattern and its arguments apart on the event for a structured encoder (logstash-logback-encoder, log4j 2's JsonTemplateLayout, OpenTelemetry), or `log.atInfo().addKeyValue("order_id", orderId).log("order moved")` with SLF4J 2's fluent API. An exception goes last, as the throwable argument, not into the text.
Interpolated log message defeats structured logging broker/src/main/java/org/apache/rocketmq/broker/BrokerPreOnlineService.java:82— `info` at line 82 is handed a message assembled at the call — a string concatenated with a value, or `String.format` — through SLF4J or log4j 2, so the logger receives one finished string: the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the level is filtered out. Pass a constant pattern and the values beside it instead: `log.info("Order {} moved to {}", orderId, status)`, which keeps the pattern and its arguments apart on the event for a structured encoder (logstash-logback-encoder, log4j 2's JsonTemplateLayout, OpenTelemetry), or `log.atInfo().addKeyValue("order_id", orderId).log("order moved")` with SLF4J 2's fluent API. An exception goes last, as the throwable argument, not into the text.
Interpolated log message defeats structured logging broker/src/main/java/org/apache/rocketmq/broker/coldctr/ColdDataPullRequestHoldService.java:76— `warn` at line 76 is handed a message assembled at the call — a string concatenated with a value, or `String.format` — through SLF4J or log4j 2, so the logger receives one finished string: the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the level is filtered out. Pass a constant pattern and the values beside it instead: `log.warn("Order {} moved to {}", orderId, status)`, which keeps the pattern and its arguments apart on the event for a structured encoder (logstash-logback-encoder, log4j 2's JsonTemplateLayout, OpenTelemetry), or `log.atInfo().addKeyValue("order_id", orderId).log("order moved")` with SLF4J 2's fluent API. An exception goes last, as the throwable argument, not into the text.
Interpolated log message defeats structured logging broker/src/main/java/org/apache/rocketmq/broker/coldctr/ColdDataCgCtrService.java:93— `warn` at line 93 is handed a message assembled at the call — a string concatenated with a value, or `String.format` — through SLF4J or log4j 2, so the logger receives one finished string: the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the level is filtered out. Pass a constant pattern and the values beside it instead: `log.warn("Order {} moved to {}", orderId, status)`, which keeps the pattern and its arguments apart on the event for a structured encoder (logstash-logback-encoder, log4j 2's JsonTemplateLayout, OpenTelemetry), or `log.atInfo().addKeyValue("order_id", orderId).log("order moved")` with SLF4J 2's fluent API. An exception goes last, as the throwable argument, not into the text.
Interpolated log message defeats structured logging broker/src/main/java/org/apache/rocketmq/broker/failover/EscapeBridge.java:148— `error` at line 148 is handed a message assembled at the call — a string concatenated with a value, or `String.format` — through SLF4J or log4j 2, so the logger receives one finished string: the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the level is filtered out. Pass a constant pattern and the values beside it instead: `log.error("Order {} moved to {}", orderId, status)`, which keeps the pattern and its arguments apart on the event for a structured encoder (logstash-logback-encoder, log4j 2's JsonTemplateLayout, OpenTelemetry), or `log.atInfo().addKeyValue("order_id", orderId).log("order moved")` with SLF4J 2's fluent API. An exception goes last, as the throwable argument, not into the text.
Interpolated log message defeats structured logging broker/src/main/java/org/apache/rocketmq/broker/failover/EscapeBridge.java:151— `error` at line 151 is handed a message assembled at the call — a string concatenated with a value, or `String.format` — through SLF4J or log4j 2, so the logger receives one finished string: the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the level is filtered out. Pass a constant pattern and the values beside it instead: `log.error("Order {} moved to {}", orderId, status)`, which keeps the pattern and its arguments apart on the event for a structured encoder (logstash-logback-encoder, log4j 2's JsonTemplateLayout, OpenTelemetry), or `log.atInfo().addKeyValue("order_id", orderId).log("order moved")` with SLF4J 2's fluent API. An exception goes last, as the throwable argument, not into the text.
Interpolated log message defeats structured logging broker/src/main/java/org/apache/rocketmq/broker/filter/ExpressionMessageFilter.java:108— `error` at line 108 is handed a message assembled at the call — a string concatenated with a value, or `String.format` — through SLF4J or log4j 2, so the logger receives one finished string: the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the level is filtered out. Pass a constant pattern and the values beside it instead: `log.error("Order {} moved to {}", orderId, status)`, which keeps the pattern and its arguments apart on the event for a structured encoder (logstash-logback-encoder, log4j 2's JsonTemplateLayout, OpenTelemetry), or `log.atInfo().addKeyValue("order_id", orderId).log("order moved")` with SLF4J 2's fluent API. An exception goes last, as the throwable argument, not into the text.
Interpolated log message defeats structured logging broker/src/main/java/org/apache/rocketmq/broker/filter/ExpressionMessageFilter.java:149— `error` at line 149 is handed a message assembled at the call — a string concatenated with a value, or `String.format` — through SLF4J or log4j 2, so the logger receives one finished string: the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the level is filtered out. Pass a constant pattern and the values beside it instead: `log.error("Order {} moved to {}", orderId, status)`, which keeps the pattern and its arguments apart on the event for a structured encoder (logstash-logback-encoder, log4j 2's JsonTemplateLayout, OpenTelemetry), or `log.atInfo().addKeyValue("order_id", orderId).log("order moved")` with SLF4J 2's fluent API. An exception goes last, as the throwable argument, not into the text.
Interpolated log message defeats structured logging broker/src/main/java/org/apache/rocketmq/broker/filter/ExpressionForRetryMessageFilter.java:86— `error` at line 86 is handed a message assembled at the call — a string concatenated with a value, or `String.format` — through SLF4J or log4j 2, so the logger receives one finished string: the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the level is filtered out. Pass a constant pattern and the values beside it instead: `log.error("Order {} moved to {}", orderId, status)`, which keeps the pattern and its arguments apart on the event for a structured encoder (logstash-logback-encoder, log4j 2's JsonTemplateLayout, OpenTelemetry), or `log.atInfo().addKeyValue("order_id", orderId).log("order moved")` with SLF4J 2's fluent API. An exception goes last, as the throwable argument, not into the text.
Interpolated log message defeats structured logging broker/src/main/java/org/apache/rocketmq/broker/filter/ConsumerFilterManager.java:252— `error` at line 252 is handed a message assembled at the call — a string concatenated with a value, or `String.format` — through SLF4J or log4j 2, so the logger receives one finished string: the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the level is filtered out. Pass a constant pattern and the values beside it instead: `log.error("Order {} moved to {}", orderId, status)`, which keeps the pattern and its arguments apart on the event for a structured encoder (logstash-logback-encoder, log4j 2's JsonTemplateLayout, OpenTelemetry), or `log.atInfo().addKeyValue("order_id", orderId).log("order moved")` with SLF4J 2's fluent API. An exception goes last, as the throwable argument, not into the text.
Interpolated log message defeats structured logging broker/src/main/java/org/apache/rocketmq/broker/latency/BrokerFastFailure.java:59— `error` at line 59 is handed a message assembled at the call — a string concatenated with a value, or `String.format` — through SLF4J or log4j 2, so the logger receives one finished string: the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the level is filtered out. Pass a constant pattern and the values beside it instead: `log.error("Order {} moved to {}", orderId, status)`, which keeps the pattern and its arguments apart on the event for a structured encoder (logstash-logback-encoder, log4j 2's JsonTemplateLayout, OpenTelemetry), or `log.atInfo().addKeyValue("order_id", orderId).log("order moved")` with SLF4J 2's fluent API. An exception goes last, as the throwable argument, not into the text.
Interpolated log message defeats structured logging broker/src/main/java/org/apache/rocketmq/broker/latency/BrokerFastFailure.java:140— `warn` at line 140 is handed a message assembled at the call — a string concatenated with a value, or `String.format` — through SLF4J or log4j 2, so the logger receives one finished string: the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the level is filtered out. Pass a constant pattern and the values beside it instead: `log.warn("Order {} moved to {}", orderId, status)`, which keeps the pattern and its arguments apart on the event for a structured encoder (logstash-logback-encoder, log4j 2's JsonTemplateLayout, OpenTelemetry), or `log.atInfo().addKeyValue("order_id", orderId).log("order moved")` with SLF4J 2's fluent API. An exception goes last, as the throwable argument, not into the text.
Interpolated log message defeats structured logging broker/src/main/java/org/apache/rocketmq/broker/longpolling/PullRequestHoldService.java:85— `warn` at line 85 is handed a message assembled at the call — a string concatenated with a value, or `String.format` — through SLF4J or log4j 2, so the logger receives one finished string: the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the level is filtered out. Pass a constant pattern and the values beside it instead: `log.warn("Order {} moved to {}", orderId, status)`, which keeps the pattern and its arguments apart on the event for a structured encoder (logstash-logback-encoder, log4j 2's JsonTemplateLayout, OpenTelemetry), or `log.atInfo().addKeyValue("order_id", orderId).log("order moved")` with SLF4J 2's fluent API. An exception goes last, as the throwable argument, not into the text.
Interpolated log message defeats structured logging broker/src/main/java/org/apache/rocketmq/broker/out/BrokerOuterAPI.java:338— `error` at line 338 is handed a message assembled at the call — a string concatenated with a value, or `String.format` — through SLF4J or log4j 2, so the logger receives one finished string: the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the level is filtered out. Pass a constant pattern and the values beside it instead: `log.error("Order {} moved to {}", orderId, status)`, which keeps the pattern and its arguments apart on the event for a structured encoder (logstash-logback-encoder, log4j 2's JsonTemplateLayout, OpenTelemetry), or `log.atInfo().addKeyValue("order_id", orderId).log("order moved")` with SLF4J 2's fluent API. An exception goes last, as the throwable argument, not into the text.
Interpolated log message defeats structured logging broker/src/main/java/org/apache/rocketmq/broker/out/BrokerOuterAPI.java:369— `error` at line 369 is handed a message assembled at the call — a string concatenated with a value, or `String.format` — through SLF4J or log4j 2, so the logger receives one finished string: the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the level is filtered out. Pass a constant pattern and the values beside it instead: `log.error("Order {} moved to {}", orderId, status)`, which keeps the pattern and its arguments apart on the event for a structured encoder (logstash-logback-encoder, log4j 2's JsonTemplateLayout, OpenTelemetry), or `log.atInfo().addKeyValue("order_id", orderId).log("order moved")` with SLF4J 2's fluent API. An exception goes last, as the throwable argument, not into the text.
Interpolated log message defeats structured logging broker/src/main/java/org/apache/rocketmq/broker/out/BrokerOuterAPI.java:1013— `error` at line 1013 is handed a message assembled at the call — a string concatenated with a value, or `String.format` — through SLF4J or log4j 2, so the logger receives one finished string: the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the level is filtered out. Pass a constant pattern and the values beside it instead: `log.error("Order {} moved to {}", orderId, status)`, which keeps the pattern and its arguments apart on the event for a structured encoder (logstash-logback-encoder, log4j 2's JsonTemplateLayout, OpenTelemetry), or `log.atInfo().addKeyValue("order_id", orderId).log("order moved")` with SLF4J 2's fluent API. An exception goes last, as the throwable argument, not into the text.
Interpolated log message defeats structured logging broker/src/main/java/org/apache/rocketmq/broker/out/BrokerOuterAPI.java:1024— `error` at line 1024 is handed a message assembled at the call — a string concatenated with a value, or `String.format` — through SLF4J or log4j 2, so the logger receives one finished string: the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the level is filtered out. Pass a constant pattern and the values beside it instead: `log.error("Order {} moved to {}", orderId, status)`, which keeps the pattern and its arguments apart on the event for a structured encoder (logstash-logback-encoder, log4j 2's JsonTemplateLayout, OpenTelemetry), or `log.atInfo().addKeyValue("order_id", orderId).log("order moved")` with SLF4J 2's fluent API. An exception goes last, as the throwable argument, not into the text.
Interpolated log message defeats structured logging broker/src/main/java/org/apache/rocketmq/broker/processor/PopBufferMergeService.java:586— `error` at line 586 is handed a message assembled at the call — a string concatenated with a value, or `String.format` — through SLF4J or log4j 2, so the logger receives one finished string: the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the level is filtered out. Pass a constant pattern and the values beside it instead: `log.error("Order {} moved to {}", orderId, status)`, which keeps the pattern and its arguments apart on the event for a structured encoder (logstash-logback-encoder, log4j 2's JsonTemplateLayout, OpenTelemetry), or `log.atInfo().addKeyValue("order_id", orderId).log("order moved")` with SLF4J 2's fluent API. An exception goes last, as the throwable argument, not into the text.
Interpolated log message defeats structured logging broker/src/main/java/org/apache/rocketmq/broker/processor/DefaultPullMessageResultHandler.java:294— `warn` at line 294 is handed a message assembled at the call — a string concatenated with a value, or `String.format` — through SLF4J or log4j 2, so the logger receives one finished string: the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the level is filtered out. Pass a constant pattern and the values beside it instead: `log.warn("Order {} moved to {}", orderId, status)`, which keeps the pattern and its arguments apart on the event for a structured encoder (logstash-logback-encoder, log4j 2's JsonTemplateLayout, OpenTelemetry), or `log.atInfo().addKeyValue("order_id", orderId).log("order moved")` with SLF4J 2's fluent API. An exception goes last, as the throwable argument, not into the text.
Interpolated log message defeats structured logging broker/src/main/java/org/apache/rocketmq/broker/processor/AdminBrokerProcessor.java:365— `error` at line 365 is handed a message assembled at the call — a string concatenated with a value, or `String.format` — through SLF4J or log4j 2, so the logger receives one finished string: the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the level is filtered out. Pass a constant pattern and the values beside it instead: `log.error("Order {} moved to {}", orderId, status)`, which keeps the pattern and its arguments apart on the event for a structured encoder (logstash-logback-encoder, log4j 2's JsonTemplateLayout, OpenTelemetry), or `log.atInfo().addKeyValue("order_id", orderId).log("order moved")` with SLF4J 2's fluent API. An exception goes last, as the throwable argument, not into the text.
Interpolated log message defeats structured logging broker/src/main/java/org/apache/rocketmq/broker/processor/AdminBrokerProcessor.java:2665— `error` at line 2665 is handed a message assembled at the call — a string concatenated with a value, or `String.format` — through SLF4J or log4j 2, so the logger receives one finished string: the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the level is filtered out. Pass a constant pattern and the values beside it instead: `log.error("Order {} moved to {}", orderId, status)`, which keeps the pattern and its arguments apart on the event for a structured encoder (logstash-logback-encoder, log4j 2's JsonTemplateLayout, OpenTelemetry), or `log.atInfo().addKeyValue("order_id", orderId).log("order moved")` with SLF4J 2's fluent API. An exception goes last, as the throwable argument, not into the text.
Duplicated predicate proxy/src/main/java/org/apache/rocketmq/proxy/processor/ProducerProcessor.java:78— `!NamespaceUtil.isRetryTopic(topic) && !NamespaceUtil.isDLQTopic(topic)` appears character-identically in 2 files — proxy/src/main/java/org/apache/rocketmq/proxy/processor/ProducerProcessor.java, proxy/src/main/java/org/apache/rocketmq/proxy/remoting/activity/SendMessageActivity.java. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
Duplicated predicate client/src/main/java/org/apache/rocketmq/client/consumer/store/LocalFileOffsetStore.java:175— `!UtilAll.isBlank(topic) && !topic.equals(mq.getTopic())` appears character-identically in 2 files — client/src/main/java/org/apache/rocketmq/client/consumer/store/LocalFileOffsetStore.java, client/src/main/java/org/apache/rocketmq/client/consumer/store/RemoteBrokerOffsetStore.java. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
Duplicated predicate broker/src/main/java/org/apache/rocketmq/broker/BrokerController.java:1642— `!isIsolated && !this.messageStoreConfig.isEnableDLegerCommitLog() && !this.messageStoreConfig.isDuplicationEnable()` appears character-identically in 2 files — broker/src/main/java/org/apache/rocketmq/broker/BrokerController.java, container/src/main/java/org/apache/rocketmq/container/InnerBrokerController.java. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
Duplicated predicate store/src/main/java/org/apache/rocketmq/store/ConsumeQueue.java:1140— `0 == start && mappedFile.getFileFromOffset() + mappedFile.getFileSize() > physicalOffsetTo` appears character-identically in 2 files — store/src/main/java/org/apache/rocketmq/store/ConsumeQueue.java, store/src/main/java/org/apache/rocketmq/store/queue/BatchConsumeQueue.java. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
Duplicated predicate store/src/main/java/org/apache/rocketmq/store/DefaultMessageStore.java:2899— `StringUtils.isBlank(multiDispatchQueue) || StringUtils.isBlank(multiQueueOffset)` appears character-identically in 2 files — store/src/main/java/org/apache/rocketmq/store/DefaultMessageStore.java, store/src/main/java/org/apache/rocketmq/store/queue/MultiDispatchUtils.java. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
Duplicated predicate store/src/main/java/org/apache/rocketmq/store/MappedFileQueue.java:493— `System.currentTimeMillis() >= liveMaxTimestamp || cleanImmediately` appears character-identically in 2 files — store/src/main/java/org/apache/rocketmq/store/MappedFileQueue.java, store/src/main/java/org/apache/rocketmq/store/dledger/DLedgerCommitLog.java. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
Duplicated predicate broker/src/main/java/org/apache/rocketmq/broker/processor/DefaultPullMessageResultHandler.java:127— `TopicValidator.isSystemTopic(requestHeader.getTopic()) || MixAll.isSysConsumerGroup(requestHeader.getConsumerGroup())` appears character-identically in 3 files — broker/src/main/java/org/apache/rocketmq/broker/processor/DefaultPullMessageResultHandler.java, broker/src/main/java/org/apache/rocketmq/broker/processor/PeekMessageProcessor.java, broker/src/main/java/org/apache/rocketmq/broker/processor/PopMessageProcessor.java. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
Duplicated predicate broker/src/main/java/org/apache/rocketmq/broker/processor/PopReviveService.java:224— `TopicValidator.isSystemTopic(topic) || MixAll.isSysConsumerGroup(group)` appears character-identically in 2 files — broker/src/main/java/org/apache/rocketmq/broker/processor/PopReviveService.java, broker/src/main/java/org/apache/rocketmq/broker/transaction/queue/TransactionalMessageBridge.java. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
Duplicated predicate openmessaging/src/main/java/io/openmessaging/rocketmq/consumer/PullConsumerImpl.java:66— `accessPoints == null || accessPoints.isEmpty()` appears character-identically in 3 files — openmessaging/src/main/java/io/openmessaging/rocketmq/consumer/PullConsumerImpl.java, openmessaging/src/main/java/io/openmessaging/rocketmq/consumer/PushConsumerImpl.java, openmessaging/src/main/java/io/openmessaging/rocketmq/producer/AbstractOMSProducer.java. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
Duplicated predicate common/src/main/java/org/apache/rocketmq/common/attribute/AttributeParser.java:69— `attributes == null || attributes.size() == 0` appears character-identically in 3 files — common/src/main/java/org/apache/rocketmq/common/attribute/AttributeParser.java, common/src/main/java/org/apache/rocketmq/common/utils/CleanupPolicyUtils.java, common/src/main/java/org/apache/rocketmq/common/utils/QueueTypeUtils.java. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
Duplicated predicate store/src/main/java/org/apache/rocketmq/store/CommitLog.java:1137— `autoMessageVersionOnTopicLen && messageExtBatch.getTopic().length() > Byte.MAX_VALUE` appears character-identically in 2 files — store/src/main/java/org/apache/rocketmq/store/CommitLog.java, store/src/main/java/org/apache/rocketmq/store/dledger/DLedgerCommitLog.java. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
Duplicated predicate broker/src/main/java/org/apache/rocketmq/broker/longpolling/LmqPullRequestHoldService.java:35— `brokerController != null && brokerController.getBrokerConfig().isInBrokerContainer()` appears character-identically in 4 files — broker/src/main/java/org/apache/rocketmq/broker/longpolling/LmqPullRequestHoldService.java, broker/src/main/java/org/apache/rocketmq/broker/longpolling/PullRequestHoldService.java, broker/src/main/java/org/apache/rocketmq/broker/processor/PopReviveService.java, broker/src/main/java/org/apache/rocketmq/broker/transaction/TransactionalMessageCheckService.java. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
Duplicated predicate store/src/main/java/org/apache/rocketmq/store/DefaultMessageStore.java:859— `bufferConsumeQueue.hasNext() && nextBeginOffset < maxOffset` appears character-identically in 2 files — store/src/main/java/org/apache/rocketmq/store/DefaultMessageStore.java, REDACTED. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
Duplicated predicate tools/src/main/java/org/apache/rocketmq/tools/admin/MQAdminUtils.java:69— `clusterInfo == null || clusterInfo.getClusterAddrTable().isEmpty()` appears character-identically in 3 files — tools/src/main/java/org/apache/rocketmq/tools/admin/MQAdminUtils.java, tools/src/main/java/org/apache/rocketmq/tools/command/topic/RemappingStaticTopicSubCommand.java, tools/src/main/java/org/apache/rocketmq/tools/command/topic/UpdateStaticTopicSubCommand.java. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
Duplicated predicate tools/src/main/java/org/apache/rocketmq/tools/command/topic/RemappingStaticTopicSubCommand.java:104— `commandLine.hasOption("fr") && Boolean.parseBoolean(commandLine.getOptionValue("fr").trim())` appears character-identically in 2 files — tools/src/main/java/org/apache/rocketmq/tools/command/topic/RemappingStaticTopicSubCommand.java, tools/src/main/java/org/apache/rocketmq/tools/command/topic/UpdateStaticTopicSubCommand.java. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
Duplicated predicate tools/src/main/java/org/apache/rocketmq/tools/command/message/QueryMsgByIdSubCommand.java:241— `commandLine.hasOption('g') && commandLine.hasOption('d')` appears character-identically in 2 files — tools/src/main/java/org/apache/rocketmq/tools/command/message/QueryMsgByIdSubCommand.java, tools/src/main/java/org/apache/rocketmq/tools/command/message/QueryMsgByUniqueKeySubCommand.java. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
Duplicated predicate tools/src/main/java/org/apache/rocketmq/tools/command/cluster/CLusterSendMsgRTCommand.java:110— `commandLine.hasOption('p') && Boolean.parseBoolean(commandLine.getOptionValue('p').trim())` appears character-identically in 2 files — tools/src/main/java/org/apache/rocketmq/tools/command/cluster/CLusterSendMsgRTCommand.java, tools/src/main/java/org/apache/rocketmq/tools/command/message/PrintMessageByQueueCommand.java. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
Duplicated predicate broker/src/main/java/org/apache/rocketmq/broker/subscription/LmqSubscriptionGroupManager.java:41— `config == null || MixAll.isLmq(config.getGroupName())` appears character-identically in 2 files — broker/src/main/java/org/apache/rocketmq/broker/subscription/LmqSubscriptionGroupManager.java, broker/src/main/java/org/apache/rocketmq/broker/subscription/RocksDBLmqSubscriptionGroupManager.java. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
Duplicated predicate broker/src/main/java/org/apache/rocketmq/broker/processor/AbstractSendMessageProcessor.java:336— `consumeMessageHookList != null && !this.consumeMessageHookList.isEmpty()` appears character-identically in 2 files — broker/src/main/java/org/apache/rocketmq/broker/processor/AbstractSendMessageProcessor.java, broker/src/main/java/org/apache/rocketmq/broker/processor/PullMessageProcessor.java. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
Duplicated predicate tools/src/main/java/org/apache/rocketmq/tools/command/message/QueryMsgByIdSubCommand.java:282— `consumerRunningInfo != null && ConsumerRunningInfo.isPushType(consumerRunningInfo)` appears character-identically in 2 files — tools/src/main/java/org/apache/rocketmq/tools/command/message/QueryMsgByIdSubCommand.java, tools/src/main/java/org/apache/rocketmq/tools/command/message/QueryMsgByUniqueKeySubCommand.java. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
Duplicated predicate client/src/main/java/org/apache/rocketmq/client/trace/hook/EndTransactionTraceHookImpl.java:49— `context == null || context.getMessage().getTopic().startsWith(((AsyncTraceDispatcher) localDispatcher).getTraceTopicName())` appears character-identically in 2 files — client/src/main/java/org/apache/rocketmq/client/trace/hook/EndTransactionTraceHookImpl.java, client/src/main/java/org/apache/rocketmq/client/trace/hook/SendMessageTraceHookImpl.java. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
Duplicated predicate client/src/main/java/org/apache/rocketmq/client/trace/hook/ConsumeMessageOpenTracingHookImpl.java:50— `context == null || context.getMsgList() == null || context.getMsgList().isEmpty()` appears character-identically in 2 files — client/src/main/java/org/apache/rocketmq/client/trace/hook/ConsumeMessageOpenTracingHookImpl.java, client/src/main/java/org/apache/rocketmq/client/trace/hook/ConsumeMessageTraceHookImpl.java. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
Duplicated predicate client/src/main/java/org/apache/rocketmq/client/impl/consumer/ConsumeMessageConcurrentlyService.java:108— `corePoolSize > 0 && corePoolSize <= Short.MAX_VALUE && corePoolSize < this.defaultMQPushConsumer.getConsumeThreadMax()` appears character-identically in 4 files — client/src/main/java/org/apache/rocketmq/client/impl/consumer/ConsumeMessageConcurrentlyService.java, client/src/main/java/org/apache/rocketmq/client/impl/consumer/ConsumeMessageOrderlyService.java, client/src/main/java/org/apache/rocketmq/client/impl/consumer/ConsumeMessagePopConcurrentlyService.java, client/src/main/java/org/apache/rocketmq/client/impl/consumer/ConsumeMessagePopOrderlyService.java. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
Duplicated predicate store/src/main/java/org/apache/rocketmq/store/ha/GroupTransferService.java:171— `defaultMessageStore != null && defaultMessageStore.getBrokerConfig().isInBrokerContainer()` appears character-identically in 2 files — store/src/main/java/org/apache/rocketmq/store/ha/GroupTransferService.java, store/src/main/java/org/apache/rocketmq/store/ha/HAConnectionStateNotificationService.java. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
Duplicated predicate client/src/main/java/org/apache/rocketmq/client/impl/consumer/DefaultLitePullConsumerImpl.java:990— `e instanceof MQBrokerException && ((MQBrokerException) e).getResponseCode() == ResponseCode.FLOW_CONTROL` appears character-identically in 2 files — client/src/main/java/org/apache/rocketmq/client/impl/consumer/DefaultLitePullConsumerImpl.java, client/src/main/java/org/apache/rocketmq/client/impl/consumer/DefaultMQPushConsumerImpl.java. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
Fat interface: MQAdminExt (104 abstract methods) tools/src/main/java/org/apache/rocketmq/tools/admin/MQAdminExt.java:72— `MQAdminExt` declares 104 abstract methods: `addBrokerToContainer`, `addWritePermOfBroker`, `cleanControllerBrokerData`, `cleanExpiredConsumerQueue`, `cleanExpiredConsumerQueueByAddr`, `cleanUnusedTopic`, `cleanUnusedTopicByAddr`, `cloneGroupOffset`, `consumeMessageDirectly`, `consumeMessageDirectly`, `createAndUpdateKvConfig`, `createAndUpdatePlainAccessConfig`, `createAndUpdateSubscriptionGroupConfig`, `createAndUpdateTopicConfig`, `createOrUpdateOrderConf`, `createStaticTopic`, `deleteExpiredCommitLog`, `deleteExpiredCommitLogByAddr`, `deleteKvConfig`, `deletePlainAccessConfig`, `deleteSubscriptionGroup`, `deleteSubscriptionGroup`, `deleteTopic`, `deleteTopicInBroker`, `deleteTopicInBrokerConcurrent`, `deleteTopicInNameServer`, `deleteTopicInNameServer`, `electMaster`, `examineBrokerClusterAclVersionInfo`, `examineBrokerClusterInfo`, `examineConsumeStats`, `examineConsumeStats`, `examineConsumeStats`, `examineConsumeStatsConcurrent`, `examineConsumerConnectionInfo`, `examineConsumerConnectionInfo`, `examineProducerConnectionInfo`, `examineSubscriptionGroupConfig`, `examineTopicConfig`, `examineTopicRouteInfo`, and 64 more. Counted over its ABSTRACT methods, once per signature; `default`, `static` and `private` methods and constants are not counted, because no implementer is forced to write them. Those 104 declarations carry 94 distinct name(s), so part of the width is overloading rather than separate responsibilities — but 94 operations clears the >15 bar on its own, so the row is about responsibilities, not signatures. A wide interface forces every implementer and caller to depend on methods they don't use (the Interface-Segregation 'I' in SOLID). Split it into focused role-interfaces.
Fat interface: TieredMetadataStore (18 abstract methods) tieredstore/src/main/java/org/apache/rocketmq/tieredstore/metadata/TieredMetadataStore.java:26— `TieredMetadataStore` declares 18 abstract methods: `addQueue`, `addTopic`, `deleteFileSegment`, `deleteFileSegment`, `deleteQueue`, `deleteTopic`, `destroy`, `getFileSegment`, `getQueue`, `getTopic`, `iterateFileSegment`, `iterateFileSegment`, `iterateQueue`, `iterateTopic`, `setTopicSequenceNumber`, `updateFileSegment`, `updateQueue`, `updateTopic`. Counted over its ABSTRACT methods, once per signature; `default`, `static` and `private` methods and constants are not counted, because no implementer is forced to write them. Those 18 declarations carry 16 distinct name(s), so part of the width is overloading rather than separate responsibilities — but 16 operations clears the >15 bar on its own, so the row is about responsibilities, not signatures. A wide interface forces every implementer and caller to depend on methods they don't use (the Interface-Segregation 'I' in SOLID). Split it into focused role-interfaces.
Fat interface: MappedFile (48 abstract methods) store/src/main/java/org/apache/rocketmq/store/logfile/MappedFile.java:35— `MappedFile` declares 48 abstract methods: `appendMessage`, `appendMessage`, `appendMessage`, `appendMessage`, `appendMessage`, `appendMessages`, `cleanSwapedMap`, `commit`, `destroy`, `flush`, `getData`, `getFile`, `getFileChannel`, `getFileFromOffset`, `getFileName`, `getFileSize`, `getFlushedPosition`, `getLastFlushTime`, `getLastModifiedTimestamp`, `getMappedByteBuffer`, `getMappedByteBufferAccessCountSinceLastSwap`, `getReadPosition`, `getRecentSwapMapTime`, `getStoreTimestamp`, `getWrotePosition`, `hold`, `init`, `isAvailable`, `isFirstCreateInQueue`, `isFull`, `isLoaded`, `iterator`, `mlock`, `moveToParent`, `munlock`, `release`, `renameTo`, `renameToDelete`, `selectMappedBuffer`, `selectMappedBuffer`, and 8 more. Counted over its ABSTRACT methods, once per signature; `default`, `static` and `private` methods and constants are not counted, because no implementer is forced to write them. Those 48 declarations carry 43 distinct name(s), so part of the width is overloading rather than separate responsibilities — but 43 operations clears the >15 bar on its own, so the row is about responsibilities, not signatures. A wide interface forces every implementer and caller to depend on methods they don't use (the Interface-Segregation 'I' in SOLID). Split it into focused role-interfaces.
Fat interface: ConsumeQueueInterface (25 abstract methods) store/src/main/java/org/apache/rocketmq/store/queue/ConsumeQueueInterface.java:28— `ConsumeQueueInterface` declares 25 abstract methods: `assignQueueOffset`, `correctMinOffset`, `estimateMessageCount`, `get`, `getCQType`, `getCqUnitAndStoreTime`, `getEarliestUnit`, `getEarliestUnitAndStoreTime`, `getLastOffset`, `getLatestUnit`, `getMaxOffsetInQueue`, `getMaxPhysicOffset`, `getMessageTotalInQueue`, `getMinLogicOffset`, `getMinOffsetInQueue`, `getOffsetInQueueByTime`, `getOffsetInQueueByTime`, `getQueueId`, `getTopic`, `getTotalSize`, `getUnitSize`, `increaseQueueOffset`, `iterateFrom`, `iterateFrom`, `putMessagePositionInfoWrapper`. Counted over its ABSTRACT methods, once per signature; `default`, `static` and `private` methods and constants are not counted, because no implementer is forced to write them. Those 25 declarations carry 23 distinct name(s), so part of the width is overloading rather than separate responsibilities — but 23 operations clears the >15 bar on its own, so the row is about responsibilities, not signatures. A wide interface forces every implementer and caller to depend on methods they don't use (the Interface-Segregation 'I' in SOLID). Split it into focused role-interfaces.
Fat interface: ConsumeQueueStoreInterface (39 abstract methods) store/src/main/java/org/apache/rocketmq/store/queue/ConsumeQueueStoreInterface.java:27— `ConsumeQueueStoreInterface` declares 39 abstract methods: `assignQueueOffset`, `checkSelf`, `cleanExpired`, `deleteExpiredFile`, `destroy`, `destroy`, `findConsumeQueueMap`, `findOrCreateConsumeQueue`, `flush`, `get`, `getConsumeQueueTable`, `getLmqQueueOffset`, `getMaxOffset`, `getMaxOffsetInQueue`, `getMaxPhyOffsetInConsumeQueue`, `getMaxPhyOffsetInConsumeQueue`, `getMinOffsetInQueue`, `getOffsetInQueueByTime`, `getStoreTime`, `getTopicQueueTable`, `getTotalSize`, `increaseLmqOffset`, `increaseQueueOffset`, `isFirstFileAvailable`, `isFirstFileExist`, `load`, `loadAfterDestroy`, `putMessagePositionInfoWrapper`, `putMessagePositionInfoWrapper`, `rangeQuery`, `recover`, `recoverConcurrently`, `recoverOffsetTable`, `removeTopicQueueTable`, `rollNextFile`, `setTopicQueueTable`, `shutdown`, `start`, `truncateDirty`. Counted over its ABSTRACT methods, once per signature; `default`, `static` and `private` methods and constants are not counted, because no implementer is forced to write them. Those 39 declarations carry 36 distinct name(s), so part of the width is overloading rather than separate responsibilities — but 36 operations clears the >15 bar on its own, so the row is about responsibilities, not signatures. A wide interface forces every implementer and caller to depend on methods they don't use (the Interface-Segregation 'I' in SOLID). Split it into focused role-interfaces.
Fat interface: MessageStore (115 abstract methods) store/src/main/java/org/apache/rocketmq/store/MessageStore.java:52— `MessageStore` declares 115 abstract methods: `addDispatcher`, `appendToCommitLog`, `assignOffset`, `calcDeltaChecksum`, `checkInDiskByConsumeOffset`, `checkInMemByConsumeOffset`, `checkInStoreByConsumeOffset`, `checkMessageAndReturnSize`, `cleanExpiredConsumerQueue`, `cleanUnusedTopic`, `deleteTopics`, `destroy`, `dispatchBehindBytes`, `estimateMessageCount`, `executeDeleteFilesManually`, `findConsumeQueue`, `finishCommitLogDispatch`, `flush`, `getAliveReplicaNumInGroup`, `getAllocateMappedFileService`, `getBrokerInitMaxOffset`, `getBrokerStatsManager`, `getBulkCommitLogData`, `getCommitLog`, `getCommitLogData`, `getCommitLogOffsetInQueue`, `getConfirmOffset`, `getConsumeQueue`, `getData`, `getDispatcherList`, `getEarliestMessageTime`, `getEarliestMessageTime`, `getEarliestMessageTimeAsync`, `getFlushedWhere`, `getHARuntimeInfo`, `getHaService`, `getLastFileFromOffset`, `getLastMappedFile`, `getMasterFlushedOffset`, `getMasterStoreInProcess`, and 75 more. Counted over its ABSTRACT methods, once per signature; `default`, `static` and `private` methods and constants are not counted, because no implementer is forced to write them. Those 115 declarations carry 108 distinct name(s), so part of the width is overloading rather than separate responsibilities — but 108 operations clears the >15 bar on its own, so the row is about responsibilities, not signatures. A wide interface forces every implementer and caller to depend on methods they don't use (the Interface-Segregation 'I' in SOLID). Split it into focused role-interfaces.
Fat interface: MessagingProcessor (33 abstract methods) proxy/src/main/java/org/apache/rocketmq/proxy/processor/MessagingProcessor.java:50— `MessagingProcessor` declares 33 abstract methods: `ackMessage`, `addReceiptHandle`, `addTransactionSubscription`, `batchAckMessage`, `changeInvisibleTime`, `doChannelCloseEvent`, `endTransaction`, `findConsumerChannel`, `findProducerChannel`, `forwardMessageToDeadLetterQueue`, `getConsumerGroupInfo`, `getMaxOffset`, `getMetadataService`, `getMinOffset`, `getProxyRelayService`, `getSubscriptionGroupConfig`, `getTopicRouteDataForProxy`, `lockBatchMQ`, `popMessage`, `pullMessage`, `queryConsumerOffset`, `registerConsumer`, `registerConsumerListener`, `registerProducer`, `registerProducerListener`, `removeReceiptHandle`, `request`, `requestOneway`, `sendMessage`, `unRegisterConsumer`, `unRegisterProducer`, `unlockBatchMQ`, `updateConsumerOffset`. Counted over its ABSTRACT methods, once per signature; `default`, `static` and `private` methods and constants are not counted, because no implementer is forced to write them. A wide interface forces every implementer and caller to depend on methods they don't use (the Interface-Segregation 'I' in SOLID). Split it into focused role-interfaces.
Fat interface: MessageService (16 abstract methods) proxy/src/main/java/org/apache/rocketmq/proxy/service/message/MessageService.java:46— `MessageService` declares 16 abstract methods: `ackMessage`, `batchAckMessage`, `changeInvisibleTime`, `endTransactionOneway`, `getMaxOffset`, `getMinOffset`, `lockBatchMQ`, `popMessage`, `pullMessage`, `queryConsumerOffset`, `request`, `requestOneway`, `sendMessage`, `sendMessageBack`, `unlockBatchMQ`, `updateConsumerOffset`. Counted over its ABSTRACT methods, once per signature; `default`, `static` and `private` methods and constants are not counted, because no implementer is forced to write them. A wide interface forces every implementer and caller to depend on methods they don't use (the Interface-Segregation 'I' in SOLID). Split it into focused role-interfaces.
Fat interface: Controller (16 abstract methods) controller/src/main/java/org/apache/rocketmq/controller/Controller.java:38— `Controller` declares 16 abstract methods: `alterSyncStateSet`, `applyBrokerId`, `cleanBrokerData`, `electMaster`, `getControllerMetadata`, `getNextBrokerId`, `getRemotingServer`, `getReplicaInfo`, `getSyncStateData`, `isLeaderState`, `registerBroker`, `registerBrokerLifecycleListener`, `shutdown`, `startScheduling`, `startup`, `stopScheduling`. Counted over its ABSTRACT methods, once per signature; `default`, `static` and `private` methods and constants are not counted, because no implementer is forced to write them. A wide interface forces every implementer and caller to depend on methods they don't use (the Interface-Segregation 'I' in SOLID). Split it into focused role-interfaces.
Fat interface: LitePullConsumer (30 abstract methods) client/src/main/java/org/apache/rocketmq/client/consumer/LitePullConsumer.java:28— `LitePullConsumer` declares 30 abstract methods: `assign`, `assignment`, `commit`, `commit`, `commit`, `commitSync`, `commitSync`, `committed`, `fetchMessageQueues`, `isAutoCommit`, `isRunning`, `offsetForTimestamp`, `pause`, `poll`, `poll`, `registerTopicMessageQueueChangeListener`, `resume`, `seek`, `seekToBegin`, `seekToEnd`, `setAutoCommit`, `setSubExpressionForAssign`, `shutdown`, `start`, `subscribe`, `subscribe`, `subscribe`, `subscribe`, `unsubscribe`, `updateNameServerAddress`. Counted over its ABSTRACT methods, once per signature; `default`, `static` and `private` methods and constants are not counted, because no implementer is forced to write them. Those 30 declarations carry 23 distinct name(s), so part of the width is overloading rather than separate responsibilities — but 23 operations clears the >15 bar on its own, so the row is about responsibilities, not signatures. A wide interface forces every implementer and caller to depend on methods they don't use (the Interface-Segregation 'I' in SOLID). Split it into focused role-interfaces.
Fat interface: MQPullConsumer (18 abstract methods) client/src/main/java/org/apache/rocketmq/client/consumer/MQPullConsumer.java:29— `MQPullConsumer` declares 18 abstract methods under just 9 distinct name(s): `fetchConsumeOffset`, `fetchMessageQueuesInBalance`, `pull`, `pull`, `pull`, `pull`, `pull`, `pull`, `pull`, `pull`, `pull`, `pullBlockIfNotFound`, `pullBlockIfNotFound`, `registerMessageQueueListener`, `sendMessageBack`, `shutdown`, `start`, `updateConsumeOffset`. Counted over its ABSTRACT methods, once per signature; `default`, `static` and `private` methods and constants are not counted, because no implementer is forced to write them. That is an OVERLOAD SET, not 18 separate responsibilities: a caller binds to 9 operation(s) and uses the overload it selected, so the Interface-Segregation harm does NOT apply on the caller's side and splitting this into role-interfaces would scatter one operation without relieving anything. The burden that does remain is the IMPLEMENTER's — all 18 signatures must be written and kept in step. Reduce it by collapsing overloads (optional or default parameters, or an options object) rather than by segregating the interface.
Fat interface: MQProducer (33 abstract methods) client/src/main/java/org/apache/rocketmq/client/producer/MQProducer.java:29— `MQProducer` declares 33 abstract methods under just 7 distinct name(s): `fetchPublishMessageQueues`, `request`, `request`, `request`, `request`, `request`, `request`, `send`, `send`, `send`, `send`, `send`, `send`, `send`, `send`, `send`, `send`, `send`, `send`, `send`, `send`, `send`, `send`, `send`, `send`, `send`, `send`, `sendMessageInTransaction`, `sendOneway`, `sendOneway`, `sendOneway`, `shutdown`, `start`. Counted over its ABSTRACT methods, once per signature; `default`, `static` and `private` methods and constants are not counted, because no implementer is forced to write them. That is an OVERLOAD SET, not 33 separate responsibilities: a caller binds to 7 operation(s) and uses the overload it selected, so the Interface-Segregation harm does NOT apply on the caller's side and splitting this into role-interfaces would scatter one operation without relieving anything. The burden that does remain is the IMPLEMENTER's — all 33 signatures must be written and kept in step. Reduce it by collapsing overloads (optional or default parameters, or an options object) rather than by segregating the interface.
Fat interface: MqClientAdmin (19 abstract methods) client/src/main/java/org/apache/rocketmq/client/MqClientAdmin.java:54— `MqClientAdmin` declares 19 abstract methods: `consumeMessageDirectly`, `deleteKvConfig`, `deleteSubscriptionGroup`, `deleteTopicInBroker`, `deleteTopicInNameserver`, `getBrokerClusterInfo`, `getConsumeStats`, `getConsumerConnectionList`, `getConsumerRunningInfo`, `getTopicStatsInfo`, `invokeBrokerToResetOffset`, `queryConsumeTimeSpan`, `queryMessage`, `querySubscriptionByConsumer`, `queryTopicConsumeByWho`, `queryTopicsByConsumer`, `updateOrCreateSubscriptionGroup`, `updateOrCreateTopic`, `viewMessage`. Counted over its ABSTRACT methods, once per signature; `default`, `static` and `private` methods and constants are not counted, because no implementer is forced to write them. A wide interface forces every implementer and caller to depend on methods they don't use (the Interface-Segregation 'I' in SOLID). Split it into focused role-interfaces.
README/code drift README.md:1— Apache RocketMQ operator CRDs installed in README but no CRD project exists — searched for: `CRDs`. Each was matched case- and separator-insensitively against file and directory NAMES anywhere in the tree, and against the CONTENTS of manifest and configuration files (package.json and other *.json, *.csproj, *.props, *.sln/*.slnx, *.yml, *.toml, *.config, tool configs such as eslint.config.js, Dockerfile); the README's own prose never counts, so a claim is never refuted by merely being made. Nothing outside that search was read — a footprint living only in a submodule, in a file type not listed here, or under a name none of those terms matches is not seen, and this row is then wrong.
README/code drift README.md:30— README advertises Docker containerisation, but no Dockerfile/compose file exists — searched for: `dockerfile`, `docker-compose`, `compose.yaml`, `compose.yml`. Each was matched case- and separator-insensitively against file and directory NAMES anywhere in the tree, and against the CONTENTS of manifest and configuration files (package.json and other *.json, *.csproj, *.props, *.sln/*.slnx, *.yml, *.toml, *.config, tool configs such as eslint.config.js, Dockerfile); the README's own prose never counts, so a claim is never refuted by merely being made. Nothing outside that search was read — a footprint living only in a submodule, in a file type not listed here, or under a name none of those terms matches is not seen, and this row is then wrong.
README/code drift docs/cn/best_practice.md:373— docs/cn/best_practice.md links to `[](`, but `docs/cn/[](` does not exist. Checked without a model against the repository: its files and folders, the scripts and dependencies of every package.json, the projects, namespaces, package references and target frameworks of the .NET build, the SDK and Node pins, and the identifiers of every file that is not a document; the documents' own text never counts. A footprint generated at build time, read only by a platform, or living outside this repository is not seen, and this row is then wrong.
README/code drift docs/cn/controller/persistent_unique_broker_id.md:32— docs/cn/controller/persistent_unique_broker_id.md names `.broker.meta.temp`, but no file or folder `.broker.meta.temp` exists. Checked without a model against the repository: its files and folders, the scripts and dependencies of every package.json, the projects, namespaces, package references and target frameworks of the .NET build, the SDK and Node pins, and the identifiers of every file that is not a document; the documents' own text never counts. A footprint generated at build time, read only by a platform, or living outside this repository is not seen, and this row is then wrong.
README/code drift docs/cn/controller/persistent_unique_broker_id.md:48— docs/cn/controller/persistent_unique_broker_id.md names `.broker.meta`, but no file or folder `.broker.meta` exists. Checked without a model against the repository: its files and folders, the scripts and dependencies of every package.json, the projects, namespaces, package references and target frameworks of the .NET build, the SDK and Node pins, and the identifiers of every file that is not a document; the documents' own text never counts. A footprint generated at build time, read only by a platform, or living outside this repository is not seen, and this row is then wrong.
README/code drift docs/en/controller/quick_start.md:148— docs/en/controller/quick_start.md names `fast-try-namesrv-plugin.sh`, but no file or folder `fast-try-namesrv-plugin.sh` exists. Checked without a model against the repository: its files and folders, the scripts and dependencies of every package.json, the projects, namespaces, package references and target frameworks of the .NET build, the SDK and Node pins, and the identifiers of every file that is not a document; the documents' own text never counts. A footprint generated at build time, read only by a platform, or living outside this repository is not seen, and this row is then wrong.
README/code drift docs/en/controller/quick_start.md:193— docs/en/controller/quick_start.md names `fast-try-independent-deployment.sh`, but no file or folder `fast-try-independent-deployment.sh` exists. Checked without a model against the repository: its files and folders, the scripts and dependencies of every package.json, the projects, namespaces, package references and target frameworks of the .NET build, the SDK and Node pins, and the identifiers of every file that is not a document; the documents' own text never counts. A footprint generated at build time, read only by a platform, or living outside this repository is not seen, and this row is then wrong.
Silent fallback default in catch REDACTED:94— `getHash` swallows every exception into `return ""` — a data error becomes a silent behavior change with no trail. Log the failure or let it propagate. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment in the catch or in the Javadoc, and the row stops firing.
Silent fallback default in catch common/src/main/java/org/apache/rocketmq/common/MixAll.java:181— `getPID` swallows every exception into `return 0` — a data error becomes a silent behavior change with no trail. Log the failure or let it propagate. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment in the catch or in the Javadoc, and the row stops firing.
Silent fallback default in catch common/src/main/java/org/apache/rocketmq/common/UtilAll.java:284— `getDiskPartitionTotalSpace` swallows every exception into `return -1` — a data error becomes a silent behavior change with no trail. Log the failure or let it propagate. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment in the catch or in the Javadoc, and the row stops firing.
Silent fallback default in catch common/src/main/java/org/apache/rocketmq/common/UtilAll.java:226— `getTotalSpace` swallows every exception into `return -1` — a data error becomes a silent behavior change with no trail. Log the failure or let it propagate. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment in the catch or in the Javadoc, and the row stops firing.
D34 · Knowledge Freshness· Most significant orphaned file · ×3
Most significant orphaned file client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:1— One of the orphaned files carrying the most lost knowledge — ranked by size weighted by the file's role in the codebase, the same weighting behind the score above, so core code outranks equally large plumbing. A reasonable place to start a read-through before the aggregate risk above bites.
Most significant orphaned file broker/src/main/java/org/apache/rocketmq/broker/processor/AdminBrokerProcessor.java:1— One of the orphaned files carrying the most lost knowledge — ranked by size weighted by the file's role in the codebase, the same weighting behind the score above, so core code outranks equally large plumbing. A reasonable place to start a read-through before the aggregate risk above bites.
Most significant orphaned file store/src/main/java/org/apache/rocketmq/store/DefaultMessageStore.java:1— One of the orphaned files carrying the most lost knowledge — ranked by size weighted by the file's role in the codebase, the same weighting behind the score above, so core code outranks equally large plumbing. A reasonable place to start a read-through before the aggregate risk above bites.
Documentation: no project overview docs/cn/Deployment.md— The deployment guide reads like a build/run script rather than an overview of what RocketMQ does and its scope. Add one or two sentences explaining the project's purpose (message queue, reliability guarantees) so readers can judge this document for the overview it claims.
Split broker — A broker whose namespaces are all subcomponents of a single broker (offsets, metrics, coldctr) is a sprawling grab-bag. Suggested: split broker into its own namespaces
Split common — Common is a huge catch-all with 30 message-related namespaces and the 'constant' layer. Suggested: split common into its own listed namespaces
Split proxy — Proxy sprawls across 39 namespaces (common, processor, remoting, service/relay/grpc) with no single cohesive concern. Suggested: split proxy into its own namespaces
Split store — A huge store project whose namespaces are all sub-areas of a single store (queue, timer, ha, rocksdb) is a grab-bag. Suggested: split store into its own namespaces
Split tools — Tools is a large grab-bag whose namespaces are command-line tools and admin APIs spread across 22 namespaces. Suggested: split tools into its own namespaces
D28 · Secrets (history)· Rotate the exposed credentials · ×1
Dormant codebase — 700 of 700 significant files have no living knowledge — the codebase as a whole is dormant, not 700 separate risks. Counted over 700 of the 1249 production source files in this repository: the rest are under the ~2,400-byte size floor this dimension measures over. Re-engage owners or document before change.
No ADRs — No Architecture Decision Records found — no conventional ADR directory, no numbered `NNNN-title` documents in any markup this check reads, and nothing ADR-shaped by content. Design rationale recorded elsewhere (a design-notes tree, a mailing list, pull-request discussion) is not visible to this check and is not re-findable per decision, so a future maintainer cannot ask why one choice was made and get an answer.
Logging is not universal — Only 13/14 runnable modules use logging (modules with no entry point or server are excluded — they are libraries a runnable module hosts). Silent: `.`.
No changelog — No CHANGELOG/HISTORY/RELEASES file — what shipped when isn't easy to reconstruct for support or audit. (Versioning/tagging makes releases traceable, but a changelog records the what.)
Benchmarks don't track allocations namesrv/src/test/java/org/apache/rocketmq/namesrv/routeinfo/RegisterBrokerBenchmark.java— A JMH/Jetpack Benchmark suite exists but nothing turns on its allocation measurement — allocations (the main way hot code pressures a garbage collector or allocator) aren't being measured.
X5 · Nullable reference types· Java packages are not null-marked everywhere · ×1
Java packages are not null-marked everywhere — 0/222 of this repository's Java package directories are under a non-null default: a `package-info.java` declaring `@NullMarked` (JSpecify) or `@NonNullApi`, `@ParametersAreNonnullByDefault`, `@NonNullByDefault`, `@DefaultQualifier(NonNull.class)`; a `module-info.java` declaring `@NullMarked`; every type in it `@NullMarked`; or a build that runs NullAway with the package in `AnnotatedPackages`, or the Checker Framework's `NullnessChecker`. Elsewhere every reference admits null and no checker warns on the dereference that throws a `NullPointerException`.
Skipped (documented): testBasic broker/src/test/java/org/apache/rocketmq/broker/processor/PopBufferMergeServiceTest.java:84— Skipped with a documented reason — a deferral, not lazy debt: skipped at run time by a JUnit assumption
Skipped (documented): testPush client/src/test/java/org/apache/rocketmq/client/impl/consumer/DefaultMQPushConsumerImplTest.java:112— Skipped with a documented reason — a deferral, not lazy debt: switched off by @Ignore
Skipped (documented): testWaitTransactionDataClear proxy/src/test/java/org/apache/rocketmq/proxy/service/transaction/TransactionDataManagerTest.java:102— Skipped with a documented reason — a deferral, not lazy debt: skipped at run time by a JUnit assumption
Skipped (documented): testAsyncPutAndGetMessage store/src/test/java/org/apache/rocketmq/store/dledger/DLedgerCommitlogTest.java:240— Skipped with a documented reason — a deferral, not lazy debt: skipped at run time by a JUnit assumption
Skipped (documented): multiDirsStorageTest store/src/test/java/org/apache/rocketmq/store/dledger/DLedgerMultiPathTest.java:41— Skipped with a documented reason — a deferral, not lazy debt: skipped at run time by a JUnit assumption
Skipped (documented): testFallBehindCQ store/src/test/java/org/apache/rocketmq/store/dledger/MixCommitlogTest.java:35— Skipped with a documented reason — a deferral, not lazy debt: skipped at run time by a JUnit assumption
Skipped (documented): testChangeRoleManyTimes store/src/test/java/org/apache/rocketmq/store/ha/autoswitch/AutoSwitchHATest.java:307— Skipped with a documented reason — a deferral, not lazy debt: switched off by @Ignore
Skipped (documented): testReplaceFiles store/src/test/java/org/apache/rocketmq/store/kv/CompactionLogTest.java:235— Skipped with a documented reason — a deferral, not lazy debt: skipped at run time by a JUnit assumption
Skipped (documented): testPutExpiredTimerMessage store/src/test/java/org/apache/rocketmq/store/timer/TimerMessageStoreTest.java:260— Skipped with a documented reason — a deferral, not lazy debt: skipped at run time by a JUnit assumption
Skipped (documented): testPutTimerMessage store/src/test/java/org/apache/rocketmq/store/timer/TimerMessageStoreTest.java:169— Skipped with a documented reason — a deferral, not lazy debt: skipped at run time by a JUnit assumption
Skipped (documented): testPutMessagePositionInfoWrapper_MultiQueue store/src/test/java/org/apache/rocketmq/store/ConsumeQueueTest.java:297— Skipped with a documented reason — a deferral, not lazy debt: skipped at run time by a JUnit assumption
Skipped (documented): testSemiSyncReplicaWhenSlaveActingMaster store/src/test/java/org/apache/rocketmq/store/HATest.java:165— Skipped with a documented reason — a deferral, not lazy debt: skipped at run time by a JUnit assumption
Skipped (documented): testMappedFile_Rename store/src/test/java/org/apache/rocketmq/store/MappedFileQueueTest.java:395— Skipped with a documented reason — a deferral, not lazy debt: skipped at run time by a JUnit assumption
Skipped (documented): testStartTwoConsumerAndOneConsumerFail test/src/test/java/org/apache/rocketmq/test/client/consumer/broadcast/normal/BroadcastNormalMsgRecvFailIT.java:57— Skipped with a documented reason — a deferral, not lazy debt: switched off by @Ignore
Skipped (documented): testNormalPopAck test/src/test/java/org/apache/rocketmq/test/client/consumer/pop/PopSubCheckIT.java:65— Skipped with a documented reason — a deferral, not lazy debt: switched off by @Ignore
Skipped (documented): checkSchema test/src/test/java/org/apache/rocketmq/test/schema/SchemaTest.java:44— Skipped with a documented reason — a deferral, not lazy debt: switched off by @Ignore
Skipped (documented): multiConsumerLockFromSlave test/src/test/java/org/apache/rocketmq/test/container/RebalanceLockOnSlaveIT.java:132— Skipped with a documented reason — a deferral, not lazy debt: switched off by @Ignore
Skipped (documented): consumeScheduledMsg test/src/test/java/org/apache/rocketmq/test/container/ScheduledMessageIT.java:79— Skipped with a documented reason — a deferral, not lazy debt: switched off by @Ignore
Skipped (documented): testQueryMessageAsync tieredstore/src/test/java/org/apache/rocketmq/tieredstore/TieredMessageFetcherTest.java:264— Skipped with a documented reason — a deferral, not lazy debt: skipped at run time by a JUnit assumption
Skipped (documented): testExamineConsumeStats tools/src/test/java/org/apache/rocketmq/tools/admin/DefaultMQAdminExtTest.java:316— Skipped with a documented reason — a deferral, not lazy debt: switched off by @Ignore
Skipped (documented): testMaxOffset tools/src/test/java/org/apache/rocketmq/tools/admin/DefaultMQAdminExtTest.java:503— Skipped with a documented reason — a deferral, not lazy debt: switched off by @Ignore
Skipped (documented): testSearchOffset tools/src/test/java/org/apache/rocketmq/tools/admin/DefaultMQAdminExtTest.java:510— Skipped with a documented reason — a deferral, not lazy debt: switched off by @Ignore
Skipped (documented): testExecute tools/src/test/java/org/apache/rocketmq/tools/command/consumer/ConsumerProgressSubCommandTest.java:55— Skipped with a documented reason — a deferral, not lazy debt: switched off by @Ignore
Skipped (documented): testExecute tools/src/test/java/org/apache/rocketmq/tools/command/offset/SkipAccumulationCommandTest.java:68— Skipped with a documented reason — a deferral, not lazy debt: switched off by @Ignore
Off the main sequence: rocketmq-common — rocketmq-common: abstractness 0.17, instability 0.00, distance 0.83 — the shape a shared-kernel / building-block library has BY DESIGN — concrete and widely depended-on is what makes it useful, and this dimension does not penalise it (the distance is reported for completeness, not as a defect). Worth a look only if it has grown past one coherent kernel into an everything-bucket.
Appendix B — Reproduction & audit trail
Every external tool invocation behind a deep-scan dimension — the tool, its captured version, the exact command, how many findings it yielded, and a link to the retained raw output. To reproduce any finding: check out the same commit and run the command shown (repo-relative — never an absolute scratch path). The complete raw scanner output is retained verbatim under artifacts/raw/ (indexed in artifacts/raw/index.json); per-invocation exit codes and wall-clock durations are in sidecar.json — kept out of this table so the rendered report stays byte-identical across runs of the same commit.
trivy: not applicable — No Infrastructure-as-Code or container manifests found (Dockerfile, Docker Compose, Terraform, Kubernetes/Helm, CloudFormation, ARM, Bicep, Ansible); nothing to scan.
semgrep: not applicable — No personal data was found crossing a boundary the PII/GDPR ruleset checks — nothing written to a log or console sink, placed in a URL or query string, or persisted to browser storage. That is a clean result for the LEAK surface only: this ruleset detects personal data escaping, it does not inventory the personal data a repository holds, so it is not evidence that this repository has no personal-data surface. The personal-data map (Appendix C) and the C1-C5 compliance cards are what speak to that. semgrep could not parse 1 file(s) — `filter/src/main/java/org/apache/rocketmq/filter/parser/SelectorParser.java` — so the PII/GDPR sweep did not cover the unparsed regions of them; rows reported elsewhere in those files are real.
disclosure: not applicable — No vulnerability-disclosure policy file found (SECURITY.md/.markdown/.rst/.txt at root or under .github/.forgejo/.gitea/docs, .well-known/security.txt). A coordinated-disclosure policy may live off-repo, so this is not evidenced rather than failed.
runtime-hardening: not applicable — No Kubernetes/orchestration workloads found in the repository manifests; network egress policy is a cluster-native control that may live at the platform/firewall layer, so there is nothing to assess here.
runtime-hardening: not applicable — No Kubernetes/orchestration workloads found in the repository manifests; seccomp/AppArmor/SELinux confinement is a workload-level control, so there is nothing to assess here.
runtime-hardening: not applicable — No Kubernetes/orchestration workloads found in the repository manifests; runtime threat-detection and admission-control policy are cluster-level controls, so there is nothing to assess here.
Run 01a165fd-497f-7ed3-a38e-72a4b150ced1 · every finding is also locatable in findings.md, and the complete scoring record (with exit codes + durations) in sidecar.json.
Issues: 79 · Warnings: 1569 · Recommendations: 866 · Info: 25 — Appendix A · all findings · full markdown report.
Generated by Watchdog — deterministic code-health analysis. 22-10-2026 @ 23:41 UTC.
Downloadable artifacts
Machine-readable and reproducible from this commit + frozen rubric — drop them straight into a contract appendix, a CRA dossier, or a downstream SCA / VEX tool.