Public report of apache/rocketmq, published 13 November 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.11.3). Assert 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, 13 November 2026, 14:15 UTC · Survey ID cd_3fe28d2e71f54115b950fd617e61d589
apache/rocketmq
Measured 13 November 2026, 14:14 UTC, at code version 164322b
Test reliability is not measured: The suite could not be re-run, but the repository declares tests of its own unreliable.
CAI scoreAt riskNo change 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: 222,810 lines of product code in 17 projects, tests not counted · Estimated rebuild effort: about 2.9 person-years · Weakest lens: Code Health, 52
Findings by how serious they are
74 critical2218 serious686 minor
16 dimensions are left out of the score. For each one, we either couldn't measure it in this code, or found no evidence of the safeguard we look 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
Canine Code Analyzer
Producer
Canine Development
Analyzer
Canine Code Analyzer engine 1.0.0
Measured
13 November 2026, 14:14 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 the Canine Code Analyzer. It is open to any tool that
implements it, and today the Canine Code Analyzer 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. We work 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 ▸
54of 54 dimensions measured by tools.
2953of 2978 findings point to an exact file and line, so you can open each one in the code. The other 25 concern the repository as a whole, such as missing documentation.
54dimensions across 6 lenses, read from 222,810 lines of product code in 17 projects.
apache/rocketmq is rated At risk because critical security findings are open, most of them in the build pipeline. It scores 58 out of 100, which the At risk rating leaves unchanged.
Code Health, at 52, is the weakest lens and counts most in the score. The best first step for the work it takes is replacing the four packages under a banned licence, worth about 4 points. Declaring which values may be missing would lift Code Health itself, worth about 5 points. Raising Code Health to 70 would lift the score to about 64.
Thirty-seven pipeline tools are referenced by a changeable name, so the build pipeline can be tampered with. Twenty-one known security holes in the packages the code depends on can be used by attackers, and four packages carry licence risk. Pinning each tool to an exact version, updating the vulnerable packages and replacing or clearing the banned-licence packages would close these risks. Passing outside input through environment variables would fix the two pipeline steps that put outside input straight into a shell command, and limiting each secret to its own step would deal with the two secrets exposed to more of the pipeline than needed. The five tests the project itself marks as unreliable need fixing or deleting.
The product code is 222,810 lines, about €430,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.
If Code Health rose from 52 to 70, the lowest score rated Strong, the score would rise from 58 to about 64.
Code composition: what the lines of code are
Product code 66%Tests 34%
New since the last survey: 442 findings
These 442 critical or serious findings weren't in the previous survey, on 24 October 2026. The first 100 are listed here, and the findings file in the download package lists them all.
Code Duplication · Edited copies of one member (3 members, 98+ corresponding lines) broker/src/main/java/org/apache/rocketmq/broker/metrics/BrokerMetricsManager.java
Code Duplication · Edited copy of a member (79 corresponding lines) broker/src/main/java/org/apache/rocketmq/broker/processor/AdminBrokerProcessor.java
Code Duplication · Edited copy of a member (85 corresponding lines) client/src/main/java/org/apache/rocketmq/client/impl/consumer/ConsumeMessageConcurrentlyService.java
Code Duplication · Edited copy of a member (98 corresponding lines) common/src/main/java/org/apache/rocketmq/common/message/MessageDecoder.java
Code Duplication · Edited copy of a member (85 corresponding lines) store/src/main/java/org/apache/rocketmq/store/ConsumeQueue.java
Code Duplication · Edited copy of a member (65 corresponding lines) broker/src/main/java/org/apache/rocketmq/broker/processor/PopReviveService.java
Code Duplication · Edited copy of a member (70 corresponding lines) broker/src/main/java/org/apache/rocketmq/broker/out/BrokerOuterAPI.java
Code Duplication · Edited copy of a member (54 corresponding lines) broker/src/main/java/org/apache/rocketmq/broker/processor/ClientManageProcessor.java
Code Duplication · Edited copy of a member (73 corresponding lines) broker/src/main/java/org/apache/rocketmq/broker/longpolling/PopLiteLongPollingService.java
Code Duplication · Edited copy of a member (49 corresponding lines) remoting/src/main/java/org/apache/rocketmq/remoting/netty/NettyRemotingAbstract.java
Code Duplication · Edited copy of a member (65 corresponding lines) client/src/main/java/org/apache/rocketmq/client/impl/consumer/RebalanceLitePullImpl.java
Code Duplication · Edited copy of a member (56 corresponding lines) broker/src/main/java/org/apache/rocketmq/broker/BrokerController.java
Code Duplication · Edited copies of one member (3 members, 68+ corresponding lines) broker/src/main/java/org/apache/rocketmq/broker/config/v1/RocksDBConsumerOffsetManager.java
Code Duplication · Edited copy of a member (55 corresponding lines) store/src/main/java/org/apache/rocketmq/store/queue/BatchConsumeQueue.java
Code Duplication · Edited copy of a member (60 corresponding lines) broker/src/main/java/org/apache/rocketmq/broker/processor/AdminBrokerProcessor.java
Code Duplication · Edited copy of a member (61 corresponding lines) store/src/main/java/org/apache/rocketmq/store/queue/BatchConsumeQueue.java
Code Duplication · Edited copy of a member (36 corresponding lines) broker/src/main/java/org/apache/rocketmq/broker/processor/PopBufferMergeService.java
Code Duplication · Edited copy of a member (40 corresponding lines) broker/src/main/java/org/apache/rocketmq/broker/processor/AdminBrokerProcessor.java
Code Duplication · Edited copy of a member (42 corresponding lines) broker/src/main/java/org/apache/rocketmq/broker/processor/AdminBrokerProcessor.java
Code Duplication · Edited copy of a member (55 corresponding lines) broker/src/main/java/org/apache/rocketmq/broker/out/BrokerOuterAPI.java
Code Duplication · Edited copy of a member (39 corresponding lines) broker/src/main/java/org/apache/rocketmq/broker/failover/EscapeBridge.java
Code Duplication · Edited copy of a member (36 corresponding lines) store/src/main/java/org/apache/rocketmq/store/ha/DefaultHAService.java
Code Duplication · Edited copy of a member (53 corresponding lines) broker/src/main/java/org/apache/rocketmq/broker/client/rebalance/RebalanceLockManager.java
Code Duplication · Edited copy of a member (41 corresponding lines) broker/src/main/java/org/apache/rocketmq/broker/longpolling/PopLiteLongPollingService.java
Code Duplication · Edited copy of a member (26 corresponding lines) proxy/src/main/java/org/apache/rocketmq/proxy/processor/ConsumerProcessor.java
Code Duplication · Edited copy of a member (49 corresponding lines) store/src/main/java/org/apache/rocketmq/store/ha/DefaultHAConnection.java
Code Duplication · Edited copy of a member (31 corresponding lines) store/src/main/java/org/apache/rocketmq/store/StoreCheckpoint.java
Code Duplication · Edited copy of a member (25 corresponding lines) proxy/src/main/java/org/apache/rocketmq/proxy/grpc/admin/ProxyAdminGrpcService.java
Code Duplication · Edited copy of a member (31 corresponding lines) broker/src/main/java/org/apache/rocketmq/broker/longpolling/PopLiteLongPollingService.java
Code Duplication · Edited copy of a member (32 corresponding lines) REDACTED
Code Duplication · Edited copy of a member (34 corresponding lines) client/src/main/java/org/apache/rocketmq/client/impl/producer/DefaultMQProducerImpl.java
Code Duplication · Edited copy of a member (53 corresponding lines) store/src/main/java/org/apache/rocketmq/store/timer/TimerMessageStore.java
Code Duplication · Edited copies of one member (3 members, 32+ corresponding lines) broker/src/main/java/org/apache/rocketmq/broker/processor/AdminBrokerProcessor.java
Code Duplication · Edited copy of a member (43 corresponding lines) store/src/main/java/org/apache/rocketmq/store/ha/DefaultHAClient.java
Code Duplication · Edited copy of a member (46 corresponding lines) remoting/src/main/java/org/apache/rocketmq/remoting/netty/NettyRemotingClient.java
Code Duplication · Edited copy of a member (33 corresponding lines) broker/src/main/java/org/apache/rocketmq/broker/processor/AdminBrokerProcessor.java
Code Duplication · Edited copy of a member (33 corresponding lines) broker/src/main/java/org/apache/rocketmq/broker/client/ConsumerManager.java
Code Duplication · Edited copy of a member (34 corresponding lines) broker/src/main/java/org/apache/rocketmq/broker/transaction/TransactionMetrics.java
Code Duplication · Edited copies of one member (3 members, 23+ corresponding lines) client/src/main/java/org/apache/rocketmq/client/trace/hook/ConsumeMessageOpenTracingHookImpl.java
Code Duplication · Edited copy of a member (35 corresponding lines) container/src/main/java/org/apache/rocketmq/container/BrokerContainer.java
Code Duplication · Edited copies of one member (3 members, 25+ corresponding lines) broker/src/main/java/org/apache/rocketmq/broker/schedule/ScheduleMessageService.java
Code Duplication · Edited copy of a member (34 corresponding lines) common/src/main/java/org/apache/rocketmq/common/config/ConfigHelper.java
Code Duplication · Edited copy of a member (30 corresponding lines) broker/src/main/java/org/apache/rocketmq/broker/processor/AdminBrokerProcessor.java
Code Duplication · Edited copy of a member (26 corresponding lines) broker/src/main/java/org/apache/rocketmq/broker/config/v2/SubscriptionGroupManagerV2.java
Code Duplication · Edited copy of a member (31 corresponding lines) broker/src/main/java/org/apache/rocketmq/broker/schedule/ScheduleMessageService.java
Code Duplication · Edited copy of a member (20 corresponding lines) broker/src/main/java/org/apache/rocketmq/broker/transaction/AbstractTransactionalMessageCheckListener.java
Code Duplication · Edited copy of a member (32 corresponding lines) broker/src/main/java/org/apache/rocketmq/broker/processor/AdminBrokerProcessor.java
Code Duplication · Edited copy of a member (24 corresponding lines) proxy/src/main/java/org/apache/rocketmq/proxy/remoting/channel/RemotingChannel.java
Code Duplication · Edited copy of a member (23 corresponding lines) store/src/main/java/org/apache/rocketmq/store/ConsumeQueue.java
Code Duplication · Edited copy of a member (27 corresponding lines) controller/src/main/java/org/apache/rocketmq/controller/impl/DLedgerController.java
Code Duplication · Edited copy of a member (25 corresponding lines) broker/src/main/java/org/apache/rocketmq/broker/processor/AdminBrokerProcessor.java
Code Duplication · Edited copy of a member (26 corresponding lines) broker/src/main/java/org/apache/rocketmq/broker/processor/AdminBrokerProcessor.java
Code Duplication · Edited copy of a member (30 corresponding lines) tieredstore/src/main/java/org/apache/rocketmq/tieredstore/provider/PosixFileSegment.java
Code Duplication · Edited copy of a member (28 corresponding lines) broker/src/main/java/org/apache/rocketmq/broker/metrics/ConsumerLagCalculator.java
Code Duplication · Edited copy of a member (19 corresponding lines) broker/src/main/java/org/apache/rocketmq/broker/processor/AdminBrokerProcessor.java
Code Duplication · Edited copies of one member (3 members, 27+ corresponding lines) client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java
Code Duplication · Edited copy of a member (29 corresponding lines) client/src/main/java/org/apache/rocketmq/client/impl/producer/DefaultMQProducerImpl.java
Code Duplication · Edited copy of a member (20 corresponding lines) proxy/src/main/java/org/apache/rocketmq/proxy/service/relay/LocalProxyRelayService.java
Code Duplication · Edited copy of a member (18 corresponding lines) store/src/main/java/org/apache/rocketmq/store/ha/DefaultHAConnection.java
Code Duplication · Edited copy of a member (23 corresponding lines) client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java
Code Duplication · Edited copies of one member (3 members, 26+ corresponding lines) remoting/src/main/java/org/apache/rocketmq/remoting/protocol/header/ExtraInfoUtil.java
Code Duplication · Edited copy of a member (20 corresponding lines) broker/src/main/java/org/apache/rocketmq/broker/config/v2/ConsumerOffsetManagerV2.java
Code Duplication · Edited copy of a member (36 corresponding lines) proxy/src/main/java/org/apache/rocketmq/proxy/service/sysmessage/HeartbeatSyncer.java
Code Duplication · Edited copy of a member (23 corresponding lines) broker/src/main/java/org/apache/rocketmq/broker/config/v2/ConsumerOffsetManagerV2.java
Code Duplication · Edited copy of a member (20 corresponding lines) client/src/main/java/org/apache/rocketmq/client/consumer/store/RemoteBrokerOffsetStore.java
Code Duplication · Edited copies of one member (3 members, 34+ corresponding lines) client/src/main/java/org/apache/rocketmq/client/impl/mqclient/MQClientAPIExt.java
Code Duplication · Edited copy of a member (24 corresponding lines) broker/src/main/java/org/apache/rocketmq/broker/config/v2/SubscriptionGroupManagerV2.java
Code Duplication · Edited copies of one member (3 members, 28+ corresponding lines) broker/src/main/java/org/apache/rocketmq/broker/processor/AdminBrokerProcessor.java
Code Duplication · Edited copy of a member (23 corresponding lines) store/src/main/java/org/apache/rocketmq/store/logfile/DefaultMappedFile.java
Code Duplication · Edited copy of a member (39 corresponding lines) broker/src/main/java/org/apache/rocketmq/broker/topic/TopicConfigManager.java
Code Duplication · Edited copy of a member (28 corresponding lines) proxy/src/main/java/org/apache/rocketmq/proxy/grpc/v2/consumer/ChangeInvisibleDurationActivity.java
Code Duplication · Edited copy of a member (24 corresponding lines) broker/src/main/java/org/apache/rocketmq/broker/config/v1/RocksDBConsumerOffsetManager.java
Code Duplication · Edited copy of a member (25 corresponding lines) broker/src/main/java/org/apache/rocketmq/broker/metrics/ConsumerLagCalculator.java
Code Duplication · Edited copy of a member (23 corresponding lines) proxy/src/main/java/org/apache/rocketmq/proxy/grpc/ProxyAndTlsProtocolNegotiator.java
Code Duplication · Edited copy of a member (29 corresponding lines) broker/src/main/java/org/apache/rocketmq/broker/pop/PopConsumerService.java
Code Duplication · Edited copy of a member (26 corresponding lines) broker/src/main/java/org/apache/rocketmq/broker/controller/ReplicasManager.java
Code Duplication · Edited copy of a member (28 corresponding lines) broker/src/main/java/org/apache/rocketmq/broker/metrics/ConsumerLagCalculator.java
Code Duplication · Edited copies of one member (3 members, 16+ corresponding lines) client/src/main/java/org/apache/rocketmq/client/impl/consumer/ConsumeMessageOrderlyService.java
Code Duplication · Edited copies of one member (3 members, 20+ corresponding lines) namesrv/src/main/java/org/apache/rocketmq/namesrv/routeinfo/RouteInfoManager.java
Code Duplication · Edited copy of a member (27 corresponding lines) broker/src/main/java/org/apache/rocketmq/broker/failover/EscapeBridge.java
Code Duplication · Edited copy of a member (28 corresponding lines) broker/src/main/java/org/apache/rocketmq/broker/topic/TopicRouteInfoManager.java
Code Duplication · Edited copy of a member (18 corresponding lines) broker/src/main/java/org/apache/rocketmq/broker/metrics/PopMetricsManager.java
Code Duplication · Edited copy of a member (37 corresponding lines) client/src/main/java/org/apache/rocketmq/client/impl/consumer/DefaultLitePullConsumerImpl.java
Code Duplication · Edited copy of a member (28 corresponding lines) common/src/main/java/org/apache/rocketmq/common/utils/HttpTinyClient.java
Code Duplication · Edited copy of a member (19 corresponding lines) proxy/src/main/java/org/apache/rocketmq/proxy/remoting/activity/ConsumerManagerActivity.java
Code Duplication · Edited copy of a member (32 corresponding lines) broker/src/main/java/org/apache/rocketmq/broker/out/BrokerOuterAPI.java
Code Duplication · Edited copy of a member (30 corresponding lines) common/src/main/java/org/apache/rocketmq/common/config/ConfigHelper.java
Code Duplication · Edited copy of a member (23 corresponding lines) openmessaging/src/main/java/io/openmessaging/rocketmq/utils/BeanUtils.java
Code Duplication · Edited copy of a member (31 corresponding lines) broker/src/main/java/org/apache/rocketmq/broker/latency/BrokerFastFailure.java
Code Duplication · Edited copies of one member (3 members, 26+ corresponding lines) broker/src/main/java/org/apache/rocketmq/broker/processor/AdminBrokerProcessor.java
Code Duplication · Edited copy of a member (31 corresponding lines) store/src/main/java/org/apache/rocketmq/store/CommitLog.java
Code Duplication · Edited copy of a member (26 corresponding lines) broker/src/main/java/org/apache/rocketmq/broker/out/BrokerOuterAPI.java
Code Duplication · Edited copy of a member (22 corresponding lines) store/src/main/java/org/apache/rocketmq/store/queue/SparseConsumeQueue.java
Code Duplication · Edited copy of a member (23 corresponding lines) client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java
Code Duplication · Edited copy of a member (24 corresponding lines) proxy/src/main/java/org/apache/rocketmq/proxy/grpc/ProxyAndTlsProtocolNegotiator.java
Code Duplication · Edited copy of a member (23 corresponding lines) broker/src/main/java/org/apache/rocketmq/broker/controller/ReplicasManager.java
Code Duplication · Edited copy of a member (24 corresponding lines) proxy/src/main/java/org/apache/rocketmq/proxy/common/ReceiptHandleGroup.java
Code Duplication · Edited copy of a member (15 corresponding lines) store/src/main/java/org/apache/rocketmq/store/rocksdb/MessageRocksDBStorage.java
We compare 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: 185 findings
These 185 critical or serious findings were in the previous survey, on 24 October 2026, and are gone from this one. The first 100 are listed here.
God Classes · TooManyMethods: DefaultMQAdminExt tools/src/main/java/org/apache/rocketmq/tools/admin/DefaultMQAdminExt.java
God Classes · TooManyMethods: DefaultMQAdminExtImpl tools/src/main/java/org/apache/rocketmq/tools/admin/DefaultMQAdminExtImpl.java
God Classes · ClassTooLong: DefaultMQAdminExtImpl tools/src/main/java/org/apache/rocketmq/tools/admin/DefaultMQAdminExtImpl.java
God Classes · FileTooLong: admin/DefaultMQAdminExtImpl.java tools/src/main/java/org/apache/rocketmq/tools/admin/DefaultMQAdminExtImpl.java
God Classes · ClassTooLong: DefaultMQAdminExt tools/src/main/java/org/apache/rocketmq/tools/admin/DefaultMQAdminExt.java
God Classes · FileTooLong: admin/DefaultMQAdminExt.java tools/src/main/java/org/apache/rocketmq/tools/admin/DefaultMQAdminExt.java
God Classes · MethodTooLong: ConsumerProgressSubCommand.execute tools/src/main/java/org/apache/rocketmq/tools/command/consumer/ConsumerProgressSubCommand.java
Code Duplication · Near-duplicate member pair (44 shared lines) broker/src/main/java/org/apache/rocketmq/broker/processor/AdminBrokerProcessor.java
Code Duplication · Near-duplicate member pair (40 shared lines) broker/src/main/java/org/apache/rocketmq/broker/BrokerController.java
Code Duplication · Near-duplicate member pair (25 shared lines) tools/src/main/java/org/apache/rocketmq/tools/admin/DefaultMQAdminExtImpl.java
Code Duplication · Edited copy of a member (35 corresponding lines) tools/src/main/java/org/apache/rocketmq/tools/command/message/ConsumeMessageCommand.java
Code Duplication · Edited copy of a member (35 corresponding lines) tools/src/main/java/org/apache/rocketmq/tools/command/message/ConsumeMessageCommand.java
Code Duplication · Edited copy of a member (35 corresponding lines) tools/src/main/java/org/apache/rocketmq/tools/command/message/PrintMessageByQueueCommand.java
Code Duplication · Edited copy of a member (35 corresponding lines) tools/src/main/java/org/apache/rocketmq/tools/command/message/PrintMessageByQueueCommand.java
Code Duplication · Edited copy of a member (35 corresponding lines) tools/src/main/java/org/apache/rocketmq/tools/command/message/QueryMsgByIdSubCommand.java
Code Duplication · Edited copy of a member (33 corresponding lines) tools/src/main/java/org/apache/rocketmq/tools/command/message/QueryMsgByIdSubCommand.java
Code Duplication · Edited copy of a member (33 corresponding lines) tools/src/main/java/org/apache/rocketmq/tools/command/message/QueryMsgByKeySubCommand.java
Code Duplication · Edited copy of a member (39 corresponding lines) tools/src/main/java/org/apache/rocketmq/tools/command/message/ConsumeMessageCommand.java
Code Duplication · Edited copy of a member (31 corresponding lines) tools/src/main/java/org/apache/rocketmq/tools/command/message/ConsumeMessageCommand.java
Code Duplication · Edited copy of a member (31 corresponding lines) tools/src/main/java/org/apache/rocketmq/tools/command/message/PrintMessageByQueueCommand.java
Code Duplication · Edited copy of a member (35 corresponding lines) tools/src/main/java/org/apache/rocketmq/tools/command/message/PrintMessageSubCommand.java
Code Duplication · Edited copy of a member (35 corresponding lines) tools/src/main/java/org/apache/rocketmq/tools/command/message/PrintMessageSubCommand.java
Code Duplication · Edited copy of a member (31 corresponding lines) tools/src/main/java/org/apache/rocketmq/tools/command/message/PrintMessageSubCommand.java
Code Duplication · Edited copy of a member (31 corresponding lines) tools/src/main/java/org/apache/rocketmq/tools/command/message/QueryMsgByIdSubCommand.java
Code Duplication · Edited copy of a member (31 corresponding lines) tools/src/main/java/org/apache/rocketmq/tools/command/message/QueryMsgByKeySubCommand.java
Code Duplication · Edited copy of a member (30 corresponding lines) tools/src/main/java/org/apache/rocketmq/tools/command/message/ConsumeMessageCommand.java
Code Duplication · Edited copy of a member (30 corresponding lines) tools/src/main/java/org/apache/rocketmq/tools/command/message/PrintMessageSubCommand.java
Code Duplication · Edited copy of a member (29 corresponding lines) tools/src/main/java/org/apache/rocketmq/tools/command/message/SendMessageCommand.java
Code Duplication · Edited copy of a member (20 corresponding lines) tools/src/main/java/org/apache/rocketmq/tools/command/broker/UpdateBrokerConfigSubCommand.java
Code Duplication · Edited copy of a member (19 corresponding lines) example/src/main/java/org/apache/rocketmq/example/operation/Consumer.java
Code Duplication · Edited copy of a member (18 corresponding lines) example/src/main/java/org/apache/rocketmq/example/operation/Consumer.java
Code Duplication · Edited copy of a member (18 corresponding lines) example/src/main/java/org/apache/rocketmq/example/operation/Consumer.java
Code Duplication · Edited copy of a member (18 corresponding lines) example/src/main/java/org/apache/rocketmq/example/operation/Producer.java
Code Duplication · Members sharing a duplicated core (9 members, 50+ identical tokens) tools/src/main/java/org/apache/rocketmq/tools/command/auth/CopyAclsSubCommand.java
€140,000 to €710,000, for 2,370 to 7,519 hours of work, about 2.9 person-years for 1 to 6 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.8 at a score of 58. 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: 222,810 lines of product code
What it is not
Not a quotation: nobody has offered to build it for that. Not a valuation: it says nothing about what the business is worth. Not a certified figure: no professional has signed it as one.
How the estimate is made: We price 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 4 Banned license finding(s) in License Compliance.
Resolve the 1 No assertions (empty test) finding(s) in Test Quality — start with NameServerInstanceTest.java.
Raises the score by about 3 points · Low effort · Test Quality
3
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).
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 €430,000 to build again, about 2.9 person-years of work. Its weakest lens is Code Health, at 52 (Adequate). Code Health is about how easy the code is to read and change safely, and code that is hard to read is slow and risky to change, so every future change costs more than it should. Because the weakest lens counts most in the score, work on Code Health also moves the score most.
Based on: the rebuild estimate · the Code Health grade · how much each lens counts
What to do: Start with the Code Health actions in Top priorities.
If you do one thing first · First action
Resolve the 4 Banned license finding(s) in License Compliance. Of all the actions in this report, it raises the score most for the work it takes: about 4 points for low effort, because it clears the 4 License Compliance 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, which only happens where the projects form a dependency cycle. A graph without cycles 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.
277 modules, with 1246 dependencies between them. 10 loops run through 81 of the modules, marked above the diagonal.
The table shows the 40 modules with the most connections; 237 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.
64 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.
15→19 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.
15→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.
15→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.
15→24 client.impl.consumer uses client.consumerpart of a loop✕
Connections
26 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.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.
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.
57 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.
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.
19→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.
19→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.
19→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.
19→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.
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.
29 pairs of types, where a type in client.impl uses a type in remoting.protocol.body. Showing 25 of them; the rest are in namespace-graph.json in this report's bundle.
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.
78 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 remoting.protocol.header, so a change to remoting.protocol.header can break tools.admin, while a change to tools.admin can't break remoting.protocol.header.
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.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 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.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.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, 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.admin uses common.message, so a change to common.message can break proxy.grpc.admin, while a change to proxy.grpc.admin can't break common.message.
Position
Below the diagonal: proxy.grpc.admin uses a module listed above it, which is the healthy direction.
proxy.grpc.admin uses remoting.protocol.heartbeat, so a change to remoting.protocol.heartbeat can break proxy.grpc.admin, while a change to proxy.grpc.admin can't break remoting.protocol.heartbeat.
Position
Below the diagonal: proxy.grpc.admin uses a module listed above it, which is the healthy direction.
proxy.grpc.admin uses remoting.protocol.route, so a change to remoting.protocol.route can break proxy.grpc.admin, while a change to proxy.grpc.admin can't break remoting.protocol.route.
Position
Below the diagonal: proxy.grpc.admin uses a module listed above it, which is the healthy direction.
proxy.grpc.admin uses remoting.protocol.subscription, so a change to remoting.protocol.subscription can break proxy.grpc.admin, while a change to proxy.grpc.admin can't break remoting.protocol.subscription.
Position
Below the diagonal: proxy.grpc.admin uses a module listed above it, which is the healthy direction.
proxy.grpc.admin uses common.utils, so a change to common.utils can break proxy.grpc.admin, while a change to proxy.grpc.admin can't break common.utils.
Position
Below the diagonal: proxy.grpc.admin uses a module listed above it, which is the healthy direction.
proxy.grpc.admin uses remoting.protocol.body, so a change to remoting.protocol.body can break proxy.grpc.admin, while a change to proxy.grpc.admin can't break remoting.protocol.body.
Position
Below the diagonal: proxy.grpc.admin uses a module listed above it, which is the healthy direction.
proxy.grpc.admin uses broker.client, so a change to broker.client can break proxy.grpc.admin, while a change to proxy.grpc.admin can't break broker.client.
Position
Below the diagonal: proxy.grpc.admin uses a module listed above it, which is the healthy direction.
proxy.grpc.admin uses proxy.common, so a change to proxy.common can break proxy.grpc.admin, while a change to proxy.grpc.admin can't break proxy.common.
Position
Below the diagonal: proxy.grpc.admin uses a module listed above it, which is the healthy direction.
proxy.grpc.admin uses proxy.grpc.v2.channel, so a change to proxy.grpc.v2.channel can break proxy.grpc.admin, while a change to proxy.grpc.admin can't break proxy.grpc.v2.channel.
Position
Below the diagonal: proxy.grpc.admin uses a module listed above it, which is the healthy direction.
proxy.grpc.admin uses proxy.service.route, so a change to proxy.service.route can break proxy.grpc.admin, while a change to proxy.grpc.admin can't break proxy.service.route.
Position
Below the diagonal: proxy.grpc.admin uses a module listed above it, which is the healthy direction.
proxy.grpc.admin uses proxy.service, so a change to proxy.service can break proxy.grpc.admin, while a change to proxy.grpc.admin can't break proxy.service.
Position
Below the diagonal: proxy.grpc.admin uses a module listed above it, which is the healthy direction.
proxy.grpc.admin uses proxy.processor, so a change to proxy.processor can break proxy.grpc.admin, while a change to proxy.grpc.admin can't break proxy.processor.
Position
Below the diagonal: proxy.grpc.admin 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 · 52% · 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
50
High / Critical
A03:2025 — Software Supply Chain Failures
40
High / Critical
A07:2025 — Authentication Failures
2
High / Critical
Roadmap
Top priorities: 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); Resolve the 4 Banned license finding(s) in License Compliance; Resolve the 1 No assertions (empty test) finding(s) in Test Quality — start with NameServerInstanceTest.java.
Ranked by impact ÷ effort. "Helps" is the estimated gain on the 0–100 health score.
Do this
Helps
Effort
Dimension
Resolve the 4 Banned license finding(s) in License Compliance.
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).
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.
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 — 74
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 — 2218
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 — 686
Recorded, with no effect on how the codebase functions.
Present so the survey is complete, not because it needs doing.
Could not be resolved — 16
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
This survey 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. All 54 evaluated dimensions are computed by tools and static analysis; no language model sets or judges any of them. Overall confidence is 0.9, the weighted average across measured dimensions.
Every figure here is one of two 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. 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.
What we checked — 54 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, 2953 of 2978 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 or a scanner, 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 — We 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.
D11 Test Reliability — not measured this run — We 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 repository declares 5 of its own test(s) unreliable. The built-in reliability runner does not support this repository's ecosystem (.java), so the suite was not re-run and no reliability score is given — these are the repository's own declarations, not our measurement.
D12 Dependency Hygiene — not measured this run — We 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 — a Maven build resolved 144 artifact(s) (115 behind a shipped release, reported), but the build resolved only part of the graph, so this dimension's own question is only partly answered. NOT a finding that these dependencies are current or healthy.
D19 Documentation Quality — measured, with a gap in what it reached — We measured this, but not all of it. What we 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. Each ecosystem's manifests (what makes a folder runnable or a published package) need their own proof before D19 judges its units. Until then those folders' READMEs are judged only as documents (boilerplate, structure), never counted as complete.
D19 Documentation Quality — measured, with a gap in what it reached — We measured this, but not all of it. What we 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. This kind did not reach the 95 % precision gate in three adjudicated runs (docs/plans/deterministic-engine/adjudication/D19-sample3-v3.md), so by the pre-registered fallback it publishes no row until a re-measurement shows it does. The candidates are counted here, not reported as findings, and the score does not include them.
D21 Naming Consistency — not measured this run — We 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. D21's deterministic naming rules are gated on C# first (docs/plans/deterministic-engine.md, P5): each other language is switched on only after its own concept suite and A/B gate pass. Until then its declarations carry no naming verdict this run — this says nothing about whether its names are consistent.
D22 Internal API Consistency — not measured this run — We 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 a COLLECTOR gap, not an environment fault: it declares a published package (REDACTED), but no published-package marker D22 reads admitted any project here, so this ecosystem's public API has no collector, and the remedy is to write one — no change to the scan image can close it.
D24 Comment Value — not measured this run — We 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's reader does not cover the language this repository's product is written in, so it had nothing of the product to read. That is a gap in this analyzer's language reach — not a finding about this repository.
D32 Data Compliance (PII/GDPR) — not measured this run — We 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 — We 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 — We 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 — We 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 — We 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 — We 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 — We 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 — We 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 — We 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, cpp 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 — We measured this, but not all of it. What we 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. 50 further occurrence(s) are not listed individually; the score already reflects all 90.
M4 Documentation accuracy — measured, with a gap in what it reached — We measured this, but not all of it. What we 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. M4 checks only the claim kinds adjudicated at or above 95 % precision: links and versions (PREREGISTRATION version 9), and artefact counts an order of magnitude off. Paths, command arguments, installs, environment variables, settings, projects, packages, routes, cd targets, infrastructure products and removed modules are read but not checked, and none of them is reported or counted.
S1 Web-Security Posture — not measured this run — We 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.
X10 Duplicated predicate — not measured this run — We 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. 54 further occurrence(s) are not listed individually; the score already reflects all 94.
X12 Unreachable branch — not measured this run — We 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's reader does not cover most of the languages this repository's product is written in. What it read is kept, but it is too small a share to grade the product by. That is a gap in this analyzer's language reach — not a finding about this repository.
X3 Exception handling — measured, with a gap in what it reached — We measured this, but not all of it. What we 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. 54 further occurrence(s) are not listed individually; the score already reflects all 94.
X4 Structured logging — measured, with a gap in what it reached — We measured this, but not all of it. What we 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. 288 further occurrence(s) are not listed individually; the score already reflects all 328.
Repo exclusion declarations (.gitattributes linguist-generated/vendored, .editorconfig generated_code): none declared — every source file was scored.
Limitations & what we did not check
We assess the repository exactly as committed, and only the repository. By design we do 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.
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").
D14 License Compliance: License compatibility is checked against declared package metadata and a policy — mislabelled or missing license metadata, and obligations that depend on how you distribute, are not resolved here.
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.
D16 Bus Factor: Bus-factor is a time-decayed model of commit attribution (who has recently, repeatedly worked a file), not comprehension — pairing, review and reading-without-committing spread knowledge it can't see; bot commits and shared accounts still distort it.
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 publishes two things only: a runnable or packaged unit with no example, and a multi-project root README that maps none of its parts. It does not judge clarity, and its other checks (overview, licence, boilerplate, structure, empty sections, XML-doc coverage) are withheld after adjudication: their candidates are counted in the card's gaps, not shown as rows. A false statement in a document is M4's; units are .NET projects only.
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: Documentation accuracy checks links, versions and artefact counts against the tree: other claims (paths, commands, settings, routes) are read but not checked, and it cannot run the onboarding or measure how long a real new joiner takes.
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.
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.
131 method(s) exceeded the cyclomatic complexity threshold of 15; the worst was DefaultAuthorizationContextBuilder.build at 108. A further 5 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 76 — 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: namesrv/src/main/java/org/apache/rocketmq/namesrv/processor/DefaultRequestProcessor.java (DefaultRequestProcessor.processRequest at 24), controller/src/main/java/org/apache/rocketmq/controller/impl/JRaftControllerStateMachine.java (JRaftControllerStateMachine.processEvent at 17), 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.
+ 126 more group(s) — more in Appendix A; the complete list is findings.md.
What to do
Bring the 3 bodies over 60 down to 60 or less in Cyclomatic Complexity — start with DefaultAuthorizationContextBuilder.build (cyclomatic 108), BrokerController.shutdownBasicService (cyclomatic 66), PopMessageProcessor.processRequest (cyclomatic 61). — 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 3 together lifts Cyclomatic Complexity from 5.9 to about 6.5/10, projected with the scoring formula itself and assuming each lands exactly at 60; a cleaner split scores higher.
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.
+ 327 more group(s) — more in Appendix A; the complete list is findings.md.
What to do
Bring the 22 bodies over 60 down to 60 or less in Cognitive Complexity — start with TransactionalMessageServiceImpl.check (cognitive 126), DefaultAuthorizationContextBuilder.build (cognitive 125), MQAdminImpl.queryMessage (cognitive 122). — 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 22 together lifts Cognitive Complexity from 5.8 to about 6.5/10, projected with the scoring formula itself and assuming each lands exactly at 60; a cleaner split scores higher.
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 73 TooManyMethods finding(s) in God Classes — start with MessageStoreConfig.java (2), ClientConfig.java (2), BrokerConfig.java. — One of this dimension's main actionable groups (73 warning-level).
Resolve the 57 ClassTooLong finding(s) in God Classes — start with MQClientAPIImpl.java, AdminBrokerProcessor.java, DefaultMessageStore.java. — One of this dimension's main actionable groups (57 warning-level).
Resolve the 44 FileTooLong finding(s) in God Classes — start with MQClientAPIImpl.java, AdminBrokerProcessor.java, DefaultMessageStore.java. — One of this dimension's main actionable groups (44 warning-level).
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.
649 duplicated block group(s) detected. A further 468 rows report members as variants of one another; they aggregate block groups already counted above and are not themselves counted. 167 of the 1117 are in trees this repository does not ship — vendored, example/demo, project-template, 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.
+ 278 more group(s) — more in Appendix A; the complete list is findings.md.
What to do
Resolve the 55 Duplicated block (7 lines × 2) finding(s) in Code Duplication — start with AdminBrokerProcessor.java (3), DefaultMQAdminExtImpl.java (3), RocksDBSubscriptionGroupManager.java (2). — One of this dimension's main actionable groups (55 warning-level).
Resolve the 47 Duplicated block (9 lines × 2) finding(s) in Code Duplication — start with ConsumeMessageConcurrentlyService.java (2), ConsumeQueue.java (2), MessageExtEncoder.java (2). — One of this dimension's main actionable groups (47 warning-level).
Resolve the 46 Duplicated block (8 lines × 2) finding(s) in Code Duplication — start with BrokerOuterAPI.java (3), BatchConsumeQueue.java (3), DefaultAuthorizationContextBuilder.java (2). — One of this dimension's main actionable groups (46 warning-level).
Detailed fixes: d4_recommendation.md · top locations in Appendix A, every location in findings.md.
Do you agree with this assessment?
D5 · Coupling8.9 / 10Strong✓ 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.
17 production modules (Maven), 0 dependency cycle(s), 1 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 17 (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).
Unstable project rocketmq-proxy
Off the main sequence: rocketmq-remoting
Off the main sequence: rocketmq-common
What to do
Resolve the 1 Unstable project rocketmq-proxy finding(s) in Coupling. — One of this dimension's main actionable groups (1 warning-level).
Resolve the 1 Off the main sequence finding(s) in Coupling. — One of this dimension's main actionable groups (1 warning-level).
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 5 Low cohesion finding(s) in Cohesion (LCOM4) — start with ConfigStorage.java, ProduceAccumulator.java, ClusterMetadataService.java. — One of this dimension's main actionable groups (5 warning-level).
Detailed fixes: d6_recommendation.md · top locations in Appendix A, every location in findings.md.
Do you agree with this assessment?
D10 · Test Quality8.9 / 10Adequategated by 1 critical finding✓ 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.
49 skipped (49 with a documented reason), 280 zero-assertion, no mocking-framework packages referenced (hand-written doubles or no mocking) across 3681 tests.
No assertions (empty test): itWorksnamesrv/src/test/java/org/apache/rocketmq/namesrv/NameServerInstanceTest.java:45
No assertions: evaluate1 · ×279auth/src/test/java/org/apache/rocketmq/auth/authentication/AuthenticationEvaluatorTest.java:62
Resolve the 1 No assertions (empty test) finding(s) in Test Quality — start with NameServerInstanceTest.java. — One of this dimension's main actionable groups (1 issue-level).
Resolve the 279 No assertions finding(s) in Test Quality — start with MQClientAPIImplTest.java (41), DefaultMQPushConsumerImplTest.java (18), DefaultMQProducerImplTest.java (10). — One of this dimension's main actionable groups (279 warning-level).
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: Whether the licenses of third-party packages are compatible with your policy.
Method: Third-party package licenses resolved from declared package metadata and checked against the configured policy (allow/deny/copyleft). Deterministic; clean = no incompatible license found at metadata depth.
4 of 14 declared JVM dependency artifact(s) use a banned license. Licences were resolved from the POMs Maven Central publishes, over the coordinates this repository's 20 Maven/Gradle manifest(s) declare with a version resolvable from the manifest itself — the same declaration-site closure this analysis reads for dependency currency. The JVM has no lockfile a checkout is guaranteed to carry, so this is deliberately NOT the transitive closure. 147 further coordinate(s) are declared with no version at the declaration site — inherited from a parent POM, a BOM or an unresolved Gradle version reference — and are NOT graded: this verdict covers what the checkout pins, not the full transitive graph.
Banned license: org.openjdk.jmh:jmh-core · ×4
What to do
Resolve the 4 Banned license finding(s) in License Compliance. — One of this dimension's main actionable groups (4 issue-level).
Detailed fixes: d14_recommendation.md · top locations in Appendix A, every location in findings.md.
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 1 Hotspot finding(s) in Churn × Complexity Hotspots — start with DefaultAuthorizationContextBuilder.java. — One of this dimension's main actionable groups (1 warning-level).
Detailed fixes: d15_recommendation.md · top locations in Appendix A, every location in findings.md.
Do you agree with this assessment?
D16 · Bus Factor9.3 / 10Exemplary✓ Tool-verified
What it measures: Whether knowledge is concentrated in too few people (the "bus factor").
Method: Living knowledge per author via time-decayed commit attribution (6-month half-life, focus weighting) across largest source files. Deterministic, avoids blame's mechanical-refactor false positives.
62 source file(s) have their living knowledge concentrated in one author (≥90% of recent, decayed contribution). The largest is broker/src/main/java/org/apache/rocketmq/broker/lite/LiteEventDispatcher.java. Counted over 842 of the 1493 production source files in this repository: 629 are under the ~2,400-byte size floor this dimension measures over, and the remaining 22 have no attributable history left to measure.
Off-boarding risk: anonymized user #1 · ×6
Further sole-owners (lower concentration)
✓ On the Gold path — maintain.
Detailed fixes: d16_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 222810 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 TieredStoreMetricsManager.java (2), ConsumerOffsetManagerV2.java (2), DLedgerProduceAndConsumeIT.java. — One of this dimension's main actionable groups (12 warning-level).
Resolve the 9 XxxComment finding(s) in Explicit Debt — start with CommitLog.java (2), ConsumeQueue.java (2), BatchConsumeQueue.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).
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: Every README, docs/ document and root guide parsed by its markup and measured in Unicode letters. Published: a runnable or packaged .NET project whose README (or a document it links, or a root guide) shows no example, and a root README naming none of three or more projects. Overview, licence, boilerplate, wall-of-text, empty-section and XML-doc rows are measured and withheld (counted in gaps) after adjudication. Deterministic, exhaustive, advisory.
8 of 16 build units (Maven) flagged as possibly oversized/incoherent.
Projects may be oversized for their cohesion
What to do
Resolve the 1 Projects may be oversized for their cohesion finding(s) in Project Cohesion. — One of this dimension's main actionable groups (1 recommendation-level).
Detailed fixes: d26_recommendation.md · top locations in Appendix A, every location in findings.md.
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.
69 % of calls cross a namespace and 8 % 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).
50 finding(s): 0 critical, 41 high, 9 medium, 0 low. 37 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 476) — 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 2 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
What to do
Resolve the 2 REDACTED finding(s) in Static Analysis (SAST) — start with REDACTED (2). — One of this dimension's main actionable groups (2 issue-level).
Resolve the 2 REDACTED finding(s) in Static Analysis (SAST) — start with REDACTED (2). — One of this dimension's main actionable groups (2 issue-level).
No action in Static Analysis (SAST) — all 37 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 (37 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. Advisory since rubric-2026.11.2 (CAI decision 0006): every row is a match against a vulnerability database that changes daily, so the reading is shown and never moves a scored dimension, lens or the headline.
Resolve the 20 High CVE finding(s) in Dependency Vulnerabilities — start with REDACTED (20). — One of this dimension's main actionable groups (20 issue-level).
Resolve the 6 Medium CVE finding(s) in Dependency Vulnerabilities — start with REDACTED (6). — One of this dimension's main actionable groups (6 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.
480 of 864 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/producer/DefaultMQProducer.java. Counted over 864 of the 1493 production source files in this repository: the rest are under the ~2,400-byte size floor this dimension measures over.
Orphaned file · ×477REDACTED:1
Most significant orphaned file · ×3client/src/main/java/org/apache/rocketmq/client/producer/DefaultMQProducer.java:1
Concentrated knowledge decay
What to do
Resolve the 477 Orphaned file finding(s) in Knowledge Freshness — start with ClientConfig.java (2), SendMessageContext.java (2), ConfigHelper.java (2). — One of this dimension's main actionable groups (477 recommendation-level).
Resolve the 3 Most significant orphaned file finding(s) in Knowledge Freshness — start with DefaultMQProducer.java, PullMessageProcessor.java, DefaultMQAdminExt.java. — One of this dimension's main actionable groups (3 recommendation-level).
Resolve the 1 Concentrated knowledge decay 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 1 Boundary-crossing change coupling finding(s) in Change Coupling — start with MQClientAPIImpl.java. — One of this dimension's main actionable groups (1 issue-level).
Resolve the 13 Change coupling finding(s) in Change Coupling — start with QueueLevelConsumerManager.java (2), CommitLog.java, DefaultMessageStore.java. — One of this dimension's main actionable groups (13 warning-level).
Resolve the 2 Change-coupling hub finding(s) in Change Coupling — start with ChangeInvisibleTimeProcessor.java, ClusterMessageService.java. — One of this dimension's main actionable groups (2 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.
+ 1 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 1 REDACTED finding(s) in Supply-chain Provenance & Signing. — One of this dimension's main actionable groups (1 warning-level).
Resolve the 1 REDACTED finding(s) in Supply-chain Provenance & Signing — start with REDACTED. — 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. Reported 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. Advisory since rubric-2026.11.2 (CAI decision 0006): the malicious-package feed is a database that changes daily, so the reading is shown and never moves a scored dimension, lens or the headline.
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 3 platform declaration(s) and 15 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.
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.
`LitePullConsumer` declares 31 abstract methods: `assign`, `assignment`, `buildSubscriptionsForHeartbeat`, `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 31 declarations carry 24 distinct name(s), so part of the width is overloading rather than separate responsibilities — but 24 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:27
`MQPullConsumer` declares 20 abstract methods under just 10 distinct name(s): `fetchConsumeOffset`, `fetchMessageQueuesInBalance`, `pull`, `pull`, `pull`, `pull`, `pull`, `pull`, `pull`, `pull`, `pull`, `pullBlockIfNotFound`, `pullBlockIfNotFound`, `pullBlockIfNotFoundWithMessageSelector`, `pullBlockIfNotFoundWithMessageSelector`, `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 20 separate responsibilities: a caller binds to 10 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 20 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 34 abstract methods under just 8 distinct name(s): `fetchPublishMessageQueues`, `recallMessage`, `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 34 separate responsibilities: a caller binds to 8 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 34 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
`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
`MessagingProcessor` declares 39 abstract methods: `ackMessage`, `ackMessage`, `addReceiptHandle`, `addTransactionSubscription`, `batchAckMessage`, `changeInvisibleTime`, `doChannelCloseEvent`, `endTransaction`, `findConsumerChannel`, `findProducerChannel`, `forwardMessageToDeadLetterQueue`, `forwardMessageToDeadLetterQueue`, `getConsumerGroupInfo`, `getMaxOffset`, `getMetadataService`, `getMinOffset`, `getProxyRelayService`, `getSubscriptionGroupConfig`, `getTopicRouteDataForProxy`, `getUnackedMessageCount`, `lockBatchMQ`, `popMessage`, `pullMessage`, `queryConsumerOffset`, `recallMessage`, `registerConsumer`, `registerConsumerListener`, `registerProducer`, `registerProducerListener`, `removeReceiptHandle`, `request`, `requestOneway`, `sendMessage`, `syncLiteSubscription`, `unRegisterConsumer`, `unRegisterProducer`, `unlockBatchMQ`, `updateConsumerOffset`, `updateConsumerOffsetAsync`. 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 37 distinct name(s), so part of the width is overloading rather than separate responsibilities — but 37 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. — proxy/src/main/java/org/apache/rocketmq/proxy/processor/MessagingProcessor.java:51
`AdminService` declares 19 abstract methods: `createTopicOnBroker`, `createTopicOnTopicBrokerIfNotExist`, `deleteSubscriptionGroup`, `getBrokerClusterInfo`, `getConsumeStats`, `getConsumerConnectionList`, `getSubscriptionGroupConfig`, `getTopicConfig`, `getTopicRouteData`, `getTopicStats`, `queryConsumeTimeSpan`, `queryMessage`, `queryTopicConsumeByWho`, `queryTopicsByConsumer`, `resetOffset`, `searchOffsetByTimestamp`, `topicExist`, `updateSubscriptionGroupConfig`, `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. — proxy/src/main/java/org/apache/rocketmq/proxy/service/admin/AdminService.java:37
`MessageService` declares 19 abstract methods: `ackMessage`, `batchAckMessage`, `changeInvisibleTime`, `endTransactionOneway`, `getMaxOffset`, `getMinOffset`, `lockBatchMQ`, `popLiteMessage`, `popMessage`, `pullMessage`, `queryConsumerOffset`, `recallMessage`, `request`, `requestOneway`, `sendMessage`, `sendMessageBack`, `unlockBatchMQ`, `updateConsumerOffset`, `updateConsumerOffsetAsync`. 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:48
`MappedFile` declares 50 abstract methods: `appendMessage`, `appendMessage`, `appendMessage`, `appendMessage`, `appendMessage`, `appendMessageUsingFileChannel`, `appendMessages`, `cleanResources`, `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`, and 10 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 50 declarations carry 45 distinct name(s), so part of the width is overloading rather than separate responsibilities — but 45 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:36
`ConsumeQueueInterface` declares 26 abstract methods: `assignQueueOffset`, `correctMinOffset`, `estimateMessageCount`, `get`, `getCQType`, `getCqUnitAndStoreTime`, `getEarliestUnit`, `getEarliestUnitAndStoreTime`, `getLastOffset`, `getLatestUnit`, `getMaxOffsetInQueue`, `getMaxPhysicOffset`, `getMessageTotalInQueue`, `getMinLogicOffset`, `getMinOffsetInQueue`, `getOffsetInQueueByTime`, `getOffsetInQueueByTime`, `getQueueId`, `getTopic`, `getTotalSize`, `getUnitSize`, `increaseQueueOffset`, `initializeWithOffset`, `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 26 declarations carry 24 distinct name(s), so part of the width is overloading rather than separate responsibilities — but 24 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 25 abstract methods: `assignQueueOffset`, `checkSelf`, `cleanExpired`, `deleteTopic`, `destroy`, `findOrCreateConsumeQueue`, `flush`, `getConsumeQueue`, `getConsumeQueueTable`, `getLmqNum`, `getLmqQueueOffset`, `getMaxOffset`, `getMinOffsetInQueue`, `getOffsetInQueueByTime`, `getTotalSize`, `increaseLmqOffset`, `increaseQueueOffset`, `isLmqExist`, `load`, `putMessagePositionInfoWrapper`, `recover`, `recoverOffsetTable`, `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. 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:28
`MessageStore` declares 124 abstract methods: `addDispatcher`, `appendToCommitLog`, `assignOffset`, `calcDeltaChecksum`, `checkInDiskByConsumeOffset`, `checkInMemByConsumeOffset`, `checkInStoreByConsumeOffset`, `checkMessageAndReturnSize`, `cleanExpiredConsumerQueue`, `cleanUnusedTopic`, `deleteTopics`, `destroy`, `dispatchBehindBytes`, `dispatchBehindMilliseconds`, `estimateMessageCount`, `executeDeleteFilesManually`, `findConsumeQueue`, `flush`, `flushBehindBytes`, `getAliveReplicaNumInGroup`, `getAllocateMappedFileService`, `getBrokerInitMaxOffset`, `getBrokerStatsManager`, `getBulkCommitLogData`, `getCommitLog`, `getCommitLogData`, `getCommitLogOffsetInQueue`, `getConfirmOffset`, `getConsumeQueue`, `getData`, `getDispatcherList`, `getEarliestMessageTime`, `getEarliestMessageTime`, `getEarliestMessageTimeAsync`, `getFlushedWhere`, `getHARuntimeInfo`, `getHaService`, `getLastFileFromOffset`, `getLastMappedFile`, `getMasterFlushedOffset`, and 84 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 124 declarations carry 115 distinct name(s), so part of the width is overloading rather than separate responsibilities — but 115 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:58
`FlatFileInterface` declares 29 abstract methods: `appendCommitLog`, `appendCommitLog`, `appendConsumeQueue`, `commitAsync`, `destroy`, `destroyExpiredFile`, `getCommitLogAsync`, `getCommitLogCommitOffset`, `getCommitLogMaxOffset`, `getCommitLogMinOffset`, `getConsumeQueueAsync`, `getConsumeQueueAsync`, `getConsumeQueueCommitOffset`, `getConsumeQueueMaxOffset`, `getConsumeQueueMinOffset`, `getFileLock`, `getFirstMessageOffset`, `getMaxStoreTimestamp`, `getMessageAsync`, `getMessageQueue`, `getMinStoreTimestamp`, `getQueueOffsetByTimeAsync`, `getTopicId`, `initOffset`, `isClosed`, `isFlatFileInit`, `release`, `rollingFile`, `shutdown`. 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 29 declarations carry 27 distinct name(s), so part of the width is overloading rather than separate responsibilities — but 27 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/file/FlatFileInterface.java:28
`MetadataStore` declares 17 abstract methods under just 15 distinct name(s): `addQueue`, `addTopic`, `deleteFileSegment`, `deleteFileSegment`, `deleteQueue`, `deleteTopic`, `destroy`, `getFileSegment`, `getQueue`, `getTopic`, `iterateFileSegment`, `iterateFileSegment`, `iterateQueue`, `iterateTopic`, `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. That is an OVERLOAD SET, not 17 separate responsibilities: a caller binds to 15 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 17 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. — tieredstore/src/main/java/org/apache/rocketmq/tieredstore/metadata/MetadataStore.java:29
`MQAdminExt` declares 126 abstract methods: `addBrokerToContainer`, `addWritePermOfBroker`, `checkRocksdbCqWriteProgress`, `cleanControllerBrokerData`, `cleanExpiredConsumerQueue`, `cleanExpiredConsumerQueueByAddr`, `cleanUnusedTopic`, `cleanUnusedTopicByAddr`, `cloneGroupOffset`, `consumeMessageDirectly`, `consumeMessageDirectly`, `createAcl`, `createAcl`, `createAndUpdateKvConfig`, `createAndUpdateSubscriptionGroupConfig`, `createAndUpdateSubscriptionGroupConfigList`, `createAndUpdateTopicConfig`, `createAndUpdateTopicConfigList`, `createOrUpdateOrderConf`, `createStaticTopic`, `createUser`, `createUser`, `deleteAcl`, `deleteExpiredCommitLog`, `deleteExpiredCommitLogByAddr`, `deleteKvConfig`, `deleteSubscriptionGroup`, `deleteSubscriptionGroup`, `deleteTopic`, `deleteTopicInBroker`, `deleteTopicInBrokerConcurrent`, `deleteTopicInNameServer`, `deleteTopicInNameServer`, `deleteUser`, `electMaster`, `examineBrokerClusterInfo`, `examineConsumeStats`, `examineConsumeStats`, `examineConsumeStats`, `examineConsumeStats`, and 86 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 126 declarations carry 112 distinct name(s), so part of the width is overloading rather than separate responsibilities — but 112 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:79
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
`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
A test is skipped/ignored — coverage that looks present but never runs. Re-enable it or delete it so the green run means something. (×2) — broker/src/test/java/org/apache/rocketmq/broker/controller/ReplicasManagerTest.java:62, broker/src/test/java/org/apache/rocketmq/broker/lite/LiteLifecycleManagerTest.java:198
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 repository and its projects have a README, and whether it is substantive.
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.
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 repository is organised deliberately: production code and tests are set apart in a way its ecosystem or the repository itself declares.
Method: Filesystem scan: src/test folder separation and namespace-prefix consistency (majority RootNamespace agreement). Exhaustive across projects, deterministic.
Maturity · Maturity — Whether the project's current-state documentation describes the code that exists.
Method: Every current-state document's checkable claims looked up in the tree (links, versions, and artefact counts an order of magnitude off), plus two README checks: an advertised infrastructure product with no footprint, and a module the CHANGELOG records as removed. Deterministic, no model. Advisory.
Readiness · Readiness — Whether an automated pipeline builds and tests every change.
Method: Filesystem scan: CI workflow files (.github/workflows, .gitlab-ci.yml, etc.) for build and test stages. Exhaustive, deterministic.
Do you agree with this assessment?
P10 · Library API & versioning9.5 / 10Exemplary✓ Tool-verified
Readiness · Readiness — For a library: a deliberate (small) public API surface and explicit semantic versioning so consumers can depend on it safely.
Method: Roslyn scan: public API surface area and semantic-versioning markers (SemVer attributes, changelog entries) for libraries; off .NET, a library is the ecosystem's publication act (an npm package that is not private and names an entry point, a PyPI distribution with a build system, a Rust library crate, a Maven/Gradle module that publishes, a Go module with no package main, a gemspec, a Composer library, a SwiftPM library product, a pub.dev or Hex package), its surface is the share of types the language's code model records as public (Rust, Swift, Java, Kotlin, Go, Dart; not measured where the model records no type visibility or, as in TypeScript, only module-level export), and its version is read from the manifest, a semver CHANGELOG, release tooling or semver git tags. Exhaustive, deterministic.
1 public type in `org.apache.rocketmq.auth.authentication.manager` is marked as implementation by its own namespace, folder or name: `AuthenticationMetadataManagerImpl` (auth/src/main/java/org/apache/rocketmq/auth/authentication/manager/AuthenticationMetadataManagerImpl.java:35, name ends in `Impl`). While it is public, every consumer of the library can bind to it, so changing it is a breaking change for those consumers. — auth/src/main/java/org/apache/rocketmq/auth/authentication/manager/AuthenticationMetadataManagerImpl.java:35
1 public type in `org.apache.rocketmq.auth.authorization.manager` is marked as implementation by its own namespace, folder or name: `AuthorizationMetadataManagerImpl` (auth/src/main/java/org/apache/rocketmq/auth/authorization/manager/AuthorizationMetadataManagerImpl.java:42, name ends in `Impl`). While it is public, every consumer of the library can bind to it, so changing it is a breaking change for those consumers. — auth/src/main/java/org/apache/rocketmq/auth/authorization/manager/AuthorizationMetadataManagerImpl.java:42
2 public types in `org.apache.rocketmq.broker.lite` are marked as implementation by their own namespace, folder or name: `LiteShardingImpl` (broker/src/main/java/org/apache/rocketmq/broker/lite/LiteShardingImpl.java:31, name ends in `Impl`), `LiteSubscriptionRegistryImpl` (broker/src/main/java/org/apache/rocketmq/broker/lite/LiteSubscriptionRegistryImpl.java:51, name ends in `Impl`). While they are public, every consumer of the library can bind to them, so changing them is a breaking change for those consumers. — broker/src/main/java/org/apache/rocketmq/broker/lite/LiteShardingImpl.java:31
1 public type in `org.apache.rocketmq.broker.transaction.queue` is marked as implementation by its own namespace, folder or name: `TransactionalMessageServiceImpl` (broker/src/main/java/org/apache/rocketmq/broker/transaction/queue/TransactionalMessageServiceImpl.java:54, name ends in `Impl`). While it is public, every consumer of the library can bind to it, so changing it is a breaking change for those consumers. — broker/src/main/java/org/apache/rocketmq/broker/transaction/queue/TransactionalMessageServiceImpl.java:54
1 public type in `org.apache.rocketmq.client.consumer` is marked as implementation by its own namespace, folder or name: `PullTaskImpl` (client/src/main/java/org/apache/rocketmq/client/consumer/MQPullConsumerScheduleService.java:163, name ends in `Impl`). While it is public, every consumer of the library can bind to it, so changing it is a breaking change for those consumers. — client/src/main/java/org/apache/rocketmq/client/consumer/MQPullConsumerScheduleService.java:163
6 public types in `org.apache.rocketmq.client.impl` are marked as implementation by their own namespace, folder or name: `ClientRemotingProcessor` (client/src/main/java/org/apache/rocketmq/client/impl/ClientRemotingProcessor.java:60, `impl`), `CommunicationMode` (client/src/main/java/org/apache/rocketmq/client/impl/CommunicationMode.java:19, `impl`), `FindBrokerResult` (client/src/main/java/org/apache/rocketmq/client/impl/FindBrokerResult.java:19, `impl`), `MQAdminImpl` (client/src/main/java/org/apache/rocketmq/client/impl/MQAdminImpl.java:63, `impl`), `MQClientAPIImpl` (client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:275, `impl`), `MQClientManager` (client/src/main/java/org/apache/rocketmq/client/impl/MQClientManager.java:29, `impl`). While they are public, every consumer of the library can bind to them, so changing them is a breaking change for those consumers. — client/src/main/java/org/apache/rocketmq/client/impl/ClientRemotingProcessor.java:60
1 public type in `org.apache.rocketmq.client.impl.admin` is marked as implementation by its own namespace, folder or name: `MqClientAdminImpl` (client/src/main/java/org/apache/rocketmq/client/impl/admin/MqClientAdminImpl.java:73, `impl`). While it is public, every consumer of the library can bind to it, so changing it is a breaking change for those consumers. — client/src/main/java/org/apache/rocketmq/client/impl/admin/MqClientAdminImpl.java:73
26 public types in `org.apache.rocketmq.client.impl.consumer` are marked as implementation by their own namespace, folder or name: `AbstractConsumeMessageService` (client/src/main/java/org/apache/rocketmq/client/impl/consumer/AbstractConsumeMessageService.java:27, `impl`), `AssignedMessageQueue` (client/src/main/java/org/apache/rocketmq/client/impl/consumer/AssignedMessageQueue.java:26, `impl`), `ConsumeMessageConcurrentlyService` (client/src/main/java/org/apache/rocketmq/client/impl/consumer/ConsumeMessageConcurrentlyService.java:46, `impl`), `ConsumeMessageOrderlyService` (client/src/main/java/org/apache/rocketmq/client/impl/consumer/ConsumeMessageOrderlyService.java:48, `impl`), `ConsumeMessagePopConcurrentlyService` (client/src/main/java/org/apache/rocketmq/client/impl/consumer/ConsumeMessagePopConcurrentlyService.java:48, `impl`), `ConsumeMessagePopOrderlyService` (client/src/main/java/org/apache/rocketmq/client/impl/consumer/ConsumeMessagePopOrderlyService.java:45, `impl`), `ConsumeMessageService` (client/src/main/java/org/apache/rocketmq/client/impl/consumer/ConsumeMessageService.java:24, `impl`), `DefaultLitePullConsumerImpl` (client/src/main/java/org/apache/rocketmq/client/impl/consumer/DefaultLitePullConsumerImpl.java:79, `impl`), and 18 more. While they are public, every consumer of the library can bind to them, so changing them is a breaking change for those consumers. — client/src/main/java/org/apache/rocketmq/client/impl/consumer/AbstractConsumeMessageService.java:27
1 public type in `org.apache.rocketmq.client.impl.factory` is marked as implementation by its own namespace, folder or name: `MQClientInstance` (client/src/main/java/org/apache/rocketmq/client/impl/factory/MQClientInstance.java:96, `impl`). While it is public, every consumer of the library can bind to it, so changing it is a breaking change for those consumers. — client/src/main/java/org/apache/rocketmq/client/impl/factory/MQClientInstance.java:96
3 public types in `org.apache.rocketmq.client.impl.mqclient` are marked as implementation by their own namespace, folder or name: `DoNothingClientRemotingProcessor` (client/src/main/java/org/apache/rocketmq/client/impl/mqclient/DoNothingClientRemotingProcessor.java:24, `impl`), `MQClientAPIExt` (client/src/main/java/org/apache/rocketmq/client/impl/mqclient/MQClientAPIExt.java:97, `impl`), `MQClientAPIFactory` (client/src/main/java/org/apache/rocketmq/client/impl/mqclient/MQClientAPIFactory.java:36, `impl`). While they are public, every consumer of the library can bind to them, so changing them is a breaking change for those consumers. — client/src/main/java/org/apache/rocketmq/client/impl/mqclient/DoNothingClientRemotingProcessor.java:24
4 public types in `org.apache.rocketmq.client.impl.producer` are marked as implementation by their own namespace, folder or name: `DefaultMQProducerImpl` (client/src/main/java/org/apache/rocketmq/client/impl/producer/DefaultMQProducerImpl.java:101, `impl`), `MQProducerInner` (client/src/main/java/org/apache/rocketmq/client/impl/producer/MQProducerInner.java:25, `impl`), `TopicPublishInfo` (client/src/main/java/org/apache/rocketmq/client/impl/producer/TopicPublishInfo.java:28, `impl`), `QueueFilter` (client/src/main/java/org/apache/rocketmq/client/impl/producer/TopicPublishInfo.java:35, `impl`). While they are public, every consumer of the library can bind to them, so changing them is a breaking change for those consumers. — client/src/main/java/org/apache/rocketmq/client/impl/producer/DefaultMQProducerImpl.java:101
1 public type in `org.apache.rocketmq.client.latency` is marked as implementation by its own namespace, folder or name: `LatencyFaultToleranceImpl` (client/src/main/java/org/apache/rocketmq/client/latency/LatencyFaultToleranceImpl.java:34, name ends in `Impl`). While it is public, every consumer of the library can bind to it, so changing it is a breaking change for those consumers. — client/src/main/java/org/apache/rocketmq/client/latency/LatencyFaultToleranceImpl.java:34
6 public types in `org.apache.rocketmq.client.trace.hook` are marked as implementation by their own namespace, folder or name: `ConsumeMessageOpenTracingHookImpl` (client/src/main/java/org/apache/rocketmq/client/trace/hook/ConsumeMessageOpenTracingHookImpl.java:35, name ends in `Impl`), `ConsumeMessageTraceHookImpl` (client/src/main/java/org/apache/rocketmq/client/trace/hook/ConsumeMessageTraceHookImpl.java:34, name ends in `Impl`), `EndTransactionOpenTracingHookImpl` (client/src/main/java/org/apache/rocketmq/client/trace/hook/EndTransactionOpenTracingHookImpl.java:31, name ends in `Impl`), `EndTransactionTraceHookImpl` (client/src/main/java/org/apache/rocketmq/client/trace/hook/EndTransactionTraceHookImpl.java:33, name ends in `Impl`), `SendMessageOpenTracingHookImpl` (client/src/main/java/org/apache/rocketmq/client/trace/hook/SendMessageOpenTracingHookImpl.java:31, name ends in `Impl`), `SendMessageTraceHookImpl` (client/src/main/java/org/apache/rocketmq/client/trace/hook/SendMessageTraceHookImpl.java:30, name ends in `Impl`). While they are public, every consumer of the library can bind to them, so changing them is a breaking change for those consumers. — client/src/main/java/org/apache/rocketmq/client/trace/hook/ConsumeMessageOpenTracingHookImpl.java:35
1 public type in `org.apache.rocketmq.common` is marked as implementation by its own namespace, folder or name: `ThreadFactoryImpl` (common/src/main/java/org/apache/rocketmq/common/ThreadFactoryImpl.java:26, name ends in `Impl`). While it is public, every consumer of the library can bind to it, so changing it is a breaking change for those consumers. — common/src/main/java/org/apache/rocketmq/common/ThreadFactoryImpl.java:26
5 public types in `org.apache.rocketmq.common.filter.impl` are marked as implementation by their own namespace, folder or name: `Op` (common/src/main/java/org/apache/rocketmq/common/filter/impl/Op.java:20, `impl`), `Operand` (common/src/main/java/org/apache/rocketmq/common/filter/impl/Operand.java:20, `impl`), `Operator` (common/src/main/java/org/apache/rocketmq/common/filter/impl/Operator.java:20, `impl`), `PolishExpr` (common/src/main/java/org/apache/rocketmq/common/filter/impl/PolishExpr.java:28, `impl`), `Type` (common/src/main/java/org/apache/rocketmq/common/filter/impl/Type.java:20, `impl`). While they are public, every consumer of the library can bind to them, so changing them is a breaking change for those consumers. — common/src/main/java/org/apache/rocketmq/common/filter/impl/Op.java:20
1 public type in `org.apache.rocketmq.controller.elect.impl` is marked as implementation by its own namespace, folder or name: `DefaultElectPolicy` (controller/src/main/java/org/apache/rocketmq/controller/elect/impl/DefaultElectPolicy.java:29, `impl`). While it is public, every consumer of the library can bind to it, so changing it is a breaking change for those consumers. — controller/src/main/java/org/apache/rocketmq/controller/elect/impl/DefaultElectPolicy.java:29
4 public types in `org.apache.rocketmq.controller.impl` are marked as implementation by their own namespace, folder or name: `DLedgerController` (controller/src/main/java/org/apache/rocketmq/controller/impl/DLedgerController.java:87, `impl`), `DLedgerControllerStateMachine` (controller/src/main/java/org/apache/rocketmq/controller/impl/DLedgerControllerStateMachine.java:35, `impl`), `JRaftController` (controller/src/main/java/org/apache/rocketmq/controller/impl/JRaftController.java:67, `impl`), `JRaftControllerStateMachine` (controller/src/main/java/org/apache/rocketmq/controller/impl/JRaftControllerStateMachine.java:78, `impl`). While they are public, every consumer of the library can bind to them, so changing them is a breaking change for those consumers. — controller/src/main/java/org/apache/rocketmq/controller/impl/DLedgerController.java:87
1 public type in `org.apache.rocketmq.controller.impl.closure` is marked as implementation by its own namespace, folder or name: `ControllerClosure` (controller/src/main/java/org/apache/rocketmq/controller/impl/closure/ControllerClosure.java:32, `impl`). While it is public, every consumer of the library can bind to it, so changing it is a breaking change for those consumers. — controller/src/main/java/org/apache/rocketmq/controller/impl/closure/ControllerClosure.java:32
10 public types in `org.apache.rocketmq.controller.impl.event` are marked as implementation by their own namespace, folder or name: `AlterSyncStateSetEvent` (controller/src/main/java/org/apache/rocketmq/controller/impl/event/AlterSyncStateSetEvent.java:26, `impl`), `ApplyBrokerIdEvent` (controller/src/main/java/org/apache/rocketmq/controller/impl/event/ApplyBrokerIdEvent.java:23, `impl`), `CleanBrokerDataEvent` (controller/src/main/java/org/apache/rocketmq/controller/impl/event/CleanBrokerDataEvent.java:22, `impl`), `ControllerResult` (controller/src/main/java/org/apache/rocketmq/controller/impl/event/ControllerResult.java:23, `impl`), `ElectMasterEvent` (controller/src/main/java/org/apache/rocketmq/controller/impl/event/ElectMasterEvent.java:23, `impl`), `EventMessage` (controller/src/main/java/org/apache/rocketmq/controller/impl/event/EventMessage.java:22, `impl`), `EventSerializer` (controller/src/main/java/org/apache/rocketmq/controller/impl/event/EventSerializer.java:25, `impl`), `EventType` (controller/src/main/java/org/apache/rocketmq/controller/impl/event/EventType.java:22, `impl`), and 2 more. While they are public, every consumer of the library can bind to them, so changing them is a breaking change for those consumers. — controller/src/main/java/org/apache/rocketmq/controller/impl/event/AlterSyncStateSetEvent.java:26
4 public types in `org.apache.rocketmq.controller.impl.heartbeat` are marked as implementation by their own namespace, folder or name: `BrokerIdentityInfo` (controller/src/main/java/org/apache/rocketmq/controller/impl/heartbeat/BrokerIdentityInfo.java:23, `impl`), `BrokerLiveInfo` (controller/src/main/java/org/apache/rocketmq/controller/impl/heartbeat/BrokerLiveInfo.java:22, `impl`), `DefaultBrokerHeartbeatManager` (controller/src/main/java/org/apache/rocketmq/controller/impl/heartbeat/DefaultBrokerHeartbeatManager.java:41, `impl`), `RaftBrokerHeartBeatManager` (controller/src/main/java/org/apache/rocketmq/controller/impl/heartbeat/RaftBrokerHeartBeatManager.java:53, `impl`). While they are public, every consumer of the library can bind to them, so changing them is a breaking change for those consumers. — controller/src/main/java/org/apache/rocketmq/controller/impl/heartbeat/BrokerIdentityInfo.java:23
5 public types in `org.apache.rocketmq.controller.impl.manager` are marked as implementation by their own namespace, folder or name: `BrokerReplicaInfo` (controller/src/main/java/org/apache/rocketmq/controller/impl/manager/BrokerReplicaInfo.java:33, `impl`), `RaftReplicasInfoManager` (controller/src/main/java/org/apache/rocketmq/controller/impl/manager/RaftReplicasInfoManager.java:48, `impl`), `BrokerValidPredicateWithInvokeTime` (controller/src/main/java/org/apache/rocketmq/controller/impl/manager/RaftReplicasInfoManager.java:222, `impl`), `ReplicasInfoManager` (controller/src/main/java/org/apache/rocketmq/controller/impl/manager/ReplicasInfoManager.java:76, `impl`), `SyncStateInfo` (controller/src/main/java/org/apache/rocketmq/controller/impl/manager/SyncStateInfo.java:28, `impl`). While they are public, every consumer of the library can bind to them, so changing them is a breaking change for those consumers. — controller/src/main/java/org/apache/rocketmq/controller/impl/manager/BrokerReplicaInfo.java:33
9 public types in `org.apache.rocketmq.controller.impl.task` are marked as implementation by their own namespace, folder or name: `BrokerCloseChannelRequest` (controller/src/main/java/org/apache/rocketmq/controller/impl/task/BrokerCloseChannelRequest.java:24, `impl`), `BrokerCloseChannelResponse` (controller/src/main/java/org/apache/rocketmq/controller/impl/task/BrokerCloseChannelResponse.java:22, `impl`), `CheckNotActiveBrokerRequest` (controller/src/main/java/org/apache/rocketmq/controller/impl/task/CheckNotActiveBrokerRequest.java:22, `impl`), `CheckNotActiveBrokerResponse` (controller/src/main/java/org/apache/rocketmq/controller/impl/task/CheckNotActiveBrokerResponse.java:22, `impl`), `GetBrokerLiveInfoRequest` (controller/src/main/java/org/apache/rocketmq/controller/impl/task/GetBrokerLiveInfoRequest.java:23, `impl`), `GetBrokerLiveInfoResponse` (controller/src/main/java/org/apache/rocketmq/controller/impl/task/GetBrokerLiveInfoResponse.java:22, `impl`), `GetSyncStateDataRequest` (controller/src/main/java/org/apache/rocketmq/controller/impl/task/GetSyncStateDataRequest.java:22, `impl`), `RaftBrokerHeartBeatEventRequest` (controller/src/main/java/org/apache/rocketmq/controller/impl/task/RaftBrokerHeartBeatEventRequest.java:24, `impl`), and 1 more. While they are public, every consumer of the library can bind to them, so changing them is a breaking change for those consumers. — controller/src/main/java/org/apache/rocketmq/controller/impl/task/BrokerCloseChannelRequest.java:24
1 public type in `io.openmessaging.rocketmq` is marked as implementation by its own namespace, folder or name: `MessagingAccessPointImpl` (openmessaging/src/main/java/io/openmessaging/rocketmq/MessagingAccessPointImpl.java:32, name ends in `Impl`). While it is public, every consumer of the library can bind to it, so changing it is a breaking change for those consumers. — openmessaging/src/main/java/io/openmessaging/rocketmq/MessagingAccessPointImpl.java:32
2 public types in `io.openmessaging.rocketmq.consumer` are marked as implementation by their own namespace, folder or name: `PullConsumerImpl` (openmessaging/src/main/java/io/openmessaging/rocketmq/consumer/PullConsumerImpl.java:42, name ends in `Impl`), `PushConsumerImpl` (openmessaging/src/main/java/io/openmessaging/rocketmq/consumer/PushConsumerImpl.java:44, name ends in `Impl`). While they are public, every consumer of the library can bind to them, so changing them is a breaking change for those consumers. — openmessaging/src/main/java/io/openmessaging/rocketmq/consumer/PullConsumerImpl.java:42
2 public types in `io.openmessaging.rocketmq.domain` are marked as implementation by their own namespace, folder or name: `BytesMessageImpl` (openmessaging/src/main/java/io/openmessaging/rocketmq/domain/BytesMessageImpl.java:26, name ends in `Impl`), `SendResultImpl` (openmessaging/src/main/java/io/openmessaging/rocketmq/domain/SendResultImpl.java:22, name ends in `Impl`). While they are public, every consumer of the library can bind to them, so changing them is a breaking change for those consumers. — openmessaging/src/main/java/io/openmessaging/rocketmq/domain/BytesMessageImpl.java:26
1 public type in `io.openmessaging.rocketmq.producer` is marked as implementation by its own namespace, folder or name: `ProducerImpl` (openmessaging/src/main/java/io/openmessaging/rocketmq/producer/ProducerImpl.java:38, name ends in `Impl`). While it is public, every consumer of the library can bind to it, so changing it is a breaking change for those consumers. — openmessaging/src/main/java/io/openmessaging/rocketmq/producer/ProducerImpl.java:38
1 public type in `org.apache.rocketmq.proxy.grpc.v2.consumer` is marked as implementation by its own namespace, folder or name: `PopMessageResultFilterImpl` (proxy/src/main/java/org/apache/rocketmq/proxy/grpc/v2/consumer/PopMessageResultFilterImpl.java:25, name ends in `Impl`). While it is public, every consumer of the library can bind to it, so changing it is a breaking change for those consumers. — proxy/src/main/java/org/apache/rocketmq/proxy/grpc/v2/consumer/PopMessageResultFilterImpl.java:25
1 public type in `org.apache.rocketmq.remoting.rpc` is marked as implementation by its own namespace, folder or name: `RpcClientImpl` (remoting/src/main/java/org/apache/rocketmq/remoting/rpc/RpcClientImpl.java:42, name ends in `Impl`). While it is public, every consumer of the library can bind to it, so changing it is a breaking change for those consumers. — remoting/src/main/java/org/apache/rocketmq/remoting/rpc/RpcClientImpl.java:42
1 public type in `org.apache.rocketmq.store.lock` is marked as implementation by its own namespace, folder or name: `AdaptiveBackOffSpinLockImpl` (store/src/main/java/org/apache/rocketmq/store/lock/AdaptiveBackOffSpinLockImpl.java:32, name ends in `Impl`). While it is public, every consumer of the library can bind to it, so changing it is a breaking change for those consumers. — store/src/main/java/org/apache/rocketmq/store/lock/AdaptiveBackOffSpinLockImpl.java:32
1 public type in `org.apache.rocketmq.store.queue` is marked as implementation by its own namespace, folder or name: `OffsetInitializerRocksDBImpl` (store/src/main/java/org/apache/rocketmq/store/queue/OffsetInitializerRocksDBImpl.java:24, name ends in `Impl`). While it is public, every consumer of the library can bind to it, so changing it is a breaking change for those consumers. — store/src/main/java/org/apache/rocketmq/store/queue/OffsetInitializerRocksDBImpl.java:24
2 public types in `org.apache.rocketmq.tieredstore.core` are marked as implementation by their own namespace, folder or name: `MessageStoreDispatcherImpl` (tieredstore/src/main/java/org/apache/rocketmq/tieredstore/core/MessageStoreDispatcherImpl.java:60, name ends in `Impl`), `MessageStoreFetcherImpl` (tieredstore/src/main/java/org/apache/rocketmq/tieredstore/core/MessageStoreFetcherImpl.java:53, name ends in `Impl`). While they are public, every consumer of the library can bind to them, so changing them is a breaking change for those consumers. — tieredstore/src/main/java/org/apache/rocketmq/tieredstore/core/MessageStoreDispatcherImpl.java:60
1 public type in `org.apache.rocketmq.tools.admin` is marked as implementation by its own namespace, folder or name: `DefaultMQAdminExtImpl` (tools/src/main/java/org/apache/rocketmq/tools/admin/DefaultMQAdminExtImpl.java:130, name ends in `Impl`). While it is public, every consumer of the library can bind to it, so changing it is a breaking change for those consumers. — tools/src/main/java/org/apache/rocketmq/tools/admin/DefaultMQAdminExtImpl.java:130
What to do
Hide `org.apache.rocketmq.auth.authentication.manager` (`AuthenticationMetadataManagerImpl`) (Java: package-private (no modifier), or leave its package out of `module-info` exports): its own namespace, folder or name already says it is implementation, and hidden it can change without breaking a consumer.
Hide `org.apache.rocketmq.auth.authorization.manager` (`AuthorizationMetadataManagerImpl`) (Java: package-private (no modifier), or leave its package out of `module-info` exports): its own namespace, folder or name already says it is implementation, and hidden it can change without breaking a consumer.
Hide `org.apache.rocketmq.broker.lite` (`LiteShardingImpl`, `LiteSubscriptionRegistryImpl`) (Java: package-private (no modifier), or leave its package out of `module-info` exports): its own namespace, folder or name already says it is implementation, and hidden it can change without breaking a consumer.
Hide `org.apache.rocketmq.broker.transaction.queue` (`TransactionalMessageServiceImpl`) (Java: package-private (no modifier), or leave its package out of `module-info` exports): its own namespace, folder or name already says it is implementation, and hidden it can change without breaking a consumer.
Hide `org.apache.rocketmq.client.consumer` (`PullTaskImpl`) (Java: package-private (no modifier), or leave its package out of `module-info` exports): its own namespace, folder or name already says it is implementation, and hidden it can change without breaking a consumer.
Hide `org.apache.rocketmq.client.impl` (`ClientRemotingProcessor`, `CommunicationMode`, `FindBrokerResult`, `MQAdminImpl`, `MQClientAPIImpl`, `MQClientManager`) (Java: package-private (no modifier), or leave its package out of `module-info` exports): its own namespace, folder or name already says it is implementation, and hidden it can change without breaking a consumer.
Hide `org.apache.rocketmq.client.impl.admin` (`MqClientAdminImpl`) (Java: package-private (no modifier), or leave its package out of `module-info` exports): its own namespace, folder or name already says it is implementation, and hidden it can change without breaking a consumer.
Hide `org.apache.rocketmq.client.impl.consumer` (`AbstractConsumeMessageService`, `AssignedMessageQueue`, `ConsumeMessageConcurrentlyService`, `ConsumeMessageOrderlyService`, `ConsumeMessagePopConcurrentlyService`, `ConsumeMessagePopOrderlyService`, `ConsumeMessageService`, `DefaultLitePullConsumerImpl`, and 18 more) (Java: package-private (no modifier), or leave its package out of `module-info` exports): its own namespace, folder or name already says it is implementation, and hidden it can change without breaking a consumer.
Hide `org.apache.rocketmq.client.impl.factory` (`MQClientInstance`) (Java: package-private (no modifier), or leave its package out of `module-info` exports): its own namespace, folder or name already says it is implementation, and hidden it can change without breaking a consumer.
Hide `org.apache.rocketmq.client.impl.mqclient` (`DoNothingClientRemotingProcessor`, `MQClientAPIExt`, `MQClientAPIFactory`) (Java: package-private (no modifier), or leave its package out of `module-info` exports): its own namespace, folder or name already says it is implementation, and hidden it can change without breaking a consumer.
Hide `org.apache.rocketmq.client.impl.producer` (`DefaultMQProducerImpl`, `MQProducerInner`, `TopicPublishInfo`, `QueueFilter`) (Java: package-private (no modifier), or leave its package out of `module-info` exports): its own namespace, folder or name already says it is implementation, and hidden it can change without breaking a consumer.
Hide `org.apache.rocketmq.client.latency` (`LatencyFaultToleranceImpl`) (Java: package-private (no modifier), or leave its package out of `module-info` exports): its own namespace, folder or name already says it is implementation, and hidden it can change without breaking a consumer.
Hide `org.apache.rocketmq.client.trace.hook` (`ConsumeMessageOpenTracingHookImpl`, `ConsumeMessageTraceHookImpl`, `EndTransactionOpenTracingHookImpl`, `EndTransactionTraceHookImpl`, `SendMessageOpenTracingHookImpl`, `SendMessageTraceHookImpl`) (Java: package-private (no modifier), or leave its package out of `module-info` exports): its own namespace, folder or name already says it is implementation, and hidden it can change without breaking a consumer.
Hide `org.apache.rocketmq.common` (`ThreadFactoryImpl`) (Java: package-private (no modifier), or leave its package out of `module-info` exports): its own namespace, folder or name already says it is implementation, and hidden it can change without breaking a consumer.
Hide `org.apache.rocketmq.common.filter.impl` (`Op`, `Operand`, `Operator`, `PolishExpr`, `Type`) (Java: package-private (no modifier), or leave its package out of `module-info` exports): its own namespace, folder or name already says it is implementation, and hidden it can change without breaking a consumer.
Hide `org.apache.rocketmq.controller.elect.impl` (`DefaultElectPolicy`) (Java: package-private (no modifier), or leave its package out of `module-info` exports): its own namespace, folder or name already says it is implementation, and hidden it can change without breaking a consumer.
Hide `org.apache.rocketmq.controller.impl` (`DLedgerController`, `DLedgerControllerStateMachine`, `JRaftController`, `JRaftControllerStateMachine`) (Java: package-private (no modifier), or leave its package out of `module-info` exports): its own namespace, folder or name already says it is implementation, and hidden it can change without breaking a consumer.
Hide `org.apache.rocketmq.controller.impl.closure` (`ControllerClosure`) (Java: package-private (no modifier), or leave its package out of `module-info` exports): its own namespace, folder or name already says it is implementation, and hidden it can change without breaking a consumer.
Hide `org.apache.rocketmq.controller.impl.event` (`AlterSyncStateSetEvent`, `ApplyBrokerIdEvent`, `CleanBrokerDataEvent`, `ControllerResult`, `ElectMasterEvent`, `EventMessage`, `EventSerializer`, `EventType`, and 2 more) (Java: package-private (no modifier), or leave its package out of `module-info` exports): its own namespace, folder or name already says it is implementation, and hidden it can change without breaking a consumer.
Hide `org.apache.rocketmq.controller.impl.heartbeat` (`BrokerIdentityInfo`, `BrokerLiveInfo`, `DefaultBrokerHeartbeatManager`, `RaftBrokerHeartBeatManager`) (Java: package-private (no modifier), or leave its package out of `module-info` exports): its own namespace, folder or name already says it is implementation, and hidden it can change without breaking a consumer.
Hide `org.apache.rocketmq.controller.impl.manager` (`BrokerReplicaInfo`, `RaftReplicasInfoManager`, `BrokerValidPredicateWithInvokeTime`, `ReplicasInfoManager`, `SyncStateInfo`) (Java: package-private (no modifier), or leave its package out of `module-info` exports): its own namespace, folder or name already says it is implementation, and hidden it can change without breaking a consumer.
Hide `org.apache.rocketmq.controller.impl.task` (`BrokerCloseChannelRequest`, `BrokerCloseChannelResponse`, `CheckNotActiveBrokerRequest`, `CheckNotActiveBrokerResponse`, `GetBrokerLiveInfoRequest`, `GetBrokerLiveInfoResponse`, `GetSyncStateDataRequest`, `RaftBrokerHeartBeatEventRequest`, and 1 more) (Java: package-private (no modifier), or leave its package out of `module-info` exports): its own namespace, folder or name already says it is implementation, and hidden it can change without breaking a consumer.
Hide `io.openmessaging.rocketmq` (`MessagingAccessPointImpl`) (Java: package-private (no modifier), or leave its package out of `module-info` exports): its own namespace, folder or name already says it is implementation, and hidden it can change without breaking a consumer.
Hide `io.openmessaging.rocketmq.consumer` (`PullConsumerImpl`, `PushConsumerImpl`) (Java: package-private (no modifier), or leave its package out of `module-info` exports): its own namespace, folder or name already says it is implementation, and hidden it can change without breaking a consumer.
Hide `io.openmessaging.rocketmq.domain` (`BytesMessageImpl`, `SendResultImpl`) (Java: package-private (no modifier), or leave its package out of `module-info` exports): its own namespace, folder or name already says it is implementation, and hidden it can change without breaking a consumer.
Hide `io.openmessaging.rocketmq.producer` (`ProducerImpl`) (Java: package-private (no modifier), or leave its package out of `module-info` exports): its own namespace, folder or name already says it is implementation, and hidden it can change without breaking a consumer.
Hide `org.apache.rocketmq.proxy.grpc.v2.consumer` (`PopMessageResultFilterImpl`) (Java: package-private (no modifier), or leave its package out of `module-info` exports): its own namespace, folder or name already says it is implementation, and hidden it can change without breaking a consumer.
Hide `org.apache.rocketmq.remoting.rpc` (`RpcClientImpl`) (Java: package-private (no modifier), or leave its package out of `module-info` exports): its own namespace, folder or name already says it is implementation, and hidden it can change without breaking a consumer.
Hide `org.apache.rocketmq.store.lock` (`AdaptiveBackOffSpinLockImpl`) (Java: package-private (no modifier), or leave its package out of `module-info` exports): its own namespace, folder or name already says it is implementation, and hidden it can change without breaking a consumer.
Hide `org.apache.rocketmq.store.queue` (`OffsetInitializerRocksDBImpl`) (Java: package-private (no modifier), or leave its package out of `module-info` exports): its own namespace, folder or name already says it is implementation, and hidden it can change without breaking a consumer.
Hide `org.apache.rocketmq.tieredstore.core` (`MessageStoreDispatcherImpl`, `MessageStoreFetcherImpl`) (Java: package-private (no modifier), or leave its package out of `module-info` exports): its own namespace, folder or name already says it is implementation, and hidden it can change without breaking a consumer.
Hide `org.apache.rocketmq.tools.admin` (`DefaultMQAdminExtImpl`) (Java: package-private (no modifier), or leave its package out of `module-info` exports): its own namespace, folder or name already says it is implementation, and hidden it can change without breaking a consumer.
Do you agree with this assessment?
P2 · Observability8.8 / 10Strong✓ Tool-verified
Readiness · Readiness — Whether the code is diagnosable in production — structured logging, tracing/metrics, health checks.
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.
Add a health-check endpoint (Spring Boot Actuator's /actuator/health, or a /health route) so orchestrators and load balancers can probe liveness/readiness.
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. — tieredstore/src/test/java/org/apache/rocketmq/tieredstore/index/IndexStoreServiceBenchTest.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.
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.4 / 10Critical✓ 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.
`topicLength` is read from the bytes being parsed at line 213 (`getInt`), then used to size a `new byte[]` at line 217 — and nowhere in its scope is `topicLength` 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 `topicLength` against the bytes actually remaining and a maximum the format allows before allocating. — store/src/main/java/org/apache/rocketmq/store/queue/RocksDBConsumeQueueOffsetTable.java:217
`topicLen` is read from the bytes being parsed at line 350 (`getInt`), then used to size a `new byte[]` at line 351 — 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:351
`size` is read from the bytes being parsed at line 158 (`getInt`), then used to size a `ByteBuffer.allocate` at line 159 — 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:159
`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 719 (`getInt`), then used to size a `new byte[]` at line 720 — 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:720
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.
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 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.
`debug` at line 348 is called with an argument built by `JSON.toJSONString(queryLog)` (line 349), whose cost grows with the collection it walks. Java evaluates a call's arguments BEFORE entering the method, so that join/projection runs in full every time this line is reached — and then the level check inside the logger discards the string it produced, because debug is a level a shipped configuration normally leaves off. Nothing here decides beforehand whether the message is wanted: no `isDebugEnabled`/`isTraceEnabled` test, no debug flag, no lambda or `Supplier` the logger calls only when the level is on. — tieredstore/src/main/java/org/apache/rocketmq/tieredstore/file/FlatMessageFile.java:348
`debug` at line 1407 is called with an argument built by `JSON.toJSONString(queryOffsetResult)` (line 1407), whose cost grows with the collection it walks. Java evaluates a call's arguments BEFORE entering the method, so that join/projection runs in full every time this line is reached — and then the level check inside the logger discards the string it produced, because debug is a level a shipped configuration normally leaves off. Nothing here decides beforehand whether the message is wanted: no `isDebugEnabled`/`isTraceEnabled` test, no debug flag, no lambda or `Supplier` the logger calls only when the level is on. — store/src/main/java/org/apache/rocketmq/store/DefaultMessageStore.java:1407
`debug` at line 1410 is called with an argument built by `JSON.toJSONString(queryOffsetResult)` (line 1410), whose cost grows with the collection it walks. Java evaluates a call's arguments BEFORE entering the method, so that join/projection runs in full every time this line is reached — and then the level check inside the logger discards the string it produced, because debug is a level a shipped configuration normally leaves off. Nothing here decides beforehand whether the message is wanted: no `isDebugEnabled`/`isTraceEnabled` test, no debug flag, no lambda or `Supplier` the logger calls only when the level is on. — store/src/main/java/org/apache/rocketmq/store/DefaultMessageStore.java:1410
`debug` at line 1462 is called with an argument built by `JSON.toJSONString(queryOffsetResult)` (line 1462), whose cost grows with the collection it walks. Java evaluates a call's arguments BEFORE entering the method, so that join/projection runs in full every time this line is reached — and then the level check inside the logger discards the string it produced, because debug is a level a shipped configuration normally leaves off. Nothing here decides beforehand whether the message is wanted: no `isDebugEnabled`/`isTraceEnabled` test, no debug flag, no lambda or `Supplier` the logger calls only when the level is on. — store/src/main/java/org/apache/rocketmq/store/DefaultMessageStore.java:1462
`debug` at line 1465 is called with an argument built by `JSON.toJSONString(queryOffsetResult)` (line 1465), whose cost grows with the collection it walks. Java evaluates a call's arguments BEFORE entering the method, so that join/projection runs in full every time this line is reached — and then the level check inside the logger discards the string it produced, because debug is a level a shipped configuration normally leaves off. Nothing here decides beforehand whether the message is wanted: no `isDebugEnabled`/`isTraceEnabled` test, no debug flag, no lambda or `Supplier` the logger calls only when the level is on. — store/src/main/java/org/apache/rocketmq/store/DefaultMessageStore.java:1465
What to do
In Java, put the construction behind the logger's own check (`if (log.isDebugEnabled())` for SLF4J and Log4j, `if (logger.isLoggable(Level.FINE))` for java.util.logging), or hand the logger a lambda it calls only when the level is on (Log4j 2's `Supplier` overloads, SLF4J 2's `log.atDebug().addArgument(() -> …)`). A `{}` placeholder alone is not the fix: it defers the formatting, not the stream, join or serialisation in the argument.
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. (×25) — store/src/main/java/org/apache/rocketmq/store/CommitLog.java:1856, store/src/main/java/org/apache/rocketmq/store/DefaultMessageStore.java:1963, store/src/main/java/org/apache/rocketmq/store/MappedFileQueue.java:712, …
`catch (Throwable)` 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. (×3) — store/src/main/java/org/apache/rocketmq/store/util/PerfCounter.java:293, proxy/src/main/java/org/apache/rocketmq/proxy/service/admin/DefaultAdminService.java:100, proxy/src/main/java/org/apache/rocketmq/proxy/grpc/v2/consumer/ReceiveMessageActivity.java:238
`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. (×12) — remoting/src/main/java/org/apache/rocketmq/remoting/protocol/RemotingCommand.java:287, proxy/src/main/java/org/apache/rocketmq/proxy/service/route/TopicRouteService.java:114, proxy/src/main/java/org/apache/rocketmq/proxy/service/route/TopicRouteService.java:125, …
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.
`warn` at line 114 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. — store/src/main/java/org/apache/rocketmq/store/AllocateMappedFileService.java:114
`warn` at line 125 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. — store/src/main/java/org/apache/rocketmq/store/AllocateMappedFileService.java:125
`warn` at line 135 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. — store/src/main/java/org/apache/rocketmq/store/AllocateMappedFileService.java:135
`info` 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.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. — store/src/main/java/org/apache/rocketmq/store/AllocateMappedFileService.java:162
`info` at line 167 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. — store/src/main/java/org/apache/rocketmq/store/AllocateMappedFileService.java:167
`warn` at line 180 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. — store/src/main/java/org/apache/rocketmq/store/AllocateMappedFileService.java:180
`warn` 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.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. — store/src/main/java/org/apache/rocketmq/store/AllocateMappedFileService.java:185
`warn` at line 212 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. — store/src/main/java/org/apache/rocketmq/store/AllocateMappedFileService.java:212
`warn` at line 232 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. — store/src/main/java/org/apache/rocketmq/store/AllocateMappedFileService.java:232
`warn` at line 236 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. — store/src/main/java/org/apache/rocketmq/store/AllocateMappedFileService.java:236
`info` at line 787 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. — store/src/main/java/org/apache/rocketmq/store/CommitLog.java:787
`info` at line 129 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. — store/src/main/java/org/apache/rocketmq/store/ConsumeQueue.java:129
`info` at line 165 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. — store/src/main/java/org/apache/rocketmq/store/ConsumeQueue.java:165
`info` at line 175 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. — store/src/main/java/org/apache/rocketmq/store/ConsumeQueue.java:175
`info` at line 183 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. — store/src/main/java/org/apache/rocketmq/store/ConsumeQueue.java:183
`info` at line 186 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. — store/src/main/java/org/apache/rocketmq/store/ConsumeQueue.java:186
`warn` at line 759 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. — store/src/main/java/org/apache/rocketmq/store/ConsumeQueue.java:759
`warn` at line 810 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. — store/src/main/java/org/apache/rocketmq/store/ConsumeQueue.java:810
`info` at line 870 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. — store/src/main/java/org/apache/rocketmq/store/ConsumeQueue.java:870
`error` at line 274 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. — store/src/main/java/org/apache/rocketmq/store/ConsumeQueueExt.java:274
`info` at line 295 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. — store/src/main/java/org/apache/rocketmq/store/ConsumeQueueExt.java:295
`info` 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.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. — store/src/main/java/org/apache/rocketmq/store/ConsumeQueueExt.java:338
`info` at line 342 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. — store/src/main/java/org/apache/rocketmq/store/ConsumeQueueExt.java:342
`warn` at line 874 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. — store/src/main/java/org/apache/rocketmq/store/DefaultMessageStore.java:874
`warn` at line 938 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. — store/src/main/java/org/apache/rocketmq/store/DefaultMessageStore.java:938
`info` at line 1917 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. — store/src/main/java/org/apache/rocketmq/store/DefaultMessageStore.java:1917
`info` at line 1928 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. — store/src/main/java/org/apache/rocketmq/store/DefaultMessageStore.java:1928
`info` at line 2296 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. — store/src/main/java/org/apache/rocketmq/store/DefaultMessageStore.java:2296
`warn` at line 2364 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. — store/src/main/java/org/apache/rocketmq/store/DefaultMessageStore.java:2364
`error` at line 2451 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. — store/src/main/java/org/apache/rocketmq/store/DefaultMessageStore.java:2451
`info` at line 2463 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. — store/src/main/java/org/apache/rocketmq/store/DefaultMessageStore.java:2463
`error` at line 2474 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. — store/src/main/java/org/apache/rocketmq/store/DefaultMessageStore.java:2474
`info` at line 2485 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. — store/src/main/java/org/apache/rocketmq/store/DefaultMessageStore.java:2485
`info` at line 2494 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. — store/src/main/java/org/apache/rocketmq/store/DefaultMessageStore.java:2494
`info` at line 2499 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. — store/src/main/java/org/apache/rocketmq/store/DefaultMessageStore.java:2499
`info` at line 2555 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. — store/src/main/java/org/apache/rocketmq/store/DefaultMessageStore.java:2555
`error` at line 2560 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. — store/src/main/java/org/apache/rocketmq/store/DefaultMessageStore.java:2560
`info` at line 2568 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. — store/src/main/java/org/apache/rocketmq/store/DefaultMessageStore.java:2568
`info` at line 2836 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. — store/src/main/java/org/apache/rocketmq/store/DefaultMessageStore.java:2836
`warn` at line 2843 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. — store/src/main/java/org/apache/rocketmq/store/DefaultMessageStore.java:2843
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/253 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 — 3 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.
D11 Test Reliability — 5 observation(s) recorded · This repository declares 5 of its own test(s) unreliable. The built-in reliability runner does not support this repository's ecosystem (.java), so the suite was not re-run and no reliability score is given — these are the repository's own declarations, not our measurement.
X10 Duplicated predicate — 40 observation(s) recorded · Advisory — this card reports evidence and never carries a score.
X7 Silent fallback defaults — 3 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 — 56 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.
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.
AXB2 Runtime readiness — Advisory — this card reports evidence and never carries a score, so there is nothing missing here.
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.
D12 Dependency Hygiene — Not scored — a Maven build resolved 144 artifact(s) (115 behind a shipped release, reported), but the build resolved only part of the graph, so this dimension's own question is only partly answered. NOT a finding that these dependencies are current or healthy.
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.
D21 Naming Consistency — Naming consistency is measured on C# and TypeScript only; Java, Python not measured.
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+ sibling projects each declaring an entity of their own or taking another project's integration events. 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 — D24 reads C#, Visual Basic, TypeScript and JavaScript comments only — this repository's production source is .java, .py, which was left unread. Not scored: this is a gap in the analyzer, not a verdict about this repository.
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.
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): 42 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 (4 CQRS handler(s))
ED5 Idempotency — Not assessed, and this one is on us: 4 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 — coverage not measured: this check compares the coverage of the analyzer's own test run across the domain and web layers, and that run measured none here — Test coverage (D8) says why
PF2 Allocation hygiene — Not scored: this check counted allocation-aware idioms (Span, pools, stackalloc) per line, which describes what kind of code a repository is rather than whether it has an allocation problem, so it was withdrawn. Nothing here is a finding about your code.
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.
X1 Async correctness — not applicable — the code was read and holds no site of this kind, so there is nothing for this check to judge
X12 Unreachable branch — X12 reached only 0% of this repository's production lines — java (222,451 lines), cpp (240 lines) was left unread. Not scored: a score over a minority of the product would be published as the whole of it.
X13 Undrained process stream — not applicable — the code was read and holds no site of this kind, so there is nothing for this check to judge
X17 Uncapped recursion over a caller-supplied document — not applicable — the code was read and holds no site of this kind, so there is nothing for this check to judge
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
X21 Side-effecting pattern guard — not applicable — the code was read and holds no site of this kind, so there is nothing for this check to judge
X22 Contradicted release guard — not applicable — the code was read and holds no site of this kind, so there is nothing for this check to judge
X24 Document value interpolated into markup unescaped — not applicable — the code was read and holds no site of this kind, so there is nothing for this check to judge
X30 Support guard that admits what it rejects — not applicable — the code was read and holds no site of this kind, so there is nothing for this check to judge
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.
D11 · Test Reliability· Test declared unreliable · ×5
Test declared unreliable: broker/src/test/java/org/apache/rocketmq/broker/controller/ReplicasManagerTest.java broker/src/test/java/org/apache/rocketmq/broker/controller/ReplicasManagerTest.java:62— This test is disabled or skipped with a reason naming unreliability — the repository's own words: "Flaky: AutoSwitchHAService.init() with mocked MessageStore causes NPE on shutdown". A test that is skipped for flakiness is neither passing nor protecting the code it covers; either stabilise it or delete it, but do not leave it disabled indefinitely. (Found by reading the repository's own test source — the suite itself was not re-run, since the reliability runner does not support this ecosystem.)
Test declared unreliable: beforeClass store/src/test/java/org/apache/rocketmq/store/dledger/DLedgerCommitlogTest.java:54— This test is disabled or skipped with a reason naming unreliability — the repository's own words: "Flaky: DLedger integration test, extremely slow and environment-sensitive". A test that is skipped for flakiness is neither passing nor protecting the code it covers; either stabilise it or delete it, but do not leave it disabled indefinitely. (Found by reading the repository's own test source — the suite itself was not re-run, since the reliability runner does not support this ecosystem.)
Test declared unreliable: multiDirsStorageTest store/src/test/java/org/apache/rocketmq/store/dledger/DLedgerMultiPathTest.java:38— This test is disabled or skipped with a reason naming unreliability — the repository's own words: "Flaky: DLedger multi-path integration test, extremely slow and environment-sensitive". A test that is skipped for flakiness is neither passing nor protecting the code it covers; either stabilise it or delete it, but do not leave it disabled indefinitely. (Found by reading the repository's own test source — the suite itself was not re-run, since the reliability runner does not support this ecosystem.)
Test declared unreliable: store/src/test/java/org/apache/rocketmq/store/ha/autoswitch/AutoSwitchHATest.java store/src/test/java/org/apache/rocketmq/store/ha/autoswitch/AutoSwitchHATest.java:65— This test is disabled or skipped with a reason naming unreliability — the repository's own words: "Flaky: HA port binding and timeout issues across platforms". A test that is skipped for flakiness is neither passing nor protecting the code it covers; either stabilise it or delete it, but do not leave it disabled indefinitely. (Found by reading the repository's own test source — the suite itself was not re-run, since the reliability runner does not support this ecosystem.)
Test declared unreliable: test_priority_consume_use_separate_retry_queue_with_queue_expansion test/src/test/java/org/apache/rocketmq/test/client/consumer/pop/PopPriorityIT.java:284— This test is disabled or skipped with a reason naming unreliability — the repository's own words: "flaky due to over-idealistic assumptions in CI/CD, temporarily disabled". A test that is skipped for flakiness is neither passing nor protecting the code it covers; either stabilise it or delete it, but do not leave it disabled indefinitely. (Found by reading the repository's own test source — the suite itself was not re-run, since the reliability runner does not support this ecosystem.)
Banned license: org.openjdk.jmh:jmh-core — `org.openjdk.jmh:jmh-core` 1.19 is published on Maven Central under `GPL-2.0`, which this policy bans, and this repository declares it in a Maven or Gradle manifest. The licence was read from the artifact's POM `<licenses>` block — following `<parent>` where the POM inherits them — and normalised to SPDX before it was judged, because Maven publishes the name as free text (`GNU Affero General Public License v3` is AGPL-3.0). Where a POM lists several licences they are read as a CHOICE, per Maven's own documentation, so this is charged only because EVERY listed licence is banned. Replace the dependency, or record an accepted exception.
Banned license: org.openjdk.jmh:jmh-generator-annprocess — `org.openjdk.jmh:jmh-generator-annprocess` 1.19 is published on Maven Central under `GPL-2.0`, which this policy bans, and this repository declares it in a Maven or Gradle manifest. The licence was read from the artifact's POM `<licenses>` block — following `<parent>` where the POM inherits them — and normalised to SPDX before it was judged, because Maven publishes the name as free text (`GNU Affero General Public License v3` is AGPL-3.0). Where a POM lists several licences they are read as a CHOICE, per Maven's own documentation, so this is charged only because EVERY listed licence is banned. Replace the dependency, or record an accepted exception.
Banned license: org.openjdk.jmh:jmh-core — `org.openjdk.jmh:jmh-core` 1.36 is published on Maven Central under `GPL-2.0`, which this policy bans, and this repository declares it in a Maven or Gradle manifest. The licence was read from the artifact's POM `<licenses>` block — following `<parent>` where the POM inherits them — and normalised to SPDX before it was judged, because Maven publishes the name as free text (`GNU Affero General Public License v3` is AGPL-3.0). Where a POM lists several licences they are read as a CHOICE, per Maven's own documentation, so this is charged only because EVERY listed licence is banned. Replace the dependency, or record an accepted exception.
Banned license: org.openjdk.jmh:jmh-generator-annprocess — `org.openjdk.jmh:jmh-generator-annprocess` 1.36 is published on Maven Central under `GPL-2.0`, which this policy bans, and this repository declares it in a Maven or Gradle manifest. The licence was read from the artifact's POM `<licenses>` block — following `<parent>` where the POM inherits them — and normalised to SPDX before it was judged, because Maven publishes the name as free text (`GNU Affero General Public License v3` is AGPL-3.0). Where a POM lists several licences they are read as a CHOICE, per Maven's own documentation, so this is charged only because EVERY listed licence is banned. Replace the dependency, or record an accepted exception.
D10 · Test Quality· No assertions (empty test) · ×1
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.
Boundary-crossing change coupling: MQClientAPIImpl.java ↔ MQAdminExt.java client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:1— `client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java` (context main) and `tools/src/main/java/org/apache/rocketmq/tools/admin/MQAdminExt.java` (context tools) sit in DIFFERENT parts of the tree yet change together 50% of the time (71 of the 142 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) — the bounded-context boundary may be in the wrong place, or one context is leaking into the other. This is the behavioural boundary violation a static scan can't see. You can check this without leaving the row: of the 71 shared commits counted here, the most recent 3 are `7cb1b1ee` [ISSUE #9467] Implement paged retrieval of Topic and SubscriptionGrou…; `b30afe81` [ISSUE #9111] Support export broker RocksDB Config to json file (#9114); `0b247685` [ISSUE #8822] Double write cq, reduce unnecessary switches (#8823) — run `git show` on any of them.
No assertions: evaluate1 auth/src/test/java/org/apache/rocketmq/auth/authentication/AuthenticationEvaluatorTest.java:62— This method's body runs code, and no assertion was recognised in it. Recognised: JUnit's assertion methods (assertEquals, assertTrue, assertInstanceOf, assertThrows, assertThrowsExactly, assertTimeoutPreemptively, assertAll and the rest of JUnit 5's list), assertThat (AssertJ, Hamcrest, Truth), fail, Mockito's verify and the `assert` statement, in the test body and in helper methods of the test's own class or an in-repository base class, followed three calls deep. Verification through a helper on another object or in another class, through a custom matcher library, 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: evaluate4 auth/src/test/java/org/apache/rocketmq/auth/authentication/AuthenticationEvaluatorTest.java:107— This method's body runs code, and no assertion was recognised in it. Recognised: JUnit's assertion methods (assertEquals, assertTrue, assertInstanceOf, assertThrows, assertThrowsExactly, assertTimeoutPreemptively, assertAll and the rest of JUnit 5's list), assertThat (AssertJ, Hamcrest, Truth), fail, Mockito's verify and the `assert` statement, in the test body and in helper methods of the test's own class or an in-repository base class, followed three calls deep. Verification through a helper on another object or in another class, through a custom matcher library, 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: evaluate5 auth/src/test/java/org/apache/rocketmq/auth/authentication/AuthenticationEvaluatorTest.java:123— This method's body runs code, and no assertion was recognised in it. Recognised: JUnit's assertion methods (assertEquals, assertTrue, assertInstanceOf, assertThrows, assertThrowsExactly, assertTimeoutPreemptively, assertAll and the rest of JUnit 5's list), assertThat (AssertJ, Hamcrest, Truth), fail, Mockito's verify and the `assert` statement, in the test body and in helper methods of the test's own class or an in-repository base class, followed three calls deep. Verification through a helper on another object or in another class, through a custom matcher library, 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: testAllowDoesNotThrow auth/src/test/java/org/apache/rocketmq/auth/authorization/chain/AclAuthorizationHandlerTest.java:167— This method's body runs code, and no assertion was recognised in it. Recognised: JUnit's assertion methods (assertEquals, assertTrue, assertInstanceOf, assertThrows, assertThrowsExactly, assertTimeoutPreemptively, assertAll and the rest of JUnit 5's list), assertThat (AssertJ, Hamcrest, Truth), fail, Mockito's verify and the `assert` statement, in the test body and in helper methods of the test's own class or an in-repository base class, followed three calls deep. Verification through a helper on another object or in another class, through a custom matcher library, 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: testLiteralAllowBeatsPrefixedDeny auth/src/test/java/org/apache/rocketmq/auth/authorization/chain/AclAuthorizationHandlerTest.java:244— This method's body runs code, and no assertion was recognised in it. Recognised: JUnit's assertion methods (assertEquals, assertTrue, assertInstanceOf, assertThrows, assertThrowsExactly, assertTimeoutPreemptively, assertAll and the rest of JUnit 5's list), assertThat (AssertJ, Hamcrest, Truth), fail, Mockito's verify and the `assert` statement, in the test body and in helper methods of the test's own class or an in-repository base class, followed three calls deep. Verification through a helper on another object or in another class, through a custom matcher library, 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: testPrefixedPatternAllowBeatsAnyPatternDeny auth/src/test/java/org/apache/rocketmq/auth/authorization/chain/AclAuthorizationHandlerTest.java:290— This method's body runs code, and no assertion was recognised in it. Recognised: JUnit's assertion methods (assertEquals, assertTrue, assertInstanceOf, assertThrows, assertThrowsExactly, assertTimeoutPreemptively, assertAll and the rest of JUnit 5's list), assertThat (AssertJ, Hamcrest, Truth), fail, Mockito's verify and the `assert` statement, in the test body and in helper methods of the test's own class or an in-repository base class, followed three calls deep. Verification through a helper on another object or in another class, through a custom matcher library, 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: testTopicTypeAllowBeatsAnyTypeDeny auth/src/test/java/org/apache/rocketmq/auth/authorization/chain/AclAuthorizationHandlerTest.java:267— This method's body runs code, and no assertion was recognised in it. Recognised: JUnit's assertion methods (assertEquals, assertTrue, assertInstanceOf, assertThrows, assertThrowsExactly, assertTimeoutPreemptively, assertAll and the rest of JUnit 5's list), assertThat (AssertJ, Hamcrest, Truth), fail, Mockito's verify and the `assert` statement, in the test body and in helper methods of the test's own class or an in-repository base class, followed three calls deep. Verification through a helper on another object or in another class, through a custom matcher library, 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: evaluate1 auth/src/test/java/org/apache/rocketmq/auth/authorization/AuthorizationEvaluatorTest.java:103— This method's body runs code, and no assertion was recognised in it. Recognised: JUnit's assertion methods (assertEquals, assertTrue, assertInstanceOf, assertThrows, assertThrowsExactly, assertTimeoutPreemptively, assertAll and the rest of JUnit 5's list), assertThat (AssertJ, Hamcrest, Truth), fail, Mockito's verify and the `assert` statement, in the test body and in helper methods of the test's own class or an in-repository base class, followed three calls deep. Verification through a helper on another object or in another class, through a custom matcher library, 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: evaluate2 auth/src/test/java/org/apache/rocketmq/auth/authorization/AuthorizationEvaluatorTest.java:135— This method's body runs code, and no assertion was recognised in it. Recognised: JUnit's assertion methods (assertEquals, assertTrue, assertInstanceOf, assertThrows, assertThrowsExactly, assertTimeoutPreemptively, assertAll and the rest of JUnit 5's list), assertThat (AssertJ, Hamcrest, Truth), fail, Mockito's verify and the `assert` statement, in the test body and in helper methods of the test's own class or an in-repository base class, followed three calls deep. Verification through a helper on another object or in another class, through a custom matcher library, 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: evaluate6 auth/src/test/java/org/apache/rocketmq/auth/authorization/AuthorizationEvaluatorTest.java:297— This method's body runs code, and no assertion was recognised in it. Recognised: JUnit's assertion methods (assertEquals, assertTrue, assertInstanceOf, assertThrows, assertThrowsExactly, assertTimeoutPreemptively, assertAll and the rest of JUnit 5's list), assertThat (AssertJ, Hamcrest, Truth), fail, Mockito's verify and the `assert` statement, in the test body and in helper methods of the test's own class or an in-repository base class, followed three calls deep. Verification through a helper on another object or in another class, through a custom matcher library, 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: evaluate7 auth/src/test/java/org/apache/rocketmq/auth/authorization/AuthorizationEvaluatorTest.java:314— This method's body runs code, and no assertion was recognised in it. Recognised: JUnit's assertion methods (assertEquals, assertTrue, assertInstanceOf, assertThrows, assertThrowsExactly, assertTimeoutPreemptively, assertAll and the rest of JUnit 5's list), assertThat (AssertJ, Hamcrest, Truth), fail, Mockito's verify and the `assert` statement, in the test body and in helper methods of the test's own class or an in-repository base class, followed three calls deep. Verification through a helper on another object or in another class, through a custom matcher library, 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: testNotifyUnsubscribeLite_ChannelNull broker/src/test/java/org/apache/rocketmq/broker/lite/LiteSubscriptionRegistryImplTest.java:1224— This method's body runs code, and no assertion was recognised in it. Recognised: JUnit's assertion methods (assertEquals, assertTrue, assertInstanceOf, assertThrows, assertThrowsExactly, assertTimeoutPreemptively, assertAll and the rest of JUnit 5's list), assertThat (AssertJ, Hamcrest, Truth), fail, Mockito's verify and the `assert` statement, in the test body and in helper methods of the test's own class or an in-repository base class, followed three calls deep. Verification through a helper on another object or in another class, through a custom matcher library, 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: testRemoveCompleteSubscription_NullSubscription broker/src/test/java/org/apache/rocketmq/broker/lite/LiteSubscriptionRegistryImplTest.java:1193— This method's body runs code, and no assertion was recognised in it. Recognised: JUnit's assertion methods (assertEquals, assertTrue, assertInstanceOf, assertThrows, assertThrowsExactly, assertTimeoutPreemptively, assertAll and the rest of JUnit 5's list), assertThat (AssertJ, Hamcrest, Truth), fail, Mockito's verify and the `assert` statement, in the test body and in helper methods of the test's own class or an in-repository base class, followed three calls deep. Verification through a helper on another object or in another class, through a custom matcher library, 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: testResetOffset_NullOption broker/src/test/java/org/apache/rocketmq/broker/lite/LiteSubscriptionRegistryImplTest.java:981— This method's body runs code, and no assertion was recognised in it. Recognised: JUnit's assertion methods (assertEquals, assertTrue, assertInstanceOf, assertThrows, assertThrowsExactly, assertTimeoutPreemptively, assertAll and the rest of JUnit 5's list), assertThat (AssertJ, Hamcrest, Truth), fail, Mockito's verify and the `assert` statement, in the test body and in helper methods of the test's own class or an in-repository base class, followed three calls deep. Verification through a helper on another object or in another class, through a custom matcher library, 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: testBroadcastOffsetExpire broker/src/test/java/org/apache/rocketmq/broker/offset/BroadcastOffsetManagerTest.java:145— This method's body runs code, and no assertion was recognised in it. Recognised: JUnit's assertion methods (assertEquals, assertTrue, assertInstanceOf, assertThrows, assertThrowsExactly, assertTimeoutPreemptively, assertAll and the rest of JUnit 5's list), assertThat (AssertJ, Hamcrest, Truth), fail, Mockito's verify and the `assert` statement, in the test body and in helper methods of the test's own class or an in-repository base class, followed three calls deep. Verification through a helper on another object or in another class, through a custom matcher library, 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: ManyMessageTransferBuilderTest broker/src/test/java/org/apache/rocketmq/broker/pagecache/ManyMessageTransferTest.java:28— This method's body runs code, and no assertion was recognised in it. Recognised: JUnit's assertion methods (assertEquals, assertTrue, assertInstanceOf, assertThrows, assertThrowsExactly, assertTimeoutPreemptively, assertAll and the rest of JUnit 5's list), assertThat (AssertJ, Hamcrest, Truth), fail, Mockito's verify and the `assert` statement, in the test body and in helper methods of the test's own class or an in-repository base class, followed three calls deep. Verification through a helper on another object or in another class, through a custom matcher library, 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: ManyMessageTransferCloseTest broker/src/test/java/org/apache/rocketmq/broker/pagecache/ManyMessageTransferTest.java:56— This method's body runs code, and no assertion was recognised in it. Recognised: JUnit's assertion methods (assertEquals, assertTrue, assertInstanceOf, assertThrows, assertThrowsExactly, assertTimeoutPreemptively, assertAll and the rest of JUnit 5's list), assertThat (AssertJ, Hamcrest, Truth), fail, Mockito's verify and the `assert` statement, in the test body and in helper methods of the test's own class or an in-repository base class, followed three calls deep. Verification through a helper on another object or in another class, through a custom matcher library, 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: OneMessageTransferTest broker/src/test/java/org/apache/rocketmq/broker/pagecache/OneMessageTransferTest.java:29— This method's body runs code, and no assertion was recognised in it. Recognised: JUnit's assertion methods (assertEquals, assertTrue, assertInstanceOf, assertThrows, assertThrowsExactly, assertTimeoutPreemptively, assertAll and the rest of JUnit 5's list), assertThat (AssertJ, Hamcrest, Truth), fail, Mockito's verify and the `assert` statement, in the test body and in helper methods of the test's own class or an in-repository base class, followed three calls deep. Verification through a helper on another object or in another class, through a custom matcher library, 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: consumerOffsetTest broker/src/test/java/org/apache/rocketmq/broker/pop/PopConsumerCacheTest.java:73— This method's body runs code, and no assertion was recognised in it. Recognised: JUnit's assertion methods (assertEquals, assertTrue, assertInstanceOf, assertThrows, assertThrowsExactly, assertTimeoutPreemptively, assertAll and the rest of JUnit 5's list), assertThat (AssertJ, Hamcrest, Truth), fail, Mockito's verify and the `assert` statement, in the test body and in helper methods of the test's own class or an in-repository base class, followed three calls deep. Verification through a helper on another object or in another class, through a custom matcher library, 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: ackAsyncTest broker/src/test/java/org/apache/rocketmq/broker/pop/PopConsumerServiceTest.java:334— This method's body runs code, and no assertion was recognised in it. Recognised: JUnit's assertion methods (assertEquals, assertTrue, assertInstanceOf, assertThrows, assertThrowsExactly, assertTimeoutPreemptively, assertAll and the rest of JUnit 5's list), assertThat (AssertJ, Hamcrest, Truth), fail, Mockito's verify and the `assert` statement, in the test body and in helper methods of the test's own class or an in-repository base class, followed three calls deep. Verification through a helper on another object or in another class, through a custom matcher library, 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: popAsyncTest broker/src/test/java/org/apache/rocketmq/broker/pop/PopConsumerServiceTest.java:288— This method's body runs code, and no assertion was recognised in it. Recognised: JUnit's assertion methods (assertEquals, assertTrue, assertInstanceOf, assertThrows, assertThrowsExactly, assertTimeoutPreemptively, assertAll and the rest of JUnit 5's list), assertThat (AssertJ, Hamcrest, Truth), fail, Mockito's verify and the `assert` statement, in the test body and in helper methods of the test's own class or an in-repository base class, followed three calls deep. Verification through a helper on another object or in another class, through a custom matcher library, 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: test_heartbeat_costTime broker/src/test/java/org/apache/rocketmq/broker/processor/ClientManageProcessorTest.java:169— This method's body runs code, and no assertion was recognised in it. Recognised: JUnit's assertion methods (assertEquals, assertTrue, assertInstanceOf, assertThrows, assertThrowsExactly, assertTimeoutPreemptively, assertAll and the rest of JUnit 5's list), assertThat (AssertJ, Hamcrest, Truth), fail, Mockito's verify and the `assert` statement, in the test body and in helper methods of the test's own class or an in-repository base class, followed three calls deep. Verification through a helper on another object or in another class, through a custom matcher library, 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: sendCheckMessage broker/src/test/java/org/apache/rocketmq/broker/transaction/queue/DefaultTransactionalMessageCheckListenerTest.java:106— This method's body runs code, and no assertion was recognised in it. Recognised: JUnit's assertion methods (assertEquals, assertTrue, assertInstanceOf, assertThrows, assertThrowsExactly, assertTimeoutPreemptively, assertAll and the rest of JUnit 5's list), assertThat (AssertJ, Hamcrest, Truth), fail, Mockito's verify and the `assert` statement, in the test body and in helper methods of the test's own class or an in-repository base class, followed three calls deep. Verification through a helper on another object or in another class, through a custom matcher library, 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: testResolveDiscardMsg broker/src/test/java/org/apache/rocketmq/broker/transaction/queue/DefaultTransactionalMessageCheckListenerTest.java:123— This method's body runs code, and no assertion was recognised in it. Recognised: JUnit's assertion methods (assertEquals, assertTrue, assertInstanceOf, assertThrows, assertThrowsExactly, assertTimeoutPreemptively, assertAll and the rest of JUnit 5's list), assertThat (AssertJ, Hamcrest, Truth), fail, Mockito's verify and the `assert` statement, in the test body and in helper methods of the test's own class or an in-repository base class, followed three calls deep. Verification through a helper on another object or in another class, through a custom matcher library, 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: testResolveHalfMsg broker/src/test/java/org/apache/rocketmq/broker/transaction/queue/DefaultTransactionalMessageCheckListenerTest.java:81— This method's body runs code, and no assertion was recognised in it. Recognised: JUnit's assertion methods (assertEquals, assertTrue, assertInstanceOf, assertThrows, assertThrowsExactly, assertTimeoutPreemptively, assertAll and the rest of JUnit 5's list), assertThat (AssertJ, Hamcrest, Truth), fail, Mockito's verify and the `assert` statement, in the test body and in helper methods of the test's own class or an in-repository base class, followed three calls deep. Verification through a helper on another object or in another class, through a custom matcher library, 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 — 493 methods. The bar is 30 methods; this is 463 over it, 16.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: MessageStoreConfig store/src/main/java/org/apache/rocketmq/store/config/MessageStoreConfig.java:27— TooManyMethods — 448 methods. The bar is 30 methods; this is 418 over it, 14.93× 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 — 331 methods. The bar is 30 methods; this is 301 over it, 11.03× 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: BrokerController broker/src/main/java/org/apache/rocketmq/broker/BrokerController.java:196— TooManyMethods — 187 methods. The bar is 30 methods; this is 157 over it, 6.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: DefaultMessageStore store/src/main/java/org/apache/rocketmq/store/DefaultMessageStore.java:126— TooManyMethods — 177 methods. The bar is 30 methods; this is 147 over it, 5.90× the bar. Most of these members implement store.MessageStore (117 of 168 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: MQClientAPIImpl client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:275— TooManyMethods — 159 methods. The bar is 30 methods; this is 129 over it, 5.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: AbstractPluginMessageStore store/src/main/java/org/apache/rocketmq/store/plugin/AbstractPluginMessageStore.java:68— TooManyMethods — 121 methods. The bar is 30 methods; this is 91 over it, 4.03× the bar. Most of these members implement store.MessageStore (112 of 114 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:70— TooManyMethods — 120 methods. The bar is 30 methods; this is 90 over it, 4.00× 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:249— TooManyMethods — 104 methods. The bar is 30 methods; this is 74 over it, 3.47× 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 — 104 methods. The bar is 30 methods; this is 74 over it, 3.47× 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 — 98 methods. The bar is 30 methods; this is 68 over it, 3.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: DefaultMQPushConsumerImpl client/src/main/java/org/apache/rocketmq/client/impl/consumer/DefaultMQPushConsumerImpl.java:97— TooManyMethods — 88 methods. The bar is 30 methods; this is 58 over it, 2.93× 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:79— TooManyMethods — 87 methods. The bar is 30 methods; this is 57 over it, 2.90× 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:47— 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: DefaultLitePullConsumerImpl client/src/main/java/org/apache/rocketmq/client/impl/consumer/DefaultLitePullConsumerImpl.java:79— TooManyMethods — 81 methods. The bar is 30 methods; this is 51 over it, 2.70× 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 tieredstore/src/main/java/org/apache/rocketmq/tieredstore/MessageStoreConfig.java:24— TooManyMethods — 81 methods. The bar is 30 methods; this is 51 over it, 2.70× 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:37— TooManyMethods — 77 methods. The bar is 30 methods; this is 47 over it, 2.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: DefaultMappedFile store/src/main/java/org/apache/rocketmq/store/logfile/DefaultMappedFile.java:64— TooManyMethods — 73 methods. The bar is 30 methods; this is 43 over it, 2.43× the bar. Most of these members implement logfile.MappedFile (41 of 60 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: MQClientInstance client/src/main/java/org/apache/rocketmq/client/impl/factory/MQClientInstance.java:96— TooManyMethods — 72 methods. The bar is 30 methods; this is 42 over it, 2.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: CommitLog store/src/main/java/org/apache/rocketmq/store/CommitLog.java:77— TooManyMethods — 72 methods. The bar is 30 methods; this is 42 over it, 2.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: DefaultMQPullConsumerImpl client/src/main/java/org/apache/rocketmq/client/impl/consumer/DefaultMQPullConsumerImpl.java:74— TooManyMethods — 70 methods. The bar is 30 methods; this is 40 over it, 2.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: BrokerStatsManager store/src/main/java/org/apache/rocketmq/store/stats/BrokerStatsManager.java:45— 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: BrokerOuterAPI broker/src/main/java/org/apache/rocketmq/broker/out/BrokerOuterAPI.java:162— TooManyMethods — 66 methods. The bar is 30 methods; this is 36 over it, 2.20× 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: DefaultMQPullConsumer client/src/main/java/org/apache/rocketmq/client/consumer/DefaultMQPullConsumer.java:47— 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.
ClassTooLong: MQClientAPIImpl client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:275— ClassTooLong — 2617 significant lines (blank, comment-only and punctuation-only lines excluded), 159 methods. The bar is 400 significant lines; this is 2217 over it, 6.54× 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:249— ClassTooLong — 2538 significant lines (blank, comment-only and punctuation-only lines excluded), 104 methods. The bar is 400 significant lines; this is 2138 over it, 6.35× 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:126— ClassTooLong — 1961 significant lines (blank, comment-only and punctuation-only lines excluded), 177 methods. The bar is 400 significant lines; this is 1561 over it, 4.90× 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:196— ClassTooLong — 1642 significant lines (blank, comment-only and punctuation-only lines excluded), 187 methods. The bar is 400 significant lines; this is 1242 over it, 4.11× 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:77— ClassTooLong — 1552 significant lines (blank, comment-only and punctuation-only lines excluded), 72 methods. The bar is 400 significant lines; this is 1152 over it, 3.88× 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:79— ClassTooLong — 1380 significant lines (blank, comment-only and punctuation-only lines excluded), 87 methods. The bar is 400 significant lines; this is 980 over it, 3.45× 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 — 1250 significant lines (blank, comment-only and punctuation-only lines excluded), 493 methods. The bar is 400 significant lines; this is 850 over it, 3.13× 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 — 1223 significant lines (blank, comment-only and punctuation-only lines excluded), 98 methods. The bar is 400 significant lines; this is 823 over it, 3.06× 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:27— ClassTooLong — 1196 significant lines (blank, comment-only and punctuation-only lines excluded), 448 methods. The bar is 400 significant lines; this is 796 over it, 2.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: ProxyAdminGrpcService proxy/src/main/java/org/apache/rocketmq/proxy/grpc/admin/ProxyAdminGrpcService.java:148— ClassTooLong — 1035 significant lines (blank, comment-only and punctuation-only lines excluded), 51 methods. The bar is 400 significant lines; this is 635 over it, 2.59× 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:162— ClassTooLong — 1024 significant lines (blank, comment-only and punctuation-only lines excluded), 66 methods. The bar is 400 significant lines; this is 624 over it, 2.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: DefaultMQPushConsumerImpl client/src/main/java/org/apache/rocketmq/client/impl/consumer/DefaultMQPushConsumerImpl.java:97— ClassTooLong — 993 significant lines (blank, comment-only and punctuation-only lines excluded), 88 methods. The bar is 400 significant lines; this is 593 over it, 2.48× 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:96— ClassTooLong — 960 significant lines (blank, comment-only and punctuation-only lines excluded), 72 methods. The bar is 400 significant lines; this is 560 over it, 2.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: ProxyConfig proxy/src/main/java/org/apache/rocketmq/proxy/config/ProxyConfig.java:41— ClassTooLong — 868 significant lines (blank, comment-only and punctuation-only lines excluded), 331 methods. The bar is 400 significant lines; this is 468 over it, 2.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: ConsumeQueue store/src/main/java/org/apache/rocketmq/store/ConsumeQueue.java:48— ClassTooLong — 817 significant lines (blank, comment-only and punctuation-only lines excluded), 55 methods. The bar is 400 significant lines; this is 417 over it, 2.04× 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 — 776 significant lines (blank, comment-only and punctuation-only lines excluded), 81 methods. The bar is 400 significant lines; this is 376 over it, 1.94× 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:98— ClassTooLong — 769 significant lines (blank, comment-only and punctuation-only lines excluded), 38 methods. The bar is 400 significant lines; this is 369 over it, 1.92× 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 — 766 significant lines (blank, comment-only and punctuation-only lines excluded), 63 methods. The bar is 400 significant lines; this is 366 over it, 1.92× 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:101— ClassTooLong — 735 significant lines (blank, comment-only and punctuation-only lines excluded), 25 methods. The bar is 400 significant lines; this is 335 over it, 1.84× 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: DLedgerCommitLog store/src/main/java/org/apache/rocketmq/store/dledger/DLedgerCommitLog.java:65— ClassTooLong — 707 significant lines (blank, comment-only and punctuation-only lines excluded), 41 methods. The bar is 400 significant lines; this is 307 over it, 1.77× 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: DefaultMappedFile store/src/main/java/org/apache/rocketmq/store/logfile/DefaultMappedFile.java:64— ClassTooLong — 678 significant lines (blank, comment-only and punctuation-only lines excluded), 73 methods. The bar is 400 significant lines; this is 278 over it, 1.70× 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 — 596 significant lines (blank, comment-only and punctuation-only lines excluded), 30 methods. The bar is 400 significant lines; this is 196 over it, 1.49× 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:83— ClassTooLong — 596 significant lines (blank, comment-only and punctuation-only lines excluded), 16 methods. The bar is 400 significant lines; this is 196 over it, 1.49× 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 (7 lines × 2) auth/src/main/java/org/apache/rocketmq/auth/authorization/manager/AuthorizationMetadataManagerImpl.java:144— auth/src/main/java/org/apache/rocketmq/auth/authorization/manager/AuthorizationMetadataManagerImpl.java:144-150 | auth/src/main/java/org/apache/rocketmq/auth/authorization/manager/AuthorizationMetadataManagerImpl.java:183-189 — 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/client/ConsumerManager.java:230— broker/src/main/java/org/apache/rocketmq/broker/client/ConsumerManager.java:230-236 | broker/src/main/java/org/apache/rocketmq/broker/client/ConsumerManager.java:281-287 — 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/config/v1/RocksDBSubscriptionGroupManager.java:164— broker/src/main/java/org/apache/rocketmq/broker/config/v1/RocksDBSubscriptionGroupManager.java:164-170 | broker/src/main/java/org/apache/rocketmq/broker/config/v1/RocksDBSubscriptionGroupManager.java:179-185 — 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/config/v2/ConsumerOffsetManagerV2.java:125— broker/src/main/java/org/apache/rocketmq/broker/config/v2/ConsumerOffsetManagerV2.java:125-131 | broker/src/main/java/org/apache/rocketmq/broker/config/v2/ConsumerOffsetManagerV2.java:142-148 — 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/config/v2/ConsumerOffsetManagerV2.java:453— broker/src/main/java/org/apache/rocketmq/broker/config/v2/ConsumerOffsetManagerV2.java:453-459 | broker/src/main/java/org/apache/rocketmq/broker/offset/LmqConsumerOffsetManager.java:140-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 `broker/src/main/java/org/apache/rocketmq/broker/config/v2/ConsumerOffsetManagerV2.java:453` 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/failover/EscapeBridge.java:342— broker/src/main/java/org/apache/rocketmq/broker/failover/EscapeBridge.java:342-348 | broker/src/main/java/org/apache/rocketmq/broker/processor/PopReviveService.java:309-315 — 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:342` 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/processor/AdminBrokerProcessor.java:857— broker/src/main/java/org/apache/rocketmq/broker/processor/AdminBrokerProcessor.java:857-863 | broker/src/main/java/org/apache/rocketmq/broker/processor/AdminBrokerProcessor.java:1871-1880 — 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:857` 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/processor/AdminBrokerProcessor.java:1906— broker/src/main/java/org/apache/rocketmq/broker/processor/AdminBrokerProcessor.java:1906-1912 | broker/src/main/java/org/apache/rocketmq/broker/processor/AdminBrokerProcessor.java:2461-2467 — 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:514-520 — 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/processor/SendMessageProcessor.java:351— broker/src/main/java/org/apache/rocketmq/broker/processor/SendMessageProcessor.java:351-357 | broker/src/main/java/org/apache/rocketmq/broker/processor/SendMessageProcessor.java:645-651 — 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:351` 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/schedule/ScheduleMessageService.java:346— broker/src/main/java/org/apache/rocketmq/broker/schedule/ScheduleMessageService.java:346-352 | store/src/main/java/org/apache/rocketmq/store/timer/TimerMessageStore.java:1255-1261 — 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 before the matched lines, `broker/src/main/java/org/apache/rocketmq/broker/schedule/ScheduleMessageService.java:344` calls `setPropertiesString`, `messageProperties2String`, `getProperties` and `store/src/main/java/org/apache/rocketmq/store/timer/TimerMessageStore.java:1253` 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 (7 lines × 2) client/src/main/java/org/apache/rocketmq/client/consumer/DefaultMQPushConsumer.java:776— client/src/main/java/org/apache/rocketmq/client/consumer/DefaultMQPushConsumer.java:776-782 | client/src/main/java/org/apache/rocketmq/client/producer/DefaultMQProducer.java:396-402 — 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/DefaultMQPushConsumer.java:776` 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/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:226-232 — 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:1178— client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:1178-1184 | client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:1299-1305 — 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:1178` 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:212— client/src/main/java/org/apache/rocketmq/client/impl/consumer/ConsumeMessageConcurrentlyService.java:212-218 | client/src/main/java/org/apache/rocketmq/client/impl/consumer/ConsumeMessagePopConcurrentlyService.java:186-192 — 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 7 separate duplicated blocks between them, totalling at least 117 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:212` 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:352— client/src/main/java/org/apache/rocketmq/client/impl/consumer/ConsumeMessageConcurrentlyService.java:352-358 | client/src/main/java/org/apache/rocketmq/client/impl/consumer/ConsumeMessagePopConcurrentlyService.java:365-371 — 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 7 separate duplicated blocks between them, totalling at least 117 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/PullAPIWrapper.java:225— client/src/main/java/org/apache/rocketmq/client/impl/consumer/PullAPIWrapper.java:225-231 | proxy/src/main/java/org/apache/rocketmq/proxy/processor/ConsumerProcessor.java:409-415 — 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/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:376— common/src/main/java/org/apache/rocketmq/common/MixAll.java:376-382 | 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:376` 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) container/src/main/java/org/apache/rocketmq/container/BrokerContainer.java:297— container/src/main/java/org/apache/rocketmq/container/BrokerContainer.java:297-303 | container/src/main/java/org/apache/rocketmq/container/BrokerContainer.java:328-334 — 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) controller/src/main/java/org/apache/rocketmq/controller/impl/manager/ReplicasInfoManager.java:625— controller/src/main/java/org/apache/rocketmq/controller/impl/manager/ReplicasInfoManager.java:625-631 | controller/src/main/java/org/apache/rocketmq/controller/impl/manager/ReplicasInfoManager.java:634-640 — 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/impl/manager/ReplicasInfoManager.java:625` 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) 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) store/src/main/java/org/apache/rocketmq/store/CommitLog.java:1751— store/src/main/java/org/apache/rocketmq/store/CommitLog.java:1751-1757 | store/src/main/java/org/apache/rocketmq/store/CommitLog.java:1861-1867 — 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:1751` 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:123— store/src/main/java/org/apache/rocketmq/store/MappedFileQueue.java:123-129 | store/src/main/java/org/apache/rocketmq/store/MappedFileQueue.java:140-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 `store/src/main/java/org/apache/rocketmq/store/MappedFileQueue.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.
Duplicated block (9 lines × 2) broker/src/main/java/org/apache/rocketmq/broker/config/v2/ConsumerOffsetManagerV2.java:240— broker/src/main/java/org/apache/rocketmq/broker/config/v2/ConsumerOffsetManagerV2.java:240-248 | broker/src/main/java/org/apache/rocketmq/broker/config/v2/ConsumerOffsetManagerV2.java:261-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 `broker/src/main/java/org/apache/rocketmq/broker/config/v2/ConsumerOffsetManagerV2.java:240` 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/metrics/BrokerMetricsManager.java:501— broker/src/main/java/org/apache/rocketmq/broker/metrics/BrokerMetricsManager.java:501-509 | broker/src/main/java/org/apache/rocketmq/broker/metrics/BrokerMetricsManager.java:511-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 `broker/src/main/java/org/apache/rocketmq/broker/metrics/BrokerMetricsManager.java:501` 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) broker/src/main/java/org/apache/rocketmq/broker/metrics/ConsumerLagCalculator.java:405— broker/src/main/java/org/apache/rocketmq/broker/metrics/ConsumerLagCalculator.java:405-413 | broker/src/main/java/org/apache/rocketmq/broker/metrics/ConsumerLagCalculator.java:461-469 — 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:405` 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/EndTransactionProcessor.java:134— broker/src/main/java/org/apache/rocketmq/broker/processor/EndTransactionProcessor.java:134-142 | broker/src/main/java/org/apache/rocketmq/broker/processor/EndTransactionProcessor.java:169-177 — 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:134` 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/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:476— client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:476-484 | client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:3348-3356 — 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:57— client/src/main/java/org/apache/rocketmq/client/impl/consumer/ConsumeMessageConcurrentlyService.java:57-65 | client/src/main/java/org/apache/rocketmq/client/impl/consumer/ConsumeMessageOrderlyService.java:61-69 — 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 `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 (9 lines × 2) client/src/main/java/org/apache/rocketmq/client/impl/consumer/ConsumeMessageConcurrentlyService.java:380— client/src/main/java/org/apache/rocketmq/client/impl/consumer/ConsumeMessageConcurrentlyService.java:380-388 | client/src/main/java/org/apache/rocketmq/client/impl/consumer/ConsumeMessageOrderlyService.java:483-491 — 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/ConsumeMessageConcurrentlyService.java:380` 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:756— client/src/main/java/org/apache/rocketmq/client/impl/consumer/DefaultLitePullConsumerImpl.java:756-764 | client/src/main/java/org/apache/rocketmq/client/impl/consumer/DefaultLitePullConsumerImpl.java:797-805 — 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:756` 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:97— client/src/main/java/org/apache/rocketmq/client/impl/consumer/RebalanceImpl.java:97-105 | client/src/main/java/org/apache/rocketmq/client/impl/consumer/RebalanceImpl.java:188-196 — 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:97` 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:1267— client/src/main/java/org/apache/rocketmq/client/impl/factory/MQClientInstance.java:1267-1275 | client/src/main/java/org/apache/rocketmq/client/impl/factory/MQClientInstance.java:1312-1320 — 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:1267` 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) proxy/src/main/java/org/apache/rocketmq/proxy/grpc/admin/ProxyAdminGrpcService.java:911— proxy/src/main/java/org/apache/rocketmq/proxy/grpc/admin/ProxyAdminGrpcService.java:911-919 | proxy/src/main/java/org/apache/rocketmq/proxy/grpc/admin/ProxyAdminGrpcService.java:1533-1541 — 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/admin/ProxyAdminGrpcService.java:911` 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 `DescribeGroupAccumulationRequest` in one and `QueryTimeSpanRequest` 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) proxy/src/main/java/org/apache/rocketmq/proxy/processor/ConsumerProcessor.java:427— proxy/src/main/java/org/apache/rocketmq/proxy/processor/ConsumerProcessor.java:427-435 | proxy/src/main/java/org/apache/rocketmq/proxy/processor/ConsumerProcessor.java:445-453 — 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:427` 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) remoting/src/main/java/org/apache/rocketmq/remoting/netty/NettyRemotingAbstract.java:241— remoting/src/main/java/org/apache/rocketmq/remoting/netty/NettyRemotingAbstract.java:241-249 | remoting/src/main/java/org/apache/rocketmq/remoting/netty/NettyRemotingAbstract.java:293-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 `remoting/src/main/java/org/apache/rocketmq/remoting/netty/NettyRemotingAbstract.java:241` 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) remoting/src/main/java/org/apache/rocketmq/remoting/protocol/RocketMQSerializable.java:39— remoting/src/main/java/org/apache/rocketmq/remoting/protocol/RocketMQSerializable.java:39-47 | remoting/src/main/java/org/apache/rocketmq/remoting/protocol/RocketMQSerializable.java:62-70 — 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/RocketMQSerializable.java:39` 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 `value` to `long` in one and `int` 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) remoting/src/main/java/org/apache/rocketmq/remoting/protocol/header/PullMessageRequestHeader.java:123— remoting/src/main/java/org/apache/rocketmq/remoting/protocol/header/PullMessageRequestHeader.java:123-131 | remoting/src/main/java/org/apache/rocketmq/remoting/protocol/header/SendMessageResponseHeader.java:62-70 — 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:177— store/src/main/java/org/apache/rocketmq/store/ConsumeQueue.java:177-185 | store/src/main/java/org/apache/rocketmq/store/queue/BatchConsumeQueue.java:266-274 — 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: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.
Duplicated block (9 lines × 2) store/src/main/java/org/apache/rocketmq/store/ConsumeQueue.java:428— store/src/main/java/org/apache/rocketmq/store/ConsumeQueue.java:428-436 | store/src/main/java/org/apache/rocketmq/store/queue/BatchConsumeQueue.java:405-413 — 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:428` 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:414` calls `position` and `store/src/main/java/org/apache/rocketmq/store/ConsumeQueue.java:437` 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:921— store/src/main/java/org/apache/rocketmq/store/DefaultMessageStore.java:921-929 | 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:921` 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:558— store/src/main/java/org/apache/rocketmq/store/MappedFileQueue.java:558-566 | store/src/main/java/org/apache/rocketmq/store/MappedFileQueue.java:601-609 — 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:558` 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:365-373 — 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:243— store/src/main/java/org/apache/rocketmq/store/ha/DefaultHAService.java:243-251 | store/src/main/java/org/apache/rocketmq/store/ha/autoswitch/AutoSwitchHAService.java:404-412 — 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:243` 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/index/rocksdb/IndexRocksDBStore.java:179— store/src/main/java/org/apache/rocketmq/store/index/rocksdb/IndexRocksDBStore.java:179-187 | store/src/main/java/org/apache/rocketmq/store/index/rocksdb/IndexRocksDBStore.java:195-203 — 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/rocksdb/IndexRocksDBStore.java:179` 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) auth/src/main/java/org/apache/rocketmq/auth/authorization/builder/DefaultAuthorizationContextBuilder.java:222— auth/src/main/java/org/apache/rocketmq/auth/authorization/builder/DefaultAuthorizationContextBuilder.java:222-229 | auth/src/main/java/org/apache/rocketmq/auth/authorization/builder/DefaultAuthorizationContextBuilder.java:233-240 — 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 (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:137-144 — 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/coldctr/ColdDataCgCtrService.java:89— broker/src/main/java/org/apache/rocketmq/broker/coldctr/ColdDataCgCtrService.java:89-96 | broker/src/main/java/org/apache/rocketmq/broker/coldctr/ColdDataPullRequestHoldService.java:73-80 — 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/coldctr/ColdDataCgCtrService.java:89` 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) broker/src/main/java/org/apache/rocketmq/broker/config/v2/ConsumerOffsetManagerV2.java:82— broker/src/main/java/org/apache/rocketmq/broker/config/v2/ConsumerOffsetManagerV2.java:82-89 | broker/src/main/java/org/apache/rocketmq/broker/config/v2/ConsumerOffsetManagerV2.java:126-133 — 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, `broker/src/main/java/org/apache/rocketmq/broker/config/v2/ConsumerOffsetManagerV2.java:79` calls `writeShort`, `writeBytes`, `writeByte` and `broker/src/main/java/org/apache/rocketmq/broker/config/v2/ConsumerOffsetManagerV2.java:125` 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/config/v2/ConsumerOffsetManagerV2.java:230— broker/src/main/java/org/apache/rocketmq/broker/config/v2/ConsumerOffsetManagerV2.java:230-237 | broker/src/main/java/org/apache/rocketmq/broker/config/v2/ConsumerOffsetManagerV2.java:251-258 — 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/out/BrokerOuterAPI.java:387— broker/src/main/java/org/apache/rocketmq/broker/out/BrokerOuterAPI.java:387-394 | broker/src/main/java/org/apache/rocketmq/broker/out/BrokerOuterAPI.java:1499-1506 — 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:387` 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:933— broker/src/main/java/org/apache/rocketmq/broker/out/BrokerOuterAPI.java:933-940 | client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:2981-2988 — 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:933` 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/MQClientAPIImpl.java:2980` calls `nanoTime` and `broker/src/main/java/org/apache/rocketmq/broker/out/BrokerOuterAPI.java:931` 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/pop/PopConsumerService.java:248— broker/src/main/java/org/apache/rocketmq/broker/pop/PopConsumerService.java:248-255 | broker/src/main/java/org/apache/rocketmq/broker/processor/PopMessageProcessor.java:761-768 — 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/pop/PopConsumerService.java:248` 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 (8 lines × 2) broker/src/main/java/org/apache/rocketmq/broker/processor/AdminBrokerProcessor.java:3337— broker/src/main/java/org/apache/rocketmq/broker/processor/AdminBrokerProcessor.java:3337-3344 | broker/src/main/java/org/apache/rocketmq/broker/processor/AdminBrokerProcessor.java:3361-3368 — 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:3337` 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/PopMessageProcessor.java:388— broker/src/main/java/org/apache/rocketmq/broker/processor/PopMessageProcessor.java:388-395 | broker/src/main/java/org/apache/rocketmq/broker/processor/PopMessageProcessor.java:558-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.
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:723-730 — 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:732` 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) client/src/main/java/org/apache/rocketmq/client/trace/TraceDataEncoder.java:51— client/src/main/java/org/apache/rocketmq/client/trace/TraceDataEncoder.java:51-58 | client/src/main/java/org/apache/rocketmq/client/trace/TraceDataEncoder.java:119-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 (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) proxy/src/main/java/org/apache/rocketmq/proxy/service/route/ProxyTopicRouteData.java:37— proxy/src/main/java/org/apache/rocketmq/proxy/service/route/ProxyTopicRouteData.java:37-44 | proxy/src/main/java/org/apache/rocketmq/proxy/service/route/ProxyTopicRouteData.java:54-61 — 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/route/ProxyTopicRouteData.java:37` 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, `proxy/src/main/java/org/apache/rocketmq/proxy/service/route/ProxyTopicRouteData.java:62` calls `fromParts`, `getHost` and `proxy/src/main/java/org/apache/rocketmq/proxy/service/route/ProxyTopicRouteData.java:46` 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 (8 lines × 2) store/src/main/java/org/apache/rocketmq/store/CommitLog.java:1178— store/src/main/java/org/apache/rocketmq/store/CommitLog.java:1178-1185 | store/src/main/java/org/apache/rocketmq/store/dledger/DLedgerCommitLog.java:646-653 — 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:656` calls `setStoreTimestamp`, `currentTimeMillis`, `getStoreStatsService` and `store/src/main/java/org/apache/rocketmq/store/CommitLog.java:1187` 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:2455— store/src/main/java/org/apache/rocketmq/store/DefaultMessageStore.java:2455-2463 | store/src/main/java/org/apache/rocketmq/store/DefaultMessageStore.java:2477-2484 — 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:2455` 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:833— store/src/main/java/org/apache/rocketmq/store/MappedFileQueue.java:833-840 | store/src/main/java/org/apache/rocketmq/store/MappedFileQueue.java:860-867 — 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:833` 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/dledger/DLedgerCommitLog.java:295— store/src/main/java/org/apache/rocketmq/store/dledger/DLedgerCommitLog.java:295-302 | store/src/main/java/org/apache/rocketmq/store/dledger/DLedgerCommitLog.java:323-330 — 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:295` 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:245— store/src/main/java/org/apache/rocketmq/store/queue/BatchConsumeQueue.java:245-252 | 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:245` 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:715— store/src/main/java/org/apache/rocketmq/store/queue/BatchConsumeQueue.java:715-723 | 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:715` 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) auth/src/main/java/org/apache/rocketmq/auth/authorization/builder/DefaultAuthorizationContextBuilder.java:736— auth/src/main/java/org/apache/rocketmq/auth/authorization/builder/DefaultAuthorizationContextBuilder.java:736-743 | auth/src/main/java/org/apache/rocketmq/auth/authorization/builder/DefaultAuthorizationContextBuilder.java:774-781 — 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 `auth/src/main/java/org/apache/rocketmq/auth/authorization/builder/DefaultAuthorizationContextBuilder.java:736` 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/metrics/ConsumerLagCalculator.java:202— broker/src/main/java/org/apache/rocketmq/broker/metrics/ConsumerLagCalculator.java:202-209 | broker/src/main/java/org/apache/rocketmq/broker/metrics/ConsumerLagCalculator.java:212-219 — 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/out/BrokerOuterAPI.java:1356— broker/src/main/java/org/apache/rocketmq/broker/out/BrokerOuterAPI.java:1356-1363 | client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:3442-3449 — 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 lines × 2) client/src/main/java/org/apache/rocketmq/client/impl/consumer/RebalanceImpl.java:431— client/src/main/java/org/apache/rocketmq/client/impl/consumer/RebalanceImpl.java:431-438 | client/src/main/java/org/apache/rocketmq/client/impl/consumer/RebalanceImpl.java:551-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/RebalanceImpl.java:431` 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) common/src/main/java/org/apache/rocketmq/common/message/MessageDecoder.java:197— common/src/main/java/org/apache/rocketmq/common/message/MessageDecoder.java:197-204 | common/src/main/java/org/apache/rocketmq/common/message/MessageDecoder.java:316-323 — 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.
FileTooLong: impl/MQClientAPIImpl.java client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java— FileTooLong — 2872 significant lines (blank, comment-only and punctuation-only lines excluded), about 91% of them inside a single declaration: MQClientAPIImpl (275-3898). The bar is 500 significant lines; this is 2372 over it, 5.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: processor/AdminBrokerProcessor.java broker/src/main/java/org/apache/rocketmq/broker/processor/AdminBrokerProcessor.java— FileTooLong — 2767 significant lines (blank, comment-only and punctuation-only lines excluded), about 92% of them inside a single declaration: AdminBrokerProcessor (249-3715). The bar is 500 significant lines; this is 2267 over it, 5.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: store/DefaultMessageStore.java store/src/main/java/org/apache/rocketmq/store/DefaultMessageStore.java— FileTooLong — 2068 significant lines (blank, comment-only and punctuation-only lines excluded), about 95% of them inside a single declaration: DefaultMessageStore (126-3310). The bar is 500 significant lines; this is 1568 over it, 4.14× 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 — 1819 significant lines (blank, comment-only and punctuation-only lines excluded), about 90% of them inside a single declaration: BrokerController (196-2826). The bar is 500 significant lines; this is 1319 over it, 3.64× 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 — 1606 significant lines (blank, comment-only and punctuation-only lines excluded), about 97% of them inside a single declaration: CommitLog (77-2580). The bar is 500 significant lines; this is 1106 over it, 3.21× 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 — 1440 significant lines (blank, comment-only and punctuation-only lines excluded), about 96% of them inside a single declaration: TimerMessageStore (79-2123). The bar is 500 significant lines; this is 940 over it, 2.88× 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 — 1304 significant lines (blank, comment-only and punctuation-only lines excluded), about 94% of them inside a single declaration: DefaultMQProducerImpl (101-1895). The bar is 500 significant lines; this is 804 over it, 2.61× 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 — 1259 significant lines (blank, comment-only and punctuation-only lines excluded), about 99% of them inside a single declaration: BrokerConfig (28-2573). The bar is 500 significant lines; this is 759 over it, 2.52× 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 — 1204 significant lines (blank, comment-only and punctuation-only lines excluded), about 99% of them inside a single declaration: MessageStoreConfig (27-2439). The bar is 500 significant lines; this is 704 over it, 2.41× 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 — 1166 significant lines (blank, comment-only and punctuation-only lines excluded), about 88% of them inside a single declaration: BrokerOuterAPI (162-1633). The bar is 500 significant lines; this is 666 over it, 2.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: admin/ProxyAdminGrpcService.java proxy/src/main/java/org/apache/rocketmq/proxy/grpc/admin/ProxyAdminGrpcService.java— FileTooLong — 1144 significant lines (blank, comment-only and punctuation-only lines excluded), about 90% of them inside a single declaration: ProxyAdminGrpcService (148-1735). The bar is 500 significant lines; this is 644 over it, 2.29× 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 — 1071 significant lines (blank, comment-only and punctuation-only lines excluded), about 93% of them inside a single declaration: DefaultMQPushConsumerImpl (97-1603). The bar is 500 significant lines; this is 571 over it, 2.14× 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 — 1035 significant lines (blank, comment-only and punctuation-only lines excluded), about 93% of them inside a single declaration: MQClientInstance (96-1588). The bar is 500 significant lines; this is 535 over it, 2.07× 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 — 889 significant lines (blank, comment-only and punctuation-only lines excluded), about 98% of them inside a single declaration: ProxyConfig (41-1689). The bar is 500 significant lines; this is 389 over it, 1.78× 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 — 846 significant lines (blank, comment-only and punctuation-only lines excluded), about 91% of them inside a single declaration: NettyRemotingClient (98-1233). The bar is 500 significant lines; this is 346 over it, 1.69× 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 — 846 significant lines (blank, comment-only and punctuation-only lines excluded), about 97% of them inside a single declaration: ConsumeQueue (48-1304). The bar is 500 significant lines; this is 346 over it, 1.69× 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 — 836 significant lines (blank, comment-only and punctuation-only lines excluded), about 93% of them inside a single declaration: DefaultLitePullConsumerImpl (79-1321). 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: 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-1114). 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: processor/PopMessageProcessor.java broker/src/main/java/org/apache/rocketmq/broker/processor/PopMessageProcessor.java— FileTooLong — 815 significant lines (blank, comment-only and punctuation-only lines excluded), about 90% of them inside a single declaration: PopMessageProcessor (101-1126). The bar is 500 significant lines; this is 315 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: queue/BatchConsumeQueue.java store/src/main/java/org/apache/rocketmq/store/queue/BatchConsumeQueue.java— FileTooLong — 792 significant lines (blank, comment-only and punctuation-only lines excluded), about 97% of them inside a single declaration: BatchConsumeQueue (46-1209). The bar is 500 significant lines; this is 292 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: 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: dledger/DLedgerCommitLog.java store/src/main/java/org/apache/rocketmq/store/dledger/DLedgerCommitLog.java— FileTooLong — 748 significant lines (blank, comment-only and punctuation-only lines excluded), about 95% of them inside a single declaration: DLedgerCommitLog (65-1138). The bar is 500 significant lines; this is 248 over it, 1.50× 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 — 721 significant lines (blank, comment-only and punctuation-only lines excluded), about 94% of them inside a single declaration: DefaultMappedFile (64-1122). The bar is 500 significant lines; this is 221 over it, 1.44× 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: builder/DefaultAuthorizationContextBuilder.java auth/src/main/java/org/apache/rocketmq/auth/authorization/builder/DefaultAuthorizationContextBuilder.java— FileTooLong — 668 significant lines (blank, comment-only and punctuation-only lines excluded), about 88% of them inside a single declaration: DefaultAuthorizationContextBuilder (101-831). The bar is 500 significant lines; this is 168 over it, 1.34× 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 — 659 significant lines (blank, comment-only and punctuation-only lines excluded), about 90% of them inside a single declaration: PullMessageProcessor (83-917). The bar is 500 significant lines; this is 159 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.
Duplicated block (10 lines × 2) auth/src/main/java/org/apache/rocketmq/auth/authentication/manager/AuthenticationMetadataManagerImpl.java:66— auth/src/main/java/org/apache/rocketmq/auth/authentication/manager/AuthenticationMetadataManagerImpl.java:66-75 | auth/src/main/java/org/apache/rocketmq/auth/authentication/manager/AuthenticationMetadataManagerImpl.java:80-89 — 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 `auth/src/main/java/org/apache/rocketmq/auth/authentication/manager/AuthenticationMetadataManagerImpl.java:66` 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/BrokerController.java:2464— broker/src/main/java/org/apache/rocketmq/broker/BrokerController.java:2464-2473 | store/src/main/java/org/apache/rocketmq/store/DefaultMessageStore.java:2228-2237 — 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/config/v2/ConsumerOffsetManagerV2.java:461— broker/src/main/java/org/apache/rocketmq/broker/config/v2/ConsumerOffsetManagerV2.java:461-470 | broker/src/main/java/org/apache/rocketmq/broker/offset/LmqConsumerOffsetManager.java:150-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. ★ 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/config/v2/ConsumerOffsetManagerV2.java:458` calls `isLmq`, `assignResetOffset` and `broker/src/main/java/org/apache/rocketmq/broker/offset/LmqConsumerOffsetManager.java:148` 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 × 2) broker/src/main/java/org/apache/rocketmq/broker/failover/EscapeBridge.java:208— broker/src/main/java/org/apache/rocketmq/broker/failover/EscapeBridge.java:208-217 | broker/src/main/java/org/apache/rocketmq/broker/failover/EscapeBridge.java:280-289 — 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:208` 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/longpolling/PopLiteLongPollingService.java:122— broker/src/main/java/org/apache/rocketmq/broker/longpolling/PopLiteLongPollingService.java:122-131 | broker/src/main/java/org/apache/rocketmq/broker/longpolling/PopLongPollingService.java:142-151 — before extracting anything, compare `broker/src/main/java/org/apache/rocketmq/broker/longpolling/PopLiteLongPollingService.java` and `broker/src/main/java/org/apache/rocketmq/broker/longpolling/PopLongPollingService.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 `broker/src/main/java/org/apache/rocketmq/broker/longpolling/PopLiteLongPollingService.java:122` 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:355— broker/src/main/java/org/apache/rocketmq/broker/metrics/ConsumerLagCalculator.java:355-364 | broker/src/main/java/org/apache/rocketmq/broker/metrics/ConsumerLagCalculator.java:416-425 — 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:355` 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/metrics/ConsumerLagCalculator.java:366— broker/src/main/java/org/apache/rocketmq/broker/metrics/ConsumerLagCalculator.java:366-375 | broker/src/main/java/org/apache/rocketmq/broker/metrics/ConsumerLagCalculator.java:427-436 — 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:366` 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/metrics/ConsumerLagCalculator.java:377` calls `debug`, `currentTimeMillis` and `broker/src/main/java/org/apache/rocketmq/broker/metrics/ConsumerLagCalculator.java:438` 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 × 2) broker/src/main/java/org/apache/rocketmq/broker/out/BrokerOuterAPI.java:436— broker/src/main/java/org/apache/rocketmq/broker/out/BrokerOuterAPI.java:436-446 | client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:3584-3593 — 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:436` 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:634— broker/src/main/java/org/apache/rocketmq/broker/out/BrokerOuterAPI.java:634-644 | client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:3411-3420 — 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:634` 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:1239— broker/src/main/java/org/apache/rocketmq/broker/out/BrokerOuterAPI.java:1239-1248 | client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:788-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:1239` 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/pop/PopConsumerService.java:395— broker/src/main/java/org/apache/rocketmq/broker/pop/PopConsumerService.java:395-404 | broker/src/main/java/org/apache/rocketmq/broker/pop/PopConsumerService.java:414-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 `broker/src/main/java/org/apache/rocketmq/broker/pop/PopConsumerService.java:395` 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/processor/AckMessageProcessor.java:246— broker/src/main/java/org/apache/rocketmq/broker/processor/AckMessageProcessor.java:246-255 | broker/src/main/java/org/apache/rocketmq/broker/processor/AckMessageProcessor.java:360-369 — 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/AckMessageProcessor.java:246` 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/impl/consumer/ConsumeMessageOrderlyService.java:353— client/src/main/java/org/apache/rocketmq/client/impl/consumer/ConsumeMessageOrderlyService.java:353-362 | client/src/main/java/org/apache/rocketmq/client/impl/consumer/ConsumeMessagePopOrderlyService.java:266-275 — 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 10 separate duplicated blocks between them, totalling at least 133 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:353` 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:1062— client/src/main/java/org/apache/rocketmq/client/impl/consumer/DefaultLitePullConsumerImpl.java:1062-1071 | 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:1062` 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/impl/consumer/RebalanceImpl.java:467— client/src/main/java/org/apache/rocketmq/client/impl/consumer/RebalanceImpl.java:467-476 | client/src/main/java/org/apache/rocketmq/client/impl/consumer/RebalanceImpl.java:622-631 — 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:467` 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:228— client/src/main/java/org/apache/rocketmq/client/producer/ProduceAccumulator.java:228-237 | client/src/main/java/org/apache/rocketmq/client/producer/ProduceAccumulator.java:242-251 — 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:228` 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:171— common/src/main/java/org/apache/rocketmq/common/UtilAll.java:171-180 | common/src/main/java/org/apache/rocketmq/common/UtilAll.java:183-192 — 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/UtilAll.java:408— common/src/main/java/org/apache/rocketmq/common/UtilAll.java:408-417 | common/src/main/java/org/apache/rocketmq/common/compression/ZlibCompressor.java:34-43 — 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 59 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:408` 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/UtilAll.java:418` calls `end` and `common/src/main/java/org/apache/rocketmq/common/compression/ZlibCompressor.java:44` 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/lite/LiteUtil.java:57— common/src/main/java/org/apache/rocketmq/common/lite/LiteUtil.java:57-66 | common/src/main/java/org/apache/rocketmq/common/lite/LiteUtil.java:71-80 — 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 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) controller/src/main/java/org/apache/rocketmq/controller/impl/task/RaftBrokerHeartBeatEventRequest.java:51— controller/src/main/java/org/apache/rocketmq/controller/impl/task/RaftBrokerHeartBeatEventRequest.java:51-60 | controller/src/main/java/org/apache/rocketmq/controller/impl/task/RaftBrokerHeartBeatEventRequest.java:77-86 — 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/impl/task/RaftBrokerHeartBeatEventRequest.java:51` 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) namesrv/src/main/java/org/apache/rocketmq/namesrv/processor/ClientRequestProcessor.java:90— namesrv/src/main/java/org/apache/rocketmq/namesrv/processor/ClientRequestProcessor.java:90-100 | proxy/src/main/java/org/apache/rocketmq/proxy/remoting/activity/GetTopicRouteActivity.java:61-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. 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 (10 lines × 2) proxy/src/main/java/org/apache/rocketmq/proxy/grpc/admin/ProxyAdminGrpcService.java:473— proxy/src/main/java/org/apache/rocketmq/proxy/grpc/admin/ProxyAdminGrpcService.java:473-482 | proxy/src/main/java/org/apache/rocketmq/proxy/grpc/admin/ProxyAdminGrpcService.java:671-680 — 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/admin/ProxyAdminGrpcService.java:473` 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 `ListSubscriptionRequest` in one and `DescribeSubscriptionRequest` 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 (10 lines × 2) remoting/src/main/java/org/apache/rocketmq/remoting/netty/NettyRemotingClient.java:442— remoting/src/main/java/org/apache/rocketmq/remoting/netty/NettyRemotingClient.java:442-451 | remoting/src/main/java/org/apache/rocketmq/remoting/netty/NettyRemotingClient.java:491-500 — 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:442` 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/CommitLog.java:1098— store/src/main/java/org/apache/rocketmq/store/CommitLog.java:1098-1107 | store/src/main/java/org/apache/rocketmq/store/CommitLog.java:1259-1268 — 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.
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 (6 lines × 2) auth/src/main/java/org/apache/rocketmq/auth/authentication/provider/LocalAuthenticationMetadataProvider.java:128— auth/src/main/java/org/apache/rocketmq/auth/authentication/provider/LocalAuthenticationMetadataProvider.java:128-133 | auth/src/main/java/org/apache/rocketmq/auth/authorization/provider/LocalAuthorizationMetadataProvider.java:135-140 — 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 `auth/src/main/java/org/apache/rocketmq/auth/authentication/provider/LocalAuthenticationMetadataProvider.java:128` 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) auth/src/main/java/org/apache/rocketmq/auth/authorization/builder/DefaultAuthorizationContextBuilder.java:384— auth/src/main/java/org/apache/rocketmq/auth/authorization/builder/DefaultAuthorizationContextBuilder.java:384-389 | auth/src/main/java/org/apache/rocketmq/auth/authorization/builder/DefaultAuthorizationContextBuilder.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 `auth/src/main/java/org/apache/rocketmq/auth/authorization/builder/DefaultAuthorizationContextBuilder.java:384` 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) auth/src/main/java/org/apache/rocketmq/auth/migration/AuthMigrator.java:122— auth/src/main/java/org/apache/rocketmq/auth/migration/AuthMigrator.java:122-127 | auth/src/main/java/org/apache/rocketmq/auth/migration/AuthMigrator.java:140-145 — 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/config/v2/ConsumerOffsetManagerV2.java:72— broker/src/main/java/org/apache/rocketmq/broker/config/v2/ConsumerOffsetManagerV2.java:72-77 | broker/src/main/java/org/apache/rocketmq/broker/config/v2/ConsumerOffsetManagerV2.java:119-124 — 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/offset/ConsumerOffsetManager.java:76— broker/src/main/java/org/apache/rocketmq/broker/offset/ConsumerOffsetManager.java:76-81 | broker/src/main/java/org/apache/rocketmq/broker/offset/LmqConsumerOffsetManager.java:126-131 — 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/offset/ConsumerOffsetManager.java:76` 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/pop/PopConsumerService.java:687— broker/src/main/java/org/apache/rocketmq/broker/pop/PopConsumerService.java:687-693 | broker/src/main/java/org/apache/rocketmq/broker/processor/PopReviveService.java:159-164 — 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/pop/PopConsumerService.java:687` 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) broker/src/main/java/org/apache/rocketmq/broker/processor/AdminBrokerProcessor.java:1007— broker/src/main/java/org/apache/rocketmq/broker/processor/AdminBrokerProcessor.java:1007-1012 | broker/src/main/java/org/apache/rocketmq/broker/processor/AdminBrokerProcessor.java:1136-1141 — 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:1007` 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:1692— broker/src/main/java/org/apache/rocketmq/broker/processor/AdminBrokerProcessor.java:1692-1697 | broker/src/main/java/org/apache/rocketmq/broker/processor/AdminBrokerProcessor.java:1730-1735 — 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:324— broker/src/main/java/org/apache/rocketmq/broker/processor/PopMessageProcessor.java:324-330 | broker/src/main/java/org/apache/rocketmq/broker/processor/PopMessageProcessor.java:361-366 — 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:324` 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 (6 lines × 2) broker/src/main/java/org/apache/rocketmq/broker/processor/PopReviveService.java:242— broker/src/main/java/org/apache/rocketmq/broker/processor/PopReviveService.java:242-247 | 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:242` 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:1203— client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:1203-1208 | proxy/src/main/java/org/apache/rocketmq/proxy/service/message/LocalMessageService.java:354-359 — 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:1203` 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:1315— client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:1315-1320 | proxy/src/main/java/org/apache/rocketmq/proxy/service/message/LocalMessageService.java:332-337 — 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:1315` 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:160— client/src/main/java/org/apache/rocketmq/client/impl/consumer/RebalanceImpl.java:160-165 | client/src/main/java/org/apache/rocketmq/client/impl/consumer/RebalanceImpl.java:202-208 — 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:160` 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) proxy/src/main/java/org/apache/rocketmq/proxy/grpc/admin/ProxyAdminGrpcService.java:1657— proxy/src/main/java/org/apache/rocketmq/proxy/grpc/admin/ProxyAdminGrpcService.java:1657-1662 | proxy/src/main/java/org/apache/rocketmq/proxy/grpc/admin/ProxyAdminGrpcService.java:1686-1691 — 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) store/src/main/java/org/apache/rocketmq/store/GetMessageResult.java:116— store/src/main/java/org/apache/rocketmq/store/GetMessageResult.java:116-121 | store/src/main/java/org/apache/rocketmq/store/GetMessageResult.java:125-130 — 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) REDACTED:644— REDACTED:644-649 | REDACTED:684-689 — 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 `REDACTED:644` 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) REDACTED:721— REDACTED:721-729 | REDACTED:764-769 — 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 `REDACTED:721` 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/AckMessageProcessor.java:135— broker/src/main/java/org/apache/rocketmq/broker/processor/AckMessageProcessor.java:135-140 | broker/src/main/java/org/apache/rocketmq/broker/processor/ChangeInvisibleTimeProcessor.java:114-119 — 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:135` 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:582— broker/src/main/java/org/apache/rocketmq/broker/processor/AdminBrokerProcessor.java:582-587 | broker/src/main/java/org/apache/rocketmq/broker/processor/AdminBrokerProcessor.java:743-748 — 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, `broker/src/main/java/org/apache/rocketmq/broker/processor/AdminBrokerProcessor.java:741` calls `getForce` and `broker/src/main/java/org/apache/rocketmq/broker/processor/AdminBrokerProcessor.java:580` 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 × 2) client/src/main/java/org/apache/rocketmq/client/impl/producer/DefaultMQProducerImpl.java:809— client/src/main/java/org/apache/rocketmq/client/impl/producer/DefaultMQProducerImpl.java:809-814 | client/src/main/java/org/apache/rocketmq/client/impl/producer/DefaultMQProducerImpl.java:846-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.
Duplicated block (6 lines × 2) proxy/src/main/java/org/apache/rocketmq/proxy/processor/ConsumerProcessor.java:494— proxy/src/main/java/org/apache/rocketmq/proxy/processor/ConsumerProcessor.java:494-499 | proxy/src/main/java/org/apache/rocketmq/proxy/processor/ConsumerProcessor.java:522-527 — 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:494` 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 (6 lines × 2) client/src/main/java/org/apache/rocketmq/client/consumer/store/LocalFileOffsetStore.java:96— client/src/main/java/org/apache/rocketmq/client/consumer/store/LocalFileOffsetStore.java:96-101 | client/src/main/java/org/apache/rocketmq/client/consumer/store/RemoteBrokerOffsetStore.java:77-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.
Duplicated block (6 lines × 2) client/src/main/java/org/apache/rocketmq/client/exception/MQClientException.java:33— client/src/main/java/org/apache/rocketmq/client/exception/MQClientException.java:33-38 | common/src/main/java/org/apache/rocketmq/common/AbortProcessException.java:45-50 — 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 (6 lines × 2) proxy/src/main/java/org/apache/rocketmq/proxy/auth/ProxyAuthenticationMetadataProvider.java:33— proxy/src/main/java/org/apache/rocketmq/proxy/auth/ProxyAuthenticationMetadataProvider.java:33-38 | proxy/src/main/java/org/apache/rocketmq/proxy/auth/ProxyAuthorizationMetadataProvider.java:35-40 — 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) store/src/main/java/org/apache/rocketmq/store/ConsumeQueue.java:1010— store/src/main/java/org/apache/rocketmq/store/ConsumeQueue.java:1010-1015 | store/src/main/java/org/apache/rocketmq/store/queue/BatchConsumeQueue.java:961-966 — 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.
MethodTooLong: DefaultAuthorizationContextBuilder.build auth/src/main/java/org/apache/rocketmq/auth/authorization/builder/DefaultAuthorizationContextBuilder.java:193— MethodTooLong — build runs 378 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 278 over it, 3.78× 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.processRequest broker/src/main/java/org/apache/rocketmq/broker/processor/PopMessageProcessor.java:220— MethodTooLong — processRequest runs 325 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 225 over it, 3.25× 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:304— MethodTooLong — processRequest runs 237 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 137 over it, 2.37× 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 184 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 84 over it, 1.84× 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:92— 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: AdminBrokerProcessor.processRequest broker/src/main/java/org/apache/rocketmq/broker/processor/AdminBrokerProcessor.java:269— MethodTooLong — processRequest runs 155 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 55 over it, 1.55× 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:676— MethodTooLong — popMsgFromQueue runs 151 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 51 over it, 1.51× 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:385— MethodTooLong — handlePutMessageResult 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: TransactionalMessageServiceImpl.check broker/src/main/java/org/apache/rocketmq/broker/transaction/queue/TransactionalMessageServiceImpl.java:162— 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: DefaultMQProducerImpl.sendKernelImpl client/src/main/java/org/apache/rocketmq/client/impl/producer/DefaultMQProducerImpl.java:911— MethodTooLong — sendKernelImpl runs 148 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 48 over it, 1.48× 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:146— MethodTooLong — init runs 146 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 46 over it, 1.46× 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:481— MethodTooLong — checkMessageAndReturnSize 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: MessageStoreDispatcherImpl.doScheduleDispatch tieredstore/src/main/java/org/apache/rocketmq/tieredstore/core/MessageStoreDispatcherImpl.java:133— MethodTooLong — doScheduleDispatch 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: BrokerController.shutdownBasicService broker/src/main/java/org/apache/rocketmq/broker/BrokerController.java:1523— MethodTooLong — shutdownBasicService runs 140 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 40 over it, 1.40× 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:866— MethodTooLong — getMessage 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: ConsumeQueue.binarySearchInQueueByTime store/src/main/java/org/apache/rocketmq/store/ConsumeQueue.java:234— 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:1027— 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:508— 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: MQAdminImpl.queryMessage client/src/main/java/org/apache/rocketmq/client/impl/MQAdminImpl.java:326— MethodTooLong — queryMessage runs 122 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 22 over it, 1.22× 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 119 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 19 over it, 1.19× 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:738— MethodTooLong — sendDefaultImpl runs 119 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 19 over it, 1.19× 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: BrokerController.<init> broker/src/main/java/org/apache/rocketmq/broker/BrokerController.java:365— MethodTooLong — <init> runs 114 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 14 over it, 1.14× 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:78— MethodTooLong — processRequest runs 113 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 13 over it, 1.13× 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:999— MethodTooLong — asyncPutMessage runs 112 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 12 over it, 1.12× 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 (11 lines × 2) auth/src/main/java/org/apache/rocketmq/auth/authentication/provider/LocalAuthenticationMetadataProvider.java:77— auth/src/main/java/org/apache/rocketmq/auth/authentication/provider/LocalAuthenticationMetadataProvider.java:77-87 | auth/src/main/java/org/apache/rocketmq/auth/authentication/provider/LocalAuthenticationMetadataProvider.java:103-113 — 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 (11 lines × 2) broker/src/main/java/org/apache/rocketmq/broker/config/v1/RocksDBConsumerOffsetManager.java:195— broker/src/main/java/org/apache/rocketmq/broker/config/v1/RocksDBConsumerOffsetManager.java:195-205 | broker/src/main/java/org/apache/rocketmq/broker/offset/ConsumerOffsetManager.java:209-219 — 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/config/v1/RocksDBConsumerOffsetManager.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 (11 lines × 2) broker/src/main/java/org/apache/rocketmq/broker/out/BrokerOuterAPI.java:815— broker/src/main/java/org/apache/rocketmq/broker/out/BrokerOuterAPI.java:815-825 | client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:3107-3117 — 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:815` 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/out/BrokerOuterAPI.java:1308— broker/src/main/java/org/apache/rocketmq/broker/out/BrokerOuterAPI.java:1308-1318 | client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:2068-2078 — 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:1308` 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/pop/orderly/QueueLevelConsumerManager.java:100— broker/src/main/java/org/apache/rocketmq/broker/pop/orderly/QueueLevelConsumerManager.java:100-110 | broker/src/main/java/org/apache/rocketmq/broker/pop/orderly/QueueLevelConsumerManager.java:156-166 — 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/processor/AckMessageProcessor.java:145— broker/src/main/java/org/apache/rocketmq/broker/processor/AckMessageProcessor.java:145-155 | broker/src/main/java/org/apache/rocketmq/broker/processor/ChangeInvisibleTimeProcessor.java:124-134 — 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 (11 lines × 2) broker/src/main/java/org/apache/rocketmq/broker/processor/AdminBrokerProcessor.java:1081— broker/src/main/java/org/apache/rocketmq/broker/processor/AdminBrokerProcessor.java:1081-1091 | container/src/main/java/org/apache/rocketmq/container/BrokerContainerProcessor.java:270-281 — before extracting anything, compare `broker/src/main/java/org/apache/rocketmq/broker/processor/AdminBrokerProcessor.java` and `container/src/main/java/org/apache/rocketmq/container/BrokerContainerProcessor.java` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 48 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/processor/AdminBrokerProcessor.java:1081` 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/processor/AdminBrokerProcessor.java:3430— broker/src/main/java/org/apache/rocketmq/broker/processor/AdminBrokerProcessor.java:3430-3440 | broker/src/main/java/org/apache/rocketmq/broker/processor/AdminBrokerProcessor.java:3457-3467 — 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/subscription/SubscriptionGroupManager.java:432— broker/src/main/java/org/apache/rocketmq/broker/subscription/SubscriptionGroupManager.java:432-442 | broker/src/main/java/org/apache/rocketmq/broker/topic/TopicConfigManager.java:770-780 — 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:432` 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:459— client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:459-469 | client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:509-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/MQClientAPIImpl.java:459` 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:1746— client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:1746-1756 | client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:1956-1966 — 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:1746` 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:1993— client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:1993-2003 | client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:2011-2021 — 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:1993` 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/DefaultLitePullConsumerImpl.java:534— client/src/main/java/org/apache/rocketmq/client/impl/consumer/DefaultLitePullConsumerImpl.java:534-544 | client/src/main/java/org/apache/rocketmq/client/impl/consumer/DefaultLitePullConsumerImpl.java:558-568 — 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:534` 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:1689— client/src/main/java/org/apache/rocketmq/client/impl/producer/DefaultMQProducerImpl.java:1689-1699 | client/src/main/java/org/apache/rocketmq/client/impl/producer/DefaultMQProducerImpl.java:1720-1730 — 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:1689` 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:1746— client/src/main/java/org/apache/rocketmq/client/impl/producer/DefaultMQProducerImpl.java:1746-1756 | client/src/main/java/org/apache/rocketmq/client/impl/producer/DefaultMQProducerImpl.java:1790-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. 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:1746` 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) controller/src/main/java/org/apache/rocketmq/controller/impl/manager/ReplicasInfoManager.java:654— controller/src/main/java/org/apache/rocketmq/controller/impl/manager/ReplicasInfoManager.java:654-664 | controller/src/main/java/org/apache/rocketmq/controller/impl/manager/ReplicasInfoManager.java:669-679 — 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/impl/manager/ReplicasInfoManager.java:654` 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:96— namesrv/src/main/java/org/apache/rocketmq/namesrv/processor/ClientRequestProcessor.java:96-106 | 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:96` 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/service/sysmessage/HeartbeatSyncer.java:117— proxy/src/main/java/org/apache/rocketmq/proxy/service/sysmessage/HeartbeatSyncer.java:117-127 | proxy/src/main/java/org/apache/rocketmq/proxy/service/sysmessage/HeartbeatSyncer.java:155-165 — 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:117` 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/RocketMQSerializable.java:49— remoting/src/main/java/org/apache/rocketmq/remoting/protocol/RocketMQSerializable.java:49-59 | remoting/src/main/java/org/apache/rocketmq/remoting/protocol/RocketMQSerializable.java:72-82 — 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/RocketMQSerializable.java:49` 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 `value` to `long` in one and `int` 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 (11 lines × 2) remoting/src/main/java/org/apache/rocketmq/remoting/protocol/header/ExtraInfoUtil.java:144— remoting/src/main/java/org/apache/rocketmq/remoting/protocol/header/ExtraInfoUtil.java:144-154 | remoting/src/main/java/org/apache/rocketmq/remoting/protocol/header/ExtraInfoUtil.java:158-168 — 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: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.
Duplicated block (11 lines × 2) store/src/main/java/org/apache/rocketmq/store/CommitLog.java:1116— store/src/main/java/org/apache/rocketmq/store/CommitLog.java:1116-1126 | store/src/main/java/org/apache/rocketmq/store/CommitLog.java:1275-1285 — 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/CommitLog.java:1115` calls `onCommitLogAppend` and `store/src/main/java/org/apache/rocketmq/store/CommitLog.java:1274` 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 (11 lines × 2) store/src/main/java/org/apache/rocketmq/store/DispatchRequest.java:99— store/src/main/java/org/apache/rocketmq/store/DispatchRequest.java:99-109 | store/src/main/java/org/apache/rocketmq/store/DispatchRequest.java:115-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.
Duplicated block (11 lines × 2) broker/src/main/java/org/apache/rocketmq/broker/transaction/AbstractTransactionalMessageCheckListener.java:57— broker/src/main/java/org/apache/rocketmq/broker/transaction/AbstractTransactionalMessageCheckListener.java:57-67 | broker/src/main/java/org/apache/rocketmq/broker/transaction/rocksdb/TransactionalMessageRocksDBService.java:230-240 — 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/transaction/AbstractTransactionalMessageCheckListener.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 (11 lines × 2) auth/src/main/java/org/apache/rocketmq/auth/authentication/exception/AuthenticationException.java:23— auth/src/main/java/org/apache/rocketmq/auth/authentication/exception/AuthenticationException.java:23-33 | auth/src/main/java/org/apache/rocketmq/auth/authorization/exception/AuthorizationException.java:23-33 — 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 (12 lines × 2) auth/src/main/java/org/apache/rocketmq/auth/authentication/context/AuthenticationContext.java:49— auth/src/main/java/org/apache/rocketmq/auth/authentication/context/AuthenticationContext.java:49-60 | auth/src/main/java/org/apache/rocketmq/auth/authorization/context/AuthorizationContext.java:33-44 — before extracting anything, compare `auth/src/main/java/org/apache/rocketmq/auth/authentication/context/AuthenticationContext.java` and `auth/src/main/java/org/apache/rocketmq/auth/authorization/context/AuthorizationContext.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 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. 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 (12 lines × 2) auth/src/main/java/org/apache/rocketmq/auth/authorization/provider/LocalAuthorizationMetadataProvider.java:81— auth/src/main/java/org/apache/rocketmq/auth/authorization/provider/LocalAuthorizationMetadataProvider.java:81-92 | auth/src/main/java/org/apache/rocketmq/auth/authorization/provider/LocalAuthorizationMetadataProvider.java:109-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. 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/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:147-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 `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:398— broker/src/main/java/org/apache/rocketmq/broker/longpolling/PopLongPollingService.java:398-409 | broker/src/main/java/org/apache/rocketmq/broker/processor/PopBufferMergeService.java:197-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 `broker/src/main/java/org/apache/rocketmq/broker/longpolling/PopLongPollingService.java:398` 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/pop/orderly/QueueLevelConsumerManager.java:584— broker/src/main/java/org/apache/rocketmq/broker/pop/orderly/QueueLevelConsumerManager.java:584-595 | broker/src/main/java/org/apache/rocketmq/broker/pop/orderly/QueueLevelConsumerManager.java:611-622 — 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/pop/orderly/QueueLevelConsumerManager.java:584` 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/processor/PopMessageProcessor.java:416— broker/src/main/java/org/apache/rocketmq/broker/processor/PopMessageProcessor.java:416-427 | broker/src/main/java/org/apache/rocketmq/broker/processor/PopMessageProcessor.java:581-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 `broker/src/main/java/org/apache/rocketmq/broker/processor/PopMessageProcessor.java:416` 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/schedule/ScheduleMessageService.java:310— broker/src/main/java/org/apache/rocketmq/broker/schedule/ScheduleMessageService.java:310-321 | store/src/main/java/org/apache/rocketmq/store/DefaultMessageStore.java:301-312 — 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:310` 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:323` calls `put` and `store/src/main/java/org/apache/rocketmq/store/DefaultMessageStore.java:313` 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) client/src/main/java/org/apache/rocketmq/client/consumer/store/LocalFileOffsetStore.java:105— client/src/main/java/org/apache/rocketmq/client/consumer/store/LocalFileOffsetStore.java:105-116 | client/src/main/java/org/apache/rocketmq/client/consumer/store/RemoteBrokerOffsetStore.java:86-97 — 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/consumer/store/LocalFileOffsetStore.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 (12 lines × 2) client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:1546— client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:1546-1557 | client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:1696-1707 — 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:1546` 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:1909— client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:1909-1920 | client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:1931-1942 — 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:1909` 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:212-223 — 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:530— client/src/main/java/org/apache/rocketmq/client/impl/mqclient/MQClientAPIExt.java:530-541 | client/src/main/java/org/apache/rocketmq/client/impl/mqclient/MQClientAPIExt.java:566-577 — 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:530` 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:80— client/src/main/java/org/apache/rocketmq/client/producer/ProduceAccumulator.java:80-91 | client/src/main/java/org/apache/rocketmq/client/producer/ProduceAccumulator.java:127-138 — 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:282— common/src/main/java/org/apache/rocketmq/common/config/AbstractRocksDBStorage.java:282-293 | common/src/main/java/org/apache/rocketmq/common/config/AbstractRocksDBStorage.java:297-308 — 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/common/ReceiptHandleGroup.java:216— proxy/src/main/java/org/apache/rocketmq/proxy/common/ReceiptHandleGroup.java:216-227 | proxy/src/main/java/org/apache/rocketmq/proxy/common/ReceiptHandleGroup.java:241-252 — 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:216` 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) store/src/main/java/org/apache/rocketmq/store/CommitLog.java:787— store/src/main/java/org/apache/rocketmq/store/CommitLog.java:787-798 | store/src/main/java/org/apache/rocketmq/store/dledger/DLedgerCommitLog.java:337-348 — 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:787` 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/longpolling/PopLiteLongPollingService.java:169— broker/src/main/java/org/apache/rocketmq/broker/longpolling/PopLiteLongPollingService.java:169-180 | broker/src/main/java/org/apache/rocketmq/broker/longpolling/PopLongPollingService.java:275-286 — before extracting anything, compare `broker/src/main/java/org/apache/rocketmq/broker/longpolling/PopLiteLongPollingService.java` and `broker/src/main/java/org/apache/rocketmq/broker/longpolling/PopLongPollingService.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 `broker/src/main/java/org/apache/rocketmq/broker/longpolling/PopLiteLongPollingService.java:169` 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/processor/AdminBrokerProcessor.java:1968— broker/src/main/java/org/apache/rocketmq/broker/processor/AdminBrokerProcessor.java:1968-1979 | proxy/src/main/java/org/apache/rocketmq/proxy/remoting/activity/ConsumerManagerActivity.java:100-111 — 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:1968` 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) remoting/src/main/java/org/apache/rocketmq/remoting/protocol/LanguageCode.java:56— remoting/src/main/java/org/apache/rocketmq/remoting/protocol/LanguageCode.java:56-73 | remoting/src/main/java/org/apache/rocketmq/remoting/protocol/SerializeType.java:28-39 — 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) 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 (12 lines × 2) tools/src/main/java/org/apache/rocketmq/tools/command/consumer/UpdateSubGroupListSubCommand.java:93— tools/src/main/java/org/apache/rocketmq/tools/command/consumer/UpdateSubGroupListSubCommand.java:93-104 | tools/src/main/java/org/apache/rocketmq/tools/command/topic/UpdateTopicListSubCommand.java:92-103 — before extracting anything, compare `tools/src/main/java/org/apache/rocketmq/tools/command/consumer/UpdateSubGroupListSubCommand.java` and `tools/src/main/java/org/apache/rocketmq/tools/command/topic/UpdateTopicListSubCommand.java` as WHOLE FILES: this scan already matched 7 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. Read the line range as the matched WINDOW rather than a finished unit: at `tools/src/main/java/org/apache/rocketmq/tools/command/consumer/UpdateSubGroupListSubCommand.java:93` 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 (12 lines × 2) tools/src/main/java/org/apache/rocketmq/tools/command/consumer/UpdateSubGroupListSubCommand.java:107— tools/src/main/java/org/apache/rocketmq/tools/command/consumer/UpdateSubGroupListSubCommand.java:107-118 | tools/src/main/java/org/apache/rocketmq/tools/command/topic/UpdateTopicListSubCommand.java:106-117 — before extracting anything, compare `tools/src/main/java/org/apache/rocketmq/tools/command/consumer/UpdateSubGroupListSubCommand.java` and `tools/src/main/java/org/apache/rocketmq/tools/command/topic/UpdateTopicListSubCommand.java` as WHOLE FILES: this scan already matched 7 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. Read the line range as the matched WINDOW rather than a finished unit: at `tools/src/main/java/org/apache/rocketmq/tools/command/consumer/UpdateSubGroupListSubCommand.java:107` 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) 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 16 separate duplicated blocks between them, totalling at least 158 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 16 separate duplicated blocks between them, totalling at least 158 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) auth/src/main/java/org/apache/rocketmq/auth/authorization/builder/DefaultAuthorizationContextBuilder.java:306— auth/src/main/java/org/apache/rocketmq/auth/authorization/builder/DefaultAuthorizationContextBuilder.java:306-310 | auth/src/main/java/org/apache/rocketmq/auth/authorization/builder/DefaultAuthorizationContextBuilder.java:316-320 — 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 `auth/src/main/java/org/apache/rocketmq/auth/authorization/builder/DefaultAuthorizationContextBuilder.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 (5 lines × 2) client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:1162— client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:1162-1166 | proxy/src/main/java/org/apache/rocketmq/proxy/service/message/LocalMessageService.java:340-344 — 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:1162` 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:413— client/src/main/java/org/apache/rocketmq/client/impl/consumer/DefaultMQPullConsumerImpl.java:413-417 | client/src/main/java/org/apache/rocketmq/client/impl/consumer/DefaultMQPushConsumerImpl.java:1410-1415 — 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:413` 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:1260— client/src/main/java/org/apache/rocketmq/client/impl/factory/MQClientInstance.java:1260-1264 | 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) controller/src/main/java/org/apache/rocketmq/controller/impl/event/ListEventSerializer.java:56— controller/src/main/java/org/apache/rocketmq/controller/impl/event/ListEventSerializer.java:56-60 | controller/src/main/java/org/apache/rocketmq/controller/impl/manager/ReplicasInfoManager.java:611-615 — 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) proxy/src/main/java/org/apache/rocketmq/proxy/grpc/v2/client/ClientActivity.java:417— proxy/src/main/java/org/apache/rocketmq/proxy/grpc/v2/client/ClientActivity.java:417-422 | proxy/src/main/java/org/apache/rocketmq/proxy/grpc/v2/client/ClientActivity.java:434-438 — 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) store/src/main/java/org/apache/rocketmq/store/CommitLog.java:1949— store/src/main/java/org/apache/rocketmq/store/CommitLog.java:1949-1953 | 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:1949` 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/DefaultMessageStore.java:1399— store/src/main/java/org/apache/rocketmq/store/DefaultMessageStore.java:1399-1405 | store/src/main/java/org/apache/rocketmq/store/DefaultMessageStore.java:1456-1460 — 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:1399` 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/timer/TimerMessageStore.java:1266— store/src/main/java/org/apache/rocketmq/store/timer/TimerMessageStore.java:1266-1270 | store/src/main/java/org/apache/rocketmq/store/timer/rocksdb/TimerMessageRocksDBStore.java:265-269 — 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/timer/TimerMessageStore.java:1266` 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) tieredstore/src/main/java/org/apache/rocketmq/tieredstore/TieredMessageStore.java:436— tieredstore/src/main/java/org/apache/rocketmq/tieredstore/TieredMessageStore.java:436-442 | tieredstore/src/main/java/org/apache/rocketmq/tieredstore/TieredMessageStore.java:470-474 — 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. 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 (5 lines × 2) tieredstore/src/main/java/org/apache/rocketmq/tieredstore/core/MessageStoreFetcherImpl.java:321— tieredstore/src/main/java/org/apache/rocketmq/tieredstore/core/MessageStoreFetcherImpl.java:321-325 | tieredstore/src/main/java/org/apache/rocketmq/tieredstore/core/MessageStoreFetcherImpl.java:449-453 — 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/core/MessageStoreFetcherImpl.java:321` 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 (5 lines × 2) tieredstore/src/main/java/org/apache/rocketmq/tieredstore/metadata/DefaultMetadataStore.java:60— tieredstore/src/main/java/org/apache/rocketmq/tieredstore/metadata/DefaultMetadataStore.java:60-64 | tieredstore/src/main/java/org/apache/rocketmq/tieredstore/metadata/DefaultMetadataStore.java:298-302 — 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) store/src/main/java/org/apache/rocketmq/store/ConsumeQueue.java:962— store/src/main/java/org/apache/rocketmq/store/ConsumeQueue.java:962-966 | store/src/main/java/org/apache/rocketmq/store/queue/BatchConsumeQueue.java:350-354 — 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:969— store/src/main/java/org/apache/rocketmq/store/ConsumeQueue.java:969-973 | store/src/main/java/org/apache/rocketmq/store/queue/BatchConsumeQueue.java:357-361 — 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/BrokerController.java:1175— broker/src/main/java/org/apache/rocketmq/broker/BrokerController.java:1175-1179 | broker/src/main/java/org/apache/rocketmq/broker/BrokerController.java:1180-1184 — 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) 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:3178-3182 — 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/MQClientAPIImpl.java:1151— client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:1151-1155 | proxy/src/main/java/org/apache/rocketmq/proxy/service/message/LocalMessageService.java:321-325 — 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) controller/src/main/java/org/apache/rocketmq/controller/impl/heartbeat/DefaultBrokerHeartbeatManager.java:77— controller/src/main/java/org/apache/rocketmq/controller/impl/heartbeat/DefaultBrokerHeartbeatManager.java:77-81 | controller/src/main/java/org/apache/rocketmq/controller/impl/manager/RaftReplicasInfoManager.java:115-119 — 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 `controller/src/main/java/org/apache/rocketmq/controller/impl/heartbeat/DefaultBrokerHeartbeatManager.java:77` 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) 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.
Duplicated block (5 lines × 2) store/src/main/java/org/apache/rocketmq/store/logfile/DefaultMappedFile.java:970— store/src/main/java/org/apache/rocketmq/store/logfile/DefaultMappedFile.java:970-974 | store/src/main/java/org/apache/rocketmq/store/logfile/DefaultMappedFile.java:999-1003 — 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:970` 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) tools/src/main/java/org/apache/rocketmq/tools/admin/DefaultMQAdminExtImpl.java:758— tools/src/main/java/org/apache/rocketmq/tools/admin/DefaultMQAdminExtImpl.java:758-762 | tools/src/main/java/org/apache/rocketmq/tools/admin/DefaultMQAdminExtImpl.java:1904-1908 — 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:758` 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) example/src/main/java/org/apache/rocketmq/example/lmq/LMQPushPopConsumer.java:93— example/src/main/java/org/apache/rocketmq/example/lmq/LMQPushPopConsumer.java:93-97 | example/src/main/java/org/apache/rocketmq/example/simple/PopConsumer.java:57-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 `example/src/main/java/org/apache/rocketmq/example/lmq/LMQPushPopConsumer.java:93` 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, `example/src/main/java/org/apache/rocketmq/example/lmq/LMQPushPopConsumer.java:92` calls `setNamesrvAddr` and `example/src/main/java/org/apache/rocketmq/example/simple/PopConsumer.java:55` 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 × 2) tools/src/main/java/org/apache/rocketmq/tools/monitor/MonitorService.java:215— tools/src/main/java/org/apache/rocketmq/tools/monitor/MonitorService.java:215-219 | tools/src/main/java/org/apache/rocketmq/tools/monitor/MonitorService.java:273-277 — 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/monitor/MonitorService.java:215` 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 (empty catch) store/src/main/java/org/apache/rocketmq/store/CommitLog.java:1856— 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) store/src/main/java/org/apache/rocketmq/store/DefaultMessageStore.java:1963— 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) store/src/main/java/org/apache/rocketmq/store/MappedFileQueue.java:712— 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) store/src/main/java/org/apache/rocketmq/store/util/PerfCounter.java:269— 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) store/src/main/java/org/apache/rocketmq/store/util/PerfCounter.java:277— 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) store/src/main/java/org/apache/rocketmq/store/util/PerfCounter.java:285— 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) store/src/main/java/org/apache/rocketmq/store/util/PerfCounter.java:317— 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) store/src/main/java/org/apache/rocketmq/store/util/PerfCounter.java:362— 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) store/src/main/java/org/apache/rocketmq/store/timer/TimerMessageStore.java:745— 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) store/src/main/java/org/apache/rocketmq/store/stats/BrokerStatsManager.java:342— 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) store/src/main/java/org/apache/rocketmq/store/queue/CombineConsumeQueueStore.java:541— 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) store/src/main/java/org/apache/rocketmq/store/pop/PopCheckPoint.java:202— 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) store/src/main/java/org/apache/rocketmq/store/logfile/DefaultMappedFile.java:1046— 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) store/src/main/java/org/apache/rocketmq/store/lock/AdaptiveBackOffSpinLockImpl.java:161— 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) store/src/main/java/org/apache/rocketmq/store/kv/CompactionStore.java:140— 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) store/src/main/java/org/apache/rocketmq/store/ha/autoswitch/AutoSwitchHAService.java:154— 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) store/src/main/java/org/apache/rocketmq/store/ha/autoswitch/AutoSwitchHAService.java:243— 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) store/src/main/java/org/apache/rocketmq/store/dledger/DLedgerCommitLog.java:506— 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) remoting/src/main/java/org/apache/rocketmq/remoting/netty/NettyLogger.java:37— 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) proxy/src/main/java/org/apache/rocketmq/proxy/remoting/RemotingProtocolServer.java:396— 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) proxy/src/main/java/org/apache/rocketmq/proxy/grpc/v2/client/ClientActivity.java:459— 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) common/src/main/java/org/apache/rocketmq/common/MixAll.java:292— 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) common/src/main/java/org/apache/rocketmq/common/MixAll.java:438— 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) common/src/main/java/org/apache/rocketmq/common/MixAll.java:479— 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) common/src/main/java/org/apache/rocketmq/common/UtilAll.java:91— 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.
D4 · Code Duplication· Edited copy of a member (12 corresponding lines) · ×24
Edited copy of a member (12 corresponding lines) controller/src/main/java/org/apache/rocketmq/controller/impl/heartbeat/DefaultBrokerHeartbeatManager.java:180— controller/src/main/java/org/apache/rocketmq/controller/impl/heartbeat/DefaultBrokerHeartbeatManager.java:180-191 | controller/src/main/java/org/apache/rocketmq/controller/impl/heartbeat/RaftBrokerHeartBeatManager.java:259-271 — These two members are one piece of code written twice and then edited apart: 12 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 (12 corresponding lines) common/src/main/java/org/apache/rocketmq/common/stats/MomentStatsItemSet.java:123— common/src/main/java/org/apache/rocketmq/common/stats/MomentStatsItemSet.java:123-134 | common/src/main/java/org/apache/rocketmq/common/stats/StatsItemSet.java:266-277 — These two members are one piece of code written twice and then edited apart: 12 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 (12 corresponding lines) broker/src/main/java/org/apache/rocketmq/broker/out/BrokerOuterAPI.java:1393— broker/src/main/java/org/apache/rocketmq/broker/out/BrokerOuterAPI.java:1393-1409 | broker/src/main/java/org/apache/rocketmq/broker/out/BrokerOuterAPI.java:1437-1448 — These two members are one piece of code written twice and then edited apart: 12 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 (12 corresponding lines) client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:3206— client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:3206-3225 | client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:3228-3239 — These two members are one piece of code written twice and then edited apart: 12 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 (12 corresponding lines) broker/src/main/java/org/apache/rocketmq/broker/config/v2/SubscriptionGroupManagerV2.java:163— broker/src/main/java/org/apache/rocketmq/broker/config/v2/SubscriptionGroupManagerV2.java:163-174 | broker/src/main/java/org/apache/rocketmq/broker/config/v2/TopicConfigManagerV2.java:167-180 — These two members are one piece of code written twice and then edited apart: 12 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 (12 corresponding lines) broker/src/main/java/org/apache/rocketmq/broker/metrics/PopMetricsManager.java:146— broker/src/main/java/org/apache/rocketmq/broker/metrics/PopMetricsManager.java:146-157 | broker/src/main/java/org/apache/rocketmq/broker/metrics/PopMetricsManager.java:160-171 — These two members are one piece of code written twice and then edited apart: 12 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 (12 corresponding lines) store/src/main/java/org/apache/rocketmq/store/MappedFileQueue.java:658— store/src/main/java/org/apache/rocketmq/store/MappedFileQueue.java:658-673 | store/src/main/java/org/apache/rocketmq/store/MappedFileQueue.java:675-686 — These two members are one piece of code written twice and then edited apart: 12 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 (12 corresponding lines) auth/src/main/java/org/apache/rocketmq/auth/authentication/provider/LocalAuthenticationMetadataProvider.java:163— auth/src/main/java/org/apache/rocketmq/auth/authentication/provider/LocalAuthenticationMetadataProvider.java:163-174 | auth/src/main/java/org/apache/rocketmq/auth/authorization/provider/LocalAuthorizationMetadataProvider.java:191-205 — These two members are one piece of code written twice and then edited apart: 12 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 (12 corresponding lines) broker/src/main/java/org/apache/rocketmq/broker/pop/PopConsumerRocksdbStore.java:115— broker/src/main/java/org/apache/rocketmq/broker/pop/PopConsumerRocksdbStore.java:115-126 | broker/src/main/java/org/apache/rocketmq/broker/pop/PopConsumerRocksdbStore.java:129-140 — These two members are one piece of code written twice and then edited apart: 12 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 (12 corresponding lines) client/src/main/java/org/apache/rocketmq/client/impl/consumer/DefaultLitePullConsumerImpl.java:478— client/src/main/java/org/apache/rocketmq/client/impl/consumer/DefaultLitePullConsumerImpl.java:478-489 | client/src/main/java/org/apache/rocketmq/client/impl/consumer/DefaultMQPushConsumerImpl.java:1250-1261 — These two members are one piece of code written twice and then edited apart: 12 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 (12 corresponding lines) proxy/src/main/java/org/apache/rocketmq/proxy/grpc/v2/GrpcMessagingApplication.java:152— proxy/src/main/java/org/apache/rocketmq/proxy/grpc/v2/GrpcMessagingApplication.java:152-165 | proxy/src/main/java/org/apache/rocketmq/proxy/remoting/RemotingProtocolServer.java:301-312 — These two members are one piece of code written twice and then edited apart: 12 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 (12 corresponding lines) client/src/main/java/org/apache/rocketmq/client/impl/factory/MQClientInstance.java:636— client/src/main/java/org/apache/rocketmq/client/impl/factory/MQClientInstance.java:636-650 | client/src/main/java/org/apache/rocketmq/client/impl/factory/MQClientInstance.java:1061-1072 — These two members are one piece of code written twice and then edited apart: 12 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 (12 corresponding lines) client/src/main/java/org/apache/rocketmq/client/producer/ProduceAccumulator.java:226— client/src/main/java/org/apache/rocketmq/client/producer/ProduceAccumulator.java:226-237 | client/src/main/java/org/apache/rocketmq/client/producer/ProduceAccumulator.java:240-251 — These two members are one piece of code written twice and then edited apart: 12 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 (12 corresponding lines) common/src/main/java/org/apache/rocketmq/common/stats/MomentStatsItem.java:44— common/src/main/java/org/apache/rocketmq/common/stats/MomentStatsItem.java:44-56 | common/src/main/java/org/apache/rocketmq/common/stats/MomentStatsItemSet.java:54-65 — These two members are one piece of code written twice and then edited apart: 12 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 (12 corresponding lines) store/src/main/java/org/apache/rocketmq/store/index/rocksdb/IndexRocksDBStore.java:246— store/src/main/java/org/apache/rocketmq/store/index/rocksdb/IndexRocksDBStore.java:246-257 | store/src/main/java/org/apache/rocketmq/store/transaction/TransMessageRocksDBStore.java:266-277 — These two members are one piece of code written twice and then edited apart: 12 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 (12 corresponding lines) common/src/main/java/org/apache/rocketmq/common/UtilAll.java:219— common/src/main/java/org/apache/rocketmq/common/UtilAll.java:219-230 | common/src/main/java/org/apache/rocketmq/common/UtilAll.java:272-288 — These two members are one piece of code written twice and then edited apart: 12 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 (12 corresponding lines) client/src/main/java/org/apache/rocketmq/client/producer/DefaultMQProducer.java:516— client/src/main/java/org/apache/rocketmq/client/producer/DefaultMQProducer.java:516-527 | client/src/main/java/org/apache/rocketmq/client/producer/DefaultMQProducer.java:617-629 — These two members are one piece of code written twice and then edited apart: 12 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 (12 corresponding lines) broker/src/main/java/org/apache/rocketmq/broker/latency/BrokerFastFailure.java:68— broker/src/main/java/org/apache/rocketmq/broker/latency/BrokerFastFailure.java:68-79 | proxy/src/main/java/org/apache/rocketmq/proxy/remoting/RemotingProtocolServer.java:401-413 — These two members are one piece of code written twice and then edited apart: 12 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 (12 corresponding lines) broker/src/main/java/org/apache/rocketmq/broker/offset/LmqConsumerOffsetManager.java:43— broker/src/main/java/org/apache/rocketmq/broker/offset/LmqConsumerOffsetManager.java:43-54 | broker/src/main/java/org/apache/rocketmq/broker/offset/LmqConsumerOffsetManager.java:57-69 — These two members are one piece of code written twice and then edited apart: 12 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 (12 corresponding lines) broker/src/main/java/org/apache/rocketmq/broker/transaction/TransactionMetrics.java:68— broker/src/main/java/org/apache/rocketmq/broker/transaction/TransactionMetrics.java:68-79 | store/src/main/java/org/apache/rocketmq/store/timer/TimerMetrics.java:93-104 — These two members are one piece of code written twice and then edited apart: 12 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 (12 corresponding lines) broker/src/main/java/org/apache/rocketmq/broker/subscription/SubscriptionGroupManager.java:387— broker/src/main/java/org/apache/rocketmq/broker/subscription/SubscriptionGroupManager.java:387-399 | broker/src/main/java/org/apache/rocketmq/broker/topic/TopicConfigManager.java:618-629 — These two members are one piece of code written twice and then edited apart: 12 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 (12 corresponding lines) store/src/main/java/org/apache/rocketmq/store/ha/DefaultHAClient.java:391— store/src/main/java/org/apache/rocketmq/store/ha/DefaultHAClient.java:391-402 | store/src/main/java/org/apache/rocketmq/store/ha/autoswitch/AutoSwitchHAClient.java:271-283 — These two members are one piece of code written twice and then edited apart: 12 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 (12 corresponding lines) broker/src/main/java/org/apache/rocketmq/broker/BrokerController.java:1807— broker/src/main/java/org/apache/rocketmq/broker/BrokerController.java:1807-1818 | tieredstore/src/main/java/org/apache/rocketmq/tieredstore/MessageStoreExecutor.java:81-94 — These two members are one piece of code written twice and then edited apart: 12 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 (12 corresponding lines) example/src/main/java/org/apache/rocketmq/example/lmq/LMQPushPopConsumer.java:90— example/src/main/java/org/apache/rocketmq/example/lmq/LMQPushPopConsumer.java:90-102 | example/src/main/java/org/apache/rocketmq/example/simple/PopConsumer.java:54-65 — These two members are one piece of code written twice and then edited apart: 12 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 (13 lines × 2) broker/src/main/java/org/apache/rocketmq/broker/BrokerStartup.java:267— broker/src/main/java/org/apache/rocketmq/broker/BrokerStartup.java:267-279 | container/src/main/java/org/apache/rocketmq/container/BrokerContainerStartup.java:373-385 — 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) broker/src/main/java/org/apache/rocketmq/broker/out/BrokerOuterAPI.java:986— broker/src/main/java/org/apache/rocketmq/broker/out/BrokerOuterAPI.java:986-998 | client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:3035-3047 — 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:986` 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 (13 lines × 2) broker/src/main/java/org/apache/rocketmq/broker/processor/PopReviveService.java:253— broker/src/main/java/org/apache/rocketmq/broker/processor/PopReviveService.java:253-265 | 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:253` 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) client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:2227— client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:2227-2239 | client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:2247-2259 — 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:2227` 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:2246` calls `setClusterName` and `client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:2226` 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/ConsumeMessageConcurrentlyService.java:362— client/src/main/java/org/apache/rocketmq/client/impl/consumer/ConsumeMessageConcurrentlyService.java:362-374 | client/src/main/java/org/apache/rocketmq/client/impl/consumer/ConsumeMessagePopConcurrentlyService.java:375-387 — 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 7 separate duplicated blocks between them, totalling at least 117 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:362` 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) 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:503-515 — 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:1007— client/src/main/java/org/apache/rocketmq/client/impl/producer/DefaultMQProducerImpl.java:1007-1019 | proxy/src/main/java/org/apache/rocketmq/proxy/processor/ProducerProcessor.java:211-223 — 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/producer/DefaultMQProducerImpl.java:1663— client/src/main/java/org/apache/rocketmq/client/impl/producer/DefaultMQProducerImpl.java:1663-1678 | client/src/main/java/org/apache/rocketmq/client/impl/producer/DefaultMQProducerImpl.java:1724-1736 — 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:1663` 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 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) proxy/src/main/java/org/apache/rocketmq/proxy/grpc/pipeline/AuthorizationPipeline.java:46— proxy/src/main/java/org/apache/rocketmq/proxy/grpc/pipeline/AuthorizationPipeline.java:46-58 | proxy/src/main/java/org/apache/rocketmq/proxy/remoting/pipeline/AuthorizationPipeline.java:47-59 — before extracting anything, compare `proxy/src/main/java/org/apache/rocketmq/proxy/grpc/pipeline/AuthorizationPipeline.java` and `proxy/src/main/java/org/apache/rocketmq/proxy/remoting/pipeline/AuthorizationPipeline.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. 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. Note first that the copies are not typed on the same thing: the declarations holding them bind `request` to `GeneratedMessageV3` in one and `RemotingCommand` 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) proxy/src/main/java/org/apache/rocketmq/proxy/remoting/MultiProtocolTlsHelper.java:102— proxy/src/main/java/org/apache/rocketmq/proxy/remoting/MultiProtocolTlsHelper.java:102-114 | remoting/src/main/java/org/apache/rocketmq/remoting/netty/TlsHelper.java:231-243 — 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 (13 lines × 2) proxy/src/main/java/org/apache/rocketmq/proxy/service/message/LocalMessageService.java:216— proxy/src/main/java/org/apache/rocketmq/proxy/service/message/LocalMessageService.java:216-228 | proxy/src/main/java/org/apache/rocketmq/proxy/service/message/LocalMessageService.java:283-295 — 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:216` 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) remoting/src/main/java/org/apache/rocketmq/remoting/common/RemotingHelper.java:233— remoting/src/main/java/org/apache/rocketmq/remoting/common/RemotingHelper.java:233-245 | remoting/src/main/java/org/apache/rocketmq/remoting/common/RemotingHelper.java:249-261 — 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/common/RemotingHelper.java:233` 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 (13 lines × 2) remoting/src/main/java/org/apache/rocketmq/remoting/netty/NettyRemotingAbstract.java:252— remoting/src/main/java/org/apache/rocketmq/remoting/netty/NettyRemotingAbstract.java:252-264 | remoting/src/main/java/org/apache/rocketmq/remoting/netty/NettyRemotingAbstract.java:304-316 — 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/NettyRemotingAbstract.java:252` 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/DefaultMessageStore.java:1887— store/src/main/java/org/apache/rocketmq/store/DefaultMessageStore.java:1887-1899 | 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:1887` 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) auth/src/main/java/org/apache/rocketmq/auth/authorization/builder/DefaultAuthorizationContextBuilder.java:411— auth/src/main/java/org/apache/rocketmq/auth/authorization/builder/DefaultAuthorizationContextBuilder.java:411-423 | auth/src/main/java/org/apache/rocketmq/auth/authorization/builder/DefaultAuthorizationContextBuilder.java:428-440 — 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) broker/src/main/java/org/apache/rocketmq/broker/processor/PopReviveService.java:406— broker/src/main/java/org/apache/rocketmq/broker/processor/PopReviveService.java:406-418 | broker/src/main/java/org/apache/rocketmq/broker/processor/PopReviveService.java:432-444 — 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:406` 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/DefaultHAService.java:226— store/src/main/java/org/apache/rocketmq/store/ha/DefaultHAService.java:226-238 | store/src/main/java/org/apache/rocketmq/store/ha/autoswitch/AutoSwitchHAService.java:387-399 — 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:226` 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/BrokerController.java:1999— broker/src/main/java/org/apache/rocketmq/broker/BrokerController.java:1999-2011 | container/src/main/java/org/apache/rocketmq/container/InnerBrokerController.java:97-109 — 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 3 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. Read the line range as the matched WINDOW rather than a finished unit: at `broker/src/main/java/org/apache/rocketmq/broker/BrokerController.java:1999` 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:1485— store/src/main/java/org/apache/rocketmq/store/CommitLog.java:1485-1497 | store/src/main/java/org/apache/rocketmq/store/dledger/DLedgerCommitLog.java:826-838 — 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 (13 lines × 2) example/src/main/java/org/apache/rocketmq/example/lmq/LMQPushConsumer.java:69— example/src/main/java/org/apache/rocketmq/example/lmq/LMQPushConsumer.java:69-81 | example/src/main/java/org/apache/rocketmq/example/lmq/LMQPushPopConsumer.java:71-83 — 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 (13 lines × 2) tools/src/main/java/org/apache/rocketmq/tools/command/auth/GetAclSubCommand.java:100— tools/src/main/java/org/apache/rocketmq/tools/command/auth/GetAclSubCommand.java:100-112 | tools/src/main/java/org/apache/rocketmq/tools/command/auth/ListAclSubCommand.java:106-118 — before extracting anything, compare `tools/src/main/java/org/apache/rocketmq/tools/command/auth/GetAclSubCommand.java` and `tools/src/main/java/org/apache/rocketmq/tools/command/auth/ListAclSubCommand.java` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 52 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/auth/GetAclSubCommand.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.
Duplicated block (13 lines × 2) tools/src/main/java/org/apache/rocketmq/tools/command/auth/GetUserSubCommand.java:101— tools/src/main/java/org/apache/rocketmq/tools/command/auth/GetUserSubCommand.java:101-113 | tools/src/main/java/org/apache/rocketmq/tools/command/auth/ListUserSubCommand.java:103-115 — before extracting anything, compare `tools/src/main/java/org/apache/rocketmq/tools/command/auth/GetUserSubCommand.java` and `tools/src/main/java/org/apache/rocketmq/tools/command/auth/ListUserSubCommand.java` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 62 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/auth/GetUserSubCommand.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.
D4 · Code Duplication· Edited copy of a member (14 corresponding lines) · ×17
Edited copy of a member (14 corresponding lines) client/src/main/java/org/apache/rocketmq/client/impl/admin/MqClientAdminImpl.java:122— client/src/main/java/org/apache/rocketmq/client/impl/admin/MqClientAdminImpl.java:122-135 | client/src/main/java/org/apache/rocketmq/client/impl/admin/MqClientAdminImpl.java:237-252 — These two members are one piece of code written twice and then edited apart: 14 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 (14 corresponding lines) remoting/src/main/java/org/apache/rocketmq/remoting/protocol/statictopic/TopicQueueMappingInfo.java:106— remoting/src/main/java/org/apache/rocketmq/remoting/protocol/statictopic/TopicQueueMappingInfo.java:106-119 | remoting/src/main/java/org/apache/rocketmq/remoting/protocol/statictopic/TopicQueueMappingOne.java:59-76 — These two members are one piece of code written twice and then edited apart: 14 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 (14 corresponding lines) store/src/main/java/org/apache/rocketmq/store/timer/TimerWheel.java:326— store/src/main/java/org/apache/rocketmq/store/timer/TimerWheel.java:326-344 | store/src/main/java/org/apache/rocketmq/store/timer/TimerWheel.java:350-363 — These two members are one piece of code written twice and then edited apart: 14 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 (14 corresponding lines) broker/src/main/java/org/apache/rocketmq/broker/processor/AdminBrokerProcessor.java:972— broker/src/main/java/org/apache/rocketmq/broker/processor/AdminBrokerProcessor.java:972-985 | broker/src/main/java/org/apache/rocketmq/broker/processor/AdminBrokerProcessor.java:987-1000 — These two members are one piece of code written twice and then edited apart: 14 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 (14 corresponding lines) client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:3657— client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:3657-3670 | client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:3734-3747 — These two members are one piece of code written twice and then edited apart: 14 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 (14 corresponding lines) broker/src/main/java/org/apache/rocketmq/broker/out/BrokerOuterAPI.java:1305— broker/src/main/java/org/apache/rocketmq/broker/out/BrokerOuterAPI.java:1305-1318 | client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:2064-2078 — These two members are one piece of code written twice and then edited apart: 14 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 (14 corresponding lines) common/src/main/java/org/apache/rocketmq/common/statistics/StatisticsBrief.java:104— common/src/main/java/org/apache/rocketmq/common/statistics/StatisticsBrief.java:104-122 | store/src/main/java/org/apache/rocketmq/store/util/PerfCounter.java:167-180 — These two members are one piece of code written twice and then edited apart: 14 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 (14 corresponding lines) broker/src/main/java/org/apache/rocketmq/broker/lite/LiteMetadataUtil.java:116— broker/src/main/java/org/apache/rocketmq/broker/lite/LiteMetadataUtil.java:116-129 | broker/src/main/java/org/apache/rocketmq/broker/lite/LiteMetadataUtil.java:131-144 — These two members are one piece of code written twice and then edited apart: 14 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 (14 corresponding lines) proxy/src/main/java/org/apache/rocketmq/proxy/service/message/LocalMessageService.java:169— proxy/src/main/java/org/apache/rocketmq/proxy/service/message/LocalMessageService.java:169-183 | proxy/src/main/java/org/apache/rocketmq/proxy/service/message/LocalMessageService.java:188-201 — These two members are one piece of code written twice and then edited apart: 14 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 (14 corresponding lines) proxy/src/main/java/org/apache/rocketmq/proxy/grpc/v2/client/ClientActivity.java:576— proxy/src/main/java/org/apache/rocketmq/proxy/grpc/v2/client/ClientActivity.java:576-589 | proxy/src/main/java/org/apache/rocketmq/proxy/service/receipt/DefaultReceiptHandleManager.java:96-111 — These two members are one piece of code written twice and then edited apart: 14 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 (14 corresponding lines) remoting/src/main/java/org/apache/rocketmq/remoting/rpc/RequestBuilder.java:36— remoting/src/main/java/org/apache/rocketmq/remoting/rpc/RequestBuilder.java:36-49 | remoting/src/main/java/org/apache/rocketmq/remoting/rpc/RequestBuilder.java:63-79 — These two members are one piece of code written twice and then edited apart: 14 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 (14 corresponding lines) broker/src/main/java/org/apache/rocketmq/broker/BrokerController.java:1336— broker/src/main/java/org/apache/rocketmq/broker/BrokerController.java:1336-1349 | proxy/src/main/java/org/apache/rocketmq/proxy/remoting/RemotingProtocolServer.java:338-356 — These two members are one piece of code written twice and then edited apart: 14 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 (14 corresponding lines) client/src/main/java/org/apache/rocketmq/client/impl/producer/DefaultMQProducerImpl.java:157— client/src/main/java/org/apache/rocketmq/client/impl/producer/DefaultMQProducerImpl.java:157-170 | proxy/src/main/java/org/apache/rocketmq/proxy/service/route/TopicRouteService.java:103-117 — These two members are one piece of code written twice and then edited apart: 14 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 (14 corresponding lines) store/src/main/java/org/apache/rocketmq/store/logfile/DefaultMappedFile.java:621— store/src/main/java/org/apache/rocketmq/store/logfile/DefaultMappedFile.java:621-634 | store/src/main/java/org/apache/rocketmq/store/logfile/DefaultMappedFile.java:636-649 — These two members are one piece of code written twice and then edited apart: 14 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 (14 corresponding lines) store/src/main/java/org/apache/rocketmq/store/DefaultMessageStore.java:1187— store/src/main/java/org/apache/rocketmq/store/DefaultMessageStore.java:1187-1200 | store/src/main/java/org/apache/rocketmq/store/DefaultMessageStore.java:1203-1216 — These two members are one piece of code written twice and then edited apart: 14 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 (14 corresponding lines) broker/src/main/java/org/apache/rocketmq/broker/client/DefaultConsumerIdsChangeListener.java:47— broker/src/main/java/org/apache/rocketmq/broker/client/DefaultConsumerIdsChangeListener.java:47-61 | client/src/main/java/org/apache/rocketmq/client/latency/LatencyFaultToleranceImpl.java:82-95 — These two members are one piece of code written twice and then edited apart: 14 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 (14 corresponding lines) tools/src/main/java/org/apache/rocketmq/tools/command/message/QueryMsgByIdSubCommand.java:294— tools/src/main/java/org/apache/rocketmq/tools/command/message/QueryMsgByIdSubCommand.java:294-307 | tools/src/main/java/org/apache/rocketmq/tools/command/message/QueryMsgByIdSubCommand.java:311-325 — These two members are one piece of code written twice and then edited apart: 14 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 (11 corresponding lines) · ×17
Edited copy of a member (11 corresponding lines) broker/src/main/java/org/apache/rocketmq/broker/processor/PopBufferMergeService.java:859— broker/src/main/java/org/apache/rocketmq/broker/processor/PopBufferMergeService.java:859-869 | broker/src/main/java/org/apache/rocketmq/broker/processor/PopBufferMergeService.java:873-883 — These two members are one piece of code written twice and then edited apart: 11 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 (11 corresponding lines) controller/src/main/java/org/apache/rocketmq/controller/impl/task/RaftBrokerHeartBeatEventRequest.java:46— controller/src/main/java/org/apache/rocketmq/controller/impl/task/RaftBrokerHeartBeatEventRequest.java:46-60 | controller/src/main/java/org/apache/rocketmq/controller/impl/task/RaftBrokerHeartBeatEventRequest.java:76-86 — These two members are one piece of code written twice and then edited apart: 11 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 (11 corresponding lines) broker/src/main/java/org/apache/rocketmq/broker/pop/PopConsumerLockService.java:71— broker/src/main/java/org/apache/rocketmq/broker/pop/PopConsumerLockService.java:71-81 | broker/src/main/java/org/apache/rocketmq/broker/processor/PopMessageProcessor.java:1074-1092 — These two members are one piece of code written twice and then edited apart: 11 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 (11 corresponding lines) auth/src/main/java/org/apache/rocketmq/auth/authentication/factory/AuthenticationFactory.java:103— auth/src/main/java/org/apache/rocketmq/auth/authentication/factory/AuthenticationFactory.java:103-113 | auth/src/main/java/org/apache/rocketmq/auth/authorization/factory/AuthorizationFactory.java:105-115 — These two members are one piece of code written twice and then edited apart: 11 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 (11 corresponding lines) client/src/main/java/org/apache/rocketmq/client/impl/consumer/DefaultMQPullConsumerImpl.java:410— client/src/main/java/org/apache/rocketmq/client/impl/consumer/DefaultMQPullConsumerImpl.java:410-420 | client/src/main/java/org/apache/rocketmq/client/impl/consumer/DefaultMQPushConsumerImpl.java:1407-1418 — These two members are one piece of code written twice and then edited apart: 11 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 (11 corresponding lines) client/src/main/java/org/apache/rocketmq/client/impl/consumer/ConsumeMessageConcurrentlyService.java:56— client/src/main/java/org/apache/rocketmq/client/impl/consumer/ConsumeMessageConcurrentlyService.java:56-67 | client/src/main/java/org/apache/rocketmq/client/impl/consumer/ConsumeMessageOrderlyService.java:60-70 — These two members are one piece of code written twice and then edited apart: 11 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 (11 corresponding lines) client/src/main/java/org/apache/rocketmq/client/impl/mqclient/MQClientAPIExt.java:539— client/src/main/java/org/apache/rocketmq/client/impl/mqclient/MQClientAPIExt.java:539-549 | client/src/main/java/org/apache/rocketmq/client/impl/mqclient/MQClientAPIExt.java:575-585 — These two members are one piece of code written twice and then edited apart: 11 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 (11 corresponding lines) broker/src/main/java/org/apache/rocketmq/broker/pop/PopConsumerService.java:761— broker/src/main/java/org/apache/rocketmq/broker/pop/PopConsumerService.java:761-771 | broker/src/main/java/org/apache/rocketmq/broker/processor/PopReviveService.java:196-206 — These two members are one piece of code written twice and then edited apart: 11 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 (11 corresponding lines) proxy/src/main/java/org/apache/rocketmq/proxy/grpc/v2/common/GrpcClientSettingsManager.java:70— proxy/src/main/java/org/apache/rocketmq/proxy/grpc/v2/common/GrpcClientSettingsManager.java:70-82 | proxy/src/main/java/org/apache/rocketmq/proxy/grpc/v2/common/GrpcClientSettingsManager.java:204-214 — These two members are one piece of code written twice and then edited apart: 11 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 (11 corresponding lines) proxy/src/main/java/org/apache/rocketmq/proxy/remoting/activity/ClientManagerActivity.java:176— proxy/src/main/java/org/apache/rocketmq/proxy/remoting/activity/ClientManagerActivity.java:176-187 | proxy/src/main/java/org/apache/rocketmq/proxy/service/sysmessage/HeartbeatSyncer.java:102-112 — These two members are one piece of code written twice and then edited apart: 11 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 (11 corresponding lines) broker/src/main/java/org/apache/rocketmq/broker/client/ConsumerGroupInfo.java:60— broker/src/main/java/org/apache/rocketmq/broker/client/ConsumerGroupInfo.java:60-70 | broker/src/main/java/org/apache/rocketmq/broker/client/ConsumerGroupInfo.java:92-104 — These two members are one piece of code written twice and then edited apart: 11 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 (11 corresponding lines) store/src/main/java/org/apache/rocketmq/store/stats/BrokerStatsManager.java:571— store/src/main/java/org/apache/rocketmq/store/stats/BrokerStatsManager.java:571-581 | store/src/main/java/org/apache/rocketmq/store/stats/BrokerStatsManager.java:583-593 — These two members are one piece of code written twice and then edited apart: 11 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 (11 corresponding lines) broker/src/main/java/org/apache/rocketmq/broker/topic/TopicRouteInfoManager.java:205— broker/src/main/java/org/apache/rocketmq/broker/topic/TopicRouteInfoManager.java:205-215 | client/src/main/java/org/apache/rocketmq/client/impl/factory/MQClientInstance.java:1295-1305 — These two members are one piece of code written twice and then edited apart: 11 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 (11 corresponding lines) store/src/main/java/org/apache/rocketmq/store/queue/ConsumeQueueStore.java:95— store/src/main/java/org/apache/rocketmq/store/queue/ConsumeQueueStore.java:95-106 | store/src/main/java/org/apache/rocketmq/store/queue/ConsumeQueueStore.java:626-636 — These two members are one piece of code written twice and then edited apart: 11 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 (11 corresponding lines) remoting/src/main/java/org/apache/rocketmq/remoting/protocol/header/CheckTransactionStateResponseHeader.java:41— remoting/src/main/java/org/apache/rocketmq/remoting/protocol/header/CheckTransactionStateResponseHeader.java:41-51 | remoting/src/main/java/org/apache/rocketmq/remoting/protocol/header/EndTransactionRequestHeader.java:56-70 — These two members are one piece of code written twice and then edited apart: 11 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 (11 corresponding lines) remoting/src/main/java/org/apache/rocketmq/remoting/protocol/statictopic/TopicQueueMappingDetail.java:132— remoting/src/main/java/org/apache/rocketmq/remoting/protocol/statictopic/TopicQueueMappingDetail.java:132-142 | remoting/src/main/java/org/apache/rocketmq/remoting/protocol/statictopic/TopicQueueMappingInfo.java:134-144 — These two members are one piece of code written twice and then edited apart: 11 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 (11 corresponding lines) tools/src/main/java/org/apache/rocketmq/tools/admin/DefaultMQAdminExtImpl.java:1002— tools/src/main/java/org/apache/rocketmq/tools/admin/DefaultMQAdminExtImpl.java:1002-1012 | tools/src/main/java/org/apache/rocketmq/tools/admin/DefaultMQAdminExtImpl.java:1307-1320 — These two members are one piece of code written twice and then edited apart: 11 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 (7 corresponding lines) · ×17
Edited copy of a member (7 corresponding lines) store/src/main/java/org/apache/rocketmq/store/timer/TimerMessageStore.java:1785— store/src/main/java/org/apache/rocketmq/store/timer/TimerMessageStore.java:1785-1791 | store/src/main/java/org/apache/rocketmq/store/timer/TimerMessageStore.java:1821-1827 — These two members are one piece of code written twice and then edited apart: 7 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 (7 corresponding lines) store/src/main/java/org/apache/rocketmq/store/queue/ConsumeQueueStore.java:309— store/src/main/java/org/apache/rocketmq/store/queue/ConsumeQueueStore.java:309-315 | store/src/main/java/org/apache/rocketmq/store/queue/ConsumeQueueStore.java:317-323 — These two members are one piece of code written twice and then edited apart: 7 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 (7 corresponding lines) tieredstore/src/main/java/org/apache/rocketmq/tieredstore/metadata/DefaultMetadataStore.java:57— tieredstore/src/main/java/org/apache/rocketmq/tieredstore/metadata/DefaultMetadataStore.java:57-66 | tieredstore/src/main/java/org/apache/rocketmq/tieredstore/metadata/DefaultMetadataStore.java:297-303 — These two members are one piece of code written twice and then edited apart: 7 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 (7 corresponding lines) common/src/main/java/org/apache/rocketmq/common/stats/MomentStatsItemSet.java:67— common/src/main/java/org/apache/rocketmq/common/stats/MomentStatsItemSet.java:67-73 | common/src/main/java/org/apache/rocketmq/common/stats/StatsItemSet.java:135-141 — These two members are one piece of code written twice and then edited apart: 7 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 (7 corresponding lines) store/src/main/java/org/apache/rocketmq/store/ha/autoswitch/TempBrokerMetadata.java:57— store/src/main/java/org/apache/rocketmq/store/ha/autoswitch/TempBrokerMetadata.java:57-64 | store/src/main/java/org/apache/rocketmq/store/ha/autoswitch/BrokerMetadata.java:53-59 — These two members are one piece of code written twice and then edited apart: 7 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 (7 corresponding lines) broker/src/main/java/org/apache/rocketmq/broker/filter/MessageEvaluationContext.java:46— broker/src/main/java/org/apache/rocketmq/broker/filter/MessageEvaluationContext.java:46-58 | remoting/src/main/java/org/apache/rocketmq/remoting/netty/RemotingCodeDistributionHandler.java:69-75 — These two members are one piece of code written twice and then edited apart: 7 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 (7 corresponding lines) broker/src/main/java/org/apache/rocketmq/broker/pop/PopConsumerService.java:290— broker/src/main/java/org/apache/rocketmq/broker/pop/PopConsumerService.java:290-299 | broker/src/main/java/org/apache/rocketmq/broker/processor/PopLiteMessageProcessor.java:317-323 — These two members are one piece of code written twice and then edited apart: 7 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 (7 corresponding lines) common/src/main/java/org/apache/rocketmq/common/MixAll.java:203— common/src/main/java/org/apache/rocketmq/common/MixAll.java:203-213 | remoting/src/main/java/org/apache/rocketmq/remoting/common/RemotingHelper.java:98-104 — These two members are one piece of code written twice and then edited apart: 7 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 (7 corresponding lines) store/src/main/java/org/apache/rocketmq/store/ha/autoswitch/TempBrokerMetadata.java:47— store/src/main/java/org/apache/rocketmq/store/ha/autoswitch/TempBrokerMetadata.java:47-54 | store/src/main/java/org/apache/rocketmq/store/ha/autoswitch/BrokerMetadata.java:44-50 — These two members are one piece of code written twice and then edited apart: 7 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 (7 corresponding lines) store/src/main/java/org/apache/rocketmq/store/ha/DefaultHAConnection.java:87— store/src/main/java/org/apache/rocketmq/store/ha/DefaultHAConnection.java:87-93 | store/src/main/java/org/apache/rocketmq/store/ha/autoswitch/AutoSwitchHAConnection.java:134-140 — These two members are one piece of code written twice and then edited apart: 7 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 (7 corresponding lines) auth/src/main/java/org/apache/rocketmq/auth/authentication/factory/AuthenticationFactory.java:115— auth/src/main/java/org/apache/rocketmq/auth/authentication/factory/AuthenticationFactory.java:115-121 | auth/src/main/java/org/apache/rocketmq/auth/authorization/factory/AuthorizationFactory.java:118-124 — These two members are one piece of code written twice and then edited apart: 7 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 (7 corresponding lines) auth/src/main/java/org/apache/rocketmq/auth/authentication/factory/AuthenticationFactory.java:124— auth/src/main/java/org/apache/rocketmq/auth/authentication/factory/AuthenticationFactory.java:124-130 | auth/src/main/java/org/apache/rocketmq/auth/authorization/factory/AuthorizationFactory.java:127-133 — These two members are one piece of code written twice and then edited apart: 7 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 (7 corresponding lines) broker/src/main/java/org/apache/rocketmq/broker/BrokerController.java:836— broker/src/main/java/org/apache/rocketmq/broker/BrokerController.java:836-842 | container/src/main/java/org/apache/rocketmq/container/BrokerContainer.java:172-178 — These two members are one piece of code written twice and then edited apart: 7 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 (7 corresponding lines) broker/src/main/java/org/apache/rocketmq/broker/BrokerController.java:2010— broker/src/main/java/org/apache/rocketmq/broker/BrokerController.java:2010-2016 | container/src/main/java/org/apache/rocketmq/container/InnerBrokerController.java:108-114 — These two members are one piece of code written twice and then edited apart: 7 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 (7 corresponding lines) broker/src/main/java/org/apache/rocketmq/broker/BrokerController.java:2030— broker/src/main/java/org/apache/rocketmq/broker/BrokerController.java:2030-2036 | container/src/main/java/org/apache/rocketmq/container/BrokerContainer.java:184-190 — These two members are one piece of code written twice and then edited apart: 7 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 (7 corresponding lines) remoting/src/main/java/org/apache/rocketmq/remoting/protocol/body/EpochEntryCache.java:30— remoting/src/main/java/org/apache/rocketmq/remoting/protocol/body/EpochEntryCache.java:30-36 | remoting/src/main/java/org/apache/rocketmq/remoting/protocol/header/controller/register/RegisterBrokerToControllerRequestHeader.java:45-51 — These two members are one piece of code written twice and then edited apart: 7 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 (7 corresponding lines) proxy/src/main/java/org/apache/rocketmq/proxy/common/utils/GrpcUtils.java:51— proxy/src/main/java/org/apache/rocketmq/proxy/common/utils/GrpcUtils.java:51-57 | proxy/src/main/java/org/apache/rocketmq/proxy/remoting/channel/RemotingChannelManager.java:80-86 — These two members are one piece of code written twice and then edited apart: 7 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 (13 corresponding lines) · ×16
Edited copy of a member (13 corresponding lines) auth/src/main/java/org/apache/rocketmq/auth/authorization/builder/DefaultAuthorizationContextBuilder.java:733— auth/src/main/java/org/apache/rocketmq/auth/authorization/builder/DefaultAuthorizationContextBuilder.java:733-746 | auth/src/main/java/org/apache/rocketmq/auth/authorization/builder/DefaultAuthorizationContextBuilder.java:772-784 — These two members are one piece of code written twice and then edited apart: 13 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 (13 corresponding lines) common/src/main/java/org/apache/rocketmq/common/lite/LiteUtil.java:56— common/src/main/java/org/apache/rocketmq/common/lite/LiteUtil.java:56-68 | common/src/main/java/org/apache/rocketmq/common/lite/LiteUtil.java:70-82 — These two members are one piece of code written twice and then edited apart: 13 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 (13 corresponding lines) common/src/main/java/org/apache/rocketmq/common/message/MessageDecoder.java:156— common/src/main/java/org/apache/rocketmq/common/message/MessageDecoder.java:156-168 | common/src/main/java/org/apache/rocketmq/common/message/MessageDecoder.java:170-182 — These two members are one piece of code written twice and then edited apart: 13 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 (13 corresponding lines) store/src/main/java/org/apache/rocketmq/store/ha/autoswitch/AutoSwitchHAConnection.java:231— store/src/main/java/org/apache/rocketmq/store/ha/autoswitch/AutoSwitchHAConnection.java:231-243 | store/src/main/java/org/apache/rocketmq/store/ha/autoswitch/AutoSwitchHAConnection.java:462-475 — These two members are one piece of code written twice and then edited apart: 13 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 (13 corresponding lines) store/src/main/java/org/apache/rocketmq/store/rocksdb/MessageRocksDBStorage.java:308— store/src/main/java/org/apache/rocketmq/store/rocksdb/MessageRocksDBStorage.java:308-320 | store/src/main/java/org/apache/rocketmq/store/rocksdb/MessageRocksDBStorage.java:622-634 — These two members are one piece of code written twice and then edited apart: 13 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 (13 corresponding lines) remoting/src/main/java/org/apache/rocketmq/remoting/protocol/header/ExtraInfoUtil.java:142— remoting/src/main/java/org/apache/rocketmq/remoting/protocol/header/ExtraInfoUtil.java:142-154 | remoting/src/main/java/org/apache/rocketmq/remoting/protocol/header/ExtraInfoUtil.java:156-168 — These two members are one piece of code written twice and then edited apart: 13 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 (13 corresponding lines) store/src/main/java/org/apache/rocketmq/store/index/IndexService.java:155— store/src/main/java/org/apache/rocketmq/store/index/IndexService.java:155-167 | store/src/main/java/org/apache/rocketmq/store/index/IndexService.java:408-424 — These two members are one piece of code written twice and then edited apart: 13 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 (13 corresponding lines) REDACTED:1061— REDACTED:1061-1073 | REDACTED:1075-1088 — These two members are one piece of code written twice and then edited apart: 13 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 (13 corresponding lines) client/src/main/java/org/apache/rocketmq/client/impl/consumer/DefaultLitePullConsumerImpl.java:1081— client/src/main/java/org/apache/rocketmq/client/impl/consumer/DefaultLitePullConsumerImpl.java:1081-1093 | client/src/main/java/org/apache/rocketmq/client/impl/consumer/DefaultMQPullConsumerImpl.java:287-299 — These two members are one piece of code written twice and then edited apart: 13 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 (13 corresponding lines) client/src/main/java/org/apache/rocketmq/client/impl/consumer/ProcessQueue.java:253— client/src/main/java/org/apache/rocketmq/client/impl/consumer/ProcessQueue.java:253-265 | client/src/main/java/org/apache/rocketmq/client/impl/consumer/ProcessQueue.java:379-394 — These two members are one piece of code written twice and then edited apart: 13 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 (13 corresponding lines) client/src/main/java/org/apache/rocketmq/client/impl/producer/DefaultMQProducerImpl.java:560— client/src/main/java/org/apache/rocketmq/client/impl/producer/DefaultMQProducerImpl.java:560-572 | client/src/main/java/org/apache/rocketmq/client/impl/producer/DefaultMQProducerImpl.java:1399-1415 — These two members are one piece of code written twice and then edited apart: 13 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 (13 corresponding lines) broker/src/main/java/org/apache/rocketmq/broker/subscription/SubscriptionGroupManager.java:430— broker/src/main/java/org/apache/rocketmq/broker/subscription/SubscriptionGroupManager.java:430-442 | broker/src/main/java/org/apache/rocketmq/broker/topic/TopicConfigManager.java:768-780 — These two members are one piece of code written twice and then edited apart: 13 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 (13 corresponding lines) broker/src/main/java/org/apache/rocketmq/broker/processor/ClientManageProcessor.java:59— broker/src/main/java/org/apache/rocketmq/broker/processor/ClientManageProcessor.java:59-71 | proxy/src/main/java/org/apache/rocketmq/proxy/remoting/activity/ClientManagerActivity.java:64-76 — These two members are one piece of code written twice and then edited apart: 13 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 (13 corresponding lines) namesrv/src/main/java/org/apache/rocketmq/namesrv/routeinfo/RouteInfoManager.java:503— namesrv/src/main/java/org/apache/rocketmq/namesrv/routeinfo/RouteInfoManager.java:503-516 | namesrv/src/main/java/org/apache/rocketmq/namesrv/routeinfo/RouteInfoManager.java:518-530 — These two members are one piece of code written twice and then edited apart: 13 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 (13 corresponding lines) proxy/src/main/java/org/apache/rocketmq/proxy/service/metadata/ClusterMetadataService.java:148— proxy/src/main/java/org/apache/rocketmq/proxy/service/metadata/ClusterMetadataService.java:148-160 | proxy/src/main/java/org/apache/rocketmq/proxy/service/metadata/ClusterMetadataService.java:163-175 — These two members are one piece of code written twice and then edited apart: 13 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 (13 corresponding lines) tools/src/main/java/org/apache/rocketmq/tools/command/broker/GetBrokerEpochSubCommand.java:93— tools/src/main/java/org/apache/rocketmq/tools/command/broker/GetBrokerEpochSubCommand.java:93-105 | tools/src/main/java/org/apache/rocketmq/tools/command/ha/GetSyncStateSetSubCommand.java:99-113 — These two members are one piece of code written twice and then edited apart: 13 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 (9 corresponding lines) · ×16
Edited copy of a member (9 corresponding lines) remoting/src/main/java/org/apache/rocketmq/remoting/Configuration.java:336— remoting/src/main/java/org/apache/rocketmq/remoting/Configuration.java:336-344 | remoting/src/main/java/org/apache/rocketmq/remoting/Configuration.java:346-358 — These two members are one piece of code written twice and then edited apart: 9 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 (9 corresponding lines) broker/src/main/java/org/apache/rocketmq/broker/subscription/SubscriptionGroupManager.java:348— broker/src/main/java/org/apache/rocketmq/broker/subscription/SubscriptionGroupManager.java:348-356 | broker/src/main/java/org/apache/rocketmq/broker/topic/TopicQueueMappingManager.java:192-200 — These two members are one piece of code written twice and then edited apart: 9 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 (9 corresponding lines) proxy/src/main/java/org/apache/rocketmq/proxy/grpc/ProxyAndTlsProtocolNegotiator.java:263— proxy/src/main/java/org/apache/rocketmq/proxy/grpc/ProxyAndTlsProtocolNegotiator.java:263-271 | remoting/src/main/java/org/apache/rocketmq/remoting/netty/NettyRemotingServer.java:826-834 — These two members are one piece of code written twice and then edited apart: 9 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 (9 corresponding lines) store/src/main/java/org/apache/rocketmq/store/queue/BatchConsumeQueue.java:196— store/src/main/java/org/apache/rocketmq/store/queue/BatchConsumeQueue.java:196-204 | store/src/main/java/org/apache/rocketmq/store/queue/SparseConsumeQueue.java:231-242 — These two members are one piece of code written twice and then edited apart: 9 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 (9 corresponding lines) controller/src/main/java/org/apache/rocketmq/controller/impl/heartbeat/DefaultBrokerHeartbeatManager.java:169— controller/src/main/java/org/apache/rocketmq/controller/impl/heartbeat/DefaultBrokerHeartbeatManager.java:169-177 | controller/src/main/java/org/apache/rocketmq/controller/impl/manager/RaftReplicasInfoManager.java:151-159 — These two members are one piece of code written twice and then edited apart: 9 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 (9 corresponding lines) broker/src/main/java/org/apache/rocketmq/broker/processor/AdminBrokerProcessor.java:2534— broker/src/main/java/org/apache/rocketmq/broker/processor/AdminBrokerProcessor.java:2534-2546 | broker/src/main/java/org/apache/rocketmq/broker/processor/AdminBrokerProcessor.java:2558-2566 — These two members are one piece of code written twice and then edited apart: 9 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 (9 corresponding lines) broker/src/main/java/org/apache/rocketmq/broker/coldctr/PIDAdaptiveColdCtrStrategy.java:65— broker/src/main/java/org/apache/rocketmq/broker/coldctr/PIDAdaptiveColdCtrStrategy.java:65-73 | broker/src/main/java/org/apache/rocketmq/broker/coldctr/SimpleColdCtrStrategy.java:37-46 — These two members are one piece of code written twice and then edited apart: 9 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 (9 corresponding lines) broker/src/main/java/org/apache/rocketmq/broker/metrics/PopMetricsManager.java:201— broker/src/main/java/org/apache/rocketmq/broker/metrics/PopMetricsManager.java:201-210 | broker/src/main/java/org/apache/rocketmq/broker/metrics/PopMetricsManager.java:212-220 — These two members are one piece of code written twice and then edited apart: 9 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 (9 corresponding lines) remoting/src/main/java/org/apache/rocketmq/remoting/netty/NettyRemotingClient.java:251— remoting/src/main/java/org/apache/rocketmq/remoting/netty/NettyRemotingClient.java:251-259 | remoting/src/main/java/org/apache/rocketmq/remoting/netty/NettyRemotingServer.java:266-276 — These two members are one piece of code written twice and then edited apart: 9 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 (9 corresponding lines) store/src/main/java/org/apache/rocketmq/store/ha/DefaultHAConnection.java:95— store/src/main/java/org/apache/rocketmq/store/ha/DefaultHAConnection.java:95-103 | store/src/main/java/org/apache/rocketmq/store/ha/autoswitch/AutoSwitchHAConnection.java:143-151 — These two members are one piece of code written twice and then edited apart: 9 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 (9 corresponding lines) store/src/main/java/org/apache/rocketmq/store/CommitLog.java:1710— store/src/main/java/org/apache/rocketmq/store/CommitLog.java:1710-1718 | store/src/main/java/org/apache/rocketmq/store/ha/GroupTransferService.java:54-62 — These two members are one piece of code written twice and then edited apart: 9 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 (9 corresponding lines) broker/src/main/java/org/apache/rocketmq/broker/config/v1/RocksDBSubscriptionGroupManager.java:101— broker/src/main/java/org/apache/rocketmq/broker/config/v1/RocksDBSubscriptionGroupManager.java:101-109 | store/src/main/java/org/apache/rocketmq/store/kv/CompactionService.java:72-80 — These two members are one piece of code written twice and then edited apart: 9 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 (9 corresponding lines) tools/src/main/java/org/apache/rocketmq/tools/admin/DefaultMQAdminExtImpl.java:757— tools/src/main/java/org/apache/rocketmq/tools/admin/DefaultMQAdminExtImpl.java:757-765 | tools/src/main/java/org/apache/rocketmq/tools/admin/DefaultMQAdminExtImpl.java:1903-1911 — These two members are one piece of code written twice and then edited apart: 9 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 (9 corresponding lines) tools/src/main/java/org/apache/rocketmq/tools/admin/DefaultMQAdminExtImpl.java:579— tools/src/main/java/org/apache/rocketmq/tools/admin/DefaultMQAdminExtImpl.java:579-587 | tools/src/main/java/org/apache/rocketmq/tools/admin/DefaultMQAdminExtImpl.java:591-599 — These two members are one piece of code written twice and then edited apart: 9 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 (9 corresponding lines) tools/src/main/java/org/apache/rocketmq/tools/command/broker/BrokerStatusSubCommand.java:51— tools/src/main/java/org/apache/rocketmq/tools/command/broker/BrokerStatusSubCommand.java:51-63 | tools/src/main/java/org/apache/rocketmq/tools/command/broker/GetBrokerConfigCommand.java:53-61 — These two members are one piece of code written twice and then edited apart: 9 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 (9 corresponding lines) tools/src/main/java/org/apache/rocketmq/tools/command/message/PrintMessageByQueueCommand.java:90— tools/src/main/java/org/apache/rocketmq/tools/command/message/PrintMessageByQueueCommand.java:90-102 | tools/src/main/java/org/apache/rocketmq/tools/command/message/PrintMessageSubCommand.java:49-57 — These two members are one piece of code written twice and then edited apart: 9 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 (10 corresponding lines) · ×15
Edited copy of a member (10 corresponding lines) store/src/main/java/org/apache/rocketmq/store/stats/BrokerStatsManager.java:488— store/src/main/java/org/apache/rocketmq/store/stats/BrokerStatsManager.java:488-497 | store/src/main/java/org/apache/rocketmq/store/stats/BrokerStatsManager.java:499-508 — These two members are one piece of code written twice and then edited apart: 10 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 (10 corresponding lines) client/src/main/java/org/apache/rocketmq/client/producer/DefaultMQProducer.java:680— client/src/main/java/org/apache/rocketmq/client/producer/DefaultMQProducer.java:680-689 | client/src/main/java/org/apache/rocketmq/client/producer/DefaultMQProducer.java:725-738 — These two members are one piece of code written twice and then edited apart: 10 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 (10 corresponding lines) client/src/main/java/org/apache/rocketmq/client/impl/consumer/AssignedMessageQueue.java:167— client/src/main/java/org/apache/rocketmq/client/impl/consumer/AssignedMessageQueue.java:167-177 | client/src/main/java/org/apache/rocketmq/client/impl/consumer/DefaultLitePullConsumerImpl.java:721-730 — These two members are one piece of code written twice and then edited apart: 10 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 (10 corresponding lines) store/src/main/java/org/apache/rocketmq/store/DefaultMessageStore.java:1295— store/src/main/java/org/apache/rocketmq/store/DefaultMessageStore.java:1295-1305 | store/src/main/java/org/apache/rocketmq/store/DefaultMessageStore.java:1326-1335 — These two members are one piece of code written twice and then edited apart: 10 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 (10 corresponding lines) client/src/main/java/org/apache/rocketmq/client/impl/consumer/ConsumeMessageOrderlyService.java:73— client/src/main/java/org/apache/rocketmq/client/impl/consumer/ConsumeMessageOrderlyService.java:73-86 | client/src/main/java/org/apache/rocketmq/client/impl/consumer/ConsumeMessagePopOrderlyService.java:68-77 — These two members are one piece of code written twice and then edited apart: 10 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 (10 corresponding lines) controller/src/main/java/org/apache/rocketmq/controller/ControllerStartup.java:154— controller/src/main/java/org/apache/rocketmq/controller/ControllerStartup.java:154-164 | namesrv/src/main/java/org/apache/rocketmq/namesrv/NamesrvStartup.java:229-238 — These two members are one piece of code written twice and then edited apart: 10 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 (10 corresponding lines) client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:3244— client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:3244-3254 | client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:3795-3804 — These two members are one piece of code written twice and then edited apart: 10 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 (10 corresponding lines) broker/src/main/java/org/apache/rocketmq/broker/transaction/queue/TransactionalMessageBridge.java:251— broker/src/main/java/org/apache/rocketmq/broker/transaction/queue/TransactionalMessageBridge.java:251-261 | broker/src/main/java/org/apache/rocketmq/broker/transaction/queue/TransactionalMessageBridge.java:358-367 — These two members are one piece of code written twice and then edited apart: 10 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 (10 corresponding lines) tieredstore/src/main/java/org/apache/rocketmq/tieredstore/core/MessageStoreFetcherImpl.java:126— tieredstore/src/main/java/org/apache/rocketmq/tieredstore/core/MessageStoreFetcherImpl.java:126-139 | tieredstore/src/main/java/org/apache/rocketmq/tieredstore/core/MessageStoreFetcherImpl.java:142-151 — These two members are one piece of code written twice and then edited apart: 10 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 (10 corresponding lines) proxy/src/main/java/org/apache/rocketmq/proxy/grpc/v2/common/GrpcValidator.java:103— proxy/src/main/java/org/apache/rocketmq/proxy/grpc/v2/common/GrpcValidator.java:103-115 | proxy/src/main/java/org/apache/rocketmq/proxy/grpc/v2/producer/SendMessageActivity.java:149-158 — These two members are one piece of code written twice and then edited apart: 10 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 (10 corresponding lines) broker/src/main/java/org/apache/rocketmq/broker/config/v2/SubscriptionGroupManagerV2.java:46— broker/src/main/java/org/apache/rocketmq/broker/config/v2/SubscriptionGroupManagerV2.java:46-57 | broker/src/main/java/org/apache/rocketmq/broker/config/v2/TopicConfigManagerV2.java:50-59 — These two members are one piece of code written twice and then edited apart: 10 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 (10 corresponding lines) proxy/src/main/java/org/apache/rocketmq/proxy/common/RenewStrategyPolicy.java:60— proxy/src/main/java/org/apache/rocketmq/proxy/common/RenewStrategyPolicy.java:60-69 | remoting/src/main/java/org/apache/rocketmq/remoting/protocol/subscription/CustomizedRetryPolicy.java:82-91 — These two members are one piece of code written twice and then edited apart: 10 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 (10 corresponding lines) store/src/main/java/org/apache/rocketmq/store/index/rocksdb/IndexRocksDBStore.java:263— store/src/main/java/org/apache/rocketmq/store/index/rocksdb/IndexRocksDBStore.java:263-272 | store/src/main/java/org/apache/rocketmq/store/transaction/TransMessageRocksDBStore.java:349-358 — These two members are one piece of code written twice and then edited apart: 10 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 (10 corresponding lines) store/src/main/java/org/apache/rocketmq/store/CommitLog.java:1720— store/src/main/java/org/apache/rocketmq/store/CommitLog.java:1720-1729 | store/src/main/java/org/apache/rocketmq/store/ha/GroupTransferService.java:68-77 — These two members are one piece of code written twice and then edited apart: 10 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 (10 corresponding lines) broker/src/main/java/org/apache/rocketmq/broker/processor/AbstractSendMessageProcessor.java:340— broker/src/main/java/org/apache/rocketmq/broker/processor/AbstractSendMessageProcessor.java:340-350 | client/src/main/java/org/apache/rocketmq/client/impl/consumer/DefaultMQPullConsumerImpl.java:331-340 — These two members are one piece of code written twice and then edited apart: 10 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.
Swallowed exception (caught, then discarded) store/src/main/java/org/apache/rocketmq/store/util/PerfCounter.java:293— `catch (Throwable)` 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) remoting/src/main/java/org/apache/rocketmq/remoting/protocol/RemotingCommand.java:287— `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) proxy/src/main/java/org/apache/rocketmq/proxy/service/route/TopicRouteService.java:114— `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) proxy/src/main/java/org/apache/rocketmq/proxy/service/route/TopicRouteService.java:125— `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) proxy/src/main/java/org/apache/rocketmq/proxy/service/metadata/ClusterMetadataService.java:124— `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) proxy/src/main/java/org/apache/rocketmq/proxy/service/metadata/ClusterMetadataService.java:138— `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) proxy/src/main/java/org/apache/rocketmq/proxy/service/admin/DefaultAdminService.java:100— `catch (Throwable)` 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) proxy/src/main/java/org/apache/rocketmq/proxy/grpc/v2/producer/SendMessageActivity.java:420— `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) proxy/src/main/java/org/apache/rocketmq/proxy/grpc/v2/consumer/ReceiveMessageActivity.java:238— `catch (Throwable)` 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:220— `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:70— `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:227— `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:285— `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:435— `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:443— `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· Edited copy of a member (15 corresponding lines) · ×14
Edited copy of a member (15 corresponding lines) store/src/main/java/org/apache/rocketmq/store/rocksdb/MessageRocksDBStorage.java:248— store/src/main/java/org/apache/rocketmq/store/rocksdb/MessageRocksDBStorage.java:248-264 | store/src/main/java/org/apache/rocketmq/store/rocksdb/MessageRocksDBStorage.java:425-439 — These two members are one piece of code written twice and then edited apart: 15 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 (15 corresponding lines) broker/src/main/java/org/apache/rocketmq/broker/offset/ConsumerOffsetManager.java:72— broker/src/main/java/org/apache/rocketmq/broker/offset/ConsumerOffsetManager.java:72-86 | broker/src/main/java/org/apache/rocketmq/broker/offset/LmqConsumerOffsetManager.java:118-136 — These two members are one piece of code written twice and then edited apart: 15 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 (15 corresponding lines) broker/src/main/java/org/apache/rocketmq/broker/processor/PopBufferMergeService.java:696— broker/src/main/java/org/apache/rocketmq/broker/processor/PopBufferMergeService.java:696-710 | broker/src/main/java/org/apache/rocketmq/broker/processor/PopBufferMergeService.java:751-767 — These two members are one piece of code written twice and then edited apart: 15 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 (15 corresponding lines) broker/src/main/java/org/apache/rocketmq/broker/out/BrokerOuterAPI.java:1372— broker/src/main/java/org/apache/rocketmq/broker/out/BrokerOuterAPI.java:1372-1386 | broker/src/main/java/org/apache/rocketmq/broker/out/BrokerOuterAPI.java:1454-1468 — These two members are one piece of code written twice and then edited apart: 15 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 (15 corresponding lines) broker/src/main/java/org/apache/rocketmq/broker/processor/PopInflightMessageCounter.java:92— broker/src/main/java/org/apache/rocketmq/broker/processor/PopInflightMessageCounter.java:92-106 | broker/src/main/java/org/apache/rocketmq/broker/processor/PopInflightMessageCounter.java:108-122 — These two members are one piece of code written twice and then edited apart: 15 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 (15 corresponding lines) broker/src/main/java/org/apache/rocketmq/broker/out/BrokerOuterAPI.java:854— broker/src/main/java/org/apache/rocketmq/broker/out/BrokerOuterAPI.java:854-868 | broker/src/main/java/org/apache/rocketmq/broker/out/BrokerOuterAPI.java:872-886 — These two members are one piece of code written twice and then edited apart: 15 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 (15 corresponding lines) filter/src/main/java/org/apache/rocketmq/filter/expression/LogicExpression.java:39— filter/src/main/java/org/apache/rocketmq/filter/expression/LogicExpression.java:39-53 | filter/src/main/java/org/apache/rocketmq/filter/expression/LogicExpression.java:64-79 — These two members are one piece of code written twice and then edited apart: 15 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 (15 corresponding lines) client/src/main/java/org/apache/rocketmq/client/impl/MQAdminImpl.java:143— client/src/main/java/org/apache/rocketmq/client/impl/MQAdminImpl.java:143-157 | client/src/main/java/org/apache/rocketmq/client/impl/MQAdminImpl.java:169-187 — These two members are one piece of code written twice and then edited apart: 15 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 (15 corresponding lines) broker/src/main/java/org/apache/rocketmq/broker/BrokerController.java:1988— broker/src/main/java/org/apache/rocketmq/broker/BrokerController.java:1988-2002 | container/src/main/java/org/apache/rocketmq/container/InnerBrokerController.java:86-100 — These two members are one piece of code written twice and then edited apart: 15 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 (15 corresponding lines) client/src/main/java/org/apache/rocketmq/client/impl/consumer/DefaultMQPushConsumerImpl.java:1279— client/src/main/java/org/apache/rocketmq/client/impl/consumer/DefaultMQPushConsumerImpl.java:1279-1293 | client/src/main/java/org/apache/rocketmq/client/impl/consumer/DefaultMQPushConsumerImpl.java:1295-1312 — These two members are one piece of code written twice and then edited apart: 15 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 (15 corresponding lines) remoting/src/main/java/org/apache/rocketmq/remoting/common/RemotingHelper.java:231— remoting/src/main/java/org/apache/rocketmq/remoting/common/RemotingHelper.java:231-245 | remoting/src/main/java/org/apache/rocketmq/remoting/common/RemotingHelper.java:247-261 — These two members are one piece of code written twice and then edited apart: 15 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 (15 corresponding lines) common/src/main/java/org/apache/rocketmq/common/stats/MomentStatsItemSet.java:107— common/src/main/java/org/apache/rocketmq/common/stats/MomentStatsItemSet.java:107-121 | common/src/main/java/org/apache/rocketmq/common/stats/StatsItemSet.java:218-235 — These two members are one piece of code written twice and then edited apart: 15 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 (15 corresponding lines) tools/src/main/java/org/apache/rocketmq/tools/admin/DefaultMQAdminExtImpl.java:1625— tools/src/main/java/org/apache/rocketmq/tools/admin/DefaultMQAdminExtImpl.java:1625-1639 | tools/src/main/java/org/apache/rocketmq/tools/command/topic/TopicListSubCommand.java:121-136 — These two members are one piece of code written twice and then edited apart: 15 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 (15 corresponding lines) tools/src/main/java/org/apache/rocketmq/tools/command/consumer/UpdateSubGroupListSubCommand.java:50— tools/src/main/java/org/apache/rocketmq/tools/command/consumer/UpdateSubGroupListSubCommand.java:50-66 | tools/src/main/java/org/apache/rocketmq/tools/command/topic/UpdateTopicListSubCommand.java:50-64 — These two members are one piece of code written twice and then edited apart: 15 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 (14 lines × 2) broker/src/main/java/org/apache/rocketmq/broker/BrokerController.java:2013— broker/src/main/java/org/apache/rocketmq/broker/BrokerController.java:2013-2026 | container/src/main/java/org/apache/rocketmq/container/InnerBrokerController.java:111-124 — 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 3 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. Read the line range as the matched WINDOW rather than a finished unit: at `broker/src/main/java/org/apache/rocketmq/broker/BrokerController.java:2013` 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:125— broker/src/main/java/org/apache/rocketmq/broker/latency/BrokerFastFailure.java:125-138 | proxy/src/main/java/org/apache/rocketmq/proxy/remoting/RemotingProtocolServer.java:373-386 — 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:125` 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:372` calls `getQueue` and `broker/src/main/java/org/apache/rocketmq/broker/latency/BrokerFastFailure.java:124` 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:1078— broker/src/main/java/org/apache/rocketmq/broker/out/BrokerOuterAPI.java:1078-1091 | broker/src/main/java/org/apache/rocketmq/broker/out/BrokerOuterAPI.java:1115-1128 — 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:1078` 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/pop/PopConsumerService.java:666— broker/src/main/java/org/apache/rocketmq/broker/pop/PopConsumerService.java:666-679 | broker/src/main/java/org/apache/rocketmq/broker/processor/PopReviveService.java:168-181 — 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 (14 lines × 2) broker/src/main/java/org/apache/rocketmq/broker/processor/AdminBrokerProcessor.java:2177— broker/src/main/java/org/apache/rocketmq/broker/processor/AdminBrokerProcessor.java:2177-2190 | broker/src/main/java/org/apache/rocketmq/broker/processor/AdminBrokerProcessor.java:2233-2246 — 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:2177` 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 × 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:3187— client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:3187-3200 | client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:3500-3513 — 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:3187` 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) client/src/main/java/org/apache/rocketmq/client/impl/factory/MQClientInstance.java:733— client/src/main/java/org/apache/rocketmq/client/impl/factory/MQClientInstance.java:733-746 | client/src/main/java/org/apache/rocketmq/client/impl/factory/MQClientInstance.java:819-832 — 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:733` 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 (14 lines × 2) namesrv/src/main/java/org/apache/rocketmq/namesrv/routeinfo/RouteInfoManager.java:828— namesrv/src/main/java/org/apache/rocketmq/namesrv/routeinfo/RouteInfoManager.java:828-841 | namesrv/src/main/java/org/apache/rocketmq/namesrv/routeinfo/RouteInfoManager.java:861-874 — 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:828` 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/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.
Duplicated block (14 lines × 2) tools/src/main/java/org/apache/rocketmq/tools/admin/DefaultMQAdminExtImpl.java:343— tools/src/main/java/org/apache/rocketmq/tools/admin/DefaultMQAdminExtImpl.java:343-356 | tools/src/main/java/org/apache/rocketmq/tools/admin/DefaultMQAdminExtImpl.java:1119-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 `tools/src/main/java/org/apache/rocketmq/tools/admin/DefaultMQAdminExtImpl.java:343` 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:1456— tools/src/main/java/org/apache/rocketmq/tools/admin/DefaultMQAdminExtImpl.java:1456-1469 | tools/src/main/java/org/apache/rocketmq/tools/admin/DefaultMQAdminExtImpl.java:1487-1500 — 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:1456` 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/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:138-151 — 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 10 separate duplicated blocks between them, totalling at least 100 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:151— tools/src/main/java/org/apache/rocketmq/tools/command/message/QueryMsgByIdSubCommand.java:151-164 | tools/src/main/java/org/apache/rocketmq/tools/command/message/QueryMsgByUniqueKeySubCommand.java:114-127 — 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 9 separate duplicated blocks between them, totalling at least 89 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: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.
Change coupling: QueueLevelConsumerManager.java ↔ PopMessageProcessor.java broker/src/main/java/org/apache/rocketmq/broker/pop/orderly/QueueLevelConsumerManager.java:1— `broker/src/main/java/org/apache/rocketmq/broker/pop/orderly/QueueLevelConsumerManager.java` and `broker/src/main/java/org/apache/rocketmq/broker/processor/PopMessageProcessor.java` change together 75% of the time (9 of the 12 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 9 shared commits counted here, the most recent 3 are `bca63932` [ISSUE #9891] Optimize pop orderly implementation to facilitate expan…; `449536be` Revert "[ISSUE# 9333] Use fastjson2 in broker module (#9334)" (#9387) (at that commit the file was still `broker/src/main/java/org/apache/rocketmq/broker/offset/ConsumerOrderInfoManager.java`); `b1daa3c0` [ISSUE# 9333] Use fastjson2 in broker module (#9334) (at that commit the file was still `broker/src/main/java/org/apache/rocketmq/broker/offset/ConsumerOrderInfoManager.java`) — run `git show` on any of them.
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 72% of the time (13 of the 18 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 13 shared commits counted here, the most recent 3 are `628230d2` [ISSUE #10011] Optimize accelerated recovery process and refactor cod…; `73e8fdbd` [ISSUE #9699] Optimize shutdown process and resource management (#9700); `b410557e` [ISSUE #6609] Fix the issue that consume queue building exceeds confi… — 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 68% of the time (23 of the 34 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 23 shared commits counted here, the most recent 3 are `d197028f` refactor: abstract StoreMetricsManager interface to support non-Defau…; `8639dcc4` [ISSUE #9254] Optimize the logs of the message store (#9528); `9aa081b8` [ISSUE #8988] Support dispatchBehindMilliseconds (#8989) — 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 65% of the time (11 of the 17 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 11 shared commits counted here, the most recent 3 are `628230d2` [ISSUE #10011] Optimize accelerated recovery process and refactor cod…; `26480ddc` [ISSUE #10073] Fix StoreCheckpoint logicsMsgTimestamp to reflect flus…; `7583fda1` fix(store): close all consume queue file handles on ConsumeQueueStore… — run `git show` on any of them.
Change coupling: QueueLevelConsumerManager.java ↔ AckMessageProcessor.java broker/src/main/java/org/apache/rocketmq/broker/pop/orderly/QueueLevelConsumerManager.java:1— `broker/src/main/java/org/apache/rocketmq/broker/pop/orderly/QueueLevelConsumerManager.java` and `broker/src/main/java/org/apache/rocketmq/broker/processor/AckMessageProcessor.java` change together 58% of the time (7 of the 12 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 `bca63932` [ISSUE #9891] Optimize pop orderly implementation to facilitate expan…; `449536be` Revert "[ISSUE# 9333] Use fastjson2 in broker module (#9334)" (#9387) (at that commit the file was still `broker/src/main/java/org/apache/rocketmq/broker/offset/ConsumerOrderInfoManager.java`); `b1daa3c0` [ISSUE# 9333] Use fastjson2 in broker module (#9334) (at that commit the file was still `broker/src/main/java/org/apache/rocketmq/broker/offset/ConsumerOrderInfoManager.java`) — run `git show` on any of them.
Change coupling: NotificationProcessor.java ↔ PopMessageProcessor.java broker/src/main/java/org/apache/rocketmq/broker/processor/NotificationProcessor.java:1— `broker/src/main/java/org/apache/rocketmq/broker/processor/NotificationProcessor.java` and `broker/src/main/java/org/apache/rocketmq/broker/processor/PopMessageProcessor.java` change together 56% of the time (10 of the 18 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 10 shared commits counted here, the most recent 3 are `5892de6d` [ISSUE #9862] [Bug] Fix the issue of missing bornTime in POP requests…; `73e8fdbd` [ISSUE #9699] Optimize shutdown process and resource management (#9700); `23cc24cc` [ISSUE #8947] Notify pop request before calculate consumer lag (#8949) — run `git show` on any of them.
Change coupling: StoreCheckpoint.java ↔ IndexService.java store/src/main/java/org/apache/rocketmq/store/StoreCheckpoint.java:1— `store/src/main/java/org/apache/rocketmq/store/StoreCheckpoint.java` and `store/src/main/java/org/apache/rocketmq/store/index/IndexService.java` change together 56% of the time (10 of the 18 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 10 shared commits counted here, the most recent 3 are `628230d2` [ISSUE #10011] Optimize accelerated recovery process and refactor cod…; `246be9eb` ROCKETMQ-6: Use logger for exceptions instead of e.printStackTrace().; `998b246d` #276 为每日消息增加统计。 (at that commit the files were still `rocketmq-store/src/main/java/com/alibaba/rocketmq/store/StoreCheckpoint.java` and `rocketmq-store/src/main/java/com/alibaba/rocketmq/store/index/IndexService.java`) — 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 (23 of the 45 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 23 shared commits counted here, the most recent 3 are `a376fbcd` [ISSUE #7634] Introduce controllableOffset to prevent unnecessary sus…; `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`) — run `git show` on any of them.
Change coupling: ConsumerProgressSubCommand.java ↔ TopicStatusSubCommand.java tools/src/main/java/org/apache/rocketmq/tools/command/consumer/ConsumerProgressSubCommand.java:1— `tools/src/main/java/org/apache/rocketmq/tools/command/consumer/ConsumerProgressSubCommand.java` and `tools/src/main/java/org/apache/rocketmq/tools/command/topic/TopicStatusSubCommand.java` change together 50% of the time (11 of the 22 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 11 shared commits counted here, the most recent 3 are `e5e38396` [ISSUE #8591] Preliminary support for key commands of LMQ (#8590); `998b246d` #276 为每日消息增加统计。 (at that commit the files were still `rocketmq-tools/src/main/java/com/alibaba/rocketmq/tools/command/consumer/ConsumerProgressSubCommand.java` and `rocketmq-tools/src/main/java/com/alibaba/rocketmq/tools/command/topic/TopicStatsSubCommand.java`); `5a80b123` #276 为每日消息增加统计。 (at that commit the files were still `rocketmq-tools/src/main/java/com/alibaba/rocketmq/tools/command/consumer/ConsumerProgressSubCommand.java` and `rocketmq-tools/src/main/java/com/alibaba/rocketmq/tools/command/topic/TopicStatsSubCommand.java`) — run `git show` on any of them.
Change coupling: DefaultMQPushConsumer.java ↔ ConsumeMessageService.java client/src/main/java/org/apache/rocketmq/client/consumer/DefaultMQPushConsumer.java:1— `client/src/main/java/org/apache/rocketmq/client/consumer/DefaultMQPushConsumer.java` and `client/src/main/java/org/apache/rocketmq/client/impl/consumer/ConsumeMessageService.java` change together 50% of the time (8 of the 16 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 8 shared commits counted here, the most recent 3 are `80459554` [ISSUE #11089] Share consumption executors for Proxy internal clients…; `2c49e6b1` [ISSUE #2085]support graceful shutdown push consumer (#2084); `0d04d3b8` 根据消息堆积数量,动态调整消费线程池数量 (at that commit the files were still `rocketmq-client/src/main/java/com/alibaba/rocketmq/client/consumer/DefaultMQPushConsumer.java` and `rocketmq-client/src/main/java/com/alibaba/rocketmq/client/impl/consumer/ConsumeMessageService.java`) — run `git show` on any of them.
Change coupling: ContextVariable.java ↔ GrpcMessagingApplication.java proxy/src/main/java/org/apache/rocketmq/proxy/common/ContextVariable.java:1— `proxy/src/main/java/org/apache/rocketmq/proxy/common/ContextVariable.java` and `proxy/src/main/java/org/apache/rocketmq/proxy/grpc/v2/GrpcMessagingApplication.java` change together 50% of the time (7 of the 14 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 `04eec349` Get namespace from header (#7782); `d2b818d9` Revert "[ISSUE #7707] Refector Context with link node implementation …; `3f99b1e9` [ISSUE #7707] Refector Context with link node implementation (#7708) (at that commit the file was still `proxy/src/main/java/org/apache/rocketmq/proxy/common/context/ContextVariable.java`) — run `git show` on any of them.
Change coupling: ControllerConfig.java ↔ NamesrvConfig.java common/src/main/java/org/apache/rocketmq/common/ControllerConfig.java:1— `common/src/main/java/org/apache/rocketmq/common/ControllerConfig.java` and `common/src/main/java/org/apache/rocketmq/common/namesrv/NamesrvConfig.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) 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 5 shared commits counted here, the most recent 3 are `f4e2a4a0` [ISSUE #9335] Use MixAll.ROCKETMQ_HOME_DIR for home directory (#9474); `a194e1eb` Add set method for config black list. (#7586); `9cfe724e` Add validation in broker/namesrv configure updating command (#7584) — run `git show` on any of them.
Change coupling: BrokerConfig.java ↔ ControllerConfig.java common/src/main/java/org/apache/rocketmq/common/BrokerConfig.java:1— `common/src/main/java/org/apache/rocketmq/common/BrokerConfig.java` and `common/src/main/java/org/apache/rocketmq/common/ControllerConfig.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 `f4e2a4a0` [ISSUE #9335] Use MixAll.ROCKETMQ_HOME_DIR for home directory (#9474); `a194e1eb` Add set method for config black list. (#7586); `9cfe724e` Add validation in broker/namesrv configure updating command (#7584) — run `git show` on any of them.
D4 · Code Duplication· Edited copy of a member (16 corresponding lines) · ×13
Edited copy of a member (16 corresponding lines) proxy/src/main/java/org/apache/rocketmq/proxy/service/route/ProxyTopicRouteData.java:35— proxy/src/main/java/org/apache/rocketmq/proxy/service/route/ProxyTopicRouteData.java:35-50 | proxy/src/main/java/org/apache/rocketmq/proxy/service/route/ProxyTopicRouteData.java:52-68 — These two members are one piece of code written twice and then edited apart: 16 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 (16 corresponding lines) remoting/src/main/java/org/apache/rocketmq/remoting/rpc/RpcClientImpl.java:224— remoting/src/main/java/org/apache/rocketmq/remoting/rpc/RpcClientImpl.java:224-246 | remoting/src/main/java/org/apache/rocketmq/remoting/rpc/RpcClientImpl.java:268-283 — These two members are one piece of code written twice and then edited apart: 16 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 (16 corresponding lines) broker/src/main/java/org/apache/rocketmq/broker/out/BrokerOuterAPI.java:1188— broker/src/main/java/org/apache/rocketmq/broker/out/BrokerOuterAPI.java:1188-1204 | proxy/src/main/java/org/apache/rocketmq/proxy/service/sysmessage/AbstractSystemMessageSyncer.java:133-148 — These two members are one piece of code written twice and then edited apart: 16 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 (16 corresponding lines) broker/src/main/java/org/apache/rocketmq/broker/processor/SendMessageProcessor.java:155— broker/src/main/java/org/apache/rocketmq/broker/processor/SendMessageProcessor.java:155-179 | broker/src/main/java/org/apache/rocketmq/broker/topic/TopicQueueMappingManager.java:262-277 — These two members are one piece of code written twice and then edited apart: 16 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 (16 corresponding lines) remoting/src/main/java/org/apache/rocketmq/remoting/netty/NettyRemotingClient.java:1206— remoting/src/main/java/org/apache/rocketmq/remoting/netty/NettyRemotingClient.java:1206-1221 | remoting/src/main/java/org/apache/rocketmq/remoting/netty/NettyRemotingServer.java:638-653 — These two members are one piece of code written twice and then edited apart: 16 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 (16 corresponding lines) store/src/main/java/org/apache/rocketmq/store/timer/TimerMessageStore.java:1420— store/src/main/java/org/apache/rocketmq/store/timer/TimerMessageStore.java:1420-1435 | store/src/main/java/org/apache/rocketmq/store/timer/TimerMessageStore.java:1560-1577 — These two members are one piece of code written twice and then edited apart: 16 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 (16 corresponding lines) broker/src/main/java/org/apache/rocketmq/broker/slave/SlaveSynchronize.java:125— broker/src/main/java/org/apache/rocketmq/broker/slave/SlaveSynchronize.java:125-140 | broker/src/main/java/org/apache/rocketmq/broker/slave/SlaveSynchronize.java:142-165 — These two members are one piece of code written twice and then edited apart: 16 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 (16 corresponding lines) client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:2224— client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:2224-2239 | client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:2243-2259 — These two members are one piece of code written twice and then edited apart: 16 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 (16 corresponding lines) client/src/main/java/org/apache/rocketmq/client/producer/ProduceAccumulator.java:93— client/src/main/java/org/apache/rocketmq/client/producer/ProduceAccumulator.java:93-110 | client/src/main/java/org/apache/rocketmq/client/producer/ProduceAccumulator.java:140-155 — These two members are one piece of code written twice and then edited apart: 16 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 (16 corresponding lines) broker/src/main/java/org/apache/rocketmq/broker/out/BrokerOuterAPI.java:209— broker/src/main/java/org/apache/rocketmq/broker/out/BrokerOuterAPI.java:209-224 | client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:361-376 — These two members are one piece of code written twice and then edited apart: 16 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 (16 corresponding lines) store/src/main/java/org/apache/rocketmq/store/DefaultMessageStore.java:2685— store/src/main/java/org/apache/rocketmq/store/DefaultMessageStore.java:2685-2700 | store/src/main/java/org/apache/rocketmq/store/DefaultMessageStore.java:3116-3133 — These two members are one piece of code written twice and then edited apart: 16 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 (16 corresponding lines) store/src/main/java/org/apache/rocketmq/store/timer/rocksdb/Timeline.java:298— store/src/main/java/org/apache/rocketmq/store/timer/rocksdb/Timeline.java:298-313 | store/src/main/java/org/apache/rocketmq/store/transaction/TransMessageRocksDBStore.java:326-345 — These two members are one piece of code written twice and then edited apart: 16 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 (16 corresponding lines) broker/src/main/java/org/apache/rocketmq/broker/transaction/AbstractTransactionalMessageCheckListener.java:72— broker/src/main/java/org/apache/rocketmq/broker/transaction/AbstractTransactionalMessageCheckListener.java:72-87 | broker/src/main/java/org/apache/rocketmq/broker/transaction/rocksdb/TransactionalMessageRocksDBService.java:202-217 — These two members are one piece of code written twice and then edited apart: 16 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 (6 corresponding lines) · ×13
Edited copy of a member (6 corresponding lines) controller/src/main/java/org/apache/rocketmq/controller/impl/heartbeat/BrokerIdentityInfo.java:55— controller/src/main/java/org/apache/rocketmq/controller/impl/heartbeat/BrokerIdentityInfo.java:55-69 | store/src/main/java/org/apache/rocketmq/store/ha/autoswitch/BrokerMetadata.java:86-91 — These two members are one piece of code written twice and then edited apart: 6 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 (6 corresponding lines) store/src/main/java/org/apache/rocketmq/store/queue/RocksDBConsumeQueueOffsetTable.java:551— store/src/main/java/org/apache/rocketmq/store/queue/RocksDBConsumeQueueOffsetTable.java:551-557 | store/src/main/java/org/apache/rocketmq/store/queue/RocksDBConsumeQueueTable.java:118-123 — These two members are one piece of code written twice and then edited apart: 6 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 (6 corresponding lines) client/src/main/java/org/apache/rocketmq/client/impl/factory/MQClientInstance.java:1259— client/src/main/java/org/apache/rocketmq/client/impl/factory/MQClientInstance.java:1259-1264 | remoting/src/main/java/org/apache/rocketmq/remoting/rpc/ClientMetadata.java:69-75 — These two members are one piece of code written twice and then edited apart: 6 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 (6 corresponding lines) controller/src/main/java/org/apache/rocketmq/controller/impl/event/ListEventSerializer.java:55— controller/src/main/java/org/apache/rocketmq/controller/impl/event/ListEventSerializer.java:55-60 | controller/src/main/java/org/apache/rocketmq/controller/impl/manager/ReplicasInfoManager.java:610-615 — These two members are one piece of code written twice and then edited apart: 6 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 (6 corresponding lines) broker/src/main/java/org/apache/rocketmq/broker/longpolling/LmqPullRequestHoldService.java:33— broker/src/main/java/org/apache/rocketmq/broker/longpolling/LmqPullRequestHoldService.java:33-38 | broker/src/main/java/org/apache/rocketmq/broker/longpolling/PullRequestHoldService.java:94-99 — These two members are one piece of code written twice and then edited apart: 6 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 (6 corresponding lines) store/src/main/java/org/apache/rocketmq/store/ha/GroupTransferService.java:170— store/src/main/java/org/apache/rocketmq/store/ha/GroupTransferService.java:170-175 | store/src/main/java/org/apache/rocketmq/store/ha/HAConnectionStateNotificationService.java:48-53 — These two members are one piece of code written twice and then edited apart: 6 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 (6 corresponding lines) store/src/main/java/org/apache/rocketmq/store/ha/DefaultHAService.java:278— store/src/main/java/org/apache/rocketmq/store/ha/DefaultHAService.java:278-283 | store/src/main/java/org/apache/rocketmq/store/ha/autoswitch/AutoSwitchHAService.java:572-577 — These two members are one piece of code written twice and then edited apart: 6 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 (6 corresponding lines) store/src/main/java/org/apache/rocketmq/store/AllocateMappedFileService.java:142— store/src/main/java/org/apache/rocketmq/store/AllocateMappedFileService.java:142-147 | store/src/main/java/org/apache/rocketmq/store/queue/ConsumeQueueStore.java:735-740 — These two members are one piece of code written twice and then edited apart: 6 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 (6 corresponding lines) broker/src/main/java/org/apache/rocketmq/broker/transaction/TransactionMetrics.java:61— broker/src/main/java/org/apache/rocketmq/broker/transaction/TransactionMetrics.java:61-66 | store/src/main/java/org/apache/rocketmq/store/timer/TimerMetrics.java:85-91 — These two members are one piece of code written twice and then edited apart: 6 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 (6 corresponding lines) common/src/main/java/org/apache/rocketmq/common/MixAll.java:577— common/src/main/java/org/apache/rocketmq/common/MixAll.java:577-582 | store/src/main/java/org/apache/rocketmq/store/queue/MultiDispatchUtils.java:39-44 — These two members are one piece of code written twice and then edited apart: 6 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 (6 corresponding lines) auth/src/main/java/org/apache/rocketmq/auth/authorization/model/Resource.java:61— auth/src/main/java/org/apache/rocketmq/auth/authorization/model/Resource.java:61-66 | broker/src/main/java/org/apache/rocketmq/broker/auth/converter/AclConverter.java:78-84 — These two members are one piece of code written twice and then edited apart: 6 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 (6 corresponding lines) client/src/main/java/org/apache/rocketmq/client/exception/MQBrokerException.java:34— client/src/main/java/org/apache/rocketmq/client/exception/MQBrokerException.java:34-40 | client/src/main/java/org/apache/rocketmq/client/exception/MQClientException.java:40-45 — These two members are one piece of code written twice and then edited apart: 6 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 (6 corresponding lines) store/src/main/java/org/apache/rocketmq/store/ha/DefaultHAConnection.java:80— store/src/main/java/org/apache/rocketmq/store/ha/DefaultHAConnection.java:80-85 | store/src/main/java/org/apache/rocketmq/store/ha/autoswitch/AutoSwitchHAConnection.java:126-131 — These two members are one piece of code written twice and then edited apart: 6 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.
TodoComment tieredstore/src/main/java/org/apache/rocketmq/tieredstore/metrics/TieredStoreMetricsManager.java:203— // TODO: handle exception 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.
TodoComment tieredstore/src/main/java/org/apache/rocketmq/tieredstore/metrics/TieredStoreMetricsManager.java:242— // TODO: handle 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 test/src/test/java/org/apache/rocketmq/test/dledger/DLedgerProduceAndConsumeIT.java:71— // 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 store/src/main/java/org/apache/rocketmq/store/CommitLog.java:368— // TODO: Discuss if we need to load more commit-log mapped files into memory. — 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/ConsumeQueue.java:1277— // TODO: when min commitLog offset is 0 and restart store, min offset of cq may be set to 0 incorrectly — 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:879— // 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 store/src/main/java/org/apache/rocketmq/store/stats/BrokerStatsManager.java:267— // 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/queue/ConsumeQueueStore.java:435— // 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/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 broker/src/main/java/org/apache/rocketmq/broker/processor/SendMessageProcessor.java:543— // 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 broker/src/main/java/org/apache/rocketmq/broker/config/v2/ConsumerOffsetManagerV2.java:98— // TODO: we have to make a copy here as WriteBatch lacks ByteBuffer API 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.
TodoComment broker/src/main/java/org/apache/rocketmq/broker/config/v2/ConsumerOffsetManagerV2.java:155— // TODO: we have to make a copy here as WriteBatch lacks ByteBuffer API 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.
D4 · Code Duplication· Members sharing a duplicated core (4 members, 50+ identical tokens) · ×12
Members sharing a duplicated core (4 members, 50+ identical tokens) broker/src/main/java/org/apache/rocketmq/broker/out/BrokerOuterAPI.java:426— broker/src/main/java/org/apache/rocketmq/broker/out/BrokerOuterAPI.java:426-446 | broker/src/main/java/org/apache/rocketmq/broker/out/BrokerOuterAPI.java:625-644 | client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:3404-3420 | client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:3572-3593 — 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:194— client/src/main/java/org/apache/rocketmq/client/impl/MQAdminImpl.java:194-211 | client/src/main/java/org/apache/rocketmq/client/impl/MQAdminImpl.java:213-229 | client/src/main/java/org/apache/rocketmq/client/impl/MQAdminImpl.java:231-247 | client/src/main/java/org/apache/rocketmq/client/impl/MQAdminImpl.java:249-265 — 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:1439— client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:1439-1460 | client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:2447-2475 | client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:2480-2502 | client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:2776-2805 — 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:1736— client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:1736-1756 | client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:1946-1966 | client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:1987-2003 | client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:2006-2021 — 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:2329— client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:2329-2356 | client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:2359-2384 | client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:3143-3173 | client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:3517-3542 — 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:91— client/src/main/java/org/apache/rocketmq/client/impl/consumer/ConsumeMessageConcurrentlyService.java:91-144 | client/src/main/java/org/apache/rocketmq/client/impl/consumer/ConsumeMessageOrderlyService.java:103-161 | client/src/main/java/org/apache/rocketmq/client/impl/consumer/ConsumeMessagePopConcurrentlyService.java:76-128 | client/src/main/java/org/apache/rocketmq/client/impl/consumer/ConsumeMessagePopOrderlyService.java:94-152 — 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/factory/MQClientInstance.java:664— client/src/main/java/org/apache/rocketmq/client/impl/factory/MQClientInstance.java:664-694 | client/src/main/java/org/apache/rocketmq/client/impl/factory/MQClientInstance.java:720-752 | client/src/main/java/org/apache/rocketmq/client/impl/factory/MQClientInstance.java:799-837 | client/src/main/java/org/apache/rocketmq/client/impl/factory/MQClientInstance.java:862-931 — 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:363— common/src/main/java/org/apache/rocketmq/common/UtilAll.java:363-401 | common/src/main/java/org/apache/rocketmq/common/compression/Lz4Compressor.java:55-85 | common/src/main/java/org/apache/rocketmq/common/compression/ZlibCompressor.java:58-96 | 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) store/src/main/java/org/apache/rocketmq/store/CommitLog.java:999— store/src/main/java/org/apache/rocketmq/store/CommitLog.java:999-1170 | store/src/main/java/org/apache/rocketmq/store/CommitLog.java:1172-1327 | store/src/main/java/org/apache/rocketmq/store/dledger/DLedgerCommitLog.java:523-539 | store/src/main/java/org/apache/rocketmq/store/dledger/DLedgerCommitLog.java:645-786 — 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:324— tools/src/main/java/org/apache/rocketmq/tools/admin/DefaultMQAdminExtImpl.java:324-354 | tools/src/main/java/org/apache/rocketmq/tools/admin/DefaultMQAdminExtImpl.java:497-562 | tools/src/main/java/org/apache/rocketmq/tools/admin/DefaultMQAdminExtImpl.java:1100-1130 | tools/src/main/java/org/apache/rocketmq/tools/admin/DefaultMQAdminExtImpl.java:1152-1180 — 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/auth/DeleteUserSubCommand.java:66— tools/src/main/java/org/apache/rocketmq/tools/command/auth/DeleteUserSubCommand.java:66-101 | tools/src/main/java/org/apache/rocketmq/tools/command/auth/GetAclSubCommand.java:70-112 | tools/src/main/java/org/apache/rocketmq/tools/command/auth/GetUserSubCommand.java:70-113 | tools/src/main/java/org/apache/rocketmq/tools/command/auth/ListUserSubCommand.java:71-115 — 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/auth/GetAclSubCommand.java:70— tools/src/main/java/org/apache/rocketmq/tools/command/auth/GetAclSubCommand.java:70-112 | tools/src/main/java/org/apache/rocketmq/tools/command/auth/GetUserSubCommand.java:70-113 | tools/src/main/java/org/apache/rocketmq/tools/command/auth/ListAclSubCommand.java:75-118 | tools/src/main/java/org/apache/rocketmq/tools/command/auth/ListUserSubCommand.java:71-115 — 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.
D4 · Code Duplication· Edited copy of a member (23 corresponding lines) · ×12
Edited copy of a member (23 corresponding lines) store/src/main/java/org/apache/rocketmq/store/ConsumeQueue.java:775— store/src/main/java/org/apache/rocketmq/store/ConsumeQueue.java:775-797 | store/src/main/java/org/apache/rocketmq/store/queue/RocksDBConsumeQueueStore.java:334-361 — 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) client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:3178— client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:3178-3200 | client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:3491-3513 — 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) broker/src/main/java/org/apache/rocketmq/broker/config/v2/ConsumerOffsetManagerV2.java:452— broker/src/main/java/org/apache/rocketmq/broker/config/v2/ConsumerOffsetManagerV2.java:452-474 | broker/src/main/java/org/apache/rocketmq/broker/offset/LmqConsumerOffsetManager.java:139-162 — 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) store/src/main/java/org/apache/rocketmq/store/logfile/DefaultMappedFile.java:961— store/src/main/java/org/apache/rocketmq/store/logfile/DefaultMappedFile.java:961-989 | store/src/main/java/org/apache/rocketmq/store/logfile/DefaultMappedFile.java:992-1014 — 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) proxy/src/main/java/org/apache/rocketmq/proxy/grpc/ProxyAndTlsProtocolNegotiator.java:228— proxy/src/main/java/org/apache/rocketmq/proxy/grpc/ProxyAndTlsProtocolNegotiator.java:228-251 | remoting/src/main/java/org/apache/rocketmq/remoting/netty/NettyRemotingServer.java:801-823 — 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) openmessaging/src/main/java/io/openmessaging/rocketmq/utils/BeanUtils.java:137— openmessaging/src/main/java/io/openmessaging/rocketmq/utils/BeanUtils.java:137-160 | openmessaging/src/main/java/io/openmessaging/rocketmq/utils/BeanUtils.java:162-184 — 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) client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:1386— client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:1386-1408 | client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:1488-1510 — 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) broker/src/main/java/org/apache/rocketmq/broker/controller/ReplicasManager.java:375— broker/src/main/java/org/apache/rocketmq/broker/controller/ReplicasManager.java:375-399 | broker/src/main/java/org/apache/rocketmq/broker/controller/ReplicasManager.java:559-581 — 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) client/src/main/java/org/apache/rocketmq/client/impl/producer/DefaultMQProducerImpl.java:1653— client/src/main/java/org/apache/rocketmq/client/impl/producer/DefaultMQProducerImpl.java:1653-1678 | client/src/main/java/org/apache/rocketmq/client/impl/producer/DefaultMQProducerImpl.java:1714-1736 — 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) proxy/src/main/java/org/apache/rocketmq/proxy/service/message/LocalMessageService.java:419— proxy/src/main/java/org/apache/rocketmq/proxy/service/message/LocalMessageService.java:419-441 | proxy/src/main/java/org/apache/rocketmq/proxy/service/message/LocalMessageService.java:548-570 — 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) example/src/main/java/org/apache/rocketmq/example/simple/LitePullConsumerAssign.java:30— example/src/main/java/org/apache/rocketmq/example/simple/LitePullConsumerAssign.java:30-52 | example/src/main/java/org/apache/rocketmq/example/simple/LitePullConsumerAssignWithSubExpression.java:31-59 — 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) example/src/main/java/org/apache/rocketmq/example/schedule/ScheduledMessageConsumer.java:30— example/src/main/java/org/apache/rocketmq/example/schedule/ScheduledMessageConsumer.java:30-52 | example/src/main/java/org/apache/rocketmq/example/schedule/TimerMessageConsumer.java:32-54 — 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) · ×12
Edited copy of a member (18 corresponding lines) store/src/main/java/org/apache/rocketmq/store/ha/DefaultHAConnection.java:61— store/src/main/java/org/apache/rocketmq/store/ha/DefaultHAConnection.java:61-78 | store/src/main/java/org/apache/rocketmq/store/ha/autoswitch/AutoSwitchHAConnection.java:105-123 — 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) broker/src/main/java/org/apache/rocketmq/broker/metrics/PopMetricsManager.java:75— broker/src/main/java/org/apache/rocketmq/broker/metrics/PopMetricsManager.java:75-92 | remoting/src/main/java/org/apache/rocketmq/remoting/metrics/RemotingMetricsManager.java:69-88 — 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) client/src/main/java/org/apache/rocketmq/client/impl/consumer/DefaultLitePullConsumerImpl.java:527— client/src/main/java/org/apache/rocketmq/client/impl/consumer/DefaultLitePullConsumerImpl.java:527-544 | client/src/main/java/org/apache/rocketmq/client/impl/consumer/DefaultLitePullConsumerImpl.java:546-568 — 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) common/src/main/java/org/apache/rocketmq/common/utils/CleanupPolicyUtils.java:32— common/src/main/java/org/apache/rocketmq/common/utils/CleanupPolicyUtils.java:32-49 | common/src/main/java/org/apache/rocketmq/common/utils/QueueTypeUtils.java:33-50 — 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) broker/src/main/java/org/apache/rocketmq/broker/transaction/TransactionMetrics.java:141— broker/src/main/java/org/apache/rocketmq/broker/transaction/TransactionMetrics.java:141-158 | store/src/main/java/org/apache/rocketmq/store/timer/TimerMetrics.java:176-194 — 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) namesrv/src/main/java/org/apache/rocketmq/namesrv/processor/DefaultRequestProcessor.java:179— namesrv/src/main/java/org/apache/rocketmq/namesrv/processor/DefaultRequestProcessor.java:179-200 | namesrv/src/main/java/org/apache/rocketmq/namesrv/processor/DefaultRequestProcessor.java:497-514 — 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) client/src/main/java/org/apache/rocketmq/client/impl/factory/MQClientInstance.java:570— client/src/main/java/org/apache/rocketmq/client/impl/factory/MQClientInstance.java:570-587 | client/src/main/java/org/apache/rocketmq/client/impl/factory/MQClientInstance.java:589-608 — 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) proxy/src/main/java/org/apache/rocketmq/proxy/grpc/v2/channel/GrpcClientChannel.java:97— proxy/src/main/java/org/apache/rocketmq/proxy/grpc/v2/channel/GrpcClientChannel.java:97-115 | proxy/src/main/java/org/apache/rocketmq/proxy/remoting/channel/RemotingChannel.java:229-246 — 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) broker/src/main/java/org/apache/rocketmq/broker/processor/ReplyMessageProcessor.java:83— broker/src/main/java/org/apache/rocketmq/broker/processor/ReplyMessageProcessor.java:83-103 | remoting/src/main/java/org/apache/rocketmq/remoting/protocol/header/SendMessageRequestHeader.java:185-202 — 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) remoting/src/main/java/org/apache/rocketmq/remoting/Configuration.java:76— remoting/src/main/java/org/apache/rocketmq/remoting/Configuration.java:76-94 | remoting/src/main/java/org/apache/rocketmq/remoting/Configuration.java:281-298 — 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) tools/src/main/java/org/apache/rocketmq/tools/command/CommandUtil.java:91— tools/src/main/java/org/apache/rocketmq/tools/command/CommandUtil.java:91-114 | tools/src/main/java/org/apache/rocketmq/tools/command/CommandUtil.java:118-135 — 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/filter/SqlFilterProducer.java:27— example/src/main/java/org/apache/rocketmq/example/filter/SqlFilterProducer.java:27-47 | example/src/main/java/org/apache/rocketmq/example/filter/TagFilterProducer.java:26-43 — 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.
Duplicated block (15 lines × 2) broker/src/main/java/org/apache/rocketmq/broker/longpolling/PopLiteLongPollingService.java:85— broker/src/main/java/org/apache/rocketmq/broker/longpolling/PopLiteLongPollingService.java:85-99 | broker/src/main/java/org/apache/rocketmq/broker/longpolling/PopLongPollingService.java:105-119 — before extracting anything, compare `broker/src/main/java/org/apache/rocketmq/broker/longpolling/PopLiteLongPollingService.java` and `broker/src/main/java/org/apache/rocketmq/broker/longpolling/PopLongPollingService.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 `broker/src/main/java/org/apache/rocketmq/broker/longpolling/PopLiteLongPollingService.java:85` 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 (15 lines × 2) broker/src/main/java/org/apache/rocketmq/broker/processor/AdminBrokerProcessor.java:3280— broker/src/main/java/org/apache/rocketmq/broker/processor/AdminBrokerProcessor.java:3280-3294 | broker/src/main/java/org/apache/rocketmq/broker/processor/AdminBrokerProcessor.java:3312-3326 — 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 (15 lines × 2) broker/src/main/java/org/apache/rocketmq/broker/processor/PopMessageProcessor.java:471— broker/src/main/java/org/apache/rocketmq/broker/processor/PopMessageProcessor.java:471-485 | broker/src/main/java/org/apache/rocketmq/broker/processor/PopMessageProcessor.java:625-639 — 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:471` 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 (15 lines × 2) client/src/main/java/org/apache/rocketmq/client/consumer/store/LocalFileOffsetStore.java:79— client/src/main/java/org/apache/rocketmq/client/consumer/store/LocalFileOffsetStore.java:79-93 | client/src/main/java/org/apache/rocketmq/client/consumer/store/RemoteBrokerOffsetStore.java:60-74 — 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.
Duplicated block (15 lines × 2) client/src/main/java/org/apache/rocketmq/client/impl/consumer/ConsumeMessageOrderlyService.java:216— client/src/main/java/org/apache/rocketmq/client/impl/consumer/ConsumeMessageOrderlyService.java:216-230 | client/src/main/java/org/apache/rocketmq/client/impl/consumer/ConsumeMessagePopOrderlyService.java:194-208 — 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 10 separate duplicated blocks between them, totalling at least 133 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:216` 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/mqclient/MQClientAPIExt.java:246— client/src/main/java/org/apache/rocketmq/client/impl/mqclient/MQClientAPIExt.java:246-260 | client/src/main/java/org/apache/rocketmq/client/impl/mqclient/MQClientAPIExt.java:271-285 — 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:246` 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) common/src/main/java/org/apache/rocketmq/common/utils/IPAddressUtils.java:51— common/src/main/java/org/apache/rocketmq/common/utils/IPAddressUtils.java:51-65 | common/src/main/java/org/apache/rocketmq/common/utils/IPAddressUtils.java:68-82 — 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 (15 lines × 2) remoting/src/main/java/org/apache/rocketmq/remoting/common/RemotingHelper.java:142— remoting/src/main/java/org/apache/rocketmq/remoting/common/RemotingHelper.java:142-156 | remoting/src/main/java/org/apache/rocketmq/remoting/common/RemotingHelper.java:160-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.
Duplicated block (15 lines × 2) store/src/main/java/org/apache/rocketmq/store/ha/DefaultHAConnection.java:64— store/src/main/java/org/apache/rocketmq/store/ha/DefaultHAConnection.java:64-78 | store/src/main/java/org/apache/rocketmq/store/ha/autoswitch/AutoSwitchHAConnection.java:109-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 38 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:64` 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 (15 lines × 2) broker/src/main/java/org/apache/rocketmq/broker/processor/AdminBrokerProcessor.java:3103— broker/src/main/java/org/apache/rocketmq/broker/processor/AdminBrokerProcessor.java:3103-3117 | broker/src/main/java/org/apache/rocketmq/broker/transaction/queue/DefaultTransactionalMessageCheckListener.java:65-79 — 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:3103` 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) 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 (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.
D4 · Code Duplication· Edited copy of a member (20 corresponding lines) · ×11
Edited copy of a member (20 corresponding lines) broker/src/main/java/org/apache/rocketmq/broker/transaction/AbstractTransactionalMessageCheckListener.java:51— broker/src/main/java/org/apache/rocketmq/broker/transaction/AbstractTransactionalMessageCheckListener.java:51-70 | broker/src/main/java/org/apache/rocketmq/broker/transaction/rocksdb/TransactionalMessageRocksDBService.java:219-246 — 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.
Edited copy of a member (20 corresponding lines) proxy/src/main/java/org/apache/rocketmq/proxy/service/relay/LocalProxyRelayService.java:44— proxy/src/main/java/org/apache/rocketmq/proxy/service/relay/LocalProxyRelayService.java:44-63 | proxy/src/main/java/org/apache/rocketmq/proxy/service/relay/LocalProxyRelayService.java:68-87 — 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.
Edited copy of a member (20 corresponding lines) broker/src/main/java/org/apache/rocketmq/broker/config/v2/ConsumerOffsetManagerV2.java:229— broker/src/main/java/org/apache/rocketmq/broker/config/v2/ConsumerOffsetManagerV2.java:229-248 | broker/src/main/java/org/apache/rocketmq/broker/config/v2/ConsumerOffsetManagerV2.java:250-269 — 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.
Edited copy of a member (20 corresponding lines) client/src/main/java/org/apache/rocketmq/client/consumer/store/RemoteBrokerOffsetStore.java:208— client/src/main/java/org/apache/rocketmq/client/consumer/store/RemoteBrokerOffsetStore.java:208-233 | client/src/main/java/org/apache/rocketmq/client/consumer/store/RemoteBrokerOffsetStore.java:236-255 — 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.
Edited copy of a member (20 corresponding lines) broker/src/main/java/org/apache/rocketmq/broker/processor/AdminBrokerProcessor.java:1376— broker/src/main/java/org/apache/rocketmq/broker/processor/AdminBrokerProcessor.java:1376-1396 | broker/src/main/java/org/apache/rocketmq/broker/processor/AdminBrokerProcessor.java:1502-1521 — 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.
Edited copy of a member (20 corresponding lines) broker/src/main/java/org/apache/rocketmq/broker/processor/AdminBrokerProcessor.java:2393— broker/src/main/java/org/apache/rocketmq/broker/processor/AdminBrokerProcessor.java:2393-2413 | broker/src/main/java/org/apache/rocketmq/broker/processor/AdminBrokerProcessor.java:2435-2454 — 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.
Edited copy of a member (20 corresponding lines) broker/src/main/java/org/apache/rocketmq/broker/BrokerStartup.java:262— broker/src/main/java/org/apache/rocketmq/broker/BrokerStartup.java:262-281 | container/src/main/java/org/apache/rocketmq/container/BrokerContainerStartup.java:368-387 — 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.
Edited copy of a member (20 corresponding lines) store/src/main/java/org/apache/rocketmq/store/ha/WaitNotifyObject.java:45— store/src/main/java/org/apache/rocketmq/store/ha/WaitNotifyObject.java:45-64 | store/src/main/java/org/apache/rocketmq/store/ha/WaitNotifyObject.java:83-104 — 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.
Edited copy of a member (20 corresponding lines) client/src/main/java/org/apache/rocketmq/client/impl/consumer/ConsumeMessageOrderlyService.java:215— client/src/main/java/org/apache/rocketmq/client/impl/consumer/ConsumeMessageOrderlyService.java:215-234 | client/src/main/java/org/apache/rocketmq/client/impl/consumer/ConsumeMessagePopOrderlyService.java:193-212 — 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.
Edited copy of a member (20 corresponding lines) store/src/main/java/org/apache/rocketmq/store/ConsumeQueueExt.java:72— store/src/main/java/org/apache/rocketmq/store/ConsumeQueueExt.java:72-91 | store/src/main/java/org/apache/rocketmq/store/ConsumeQueueExt.java:108-127 — 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.
Edited copy of a member (20 corresponding lines) example/src/main/java/org/apache/rocketmq/example/filter/SqlFilterConsumer.java:30— example/src/main/java/org/apache/rocketmq/example/filter/SqlFilterConsumer.java:30-51 | example/src/main/java/org/apache/rocketmq/example/filter/TagFilterConsumer.java:29-48 — 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 (17 corresponding lines) · ×11
Edited copy of a member (17 corresponding lines) broker/src/main/java/org/apache/rocketmq/broker/transaction/queue/TransactionalMessageBridge.java:279— broker/src/main/java/org/apache/rocketmq/broker/transaction/queue/TransactionalMessageBridge.java:279-295 | broker/src/main/java/org/apache/rocketmq/broker/transaction/queue/TransactionalMessageBridge.java:297-313 — These two members are one piece of code written twice and then edited apart: 17 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 (17 corresponding lines) store/src/main/java/org/apache/rocketmq/store/ha/DefaultHAClient.java:251— store/src/main/java/org/apache/rocketmq/store/ha/DefaultHAClient.java:251-270 | store/src/main/java/org/apache/rocketmq/store/ha/autoswitch/AutoSwitchHAClient.java:341-357 — These two members are one piece of code written twice and then edited apart: 17 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 (17 corresponding lines) auth/src/main/java/org/apache/rocketmq/auth/authentication/factory/AuthenticationFactory.java:47— auth/src/main/java/org/apache/rocketmq/auth/authentication/factory/AuthenticationFactory.java:47-63 | auth/src/main/java/org/apache/rocketmq/auth/authorization/factory/AuthorizationFactory.java:48-65 — These two members are one piece of code written twice and then edited apart: 17 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 (17 corresponding lines) auth/src/main/java/org/apache/rocketmq/auth/authentication/strategy/StatefulAuthenticationStrategy.java:44— auth/src/main/java/org/apache/rocketmq/auth/authentication/strategy/StatefulAuthenticationStrategy.java:44-64 | auth/src/main/java/org/apache/rocketmq/auth/authorization/strategy/StatefulAuthorizationStrategy.java:44-60 — These two members are one piece of code written twice and then edited apart: 17 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 (17 corresponding lines) namesrv/src/main/java/org/apache/rocketmq/namesrv/processor/DefaultRequestProcessor.java:404— namesrv/src/main/java/org/apache/rocketmq/namesrv/processor/DefaultRequestProcessor.java:404-423 | namesrv/src/main/java/org/apache/rocketmq/namesrv/processor/DefaultRequestProcessor.java:426-442 — These two members are one piece of code written twice and then edited apart: 17 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 (17 corresponding lines) client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:1904— client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:1904-1920 | client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:1924-1942 — These two members are one piece of code written twice and then edited apart: 17 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 (17 corresponding lines) broker/src/main/java/org/apache/rocketmq/broker/BrokerController.java:993— broker/src/main/java/org/apache/rocketmq/broker/BrokerController.java:993-1009 | namesrv/src/main/java/org/apache/rocketmq/namesrv/NamesrvController.java:158-174 — These two members are one piece of code written twice and then edited apart: 17 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 (17 corresponding lines) broker/src/main/java/org/apache/rocketmq/broker/longpolling/PopLiteLongPollingService.java:260— broker/src/main/java/org/apache/rocketmq/broker/longpolling/PopLiteLongPollingService.java:260-278 | broker/src/main/java/org/apache/rocketmq/broker/longpolling/PopLongPollingService.java:420-436 — These two members are one piece of code written twice and then edited apart: 17 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 (17 corresponding lines) client/src/main/java/org/apache/rocketmq/client/impl/consumer/DefaultMQPullConsumerImpl.java:685— client/src/main/java/org/apache/rocketmq/client/impl/consumer/DefaultMQPullConsumerImpl.java:685-701 | client/src/main/java/org/apache/rocketmq/client/impl/consumer/DefaultMQPushConsumerImpl.java:903-922 — These two members are one piece of code written twice and then edited apart: 17 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 (17 corresponding lines) store/src/main/java/org/apache/rocketmq/store/DefaultMessageStore.java:2318— store/src/main/java/org/apache/rocketmq/store/DefaultMessageStore.java:2318-2334 | store/src/main/java/org/apache/rocketmq/store/DefaultMessageStore.java:2336-2352 — These two members are one piece of code written twice and then edited apart: 17 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 (17 corresponding lines) tools/src/main/java/org/apache/rocketmq/tools/command/auth/GetAclSubCommand.java:114— tools/src/main/java/org/apache/rocketmq/tools/command/auth/GetAclSubCommand.java:114-133 | tools/src/main/java/org/apache/rocketmq/tools/command/auth/ListAclSubCommand.java:120-136 — These two members are one piece of code written twice and then edited apart: 17 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) · ×10
Edited copy of a member (19 corresponding lines) broker/src/main/java/org/apache/rocketmq/broker/processor/AdminBrokerProcessor.java:3096— broker/src/main/java/org/apache/rocketmq/broker/processor/AdminBrokerProcessor.java:3096-3117 | broker/src/main/java/org/apache/rocketmq/broker/transaction/queue/DefaultTransactionalMessageCheckListener.java:61-79 — 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.
Edited copy of a member (19 corresponding lines) proxy/src/main/java/org/apache/rocketmq/proxy/remoting/activity/ConsumerManagerActivity.java:133— proxy/src/main/java/org/apache/rocketmq/proxy/remoting/activity/ConsumerManagerActivity.java:133-151 | proxy/src/main/java/org/apache/rocketmq/proxy/remoting/activity/ConsumerManagerActivity.java:154-172 — 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.
Edited copy of a member (19 corresponding lines) store/src/main/java/org/apache/rocketmq/store/timer/rocksdb/TimerMessageRocksDBStore.java:280— store/src/main/java/org/apache/rocketmq/store/timer/rocksdb/TimerMessageRocksDBStore.java:280-298 | store/src/main/java/org/apache/rocketmq/store/transaction/TransMessageRocksDBStore.java:187-211 — 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.
Edited copy of a member (19 corresponding lines) client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:2203— client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:2203-2221 | client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:2285-2304 — 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.
Edited copy of a member (19 corresponding lines) auth/src/main/java/org/apache/rocketmq/auth/authentication/factory/AuthenticationFactory.java:74— auth/src/main/java/org/apache/rocketmq/auth/authentication/factory/AuthenticationFactory.java:74-92 | auth/src/main/java/org/apache/rocketmq/auth/authorization/factory/AuthorizationFactory.java:76-94 — 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.
Edited copy of a member (19 corresponding lines) broker/src/main/java/org/apache/rocketmq/broker/processor/AdminBrokerProcessor.java:1073— broker/src/main/java/org/apache/rocketmq/broker/processor/AdminBrokerProcessor.java:1073-1091 | namesrv/src/main/java/org/apache/rocketmq/namesrv/processor/DefaultRequestProcessor.java:650-669 — 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.
Edited copy of a member (19 corresponding lines) store/src/main/java/org/apache/rocketmq/store/timer/rocksdb/Timeline.java:107— store/src/main/java/org/apache/rocketmq/store/timer/rocksdb/Timeline.java:107-125 | store/src/main/java/org/apache/rocketmq/store/timer/rocksdb/TimerMessageRocksDBStore.java:158-176 — 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.
Edited copy of a member (19 corresponding lines) broker/src/main/java/org/apache/rocketmq/broker/config/v2/ConsumerOffsetManagerV2.java:387— broker/src/main/java/org/apache/rocketmq/broker/config/v2/ConsumerOffsetManagerV2.java:387-405 | broker/src/main/java/org/apache/rocketmq/broker/config/v2/ConsumerOffsetManagerV2.java:431-449 — 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.
Edited copy of a member (19 corresponding lines) store/src/main/java/org/apache/rocketmq/store/ha/DefaultHAClient.java:347— store/src/main/java/org/apache/rocketmq/store/ha/DefaultHAClient.java:347-365 | store/src/main/java/org/apache/rocketmq/store/ha/autoswitch/AutoSwitchHAClient.java:359-377 — 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.
Edited copy of a member (19 corresponding lines) tools/src/main/java/org/apache/rocketmq/tools/admin/DefaultMQAdminExtImpl.java:604— tools/src/main/java/org/apache/rocketmq/tools/admin/DefaultMQAdminExtImpl.java:604-623 | tools/src/main/java/org/apache/rocketmq/tools/admin/DefaultMQAdminExtImpl.java:642-660 — 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.
Duplicated block (9–10 lines × 2) broker/src/main/java/org/apache/rocketmq/broker/out/BrokerOuterAPI.java:1277— broker/src/main/java/org/apache/rocketmq/broker/out/BrokerOuterAPI.java:1277-1286 | client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:2093-2101 — 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:1277` 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:1193— broker/src/main/java/org/apache/rocketmq/broker/processor/AdminBrokerProcessor.java:1193-1202 | broker/src/main/java/org/apache/rocketmq/broker/processor/AdminBrokerProcessor.java:2198-2206 — 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:1193` 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 (9–10 lines × 2) broker/src/main/java/org/apache/rocketmq/broker/processor/AdminBrokerProcessor.java:1186— broker/src/main/java/org/apache/rocketmq/broker/processor/AdminBrokerProcessor.java:1186-1195 | container/src/main/java/org/apache/rocketmq/container/BrokerContainerProcessor.java:321-329 — before extracting anything, compare `broker/src/main/java/org/apache/rocketmq/broker/processor/AdminBrokerProcessor.java` and `container/src/main/java/org/apache/rocketmq/container/BrokerContainerProcessor.java` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 48 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/processor/AdminBrokerProcessor.java:1186` 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 × 2) broker/src/main/java/org/apache/rocketmq/broker/processor/AdminBrokerProcessor.java:2105— broker/src/main/java/org/apache/rocketmq/broker/processor/AdminBrokerProcessor.java:2105-2114 | broker/src/main/java/org/apache/rocketmq/broker/processor/AdminBrokerProcessor.java:2805-2813 — 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:2105` 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:2103` calls `setPullOffset`, `max` and `broker/src/main/java/org/apache/rocketmq/broker/processor/AdminBrokerProcessor.java:2803` 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) remoting/src/main/java/org/apache/rocketmq/remoting/netty/NettyRemotingClient.java:209— remoting/src/main/java/org/apache/rocketmq/remoting/netty/NettyRemotingClient.java:209-217 | remoting/src/main/java/org/apache/rocketmq/remoting/netty/NettyRemotingClient.java:338-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.
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/stats/BrokerStatsManager.java:714— store/src/main/java/org/apache/rocketmq/store/stats/BrokerStatsManager.java:714-722 | store/src/main/java/org/apache/rocketmq/store/stats/BrokerStatsManager.java:727-736 — 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 (9–10 lines × 2) tools/src/main/java/org/apache/rocketmq/tools/command/consumer/UpdateSubGroupSubCommand.java:199— 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:161-170 — before extracting anything, compare `tools/src/main/java/org/apache/rocketmq/tools/command/consumer/UpdateSubGroupSubCommand.java` and `tools/src/main/java/org/apache/rocketmq/tools/command/topic/UpdateTopicSubCommand.java` as WHOLE FILES: this scan already matched 14 separate duplicated blocks between them, totalling at least 123 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/consumer/UpdateSubGroupSubCommand.java:199` 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 (8 lines × 3) broker/src/main/java/org/apache/rocketmq/broker/processor/ConsumerManageProcessor.java:110— broker/src/main/java/org/apache/rocketmq/broker/processor/ConsumerManageProcessor.java:110-117 | broker/src/main/java/org/apache/rocketmq/broker/processor/ConsumerManageProcessor.java:207-214 | broker/src/main/java/org/apache/rocketmq/broker/topic/TopicQueueMappingManager.java:263-270 — 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:110` 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/schedule/ScheduleMessageService.java:308— broker/src/main/java/org/apache/rocketmq/broker/schedule/ScheduleMessageService.java:308-315 | proxy/src/main/java/org/apache/rocketmq/proxy/config/ProxyConfig.java:361-368 | store/src/main/java/org/apache/rocketmq/store/DefaultMessageStore.java:299-306 — 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: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.
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:1654— client/src/main/java/org/apache/rocketmq/client/impl/producer/DefaultMQProducerImpl.java:1654-1661 | client/src/main/java/org/apache/rocketmq/client/impl/producer/DefaultMQProducerImpl.java:1715-1722 | client/src/main/java/org/apache/rocketmq/client/impl/producer/DefaultMQProducerImpl.java:1785-1792 — 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) proxy/src/main/java/org/apache/rocketmq/proxy/grpc/v2/route/RouteActivity.java:267— proxy/src/main/java/org/apache/rocketmq/proxy/grpc/v2/route/RouteActivity.java:267-274 | proxy/src/main/java/org/apache/rocketmq/proxy/grpc/v2/route/RouteActivity.java:276-283 | proxy/src/main/java/org/apache/rocketmq/proxy/grpc/v2/route/RouteActivity.java:285-292 — 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 `proxy/src/main/java/org/apache/rocketmq/proxy/grpc/v2/route/RouteActivity.java:267` 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 × 3) broker/src/main/java/org/apache/rocketmq/broker/metrics/BrokerMetricsManager.java:492— broker/src/main/java/org/apache/rocketmq/broker/metrics/BrokerMetricsManager.java:492-499 | broker/src/main/java/org/apache/rocketmq/broker/metrics/PopMetricsManager.java:78-85 | remoting/src/main/java/org/apache/rocketmq/remoting/metrics/RemotingMetricsManager.java:75-82 — 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/metrics/BrokerMetricsManager.java:492` 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 (8 lines × 3) broker/src/main/java/org/apache/rocketmq/broker/config/v1/RocksDBConsumerOffsetManager.java:242— broker/src/main/java/org/apache/rocketmq/broker/config/v1/RocksDBConsumerOffsetManager.java:242-249 | broker/src/main/java/org/apache/rocketmq/broker/config/v1/RocksDBSubscriptionGroupManager.java:244-251 | broker/src/main/java/org/apache/rocketmq/broker/config/v1/RocksDBTopicConfigManager.java:199-206 — before extracting anything, compare `broker/src/main/java/org/apache/rocketmq/broker/config/v1/RocksDBConsumerOffsetManager.java` and `broker/src/main/java/org/apache/rocketmq/broker/config/v1/RocksDBSubscriptionGroupManager.java` as WHOLE FILES: this scan already matched 7 separate duplicated blocks between them, totalling at least 98 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 × 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:676-683 | client/src/main/java/org/apache/rocketmq/client/impl/producer/DefaultMQProducerImpl.java:483-490 — 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.
Duplicated block (8 lines × 3) broker/src/main/java/org/apache/rocketmq/broker/config/v1/RocksDBConsumerOffsetManager.java:336— broker/src/main/java/org/apache/rocketmq/broker/config/v1/RocksDBConsumerOffsetManager.java:336-343 | broker/src/main/java/org/apache/rocketmq/broker/config/v1/RocksDBSubscriptionGroupManager.java:405-412 | broker/src/main/java/org/apache/rocketmq/broker/config/v1/RocksDBTopicConfigManager.java:299-306 — before extracting anything, compare `broker/src/main/java/org/apache/rocketmq/broker/config/v1/RocksDBConsumerOffsetManager.java` and `broker/src/main/java/org/apache/rocketmq/broker/config/v1/RocksDBSubscriptionGroupManager.java` as WHOLE FILES: this scan already matched 7 separate duplicated blocks between them, totalling at least 98 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.
XxxComment store/src/main/java/org/apache/rocketmq/store/CommitLog.java:1120— // 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:1279— // 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:758— // 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:770— // 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:543— // 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:554— // 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:382— // 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:650— // 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:668— // 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.
D4 · Code Duplication· Edited copy of a member (22 corresponding lines) · ×9
Edited copy of a member (22 corresponding lines) store/src/main/java/org/apache/rocketmq/store/queue/SparseConsumeQueue.java:326— store/src/main/java/org/apache/rocketmq/store/queue/SparseConsumeQueue.java:326-347 | store/src/main/java/org/apache/rocketmq/store/queue/SparseConsumeQueue.java:350-373 — These two members are one piece of code written twice and then edited apart: 22 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 (22 corresponding lines) client/src/main/java/org/apache/rocketmq/client/impl/producer/DefaultMQProducerImpl.java:1739— client/src/main/java/org/apache/rocketmq/client/impl/producer/DefaultMQProducerImpl.java:1739-1767 | client/src/main/java/org/apache/rocketmq/client/impl/producer/DefaultMQProducerImpl.java:1784-1805 — These two members are one piece of code written twice and then edited apart: 22 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 (22 corresponding lines) remoting/src/main/java/org/apache/rocketmq/remoting/protocol/RocketMQSerializable.java:38— remoting/src/main/java/org/apache/rocketmq/remoting/protocol/RocketMQSerializable.java:38-59 | remoting/src/main/java/org/apache/rocketmq/remoting/protocol/RocketMQSerializable.java:61-82 — These two members are one piece of code written twice and then edited apart: 22 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 (22 corresponding lines) proxy/src/main/java/org/apache/rocketmq/proxy/processor/ConsumerProcessor.java:263— proxy/src/main/java/org/apache/rocketmq/proxy/processor/ConsumerProcessor.java:263-286 | proxy/src/main/java/org/apache/rocketmq/proxy/processor/ConsumerProcessor.java:402-423 — These two members are one piece of code written twice and then edited apart: 22 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 (22 corresponding lines) client/src/main/java/org/apache/rocketmq/client/impl/producer/DefaultMQProducerImpl.java:554— client/src/main/java/org/apache/rocketmq/client/impl/producer/DefaultMQProducerImpl.java:554-575 | client/src/main/java/org/apache/rocketmq/client/impl/producer/DefaultMQProducerImpl.java:1394-1419 — These two members are one piece of code written twice and then edited apart: 22 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 (22 corresponding lines) client/src/main/java/org/apache/rocketmq/client/consumer/store/LocalFileOffsetStore.java:230— client/src/main/java/org/apache/rocketmq/client/consumer/store/LocalFileOffsetStore.java:230-251 | client/src/main/java/org/apache/rocketmq/client/consumer/store/LocalFileOffsetStore.java:253-275 — These two members are one piece of code written twice and then edited apart: 22 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 (22 corresponding lines) store/src/main/java/org/apache/rocketmq/store/MessageExtEncoder.java:61— store/src/main/java/org/apache/rocketmq/store/MessageExtEncoder.java:61-83 | store/src/main/java/org/apache/rocketmq/store/MessageExtEncoder.java:86-107 — These two members are one piece of code written twice and then edited apart: 22 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 (22 corresponding lines) example/src/main/java/org/apache/rocketmq/example/lmq/LMQProducer.java:40— example/src/main/java/org/apache/rocketmq/example/lmq/LMQProducer.java:40-61 | example/src/main/java/org/apache/rocketmq/example/simple/AclClient.java:59-80 — These two members are one piece of code written twice and then edited apart: 22 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 (22 corresponding lines) example/src/main/java/org/apache/rocketmq/example/schedule/ScheduledMessageProducer.java:30— example/src/main/java/org/apache/rocketmq/example/schedule/ScheduledMessageProducer.java:30-51 | example/src/main/java/org/apache/rocketmq/example/schedule/TimerMessageProducer.java:32-57 — These two members are one piece of code written twice and then edited apart: 22 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 (8 corresponding lines) · ×9
Edited copy of a member (8 corresponding lines) remoting/src/main/java/org/apache/rocketmq/remoting/protocol/statictopic/TopicQueueMappingInfo.java:122— remoting/src/main/java/org/apache/rocketmq/remoting/protocol/statictopic/TopicQueueMappingInfo.java:122-131 | remoting/src/main/java/org/apache/rocketmq/remoting/protocol/statictopic/TopicQueueMappingOne.java:79-86 — These two members are one piece of code written twice and then edited apart: 8 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 (8 corresponding lines) store/src/main/java/org/apache/rocketmq/store/GetMessageResult.java:115— store/src/main/java/org/apache/rocketmq/store/GetMessageResult.java:115-122 | store/src/main/java/org/apache/rocketmq/store/GetMessageResult.java:124-132 — These two members are one piece of code written twice and then edited apart: 8 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 (8 corresponding lines) broker/src/main/java/org/apache/rocketmq/broker/pop/orderly/QueueLevelConsumerOrderInfoLockManager.java:167— broker/src/main/java/org/apache/rocketmq/broker/pop/orderly/QueueLevelConsumerOrderInfoLockManager.java:167-176 | common/src/main/java/org/apache/rocketmq/common/TopicQueueId.java:35-42 — These two members are one piece of code written twice and then edited apart: 8 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 (8 corresponding lines) auth/src/main/java/org/apache/rocketmq/auth/authorization/model/Policy.java:41— auth/src/main/java/org/apache/rocketmq/auth/authorization/model/Policy.java:41-49 | remoting/src/main/java/org/apache/rocketmq/remoting/protocol/body/AclInfo.java:46-53 — These two members are one piece of code written twice and then edited apart: 8 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 (8 corresponding lines) proxy/src/main/java/org/apache/rocketmq/proxy/grpc/ProxyAndTlsProtocolNegotiator.java:212— proxy/src/main/java/org/apache/rocketmq/proxy/grpc/ProxyAndTlsProtocolNegotiator.java:212-220 | remoting/src/main/java/org/apache/rocketmq/remoting/netty/NettyRemotingServer.java:786-793 — These two members are one piece of code written twice and then edited apart: 8 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 (8 corresponding lines) remoting/src/main/java/org/apache/rocketmq/remoting/protocol/header/QueryConsumerOffsetRequestHeader.java:87— remoting/src/main/java/org/apache/rocketmq/remoting/protocol/header/QueryConsumerOffsetRequestHeader.java:87-94 | remoting/src/main/java/org/apache/rocketmq/remoting/protocol/header/UpdateConsumerOffsetRequestHeader.java:87-94 — These two members are one piece of code written twice and then edited apart: 8 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 (8 corresponding lines) proxy/src/main/java/org/apache/rocketmq/proxy/grpc/v2/channel/GrpcClientChannel.java:118— proxy/src/main/java/org/apache/rocketmq/proxy/grpc/v2/channel/GrpcClientChannel.java:118-125 | proxy/src/main/java/org/apache/rocketmq/proxy/remoting/channel/RemotingChannel.java:249-256 — These two members are one piece of code written twice and then edited apart: 8 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 (8 corresponding lines) auth/src/main/java/org/apache/rocketmq/auth/authentication/enums/UserStatus.java:38— auth/src/main/java/org/apache/rocketmq/auth/authentication/enums/UserStatus.java:38-45 | auth/src/main/java/org/apache/rocketmq/auth/authorization/enums/Decision.java:37-44 — These two members are one piece of code written twice and then edited apart: 8 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 (8 corresponding lines) remoting/src/main/java/org/apache/rocketmq/remoting/protocol/body/BrokerReplicasInfo.java:57— remoting/src/main/java/org/apache/rocketmq/remoting/protocol/body/BrokerReplicasInfo.java:57-64 | remoting/src/main/java/org/apache/rocketmq/remoting/protocol/body/RoleChangeNotifyEntry.java:41-48 — These two members are one piece of code written twice and then edited apart: 8 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 (16 lines × 2) client/src/main/java/org/apache/rocketmq/client/impl/mqclient/MQClientAPIExt.java:543— client/src/main/java/org/apache/rocketmq/client/impl/mqclient/MQClientAPIExt.java:543-558 | client/src/main/java/org/apache/rocketmq/client/impl/mqclient/MQClientAPIExt.java:579-594 — 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:543` 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:331— store/src/main/java/org/apache/rocketmq/store/ConsumeQueue.java:331-346 | store/src/main/java/org/apache/rocketmq/store/ConsumeQueue.java:352-367 — 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:331` 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/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:738-753 — 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:736` 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:919— store/src/main/java/org/apache/rocketmq/store/timer/TimerMessageStore.java:919-934 | store/src/main/java/org/apache/rocketmq/store/timer/TimerMessageStore.java:1046-1061 — 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:919` 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) broker/src/main/java/org/apache/rocketmq/broker/offset/ConsumerOffsetManager.java:141— broker/src/main/java/org/apache/rocketmq/broker/offset/ConsumerOffsetManager.java:141-156 | broker/src/main/java/org/apache/rocketmq/broker/offset/ConsumerOffsetManager.java:159-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. 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 × 2) broker/src/main/java/org/apache/rocketmq/broker/processor/EndTransactionProcessor.java:340— broker/src/main/java/org/apache/rocketmq/broker/processor/EndTransactionProcessor.java:340-355 | broker/src/main/java/org/apache/rocketmq/broker/processor/SendMessageProcessor.java:429-444 — 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) tools/src/main/java/org/apache/rocketmq/tools/command/metadata/RocksDBConfigToJsonCommand.java:197— tools/src/main/java/org/apache/rocketmq/tools/command/metadata/RocksDBConfigToJsonCommand.java:197-212 | tools/src/main/java/org/apache/rocketmq/tools/command/metadata/RocksDBConfigToJsonCommand.java:300-315 — 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:197` 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 × 2) broker/src/main/java/org/apache/rocketmq/broker/failover/EscapeBridge.java:183— broker/src/main/java/org/apache/rocketmq/broker/failover/EscapeBridge.java:183-192 | broker/src/main/java/org/apache/rocketmq/broker/failover/EscapeBridge.java:252-262 — 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:183` 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–11 lines × 2) broker/src/main/java/org/apache/rocketmq/broker/filter/ConsumerFilterManager.java:438— broker/src/main/java/org/apache/rocketmq/broker/filter/ConsumerFilterManager.java:438-447 | broker/src/main/java/org/apache/rocketmq/broker/filter/ConsumerFilterManager.java:458-468 — 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:438` 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 (10–11 lines × 2) broker/src/main/java/org/apache/rocketmq/broker/pop/PopConsumerService.java:715— broker/src/main/java/org/apache/rocketmq/broker/pop/PopConsumerService.java:715-725 | broker/src/main/java/org/apache/rocketmq/broker/processor/PopReviveService.java:115-124 — 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 (10–11 lines × 2) broker/src/main/java/org/apache/rocketmq/broker/processor/AdminBrokerProcessor.java:1948— broker/src/main/java/org/apache/rocketmq/broker/processor/AdminBrokerProcessor.java:1948-1958 | broker/src/main/java/org/apache/rocketmq/broker/processor/AdminBrokerProcessor.java:2122-2131 — 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:1948` 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 (10–11 lines × 2) client/src/main/java/org/apache/rocketmq/client/consumer/store/RemoteBrokerOffsetStore.java:133— client/src/main/java/org/apache/rocketmq/client/consumer/store/RemoteBrokerOffsetStore.java:133-142 | client/src/main/java/org/apache/rocketmq/client/consumer/store/RemoteBrokerOffsetStore.java:161-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 `client/src/main/java/org/apache/rocketmq/client/consumer/store/RemoteBrokerOffsetStore.java:161` 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:253— client/src/main/java/org/apache/rocketmq/client/impl/consumer/ConsumeMessageOrderlyService.java:253-262 | client/src/main/java/org/apache/rocketmq/client/impl/consumer/ConsumeMessageOrderlyService.java:285-295 — 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:253` 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:264` calls `getProcessQueue`, `commit` and `client/src/main/java/org/apache/rocketmq/client/impl/consumer/ConsumeMessageOrderlyService.java:295` 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) store/src/main/java/org/apache/rocketmq/store/DefaultMessageStore.java:1028— store/src/main/java/org/apache/rocketmq/store/DefaultMessageStore.java:1028-1038 | 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:1028` 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/consumer/store/LocalFileOffsetStore.java:218— client/src/main/java/org/apache/rocketmq/client/consumer/store/LocalFileOffsetStore.java:218-228 | client/src/main/java/org/apache/rocketmq/client/consumer/store/RemoteBrokerOffsetStore.java:184-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. 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–11 lines × 2) example/src/main/java/org/apache/rocketmq/example/lmq/LMQPushPopConsumer.java:62— example/src/main/java/org/apache/rocketmq/example/lmq/LMQPushPopConsumer.java:62-71 | example/src/main/java/org/apache/rocketmq/example/simple/PopConsumer.java:41-51 — 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 before the matched lines, `example/src/main/java/org/apache/rocketmq/example/lmq/LMQPushPopConsumer.java:59` calls `setNamesrvAddr` and `example/src/main/java/org/apache/rocketmq/example/simple/PopConsumer.java:38` 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.
D4 · Code Duplication· Edited copy of a member (25 corresponding lines) · ×8
Edited copy of a member (25 corresponding lines) proxy/src/main/java/org/apache/rocketmq/proxy/grpc/admin/ProxyAdminGrpcService.java:468— proxy/src/main/java/org/apache/rocketmq/proxy/grpc/admin/ProxyAdminGrpcService.java:468-492 | proxy/src/main/java/org/apache/rocketmq/proxy/grpc/admin/ProxyAdminGrpcService.java:666-690 — These two members are one piece of code written twice and then edited apart: 25 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 (25 corresponding lines) broker/src/main/java/org/apache/rocketmq/broker/processor/AdminBrokerProcessor.java:3426— broker/src/main/java/org/apache/rocketmq/broker/processor/AdminBrokerProcessor.java:3426-3450 | broker/src/main/java/org/apache/rocketmq/broker/processor/AdminBrokerProcessor.java:3453-3478 — These two members are one piece of code written twice and then edited apart: 25 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 (25 corresponding lines) broker/src/main/java/org/apache/rocketmq/broker/metrics/ConsumerLagCalculator.java:354— broker/src/main/java/org/apache/rocketmq/broker/metrics/ConsumerLagCalculator.java:354-381 | broker/src/main/java/org/apache/rocketmq/broker/metrics/ConsumerLagCalculator.java:415-439 — These two members are one piece of code written twice and then edited apart: 25 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 (25 corresponding lines) broker/src/main/java/org/apache/rocketmq/broker/pop/orderly/QueueLevelConsumerManager.java:576— broker/src/main/java/org/apache/rocketmq/broker/pop/orderly/QueueLevelConsumerManager.java:576-601 | broker/src/main/java/org/apache/rocketmq/broker/pop/orderly/QueueLevelConsumerManager.java:604-628 — These two members are one piece of code written twice and then edited apart: 25 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 (25 corresponding lines) broker/src/main/java/org/apache/rocketmq/broker/out/BrokerOuterAPI.java:377— broker/src/main/java/org/apache/rocketmq/broker/out/BrokerOuterAPI.java:377-401 | broker/src/main/java/org/apache/rocketmq/broker/out/BrokerOuterAPI.java:1484-1511 — These two members are one piece of code written twice and then edited apart: 25 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 (25 corresponding lines) auth/src/main/java/org/apache/rocketmq/auth/authentication/strategy/AbstractAuthenticationStrategy.java:40— auth/src/main/java/org/apache/rocketmq/auth/authentication/strategy/AbstractAuthenticationStrategy.java:40-64 | auth/src/main/java/org/apache/rocketmq/auth/authorization/strategy/AbstractAuthorizationStrategy.java:50-74 — These two members are one piece of code written twice and then edited apart: 25 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 (25 corresponding lines) tools/src/main/java/org/apache/rocketmq/tools/admin/DefaultMQAdminExtImpl.java:1534— tools/src/main/java/org/apache/rocketmq/tools/admin/DefaultMQAdminExtImpl.java:1534-1558 | tools/src/main/java/org/apache/rocketmq/tools/admin/DefaultMQAdminExtImpl.java:1561-1589 — These two members are one piece of code written twice and then edited apart: 25 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 (25 corresponding lines) tools/src/main/java/org/apache/rocketmq/tools/admin/MQAdminUtils.java:210— tools/src/main/java/org/apache/rocketmq/tools/admin/MQAdminUtils.java:210-237 | tools/src/main/java/org/apache/rocketmq/tools/admin/MQAdminUtils.java:240-264 — These two members are one piece of code written twice and then edited apart: 25 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 (28 corresponding lines) · ×8
Edited copy of a member (28 corresponding lines) broker/src/main/java/org/apache/rocketmq/broker/metrics/ConsumerLagCalculator.java:269— broker/src/main/java/org/apache/rocketmq/broker/metrics/ConsumerLagCalculator.java:269-296 | broker/src/main/java/org/apache/rocketmq/broker/metrics/ConsumerLagCalculator.java:298-327 — These two members are one piece of code written twice and then edited apart: 28 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 (28 corresponding lines) proxy/src/main/java/org/apache/rocketmq/proxy/grpc/v2/consumer/ChangeInvisibleDurationActivity.java:43— proxy/src/main/java/org/apache/rocketmq/proxy/grpc/v2/consumer/ChangeInvisibleDurationActivity.java:43-73 | proxy/src/main/java/org/apache/rocketmq/proxy/grpc/v2/producer/ForwardMessageToDLQActivity.java:40-67 — These two members are one piece of code written twice and then edited apart: 28 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 (28 corresponding lines) broker/src/main/java/org/apache/rocketmq/broker/metrics/ConsumerLagCalculator.java:384— broker/src/main/java/org/apache/rocketmq/broker/metrics/ConsumerLagCalculator.java:384-413 | broker/src/main/java/org/apache/rocketmq/broker/metrics/ConsumerLagCalculator.java:442-469 — These two members are one piece of code written twice and then edited apart: 28 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 (28 corresponding lines) broker/src/main/java/org/apache/rocketmq/broker/topic/TopicRouteInfoManager.java:221— broker/src/main/java/org/apache/rocketmq/broker/topic/TopicRouteInfoManager.java:221-248 | client/src/main/java/org/apache/rocketmq/client/impl/factory/MQClientInstance.java:1311-1343 — These two members are one piece of code written twice and then edited apart: 28 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 (28 corresponding lines) common/src/main/java/org/apache/rocketmq/common/utils/HttpTinyClient.java:33— common/src/main/java/org/apache/rocketmq/common/utils/HttpTinyClient.java:33-60 | common/src/main/java/org/apache/rocketmq/common/utils/HttpTinyClient.java:96-125 — These two members are one piece of code written twice and then edited apart: 28 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 (28 corresponding lines) store/src/main/java/org/apache/rocketmq/store/DefaultMessageStore.java:1885— store/src/main/java/org/apache/rocketmq/store/DefaultMessageStore.java:1885-1912 | REDACTED:283-316 — These two members are one piece of code written twice and then edited apart: 28 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 (28 corresponding lines) remoting/src/main/java/org/apache/rocketmq/remoting/protocol/RemotingCommand.java:387— remoting/src/main/java/org/apache/rocketmq/remoting/protocol/RemotingCommand.java:387-419 | remoting/src/main/java/org/apache/rocketmq/remoting/protocol/RemotingCommand.java:483-510 — These two members are one piece of code written twice and then edited apart: 28 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 (28 corresponding lines) tools/src/main/java/org/apache/rocketmq/tools/command/topic/RemappingStaticTopicSubCommand.java:54— tools/src/main/java/org/apache/rocketmq/tools/command/topic/RemappingStaticTopicSubCommand.java:54-81 | tools/src/main/java/org/apache/rocketmq/tools/command/topic/UpdateStaticTopicSubCommand.java:55-86 — These two members are one piece of code written twice and then edited apart: 28 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 (6 lines × 3) client/src/main/java/org/apache/rocketmq/client/impl/consumer/ConsumeMessageOrderlyService.java:107— client/src/main/java/org/apache/rocketmq/client/impl/consumer/ConsumeMessageOrderlyService.java:107-112 | client/src/main/java/org/apache/rocketmq/client/impl/consumer/ConsumeMessagePopConcurrentlyService.java:81-86 | client/src/main/java/org/apache/rocketmq/client/impl/consumer/ConsumeMessagePopOrderlyService.java:98-103 — 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 10 separate duplicated blocks between them, totalling at least 133 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:79` calls `setAutoCommit` and `client/src/main/java/org/apache/rocketmq/client/impl/consumer/ConsumeMessageOrderlyService.java:105` 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) client/src/main/java/org/apache/rocketmq/client/trace/TraceDataEncoder.java:50— client/src/main/java/org/apache/rocketmq/client/trace/TraceDataEncoder.java:50-55 | client/src/main/java/org/apache/rocketmq/client/trace/TraceDataEncoder.java:118-123 | client/src/main/java/org/apache/rocketmq/client/trace/TraceDataEncoder.java:138-143 — 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) 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) proxy/src/main/java/org/apache/rocketmq/proxy/service/message/LocalMessageService.java:115— proxy/src/main/java/org/apache/rocketmq/proxy/service/message/LocalMessageService.java:115-120 | proxy/src/main/java/org/apache/rocketmq/proxy/service/message/LocalMessageService.java:207-212 | proxy/src/main/java/org/apache/rocketmq/proxy/service/message/LocalMessageService.java:274-279 — 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 `proxy/src/main/java/org/apache/rocketmq/proxy/service/message/LocalMessageService.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.
Duplicated block (6 lines × 3) store/src/main/java/org/apache/rocketmq/store/stats/BrokerStatsManager.java:467— store/src/main/java/org/apache/rocketmq/store/stats/BrokerStatsManager.java:467-472 | store/src/main/java/org/apache/rocketmq/store/stats/BrokerStatsManager.java:489-494 | store/src/main/java/org/apache/rocketmq/store/stats/BrokerStatsManager.java:500-505 — 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) store/src/main/java/org/apache/rocketmq/store/rocksdb/MessageRocksDBStorage.java:278— store/src/main/java/org/apache/rocketmq/store/rocksdb/MessageRocksDBStorage.java:278-283 | store/src/main/java/org/apache/rocketmq/store/rocksdb/MessageRocksDBStorage.java:349-354 | store/src/main/java/org/apache/rocketmq/store/rocksdb/MessageRocksDBStorage.java:539-544 — 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.
Duplicated block (6 lines × 3) client/src/main/java/org/apache/rocketmq/client/trace/TraceDataEncoder.java:170— client/src/main/java/org/apache/rocketmq/client/trace/TraceDataEncoder.java:170-175 | client/src/main/java/org/apache/rocketmq/client/trace/TraceDataEncoder.java:218-223 | client/src/main/java/org/apache/rocketmq/client/trace/TraceDataEncoder.java:235-240 — 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:1364— tools/src/main/java/org/apache/rocketmq/tools/admin/DefaultMQAdminExtImpl.java:1364-1369 | tools/src/main/java/org/apache/rocketmq/tools/admin/DefaultMQAdminExtImpl.java:1456-1461 | tools/src/main/java/org/apache/rocketmq/tools/admin/DefaultMQAdminExtImpl.java:1487-1492 — 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:1364` 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:1462` calls `countDown` and `tools/src/main/java/org/apache/rocketmq/tools/admin/DefaultMQAdminExtImpl.java:1370` 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.
D4 · Code Duplication· Edited copy of a member (26 corresponding lines) · ×7
Edited copy of a member (26 corresponding lines) proxy/src/main/java/org/apache/rocketmq/proxy/processor/ConsumerProcessor.java:479— proxy/src/main/java/org/apache/rocketmq/proxy/processor/ConsumerProcessor.java:479-507 | proxy/src/main/java/org/apache/rocketmq/proxy/processor/ConsumerProcessor.java:510-535 — 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) broker/src/main/java/org/apache/rocketmq/broker/config/v2/SubscriptionGroupManagerV2.java:59— broker/src/main/java/org/apache/rocketmq/broker/config/v2/SubscriptionGroupManagerV2.java:59-84 | broker/src/main/java/org/apache/rocketmq/broker/config/v2/TopicConfigManagerV2.java:61-88 — 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) broker/src/main/java/org/apache/rocketmq/broker/processor/AdminBrokerProcessor.java:434— broker/src/main/java/org/apache/rocketmq/broker/processor/AdminBrokerProcessor.java:434-459 | broker/src/main/java/org/apache/rocketmq/broker/processor/AdminBrokerProcessor.java:3120-3150 — 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) broker/src/main/java/org/apache/rocketmq/broker/controller/ReplicasManager.java:348— broker/src/main/java/org/apache/rocketmq/broker/controller/ReplicasManager.java:348-373 | broker/src/main/java/org/apache/rocketmq/broker/dledger/DLedgerRoleChangeHandler.java:106-134 — 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) broker/src/main/java/org/apache/rocketmq/broker/out/BrokerOuterAPI.java:1562— broker/src/main/java/org/apache/rocketmq/broker/out/BrokerOuterAPI.java:1562-1587 | client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:1086-1111 — 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) store/src/main/java/org/apache/rocketmq/store/logfile/DefaultMappedFile.java:439— store/src/main/java/org/apache/rocketmq/store/logfile/DefaultMappedFile.java:439-467 | store/src/main/java/org/apache/rocketmq/store/logfile/DefaultMappedFile.java:476-501 — 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) example/src/main/java/org/apache/rocketmq/example/rpc/AsyncRequestProducer.java:31— example/src/main/java/org/apache/rocketmq/example/rpc/AsyncRequestProducer.java:31-62 | example/src/main/java/org/apache/rocketmq/example/rpc/RequestProducer.java:26-51 — 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 (24 corresponding lines) · ×7
Edited copy of a member (24 corresponding lines) proxy/src/main/java/org/apache/rocketmq/proxy/remoting/channel/RemotingChannel.java:157— proxy/src/main/java/org/apache/rocketmq/proxy/remoting/channel/RemotingChannel.java:157-180 | proxy/src/main/java/org/apache/rocketmq/proxy/remoting/channel/RemotingChannel.java:190-215 — These two members are one piece of code written twice and then edited apart: 24 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 (24 corresponding lines) broker/src/main/java/org/apache/rocketmq/broker/config/v2/SubscriptionGroupManagerV2.java:86— broker/src/main/java/org/apache/rocketmq/broker/config/v2/SubscriptionGroupManagerV2.java:86-109 | broker/src/main/java/org/apache/rocketmq/broker/config/v2/TopicConfigManagerV2.java:98-123 — These two members are one piece of code written twice and then edited apart: 24 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 (24 corresponding lines) broker/src/main/java/org/apache/rocketmq/broker/config/v1/RocksDBConsumerOffsetManager.java:95— broker/src/main/java/org/apache/rocketmq/broker/config/v1/RocksDBConsumerOffsetManager.java:95-118 | broker/src/main/java/org/apache/rocketmq/broker/config/v1/RocksDBTopicConfigManager.java:93-124 — These two members are one piece of code written twice and then edited apart: 24 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 (24 corresponding lines) proxy/src/main/java/org/apache/rocketmq/proxy/grpc/ProxyAndTlsProtocolNegotiator.java:172— proxy/src/main/java/org/apache/rocketmq/proxy/grpc/ProxyAndTlsProtocolNegotiator.java:172-195 | remoting/src/main/java/org/apache/rocketmq/remoting/netty/NettyRemotingServer.java:481-505 — These two members are one piece of code written twice and then edited apart: 24 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 (24 corresponding lines) proxy/src/main/java/org/apache/rocketmq/proxy/common/ReceiptHandleGroup.java:215— proxy/src/main/java/org/apache/rocketmq/proxy/common/ReceiptHandleGroup.java:215-238 | proxy/src/main/java/org/apache/rocketmq/proxy/common/ReceiptHandleGroup.java:240-264 — These two members are one piece of code written twice and then edited apart: 24 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 (24 corresponding lines) store/src/main/java/org/apache/rocketmq/store/ha/DefaultHAClient.java:272— store/src/main/java/org/apache/rocketmq/store/ha/DefaultHAClient.java:272-300 | store/src/main/java/org/apache/rocketmq/store/ha/autoswitch/AutoSwitchHAClient.java:240-263 — These two members are one piece of code written twice and then edited apart: 24 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 (24 corresponding lines) filter/src/main/java/org/apache/rocketmq/filter/expression/LogicExpression.java:36— filter/src/main/java/org/apache/rocketmq/filter/expression/LogicExpression.java:36-59 | filter/src/main/java/org/apache/rocketmq/filter/expression/LogicExpression.java:61-85 — These two members are one piece of code written twice and then edited apart: 24 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) · ×7
Edited copy of a member (21 corresponding lines) auth/src/main/java/org/apache/rocketmq/auth/authentication/provider/LocalAuthenticationMetadataProvider.java:52— auth/src/main/java/org/apache/rocketmq/auth/authentication/provider/LocalAuthenticationMetadataProvider.java:52-73 | auth/src/main/java/org/apache/rocketmq/auth/authorization/provider/LocalAuthorizationMetadataProvider.java:57-77 — 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.
Edited copy of a member (21 corresponding lines) client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:3452— client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:3452-3472 | client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:3546-3568 — 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.
Edited copy of a member (21 corresponding lines) broker/src/main/java/org/apache/rocketmq/broker/subscription/SubscriptionGroupManager.java:152— broker/src/main/java/org/apache/rocketmq/broker/subscription/SubscriptionGroupManager.java:152-172 | broker/src/main/java/org/apache/rocketmq/broker/topic/TopicConfigManager.java:521-544 — 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.
Edited copy of a member (21 corresponding lines) broker/src/main/java/org/apache/rocketmq/broker/BrokerStartup.java:57— broker/src/main/java/org/apache/rocketmq/broker/BrokerStartup.java:57-78 | container/src/main/java/org/apache/rocketmq/container/BrokerContainerStartup.java:200-220 — 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.
Edited copy of a member (21 corresponding lines) broker/src/main/java/org/apache/rocketmq/broker/topic/TopicConfigManager.java:476— broker/src/main/java/org/apache/rocketmq/broker/topic/TopicConfigManager.java:476-497 | broker/src/main/java/org/apache/rocketmq/broker/topic/TopicConfigManager.java:499-519 — 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.
Edited copy of a member (21 corresponding lines) tools/src/main/java/org/apache/rocketmq/tools/command/namesrv/UpdateKvConfigCommand.java:55— tools/src/main/java/org/apache/rocketmq/tools/command/namesrv/UpdateKvConfigCommand.java:55-78 | tools/src/main/java/org/apache/rocketmq/tools/command/topic/DeleteTopicSubCommand.java:79-99 — 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.
Edited copy of a member (21 corresponding lines) example/src/main/java/org/apache/rocketmq/example/broadcast/PushConsumer.java:34— example/src/main/java/org/apache/rocketmq/example/broadcast/PushConsumer.java:34-54 | example/src/main/java/org/apache/rocketmq/example/quickstart/Consumer.java:34-79 — 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· Edited copies of one member (3 members, 12+ corresponding lines) · ×7
Edited copies of one member (3 members, 12+ corresponding lines) broker/src/main/java/org/apache/rocketmq/broker/processor/PopBufferMergeService.java:934— broker/src/main/java/org/apache/rocketmq/broker/processor/PopBufferMergeService.java:934-946 | store/src/main/java/org/apache/rocketmq/store/pop/AckMsg.java:101-112 | store/src/main/java/org/apache/rocketmq/store/pop/BatchAckMsg.java:39-50 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 12 lines, 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 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. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
Edited copies of one member (3 members, 12+ corresponding lines) common/src/main/java/org/apache/rocketmq/common/stats/StatsItem.java:156— common/src/main/java/org/apache/rocketmq/common/stats/StatsItem.java:156-167 | common/src/main/java/org/apache/rocketmq/common/stats/StatsItem.java:169-180 | common/src/main/java/org/apache/rocketmq/common/stats/StatsItem.java:182-193 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 12 lines, 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 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. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
Edited copies of one member (3 members, 12+ corresponding lines) broker/src/main/java/org/apache/rocketmq/broker/config/v1/RocksDBSubscriptionGroupManager.java:160— broker/src/main/java/org/apache/rocketmq/broker/config/v1/RocksDBSubscriptionGroupManager.java:160-172 | broker/src/main/java/org/apache/rocketmq/broker/config/v1/RocksDBSubscriptionGroupManager.java:175-188 | broker/src/main/java/org/apache/rocketmq/broker/config/v1/RocksDBTopicConfigManager.java:141-152 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 12 lines, 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 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. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
Edited copies of one member (3 members, 12+ corresponding lines) store/src/main/java/org/apache/rocketmq/store/index/rocksdb/IndexRocksDBStore.java:294— store/src/main/java/org/apache/rocketmq/store/index/rocksdb/IndexRocksDBStore.java:294-306 | store/src/main/java/org/apache/rocketmq/store/timer/rocksdb/Timeline.java:233-244 | store/src/main/java/org/apache/rocketmq/store/transaction/TransMessageRocksDBStore.java:299-311 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 12 lines, 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 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. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
Edited copies of one member (3 members, 12+ corresponding lines) store/src/main/java/org/apache/rocketmq/store/dledger/DLedgerCommitLog.java:259— store/src/main/java/org/apache/rocketmq/store/dledger/DLedgerCommitLog.java:259-275 | store/src/main/java/org/apache/rocketmq/store/dledger/DLedgerCommitLog.java:278-292 | store/src/main/java/org/apache/rocketmq/store/dledger/DLedgerCommitLog.java:789-800 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 12 lines, 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 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. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
Edited copies of one member (3 members, 12+ corresponding lines) broker/src/main/java/org/apache/rocketmq/broker/loadbalance/MessageRequestModeManager.java:41— broker/src/main/java/org/apache/rocketmq/broker/loadbalance/MessageRequestModeManager.java:41-52 | common/src/main/java/org/apache/rocketmq/common/statistics/StatisticsItemScheduledIncrementPrinter.java:138-151 | common/src/main/java/org/apache/rocketmq/common/statistics/StatisticsItemScheduledIncrementPrinter.java:154-165 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 12 lines, 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 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. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
Edited copies of one member (3 members, 12+ corresponding lines) broker/src/main/java/org/apache/rocketmq/broker/config/v1/RocksDBConsumerOffsetManager.java:78— broker/src/main/java/org/apache/rocketmq/broker/config/v1/RocksDBConsumerOffsetManager.java:78-89 | broker/src/main/java/org/apache/rocketmq/broker/config/v1/RocksDBSubscriptionGroupManager.java:77-89 | broker/src/main/java/org/apache/rocketmq/broker/config/v1/RocksDBTopicConfigManager.java:71-83 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 12 lines, 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 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. Left alone, the next edit has to be made 3 times and the copies 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) 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) store/src/main/java/org/apache/rocketmq/store/MessageExtEncoder.java:298— store/src/main/java/org/apache/rocketmq/store/MessageExtEncoder.java:298-317 | store/src/main/java/org/apache/rocketmq/store/dledger/DLedgerCommitLog.java:1022-1041 — 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 (20 lines × 2) tieredstore/src/main/java/org/apache/rocketmq/tieredstore/stream/CommitLogInputStream.java:112— tieredstore/src/main/java/org/apache/rocketmq/tieredstore/stream/CommitLogInputStream.java:112-131 | tieredstore/src/main/java/org/apache/rocketmq/tieredstore/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) broker/src/main/java/org/apache/rocketmq/broker/subscription/SubscriptionGroupManager.java:323— broker/src/main/java/org/apache/rocketmq/broker/subscription/SubscriptionGroupManager.java:323-342 | broker/src/main/java/org/apache/rocketmq/broker/topic/TopicConfigManager.java:743-762 — 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:323` 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 `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) 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 (20 lines × 2) tools/src/main/java/org/apache/rocketmq/tools/admin/DefaultMQAdminExtImpl.java:1411— tools/src/main/java/org/apache/rocketmq/tools/admin/DefaultMQAdminExtImpl.java:1411-1430 | tools/src/main/java/org/apache/rocketmq/tools/admin/DefaultMQAdminExtImpl.java:1502-1521 — 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:1411` 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, `tools/src/main/java/org/apache/rocketmq/tools/admin/DefaultMQAdminExtImpl.java:1498` calls `countDown` and `tools/src/main/java/org/apache/rocketmq/tools/admin/DefaultMQAdminExtImpl.java:1407` 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 × 3) auth/src/main/java/org/apache/rocketmq/auth/authorization/builder/DefaultAuthorizationContextBuilder.java:356— auth/src/main/java/org/apache/rocketmq/auth/authorization/builder/DefaultAuthorizationContextBuilder.java:356-365 | auth/src/main/java/org/apache/rocketmq/auth/authorization/builder/DefaultAuthorizationContextBuilder.java:416-424 | auth/src/main/java/org/apache/rocketmq/auth/authorization/builder/DefaultAuthorizationContextBuilder.java:433-441 — 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 `auth/src/main/java/org/apache/rocketmq/auth/authorization/builder/DefaultAuthorizationContextBuilder.java:356` 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 lines × 3) broker/src/main/java/org/apache/rocketmq/broker/config/v1/RocksDBConsumerOffsetManager.java:145— broker/src/main/java/org/apache/rocketmq/broker/config/v1/RocksDBConsumerOffsetManager.java:145-153 | broker/src/main/java/org/apache/rocketmq/broker/config/v1/RocksDBSubscriptionGroupManager.java:223-231 | broker/src/main/java/org/apache/rocketmq/broker/config/v1/RocksDBTopicConfigManager.java:178-186 — before extracting anything, compare `broker/src/main/java/org/apache/rocketmq/broker/config/v1/RocksDBConsumerOffsetManager.java` and `broker/src/main/java/org/apache/rocketmq/broker/config/v1/RocksDBSubscriptionGroupManager.java` as WHOLE FILES: this scan already matched 7 separate duplicated blocks between them, totalling at least 98 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 (9 lines × 3) broker/src/main/java/org/apache/rocketmq/broker/out/BrokerOuterAPI.java:434— broker/src/main/java/org/apache/rocketmq/broker/out/BrokerOuterAPI.java:434-443 | broker/src/main/java/org/apache/rocketmq/broker/out/BrokerOuterAPI.java:633-641 | client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:3410-3418 — 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:1623— client/src/main/java/org/apache/rocketmq/client/impl/producer/DefaultMQProducerImpl.java:1623-1631 | client/src/main/java/org/apache/rocketmq/client/impl/producer/DefaultMQProducerImpl.java:1683-1691 | client/src/main/java/org/apache/rocketmq/client/impl/producer/DefaultMQProducerImpl.java:1740-1748 — 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:1623` 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) store/src/main/java/org/apache/rocketmq/store/rocksdb/RocksDBOptionsFactory.java:163— store/src/main/java/org/apache/rocketmq/store/rocksdb/RocksDBOptionsFactory.java:163-171 | store/src/main/java/org/apache/rocketmq/store/rocksdb/RocksDBOptionsFactory.java:291-299 | store/src/main/java/org/apache/rocketmq/store/rocksdb/RocksDBOptionsFactory.java:342-350 — 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 `store/src/main/java/org/apache/rocketmq/store/rocksdb/RocksDBOptionsFactory.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 × 3) tools/src/main/java/org/apache/rocketmq/tools/command/auth/CreateAclSubCommand.java:112— tools/src/main/java/org/apache/rocketmq/tools/command/auth/CreateAclSubCommand.java:112-120 | tools/src/main/java/org/apache/rocketmq/tools/command/auth/DeleteAclSubCommand.java:80-88 | tools/src/main/java/org/apache/rocketmq/tools/command/auth/UpdateAclSubCommand.java:112-120 — before extracting anything, compare `tools/src/main/java/org/apache/rocketmq/tools/command/auth/CreateAclSubCommand.java` and `tools/src/main/java/org/apache/rocketmq/tools/command/auth/DeleteAclSubCommand.java` as WHOLE FILES: this scan already matched 10 separate duplicated blocks between them, totalling at least 93 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/auth/CreateAclSubCommand.java:112` 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:103-111 | 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.
D4 · Code Duplication· Edited copy of a member (31 corresponding lines) · ×6
Edited copy of a member (31 corresponding lines) store/src/main/java/org/apache/rocketmq/store/StoreCheckpoint.java:45— store/src/main/java/org/apache/rocketmq/store/StoreCheckpoint.java:45-75 | store/src/main/java/org/apache/rocketmq/store/timer/TimerCheckpoint.java:51-84 — 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) broker/src/main/java/org/apache/rocketmq/broker/longpolling/PopLiteLongPollingService.java:165— broker/src/main/java/org/apache/rocketmq/broker/longpolling/PopLiteLongPollingService.java:165-195 | broker/src/main/java/org/apache/rocketmq/broker/longpolling/PopLongPollingService.java:263-301 — 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) broker/src/main/java/org/apache/rocketmq/broker/schedule/ScheduleMessageService.java:334— broker/src/main/java/org/apache/rocketmq/broker/schedule/ScheduleMessageService.java:334-364 | store/src/main/java/org/apache/rocketmq/store/timer/TimerMessageStore.java:1245-1276 — 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) broker/src/main/java/org/apache/rocketmq/broker/latency/BrokerFastFailure.java:122— broker/src/main/java/org/apache/rocketmq/broker/latency/BrokerFastFailure.java:122-154 | proxy/src/main/java/org/apache/rocketmq/proxy/remoting/RemotingProtocolServer.java:369-399 — 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) store/src/main/java/org/apache/rocketmq/store/CommitLog.java:1731— store/src/main/java/org/apache/rocketmq/store/CommitLog.java:1731-1765 | store/src/main/java/org/apache/rocketmq/store/CommitLog.java:1842-1872 — 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/admin/DefaultMQAdminExtImpl.java:324— tools/src/main/java/org/apache/rocketmq/tools/admin/DefaultMQAdminExtImpl.java:324-354 | tools/src/main/java/org/apache/rocketmq/tools/admin/DefaultMQAdminExtImpl.java:1149-1182 — 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 copies of one member (3 members, 10+ corresponding lines) · ×6
Edited copies of one member (3 members, 10+ corresponding lines) filter/src/main/java/org/apache/rocketmq/filter/util/BitsArray.java:93— filter/src/main/java/org/apache/rocketmq/filter/util/BitsArray.java:93-102 | filter/src/main/java/org/apache/rocketmq/filter/util/BitsArray.java:115-124 | filter/src/main/java/org/apache/rocketmq/filter/util/BitsArray.java:134-143 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 10 lines, 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 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. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
Edited copies of one member (3 members, 10+ corresponding lines) client/src/main/java/org/apache/rocketmq/acl/common/AclSigner.java:46— client/src/main/java/org/apache/rocketmq/acl/common/AclSigner.java:46-55 | client/src/main/java/org/apache/rocketmq/acl/common/AclSigner.java:57-67 | client/src/main/java/org/apache/rocketmq/acl/common/AclSigner.java:79-88 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 10 lines, 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 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. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
Edited copies of one member (3 members, 10+ corresponding lines) proxy/src/main/java/org/apache/rocketmq/proxy/service/metadata/ClusterMetadataService.java:184— proxy/src/main/java/org/apache/rocketmq/proxy/service/metadata/ClusterMetadataService.java:184-193 | proxy/src/main/java/org/apache/rocketmq/proxy/service/metadata/ClusterMetadataService.java:230-243 | proxy/src/main/java/org/apache/rocketmq/proxy/service/metadata/ClusterMetadataService.java:258-271 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 10 lines, 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 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. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
Edited copies of one member (3 members, 10+ corresponding lines) store/src/main/java/org/apache/rocketmq/store/stats/BrokerStatsManager.java:466— store/src/main/java/org/apache/rocketmq/store/stats/BrokerStatsManager.java:466-475 | store/src/main/java/org/apache/rocketmq/store/stats/BrokerStatsManager.java:477-486 | store/src/main/java/org/apache/rocketmq/store/stats/BrokerStatsManager.java:525-534 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 10 lines, 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 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. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
Edited copies of one member (3 members, 10+ corresponding lines) broker/src/main/java/org/apache/rocketmq/broker/transaction/rocksdb/TransactionalMessageRocksDBService.java:88— broker/src/main/java/org/apache/rocketmq/broker/transaction/rocksdb/TransactionalMessageRocksDBService.java:88-100 | store/src/main/java/org/apache/rocketmq/store/index/rocksdb/IndexRocksDBStore.java:96-105 | store/src/main/java/org/apache/rocketmq/store/transaction/TransMessageRocksDBStore.java:95-104 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 10 lines, 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 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. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
Edited copies of one member (3 members, 10+ corresponding lines) openmessaging/src/main/java/io/openmessaging/rocketmq/consumer/PullConsumerImpl.java:132— openmessaging/src/main/java/io/openmessaging/rocketmq/consumer/PullConsumerImpl.java:132-142 | openmessaging/src/main/java/io/openmessaging/rocketmq/consumer/PushConsumerImpl.java:145-154 | openmessaging/src/main/java/io/openmessaging/rocketmq/producer/AbstractOMSProducer.java:73-82 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 10 lines, 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 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. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
Duplicated block (18 lines × 2) broker/src/main/java/org/apache/rocketmq/broker/client/ProducerManager.java:161— broker/src/main/java/org/apache/rocketmq/broker/client/ProducerManager.java:161-178 | broker/src/main/java/org/apache/rocketmq/broker/client/ProducerManager.java:184-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 `broker/src/main/java/org/apache/rocketmq/broker/client/ProducerManager.java:161` 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) client/src/main/java/org/apache/rocketmq/client/impl/producer/DefaultMQProducerImpl.java:1633— client/src/main/java/org/apache/rocketmq/client/impl/producer/DefaultMQProducerImpl.java:1633-1650 | client/src/main/java/org/apache/rocketmq/client/impl/producer/DefaultMQProducerImpl.java:1693-1710 — 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:1633` 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:1149— store/src/main/java/org/apache/rocketmq/store/CommitLog.java:1149-1166 | store/src/main/java/org/apache/rocketmq/store/CommitLog.java:1306-1323 — 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:1149` 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:1769— store/src/main/java/org/apache/rocketmq/store/CommitLog.java:1769-1786 | store/src/main/java/org/apache/rocketmq/store/CommitLog.java:1875-1892 — 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 (18 lines × 2) store/src/main/java/org/apache/rocketmq/store/logfile/DefaultMappedFile.java:293— store/src/main/java/org/apache/rocketmq/store/logfile/DefaultMappedFile.java:293-310 | store/src/main/java/org/apache/rocketmq/store/logfile/DefaultMappedFile.java:353-370 — 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:293` 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 `cb` to `CompactionAppendMsgCallback` in one and `AppendMessageCallback` 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 (18 lines × 2) store/src/main/java/org/apache/rocketmq/store/exception/ConsumeQueueException.java:20— store/src/main/java/org/apache/rocketmq/store/exception/ConsumeQueueException.java:20-38 | store/src/main/java/org/apache/rocketmq/store/exception/StoreException.java:20-37 — 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 (17 lines × 2) client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:753— client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:753-769 | proxy/src/main/java/org/apache/rocketmq/proxy/service/message/LocalMessageService.java:136-152 — 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:753` 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) proxy/src/main/java/org/apache/rocketmq/proxy/remoting/channel/RemotingChannel.java:164— proxy/src/main/java/org/apache/rocketmq/proxy/remoting/channel/RemotingChannel.java:164-180 | proxy/src/main/java/org/apache/rocketmq/proxy/remoting/channel/RemotingChannel.java:199-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 `proxy/src/main/java/org/apache/rocketmq/proxy/remoting/channel/RemotingChannel.java:164` 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) tieredstore/src/main/java/org/apache/rocketmq/tieredstore/TieredMessageStore.java:444— tieredstore/src/main/java/org/apache/rocketmq/tieredstore/TieredMessageStore.java:444-460 | tieredstore/src/main/java/org/apache/rocketmq/tieredstore/TieredMessageStore.java:476-492 — 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/TieredMessageStore.java:444` 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 (17 lines × 2) client/src/main/java/org/apache/rocketmq/client/impl/consumer/ConsumeMessageOrderlyService.java:323— client/src/main/java/org/apache/rocketmq/client/impl/consumer/ConsumeMessageOrderlyService.java:323-339 | client/src/main/java/org/apache/rocketmq/client/impl/consumer/ConsumeMessagePopOrderlyService.java:237-253 — 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 10 separate duplicated blocks between them, totalling at least 133 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 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 (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 16 separate duplicated blocks between them, totalling at least 158 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 (8–9 lines × 2) broker/src/main/java/org/apache/rocketmq/broker/pop/PopConsumerRocksdbStore.java:73— broker/src/main/java/org/apache/rocketmq/broker/pop/PopConsumerRocksdbStore.java:73-81 | common/src/main/java/org/apache/rocketmq/common/config/AbstractRocksDBStorage.java:158-165 — 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/pop/PopConsumerRocksdbStore.java:73` 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) broker/src/main/java/org/apache/rocketmq/broker/processor/DefaultPullMessageResultHandler.java:115— broker/src/main/java/org/apache/rocketmq/broker/processor/DefaultPullMessageResultHandler.java:115-122 | broker/src/main/java/org/apache/rocketmq/broker/processor/PeekMessageProcessor.java:177-185 — 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:115` 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) store/src/main/java/org/apache/rocketmq/store/CommitLog.java:351— store/src/main/java/org/apache/rocketmq/store/CommitLog.java:351-358 | store/src/main/java/org/apache/rocketmq/store/CommitLog.java:773-781 — 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:351` 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:772` calls `getMessageStoreConfig`, `isCheckCommitLogOffsetOnRecover` and `store/src/main/java/org/apache/rocketmq/store/CommitLog.java:350` 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 × 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–9 lines × 2) tools/src/main/java/org/apache/rocketmq/tools/command/broker/RemoveColdDataFlowCtrGroupConfigSubCommand.java:61— 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 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/broker/RemoveColdDataFlowCtrGroupConfigSubCommand.java:61` 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) 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:138-146 — 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 (7 lines × 3) proxy/src/main/java/org/apache/rocketmq/proxy/service/route/ProxyTopicRouteData.java:36— proxy/src/main/java/org/apache/rocketmq/proxy/service/route/ProxyTopicRouteData.java:36-42 | proxy/src/main/java/org/apache/rocketmq/proxy/service/route/ProxyTopicRouteData.java:53-59 | proxy/src/main/java/org/apache/rocketmq/proxy/service/route/ProxyTopicRouteData.java:71-77 — 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 `proxy/src/main/java/org/apache/rocketmq/proxy/service/route/ProxyTopicRouteData.java:36` 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, `proxy/src/main/java/org/apache/rocketmq/proxy/service/route/ProxyTopicRouteData.java:62` calls `fromParts`, `getHost` and `proxy/src/main/java/org/apache/rocketmq/proxy/service/route/ProxyTopicRouteData.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 (7 lines × 3) store/src/main/java/org/apache/rocketmq/store/queue/BatchConsumeQueue.java:245— store/src/main/java/org/apache/rocketmq/store/queue/BatchConsumeQueue.java:245-251 | store/src/main/java/org/apache/rocketmq/store/queue/BatchConsumeQueue.java:414-420 | 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) namesrv/src/main/java/org/apache/rocketmq/namesrv/routeinfo/RouteInfoManager.java:1052— namesrv/src/main/java/org/apache/rocketmq/namesrv/routeinfo/RouteInfoManager.java:1052-1058 | namesrv/src/main/java/org/apache/rocketmq/namesrv/routeinfo/RouteInfoManager.java:1073-1079 | namesrv/src/main/java/org/apache/rocketmq/namesrv/routeinfo/RouteInfoManager.java:1094-1100 — 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:1052` 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:1101` calls `hasUnitFlag`, `values`, `iterator` and `namesrv/src/main/java/org/apache/rocketmq/namesrv/routeinfo/RouteInfoManager.java:1080` 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 (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 (7 lines × 3) tools/src/main/java/org/apache/rocketmq/tools/admin/DefaultMQAdminExtImpl.java:1457— tools/src/main/java/org/apache/rocketmq/tools/admin/DefaultMQAdminExtImpl.java:1457-1463 | tools/src/main/java/org/apache/rocketmq/tools/admin/DefaultMQAdminExtImpl.java:1480-1486 | tools/src/main/java/org/apache/rocketmq/tools/admin/DefaultMQAdminExtImpl.java:1488-1494 — 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) tools/src/main/java/org/apache/rocketmq/tools/command/broker/GetBrokerEpochSubCommand.java:63— tools/src/main/java/org/apache/rocketmq/tools/command/broker/GetBrokerEpochSubCommand.java:63-69 | tools/src/main/java/org/apache/rocketmq/tools/command/ha/GetSyncStateSetSubCommand.java:69-75 | tools/src/main/java/org/apache/rocketmq/tools/command/ha/HAStatusSubCommand.java:66-72 — before extracting anything, compare `tools/src/main/java/org/apache/rocketmq/tools/command/ha/GetSyncStateSetSubCommand.java` and `tools/src/main/java/org/apache/rocketmq/tools/command/ha/HAStatusSubCommand.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. Read the line range as the matched WINDOW rather than a finished unit: at `tools/src/main/java/org/apache/rocketmq/tools/command/broker/GetBrokerEpochSubCommand.java:63` 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.
D4 · Code Duplication· Edited copy of a member (30 corresponding lines) · ×5
Edited copy of a member (30 corresponding lines) tieredstore/src/main/java/org/apache/rocketmq/tieredstore/TieredMessageStore.java:435— tieredstore/src/main/java/org/apache/rocketmq/tieredstore/TieredMessageStore.java:435-466 | tieredstore/src/main/java/org/apache/rocketmq/tieredstore/TieredMessageStore.java:469-498 — 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) broker/src/main/java/org/apache/rocketmq/broker/processor/AdminBrokerProcessor.java:3276— broker/src/main/java/org/apache/rocketmq/broker/processor/AdminBrokerProcessor.java:3276-3305 | broker/src/main/java/org/apache/rocketmq/broker/processor/AdminBrokerProcessor.java:3308-3344 — 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) tieredstore/src/main/java/org/apache/rocketmq/tieredstore/provider/PosixFileSegment.java:180— tieredstore/src/main/java/org/apache/rocketmq/tieredstore/provider/PosixFileSegment.java:180-209 | tieredstore/src/main/java/org/apache/rocketmq/tieredstore/provider/PosixFileSegment.java:214-245 — 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) common/src/main/java/org/apache/rocketmq/common/config/ConfigHelper.java:78— common/src/main/java/org/apache/rocketmq/common/config/ConfigHelper.java:78-118 | store/src/main/java/org/apache/rocketmq/store/rocksdb/RocksDBOptionsFactory.java:189-218 — 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) store/src/main/java/org/apache/rocketmq/store/ha/DefaultHAClient.java:153— store/src/main/java/org/apache/rocketmq/store/ha/DefaultHAClient.java:153-182 | store/src/main/java/org/apache/rocketmq/store/ha/io/AbstractHAReader.java:33-63 — 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.
D4 · Code Duplication· Edited copy of a member (36 corresponding lines) · ×5
Edited copy of a member (36 corresponding lines) broker/src/main/java/org/apache/rocketmq/broker/processor/PopBufferMergeService.java:658— broker/src/main/java/org/apache/rocketmq/broker/processor/PopBufferMergeService.java:658-693 | broker/src/main/java/org/apache/rocketmq/broker/processor/PopBufferMergeService.java:713-748 — These two members are one piece of code written twice and then edited apart: 36 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 (36 corresponding lines) store/src/main/java/org/apache/rocketmq/store/ha/DefaultHAService.java:225— store/src/main/java/org/apache/rocketmq/store/ha/DefaultHAService.java:225-264 | store/src/main/java/org/apache/rocketmq/store/ha/autoswitch/AutoSwitchHAService.java:386-421 — These two members are one piece of code written twice and then edited apart: 36 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 (36 corresponding lines) proxy/src/main/java/org/apache/rocketmq/proxy/service/sysmessage/HeartbeatSyncer.java:116— proxy/src/main/java/org/apache/rocketmq/proxy/service/sysmessage/HeartbeatSyncer.java:116-152 | proxy/src/main/java/org/apache/rocketmq/proxy/service/sysmessage/HeartbeatSyncer.java:154-189 — These two members are one piece of code written twice and then edited apart: 36 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 (36 corresponding lines) tools/src/main/java/org/apache/rocketmq/tools/command/message/QueryMsgByIdSubCommand.java:60— tools/src/main/java/org/apache/rocketmq/tools/command/message/QueryMsgByIdSubCommand.java:60-164 | tools/src/main/java/org/apache/rocketmq/tools/command/message/QueryMsgByUniqueKeySubCommand.java:92-127 — These two members are one piece of code written twice and then edited apart: 36 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 (36 corresponding lines) example/src/main/java/org/apache/rocketmq/example/namespace/PullConsumerWithNamespace.java:36— example/src/main/java/org/apache/rocketmq/example/namespace/PullConsumerWithNamespace.java:36-73 | example/src/main/java/org/apache/rocketmq/example/simple/AclClient.java:103-138 — These two members are one piece of code written twice and then edited apart: 36 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 (34 corresponding lines) · ×5
Edited copy of a member (34 corresponding lines) client/src/main/java/org/apache/rocketmq/client/impl/producer/DefaultMQProducerImpl.java:685— client/src/main/java/org/apache/rocketmq/client/impl/producer/DefaultMQProducerImpl.java:685-718 | client/src/main/java/org/apache/rocketmq/client/impl/producer/DefaultMQProducerImpl.java:1335-1368 — These two members are one piece of code written twice and then edited apart: 34 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 (34 corresponding lines) broker/src/main/java/org/apache/rocketmq/broker/transaction/TransactionMetrics.java:184— broker/src/main/java/org/apache/rocketmq/broker/transaction/TransactionMetrics.java:184-217 | store/src/main/java/org/apache/rocketmq/store/timer/TimerMetrics.java:227-260 — These two members are one piece of code written twice and then edited apart: 34 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 (34 corresponding lines) common/src/main/java/org/apache/rocketmq/common/config/ConfigHelper.java:41— common/src/main/java/org/apache/rocketmq/common/config/ConfigHelper.java:41-76 | store/src/main/java/org/apache/rocketmq/store/rocksdb/RocksDBOptionsFactory.java:99-132 — These two members are one piece of code written twice and then edited apart: 34 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 (34 corresponding lines) tools/src/main/java/org/apache/rocketmq/tools/command/controller/UpdateControllerConfigSubCommand.java:62— tools/src/main/java/org/apache/rocketmq/tools/command/controller/UpdateControllerConfigSubCommand.java:62-95 | tools/src/main/java/org/apache/rocketmq/tools/command/namesrv/UpdateNamesrvConfigCommand.java:57-90 — These two members are one piece of code written twice and then edited apart: 34 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 (34 corresponding lines) example/src/main/java/org/apache/rocketmq/example/lmq/LMQPushConsumer.java:56— example/src/main/java/org/apache/rocketmq/example/lmq/LMQPushConsumer.java:56-89 | example/src/main/java/org/apache/rocketmq/example/lmq/LMQPushPopConsumer.java:55-88 — These two members are one piece of code written twice and then edited apart: 34 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 (19 lines × 2) auth/src/main/java/org/apache/rocketmq/auth/authentication/factory/AuthenticationFactory.java:134— auth/src/main/java/org/apache/rocketmq/auth/authentication/factory/AuthenticationFactory.java:134-152 | auth/src/main/java/org/apache/rocketmq/auth/authorization/factory/AuthorizationFactory.java:137-155 — 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 (19 lines × 2) broker/src/main/java/org/apache/rocketmq/broker/BrokerController.java:1979— broker/src/main/java/org/apache/rocketmq/broker/BrokerController.java:1979-1997 | container/src/main/java/org/apache/rocketmq/container/InnerBrokerController.java:77-95 — 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 3 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. Read the line range as the matched WINDOW rather than a finished unit: at `broker/src/main/java/org/apache/rocketmq/broker/BrokerController.java:1979` 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) broker/src/main/java/org/apache/rocketmq/broker/topic/TopicConfigManager.java:416— broker/src/main/java/org/apache/rocketmq/broker/topic/TopicConfigManager.java:416-434 | broker/src/main/java/org/apache/rocketmq/broker/topic/TopicConfigManager.java:456-474 — 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:416` 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 (19 lines × 2) proxy/src/main/java/org/apache/rocketmq/proxy/service/message/LocalMessageService.java:423— proxy/src/main/java/org/apache/rocketmq/proxy/service/message/LocalMessageService.java:423-441 | proxy/src/main/java/org/apache/rocketmq/proxy/service/message/LocalMessageService.java:478-496 — 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:423` 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:49— tools/src/main/java/org/apache/rocketmq/tools/command/offset/ResetOffsetByTimeOldCommand.java:49-67 | tools/src/main/java/org/apache/rocketmq/tools/command/offset/SkipAccumulationSubCommand.java:88-106 — 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 12 separate duplicated blocks between them, totalling at least 107 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:71` calls `commandName` and `tools/src/main/java/org/apache/rocketmq/tools/command/offset/SkipAccumulationSubCommand.java:107` 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–13 lines × 2) broker/src/main/java/org/apache/rocketmq/broker/processor/LiteManagerProcessor.java:297— broker/src/main/java/org/apache/rocketmq/broker/processor/LiteManagerProcessor.java:297-309 | broker/src/main/java/org/apache/rocketmq/broker/processor/LiteManagerProcessor.java:368-379 — 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 (12–13 lines × 2) broker/src/main/java/org/apache/rocketmq/broker/processor/PopMessageProcessor.java:457— broker/src/main/java/org/apache/rocketmq/broker/processor/PopMessageProcessor.java:457-468 | broker/src/main/java/org/apache/rocketmq/broker/processor/PopMessageProcessor.java:610-622 — 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:457` 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 (12–13 lines × 2) store/src/main/java/org/apache/rocketmq/store/ConsumeQueue.java:172— store/src/main/java/org/apache/rocketmq/store/ConsumeQueue.java:172-184 | store/src/main/java/org/apache/rocketmq/store/dledger/DLedgerCommitLog.java:365-376 — 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/dledger/DLedgerCommitLog.java:365` 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 (12–13 lines × 2) broker/src/main/java/org/apache/rocketmq/broker/processor/AdminBrokerProcessor.java:592— broker/src/main/java/org/apache/rocketmq/broker/processor/AdminBrokerProcessor.java:592-604 | broker/src/main/java/org/apache/rocketmq/broker/processor/AdminBrokerProcessor.java:671-682 — 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:592` 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) tools/src/main/java/org/apache/rocketmq/tools/command/consumer/UpdateSubGroupListSubCommand.java:71— tools/src/main/java/org/apache/rocketmq/tools/command/consumer/UpdateSubGroupListSubCommand.java:71-82 | tools/src/main/java/org/apache/rocketmq/tools/command/topic/UpdateTopicListSubCommand.java:69-81 — before extracting anything, compare `tools/src/main/java/org/apache/rocketmq/tools/command/consumer/UpdateSubGroupListSubCommand.java` and `tools/src/main/java/org/apache/rocketmq/tools/command/topic/UpdateTopicListSubCommand.java` as WHOLE FILES: this scan already matched 7 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. Read the line range as the matched WINDOW rather than a finished unit: at `tools/src/main/java/org/apache/rocketmq/tools/command/consumer/UpdateSubGroupListSubCommand.java:71` 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 × 3) broker/src/main/java/org/apache/rocketmq/broker/processor/LiteManagerProcessor.java:142— broker/src/main/java/org/apache/rocketmq/broker/processor/LiteManagerProcessor.java:142-152 | broker/src/main/java/org/apache/rocketmq/broker/processor/LiteManagerProcessor.java:178-188 | broker/src/main/java/org/apache/rocketmq/broker/processor/LiteManagerProcessor.java:226-236 — 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.
Duplicated block (11 lines × 3) client/src/main/java/org/apache/rocketmq/client/impl/producer/DefaultMQProducerImpl.java:1633— client/src/main/java/org/apache/rocketmq/client/impl/producer/DefaultMQProducerImpl.java:1633-1643 | client/src/main/java/org/apache/rocketmq/client/impl/producer/DefaultMQProducerImpl.java:1693-1703 | client/src/main/java/org/apache/rocketmq/client/impl/producer/DefaultMQProducerImpl.java:1750-1760 — 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/processor/DefaultRequestProcessor.java:559— namesrv/src/main/java/org/apache/rocketmq/namesrv/processor/DefaultRequestProcessor.java:559-569 | namesrv/src/main/java/org/apache/rocketmq/namesrv/processor/DefaultRequestProcessor.java:579-589 | namesrv/src/main/java/org/apache/rocketmq/namesrv/processor/DefaultRequestProcessor.java:598-608 — 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/processor/DefaultRequestProcessor.java:559` 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 × 3) namesrv/src/main/java/org/apache/rocketmq/namesrv/routeinfo/RouteInfoManager.java:1060— namesrv/src/main/java/org/apache/rocketmq/namesrv/routeinfo/RouteInfoManager.java:1060-1070 | namesrv/src/main/java/org/apache/rocketmq/namesrv/routeinfo/RouteInfoManager.java:1081-1091 | namesrv/src/main/java/org/apache/rocketmq/namesrv/routeinfo/RouteInfoManager.java:1103-1113 — 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:1060` 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:1101` calls `hasUnitFlag`, `values`, `iterator` and `namesrv/src/main/java/org/apache/rocketmq/namesrv/routeinfo/RouteInfoManager.java:1079` 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 × 3) client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:1952— client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:1952-1962 | client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:1990-2000 | client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:2008-2018 — 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:1952` 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, `client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:1989` calls `properties2String` and `client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:2007` 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) broker/src/main/java/org/apache/rocketmq/broker/config/v1/RocksDBConsumerOffsetManager.java:55— broker/src/main/java/org/apache/rocketmq/broker/config/v1/RocksDBConsumerOffsetManager.java:55-64 | broker/src/main/java/org/apache/rocketmq/broker/config/v1/RocksDBSubscriptionGroupManager.java:54-63 | broker/src/main/java/org/apache/rocketmq/broker/config/v1/RocksDBTopicConfigManager.java:48-57 — before extracting anything, compare `broker/src/main/java/org/apache/rocketmq/broker/config/v1/RocksDBConsumerOffsetManager.java` and `broker/src/main/java/org/apache/rocketmq/broker/config/v1/RocksDBSubscriptionGroupManager.java` as WHOLE FILES: this scan already matched 7 separate duplicated blocks between them, totalling at least 98 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/config/v1/RocksDBConsumerOffsetManager.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 (10 lines × 3) client/src/main/java/org/apache/rocketmq/client/impl/consumer/RebalanceImpl.java:440— client/src/main/java/org/apache/rocketmq/client/impl/consumer/RebalanceImpl.java:440-449 | client/src/main/java/org/apache/rocketmq/client/impl/consumer/RebalanceImpl.java:560-569 | client/src/main/java/org/apache/rocketmq/client/impl/consumer/RebalanceImpl.java:594-603 — 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:440` 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) proxy/src/main/java/org/apache/rocketmq/proxy/service/message/LocalMessageService.java:122— proxy/src/main/java/org/apache/rocketmq/proxy/service/message/LocalMessageService.java:122-131 | proxy/src/main/java/org/apache/rocketmq/proxy/service/message/LocalMessageService.java:214-223 | proxy/src/main/java/org/apache/rocketmq/proxy/service/message/LocalMessageService.java:281-290 — 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 `proxy/src/main/java/org/apache/rocketmq/proxy/service/message/LocalMessageService.java:122` 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:143— remoting/src/main/java/org/apache/rocketmq/remoting/protocol/header/ExtraInfoUtil.java:143-152 | remoting/src/main/java/org/apache/rocketmq/remoting/protocol/header/ExtraInfoUtil.java:157-166 | remoting/src/main/java/org/apache/rocketmq/remoting/protocol/header/ExtraInfoUtil.java:185-194 — 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) broker/src/main/java/org/apache/rocketmq/broker/processor/NotificationProcessor.java:103— broker/src/main/java/org/apache/rocketmq/broker/processor/NotificationProcessor.java:103-112 | broker/src/main/java/org/apache/rocketmq/broker/processor/PeekMessageProcessor.java:86-95 | broker/src/main/java/org/apache/rocketmq/broker/processor/PollingInfoProcessor.java:61-70 — 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/NotificationProcessor.java:103` 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.
Low cohesion: ConfigStorage (LCOM4 7) broker/src/main/java/org/apache/rocketmq/broker/config/v2/ConfigStorage.java:53— ConfigStorage's methods fall into 7 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 7 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: 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: ClusterMetadataService (LCOM4 5) proxy/src/main/java/org/apache/rocketmq/proxy/service/metadata/ClusterMetadataService.java:52— ClusterMetadataService's methods fall into 5 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 5 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:63— 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:51— 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.
X15 · Unvalidated length from an untrusted reader· Length read from the parsed input is spent without ever being bounded · ×5
Length read from the parsed input is spent without ever being bounded store/src/main/java/org/apache/rocketmq/store/queue/RocksDBConsumeQueueOffsetTable.java:217— `topicLength` is read from the bytes being parsed at line 213 (`getInt`), then used to size a `new byte[]` at line 217 — and nowhere in its scope is `topicLength` 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 `topicLength` 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:351— `topicLen` is read from the bytes being parsed at line 350 (`getInt`), then used to size a `new byte[]` at line 351 — 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.
Length read from the parsed input is spent without ever being bounded remoting/src/main/java/org/apache/rocketmq/remoting/common/RemotingHelper.java:159— `size` is read from the bytes being parsed at line 158 (`getInt`), then used to size a `ByteBuffer.allocate` at line 159 — 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 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:720— `bodyLen` is read from the bytes being parsed at line 719 (`getInt`), then used to size a `new byte[]` at line 720 — 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.
D4 · Code Duplication· Edited copy of a member (32 corresponding lines) · ×4
Edited copy of a member (32 corresponding lines) REDACTED:708— REDACTED:708-753 | REDACTED:756-787 — These two members are one piece of code written twice and then edited apart: 32 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 (32 corresponding lines) broker/src/main/java/org/apache/rocketmq/broker/processor/AdminBrokerProcessor.java:1176— broker/src/main/java/org/apache/rocketmq/broker/processor/AdminBrokerProcessor.java:1176-1209 | container/src/main/java/org/apache/rocketmq/container/BrokerContainerProcessor.java:312-343 — These two members are one piece of code written twice and then edited apart: 32 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 (32 corresponding lines) broker/src/main/java/org/apache/rocketmq/broker/out/BrokerOuterAPI.java:1058— broker/src/main/java/org/apache/rocketmq/broker/out/BrokerOuterAPI.java:1058-1091 | broker/src/main/java/org/apache/rocketmq/broker/out/BrokerOuterAPI.java:1097-1128 — These two members are one piece of code written twice and then edited apart: 32 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 (32 corresponding lines) tools/src/main/java/org/apache/rocketmq/tools/command/controller/GetControllerConfigSubCommand.java:55— tools/src/main/java/org/apache/rocketmq/tools/command/controller/GetControllerConfigSubCommand.java:55-86 | tools/src/main/java/org/apache/rocketmq/tools/command/namesrv/GetNamesrvConfigCommand.java:52-83 — These two members are one piece of code written twice and then edited apart: 32 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 copies of one member (3 members, 14+ corresponding lines) · ×4
Edited copies of one member (3 members, 14+ corresponding lines) broker/src/main/java/org/apache/rocketmq/broker/out/BrokerOuterAPI.java:890— broker/src/main/java/org/apache/rocketmq/broker/out/BrokerOuterAPI.java:890-903 | broker/src/main/java/org/apache/rocketmq/broker/out/BrokerOuterAPI.java:907-920 | broker/src/main/java/org/apache/rocketmq/broker/out/BrokerOuterAPI.java:1340-1353 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 14 lines, 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 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. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
Edited copies of one member (3 members, 14+ corresponding lines) store/src/main/java/org/apache/rocketmq/store/DefaultMessageStore.java:2835— store/src/main/java/org/apache/rocketmq/store/DefaultMessageStore.java:2835-2848 | store/src/main/java/org/apache/rocketmq/store/DefaultMessageStore.java:2907-2920 | store/src/main/java/org/apache/rocketmq/store/DefaultMessageStore.java:2965-2978 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 14 lines, 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 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. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
Edited copies of one member (3 members, 14+ corresponding lines) store/src/main/java/org/apache/rocketmq/store/StoreStatsService.java:528— store/src/main/java/org/apache/rocketmq/store/StoreStatsService.java:528-544 | store/src/main/java/org/apache/rocketmq/store/ha/GroupTransferService.java:149-162 | store/src/main/java/org/apache/rocketmq/store/queue/ConsumeQueueStore.java:716-732 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 14 lines, 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 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. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
Edited copies of one member (3 members, 14+ corresponding lines) broker/src/main/java/org/apache/rocketmq/broker/auth/pipeline/AuthenticationPipeline.java:45— broker/src/main/java/org/apache/rocketmq/broker/auth/pipeline/AuthenticationPipeline.java:45-58 | broker/src/main/java/org/apache/rocketmq/broker/auth/pipeline/AuthorizationPipeline.java:47-60 | proxy/src/main/java/org/apache/rocketmq/proxy/remoting/pipeline/AuthenticationPipeline.java:44-57 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 14 lines, 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 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. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication· Edited copies of one member (3 members, 15+ corresponding lines) · ×4
Edited copies of one member (3 members, 15+ corresponding lines) client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:1970— client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:1970-1984 | client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:2024-2039 | client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:3424-3438 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 15 lines, 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 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. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
Edited copies of one member (3 members, 15+ corresponding lines) proxy/src/main/java/org/apache/rocketmq/proxy/common/MessageReceiptHandle.java:84— proxy/src/main/java/org/apache/rocketmq/proxy/common/MessageReceiptHandle.java:84-99 | remoting/src/main/java/org/apache/rocketmq/remoting/protocol/header/NotificationRequestHeader.java:150-164 | remoting/src/main/java/org/apache/rocketmq/remoting/protocol/header/PopMessageRequestHeader.java:176-191 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 15 lines, 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 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. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
Edited copies of one member (3 members, 15+ corresponding lines) store/src/main/java/org/apache/rocketmq/store/DispatchRequest.java:82— store/src/main/java/org/apache/rocketmq/store/DispatchRequest.java:82-96 | store/src/main/java/org/apache/rocketmq/store/DispatchRequest.java:98-112 | store/src/main/java/org/apache/rocketmq/store/DispatchRequest.java:114-128 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 15 lines, 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 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. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
Edited copies of one member (3 members, 15+ corresponding lines) store/src/main/java/org/apache/rocketmq/store/MappedFileQueue.java:403— store/src/main/java/org/apache/rocketmq/store/MappedFileQueue.java:403-417 | store/src/main/java/org/apache/rocketmq/store/MappedFileQueue.java:739-753 | store/src/main/java/org/apache/rocketmq/store/MappedFileQueue.java:948-962 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 15 lines, 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 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. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication· Edited copies of one member (3 members, 11+ corresponding lines) · ×4
Edited copies of one member (3 members, 11+ corresponding lines) common/src/main/java/org/apache/rocketmq/common/UtilAll.java:146— common/src/main/java/org/apache/rocketmq/common/UtilAll.java:146-156 | common/src/main/java/org/apache/rocketmq/common/UtilAll.java:158-168 | common/src/main/java/org/apache/rocketmq/common/message/MessageClientIDSetter.java:50-61 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 11 lines, 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 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. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
Edited copies of one member (3 members, 11+ corresponding lines) store/src/main/java/org/apache/rocketmq/store/timer/TimerMessageStore.java:1539— store/src/main/java/org/apache/rocketmq/store/timer/TimerMessageStore.java:1539-1549 | store/src/main/java/org/apache/rocketmq/store/timer/TimerMessageStore.java:1794-1806 | store/src/main/java/org/apache/rocketmq/store/timer/TimerMessageStore.java:1834-1849 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 11 lines, 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 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. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
Edited copies of one member (3 members, 11+ corresponding lines) client/src/main/java/org/apache/rocketmq/client/impl/mqclient/MQClientAPIExt.java:138— client/src/main/java/org/apache/rocketmq/client/impl/mqclient/MQClientAPIExt.java:138-150 | client/src/main/java/org/apache/rocketmq/client/impl/mqclient/MQClientAPIExt.java:438-448 | client/src/main/java/org/apache/rocketmq/client/impl/mqclient/MQClientAPIExt.java:640-651 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 11 lines, 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 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. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
Edited copies of one member (3 members, 11+ corresponding lines) broker/src/main/java/org/apache/rocketmq/broker/pagecache/ManyMessageTransfer.java:67— broker/src/main/java/org/apache/rocketmq/broker/pagecache/ManyMessageTransfer.java:67-82 | broker/src/main/java/org/apache/rocketmq/broker/pagecache/OneMessageTransfer.java:61-71 | broker/src/main/java/org/apache/rocketmq/broker/pagecache/QueryMessageTransfer.java:67-82 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 11 lines, 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 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. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication· Edited copies of one member (3 members, 9+ corresponding lines) · ×4
Edited copies of one member (3 members, 9+ corresponding lines) remoting/src/main/java/org/apache/rocketmq/remoting/netty/NettyRemotingServer.java:616— remoting/src/main/java/org/apache/rocketmq/remoting/netty/NettyRemotingServer.java:616-624 | remoting/src/main/java/org/apache/rocketmq/remoting/netty/NettyRemotingServer.java:627-635 | remoting/src/main/java/org/apache/rocketmq/remoting/netty/NettyRemotingServer.java:656-666 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 9 lines, 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 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. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
Edited copies of one member (3 members, 9+ corresponding lines) broker/src/main/java/org/apache/rocketmq/broker/topic/TopicQueueMappingManager.java:178— broker/src/main/java/org/apache/rocketmq/broker/topic/TopicQueueMappingManager.java:178-186 | broker/src/main/java/org/apache/rocketmq/broker/transaction/TransactionMetrics.java:114-123 | store/src/main/java/org/apache/rocketmq/store/timer/TimerMetrics.java:155-163 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 9 lines, 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 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. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
Edited copies of one member (3 members, 9+ corresponding lines) proxy/src/main/java/org/apache/rocketmq/proxy/service/transaction/TransactionData.java:107— proxy/src/main/java/org/apache/rocketmq/proxy/service/transaction/TransactionData.java:107-116 | remoting/src/main/java/org/apache/rocketmq/remoting/protocol/header/CheckTransactionStateRequestHeader.java:98-106 | remoting/src/main/java/org/apache/rocketmq/remoting/protocol/header/EndTransactionRequestHeader.java:137-147 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 9 lines, 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 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. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
Edited copies of one member (3 members, 9+ corresponding lines) tools/src/main/java/org/apache/rocketmq/tools/admin/DefaultMQAdminExtImpl.java:1325— tools/src/main/java/org/apache/rocketmq/tools/admin/DefaultMQAdminExtImpl.java:1325-1333 | tools/src/main/java/org/apache/rocketmq/tools/admin/DefaultMQAdminExtImpl.java:1339-1347 | tools/src/main/java/org/apache/rocketmq/tools/admin/DefaultMQAdminExtImpl.java:1797-1805 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 9 lines, 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 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. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication· Edited copy of a member (4 corresponding lines) · ×4
Edited copy of a member (4 corresponding lines) store/src/main/java/org/apache/rocketmq/store/DefaultMessageStore.java:1852— store/src/main/java/org/apache/rocketmq/store/DefaultMessageStore.java:1852-1855 | REDACTED:276-280 — These two members are one piece of code written twice and then edited apart: 4 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 (4 corresponding lines) auth/src/main/java/org/apache/rocketmq/auth/authentication/provider/DefaultAuthenticationProvider.java:51— auth/src/main/java/org/apache/rocketmq/auth/authentication/provider/DefaultAuthenticationProvider.java:51-54 | auth/src/main/java/org/apache/rocketmq/auth/authorization/provider/DefaultAuthorizationProvider.java:60-63 — These two members are one piece of code written twice and then edited apart: 4 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 (4 corresponding lines) controller/src/main/java/org/apache/rocketmq/controller/impl/event/EventSerializer.java:32— controller/src/main/java/org/apache/rocketmq/controller/impl/event/EventSerializer.java:32-35 | controller/src/main/java/org/apache/rocketmq/controller/impl/event/ListEventSerializer.java:34-37 — These two members are one piece of code written twice and then edited apart: 4 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 (4 corresponding lines) client/src/main/java/org/apache/rocketmq/client/impl/consumer/DefaultMQPullConsumerImpl.java:620— client/src/main/java/org/apache/rocketmq/client/impl/consumer/DefaultMQPullConsumerImpl.java:620-623 | client/src/main/java/org/apache/rocketmq/client/impl/producer/DefaultMQProducerImpl.java:525-528 — These two members are one piece of code written twice and then edited apart: 4 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 (17–18 lines × 2) broker/src/main/java/org/apache/rocketmq/broker/processor/PeekMessageProcessor.java:286— broker/src/main/java/org/apache/rocketmq/broker/processor/PeekMessageProcessor.java:286-302 | broker/src/main/java/org/apache/rocketmq/broker/processor/PopMessageProcessor.java:1000-1017 — 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 8 separate duplicated blocks between them, totalling at least 86 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:756— store/src/main/java/org/apache/rocketmq/store/ConsumeQueue.java:756-773 | store/src/main/java/org/apache/rocketmq/store/queue/BatchConsumeQueue.java:541-557 — 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:756` 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:753` calls `checkMultiDispatchQueue`, `getMessageStoreConfig`, `multiDispatchLmqQueue` and `store/src/main/java/org/apache/rocketmq/store/queue/BatchConsumeQueue.java:540` 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:957— store/src/main/java/org/apache/rocketmq/store/DefaultMessageStore.java:957-973 | 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:957` 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:1061— broker/src/main/java/org/apache/rocketmq/broker/out/BrokerOuterAPI.java:1061-1073 | broker/src/main/java/org/apache/rocketmq/broker/out/BrokerOuterAPI.java:1100-1113 — 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:1061` 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) store/src/main/java/org/apache/rocketmq/store/dledger/DLedgerCommitLog.java:967— store/src/main/java/org/apache/rocketmq/store/dledger/DLedgerCommitLog.java:967-980 | store/src/main/java/org/apache/rocketmq/store/dledger/DLedgerCommitLog.java:1065-1077 — 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) broker/src/main/java/org/apache/rocketmq/broker/processor/QueryMessageProcessor.java:132— broker/src/main/java/org/apache/rocketmq/broker/processor/QueryMessageProcessor.java:132-145 | broker/src/main/java/org/apache/rocketmq/broker/processor/QueryMessageProcessor.java:194-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 `broker/src/main/java/org/apache/rocketmq/broker/processor/QueryMessageProcessor.java:132` 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 (13–14 lines × 2) tools/src/main/java/org/apache/rocketmq/tools/command/broker/BrokerConsumeStatsSubCommand.java:42— tools/src/main/java/org/apache/rocketmq/tools/command/broker/BrokerConsumeStatsSubCommand.java:42-55 | tools/src/main/java/org/apache/rocketmq/tools/command/message/QueryMsgByUniqueKeySubCommand.java:56-68 — before extracting anything, compare `tools/src/main/java/org/apache/rocketmq/tools/command/broker/BrokerConsumeStatsSubCommand.java` and `tools/src/main/java/org/apache/rocketmq/tools/command/message/QueryMsgByUniqueKeySubCommand.java` as WHOLE FILES: this scan already matched 9 separate duplicated blocks between them, totalling at least 89 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 before the matched lines, `tools/src/main/java/org/apache/rocketmq/tools/command/message/QueryMsgByUniqueKeySubCommand.java:53` calls `comparingLong` and `tools/src/main/java/org/apache/rocketmq/tools/command/broker/BrokerConsumeStatsSubCommand.java:39` 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 (11–12 lines × 2) broker/src/main/java/org/apache/rocketmq/broker/config/v2/SubscriptionGroupManagerV2.java:87— broker/src/main/java/org/apache/rocketmq/broker/config/v2/SubscriptionGroupManagerV2.java:87-97 | broker/src/main/java/org/apache/rocketmq/broker/config/v2/TopicConfigManagerV2.java:99-110 — 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/config/v2/SubscriptionGroupManagerV2.java:87` 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–12 lines × 2) broker/src/main/java/org/apache/rocketmq/broker/processor/EndTransactionProcessor.java:321— broker/src/main/java/org/apache/rocketmq/broker/processor/EndTransactionProcessor.java:321-332 | broker/src/main/java/org/apache/rocketmq/broker/processor/SendMessageProcessor.java:419-429 — 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:814— client/src/main/java/org/apache/rocketmq/client/impl/consumer/DefaultMQPushConsumerImpl.java:814-825 | client/src/main/java/org/apache/rocketmq/client/impl/consumer/DefaultMQPushConsumerImpl.java:863-873 — 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:811` calls `getQueueOffset`, `getTopic` and `client/src/main/java/org/apache/rocketmq/client/impl/consumer/DefaultMQPushConsumerImpl.java:861` 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) 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 16 separate duplicated blocks between them, totalling at least 158 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 (5 lines × 4) broker/src/main/java/org/apache/rocketmq/broker/processor/AckMessageProcessor.java:129— broker/src/main/java/org/apache/rocketmq/broker/processor/AckMessageProcessor.java:129-133 | broker/src/main/java/org/apache/rocketmq/broker/processor/NotificationProcessor.java:113-117 | broker/src/main/java/org/apache/rocketmq/broker/processor/PollingInfoProcessor.java:71-75 | broker/src/main/java/org/apache/rocketmq/broker/processor/PopMessageProcessor.java:276-282 — 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 9 separate duplicated blocks between them, totalling at least 88 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:129` 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 (5 lines × 4) controller/src/main/java/org/apache/rocketmq/controller/impl/task/BrokerCloseChannelRequest.java:40— controller/src/main/java/org/apache/rocketmq/controller/impl/task/BrokerCloseChannelRequest.java:40-44 | controller/src/main/java/org/apache/rocketmq/controller/impl/task/BrokerCloseChannelRequest.java:50-54 | controller/src/main/java/org/apache/rocketmq/controller/impl/task/GetBrokerLiveInfoRequest.java:39-43 | controller/src/main/java/org/apache/rocketmq/controller/impl/task/GetBrokerLiveInfoRequest.java:49-53 — 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 (5 lines × 4) tools/src/main/java/org/apache/rocketmq/tools/command/message/QueryMsgByOffsetSubCommand.java:80— tools/src/main/java/org/apache/rocketmq/tools/command/message/QueryMsgByOffsetSubCommand.java:80-85 | 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:90-94 | tools/src/main/java/org/apache/rocketmq/tools/command/offset/ResetOffsetByTimeOldCommand.java:108-112 — 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 6 separate duplicated blocks between them, totalling at least 45 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: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. ★ 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:77` 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 (5 lines × 4) tools/src/main/java/org/apache/rocketmq/tools/command/namesrv/UpdateKvConfigCommand.java:56— tools/src/main/java/org/apache/rocketmq/tools/command/namesrv/UpdateKvConfigCommand.java:56-62 | tools/src/main/java/org/apache/rocketmq/tools/command/offset/ResetOffsetByTimeCommand.java:89-93 | tools/src/main/java/org/apache/rocketmq/tools/command/offset/ResetOffsetByTimeOldCommand.java:107-111 | tools/src/main/java/org/apache/rocketmq/tools/command/offset/SkipAccumulationSubCommand.java:70-74 — before extracting anything, compare `tools/src/main/java/org/apache/rocketmq/tools/command/namesrv/UpdateKvConfigCommand.java` and `tools/src/main/java/org/apache/rocketmq/tools/command/offset/ResetOffsetByTimeCommand.java` as WHOLE FILES: this scan already matched 7 separate duplicated blocks between them, totalling at least 52 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/namesrv/UpdateKvConfigCommand.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. ★ 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:112` calls `getOptionValue`, `trim` and `tools/src/main/java/org/apache/rocketmq/tools/command/offset/SkipAccumulationSubCommand.java:75` 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) broker/src/main/java/org/apache/rocketmq/broker/config/v2/ConsumerOffsetManagerV2.java:140— broker/src/main/java/org/apache/rocketmq/broker/config/v2/ConsumerOffsetManagerV2.java:140-144 | broker/src/main/java/org/apache/rocketmq/broker/config/v2/ConsumerOffsetManagerV2.java:148-152 | broker/src/main/java/org/apache/rocketmq/broker/config/v2/ConsumerOffsetManagerV2.java:258-262 — 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 (5 lines × 3) broker/src/main/java/org/apache/rocketmq/broker/offset/ConsumerOffsetManager.java:108— broker/src/main/java/org/apache/rocketmq/broker/offset/ConsumerOffsetManager.java:108-112 | broker/src/main/java/org/apache/rocketmq/broker/offset/ConsumerOffsetManager.java:144-148 | broker/src/main/java/org/apache/rocketmq/broker/offset/ConsumerOffsetManager.java:162-166 — 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:108` 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:3055— client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:3055-3059 | client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:3327-3331 | client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:3389-3393 — 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:3055` 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) store/src/main/java/org/apache/rocketmq/store/queue/BatchConsumeQueue.java:737— store/src/main/java/org/apache/rocketmq/store/queue/BatchConsumeQueue.java:737-741 | store/src/main/java/org/apache/rocketmq/store/queue/BatchConsumeQueue.java:828-832 | 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:737` 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.
D4 · Code Duplication· Members sharing a duplicated core (7 members, 50+ identical tokens) · ×3
Members sharing a duplicated core (7 members, 50+ identical tokens) client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:1621— client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:1621-1639 | client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:3595-3609 | client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:3611-3625 | client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:3627-3640 | client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:3672-3686 | client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:3688-3702 | client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:3704-3717 — 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.
Members sharing a duplicated core (7 members, 50+ identical tokens) tools/src/main/java/org/apache/rocketmq/tools/command/broker/RemoveColdDataFlowCtrGroupConfigSubCommand.java:60— tools/src/main/java/org/apache/rocketmq/tools/command/broker/RemoveColdDataFlowCtrGroupConfigSubCommand.java:60-92 | tools/src/main/java/org/apache/rocketmq/tools/command/broker/SwitchTimerEngineSubCommand.java:64-101 | 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:114-228 | tools/src/main/java/org/apache/rocketmq/tools/command/topic/UpdateTopicSubCommand.java:98-202 — 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) · ×3
Members sharing a duplicated core (6 members, 50+ identical tokens) broker/src/main/java/org/apache/rocketmq/broker/processor/NotificationProcessor.java:90— broker/src/main/java/org/apache/rocketmq/broker/processor/NotificationProcessor.java:90-223 | broker/src/main/java/org/apache/rocketmq/broker/processor/PeekMessageProcessor.java:79-225 | broker/src/main/java/org/apache/rocketmq/broker/processor/PollingInfoProcessor.java:55-112 | broker/src/main/java/org/apache/rocketmq/broker/processor/PopLiteMessageProcessor.java:166-231 | broker/src/main/java/org/apache/rocketmq/broker/processor/PopMessageProcessor.java:221-647 | broker/src/main/java/org/apache/rocketmq/broker/processor/PullMessageProcessor.java:306-610 — 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) 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.
D4 · Code Duplication· Edited copy of a member (65 corresponding lines) · ×3
Edited copy of a member (65 corresponding lines) broker/src/main/java/org/apache/rocketmq/broker/processor/PopReviveService.java:239— broker/src/main/java/org/apache/rocketmq/broker/processor/PopReviveService.java:239-306 | broker/src/main/java/org/apache/rocketmq/broker/transaction/queue/TransactionalMessageBridge.java:127-191 — These two members are one piece of code written twice and then edited apart: 65 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 (65 corresponding lines) client/src/main/java/org/apache/rocketmq/client/impl/consumer/RebalanceLitePullImpl.java:90— client/src/main/java/org/apache/rocketmq/client/impl/consumer/RebalanceLitePullImpl.java:90-154 | client/src/main/java/org/apache/rocketmq/client/impl/consumer/RebalancePushImpl.java:166-248 — These two members are one piece of code written twice and then edited apart: 65 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 (65 corresponding lines) tools/src/main/java/org/apache/rocketmq/tools/command/message/PrintMessageByQueueCommand.java:160— tools/src/main/java/org/apache/rocketmq/tools/command/message/PrintMessageByQueueCommand.java:160-224 | tools/src/main/java/org/apache/rocketmq/tools/command/message/PrintMessageSubCommand.java:111-186 — These two members are one piece of code written twice and then edited apart: 65 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 copies of one member (3 members, 26+ corresponding lines) · ×3
Edited copies of one member (3 members, 26+ corresponding lines) remoting/src/main/java/org/apache/rocketmq/remoting/protocol/header/ExtraInfoUtil.java:205— remoting/src/main/java/org/apache/rocketmq/remoting/protocol/header/ExtraInfoUtil.java:205-235 | remoting/src/main/java/org/apache/rocketmq/remoting/protocol/header/ExtraInfoUtil.java:237-262 | remoting/src/main/java/org/apache/rocketmq/remoting/protocol/header/ExtraInfoUtil.java:264-289 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 26 lines, 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 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. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
Edited copies of one member (3 members, 26+ corresponding lines) broker/src/main/java/org/apache/rocketmq/broker/processor/AdminBrokerProcessor.java:2165— broker/src/main/java/org/apache/rocketmq/broker/processor/AdminBrokerProcessor.java:2165-2190 | broker/src/main/java/org/apache/rocketmq/broker/processor/AdminBrokerProcessor.java:2192-2219 | broker/src/main/java/org/apache/rocketmq/broker/processor/AdminBrokerProcessor.java:2221-2246 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 26 lines, 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 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. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
Edited copies of one member (3 members, 26+ corresponding lines) tools/src/main/java/org/apache/rocketmq/tools/command/broker/CommitLogSetReadAheadSubCommand.java:69— tools/src/main/java/org/apache/rocketmq/tools/command/broker/CommitLogSetReadAheadSubCommand.java:69-99 | tools/src/main/java/org/apache/rocketmq/tools/command/broker/GetBrokerConfigCommand.java:65-119 | tools/src/main/java/org/apache/rocketmq/tools/command/broker/GetColdDataFlowCtrInfoSubCommand.java:70-95 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 26 lines, 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 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. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication· Edited copies of one member (3 members, 21+ corresponding lines) · ×3
Edited copies of one member (3 members, 21+ corresponding lines) broker/src/main/java/org/apache/rocketmq/broker/config/v2/ConsumerOffsetManagerV2.java:408— broker/src/main/java/org/apache/rocketmq/broker/config/v2/ConsumerOffsetManagerV2.java:408-428 | broker/src/main/java/org/apache/rocketmq/broker/config/v2/SubscriptionGroupManagerV2.java:131-151 | broker/src/main/java/org/apache/rocketmq/broker/config/v2/TopicConfigManagerV2.java:143-164 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 21 lines, 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 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. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
Edited copies of one member (3 members, 21+ corresponding lines) broker/src/main/java/org/apache/rocketmq/broker/processor/AdminBrokerProcessor.java:3403— broker/src/main/java/org/apache/rocketmq/broker/processor/AdminBrokerProcessor.java:3403-3423 | broker/src/main/java/org/apache/rocketmq/broker/processor/AdminBrokerProcessor.java:3505-3528 | broker/src/main/java/org/apache/rocketmq/broker/processor/AdminBrokerProcessor.java:3531-3553 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 21 lines, 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 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. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
Edited copies of one member (3 members, 21+ corresponding lines) broker/src/main/java/org/apache/rocketmq/broker/config/v2/ConfigStorage.java:209— broker/src/main/java/org/apache/rocketmq/broker/config/v2/ConfigStorage.java:209-229 | store/src/main/java/org/apache/rocketmq/store/CommitLog.java:1768-1792 | store/src/main/java/org/apache/rocketmq/store/CommitLog.java:1874-1901 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 21 lines, 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 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. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication· Edited copies of one member (4 members, 18+ corresponding lines) · ×3
Edited copies of one member (4 members, 18+ corresponding lines) client/src/main/java/org/apache/rocketmq/client/impl/mqclient/MQClientAPIExt.java:599— client/src/main/java/org/apache/rocketmq/client/impl/mqclient/MQClientAPIExt.java:599-616 | client/src/main/java/org/apache/rocketmq/client/impl/mqclient/MQClientAPIExt.java:619-637 | client/src/main/java/org/apache/rocketmq/client/impl/mqclient/MQClientAPIExt.java:660-679 | client/src/main/java/org/apache/rocketmq/client/impl/mqclient/MQClientAPIExt.java:682-699 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 18 lines, 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 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. Left alone, the next edit has to be made 4 times and the copies will drift further apart.
Edited copies of one member (4 members, 18+ corresponding lines) client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:1760— client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:1760-1778 | client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:1799-1819 | client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:2506-2523 | client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:2527-2544 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 18 lines, 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 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. Left alone, the next edit has to be made 4 times and the copies will drift further apart.
Edited copies of one member (4 members, 18+ corresponding lines) example/src/main/java/org/apache/rocketmq/example/namespace/ProducerWithNamespace.java:34— example/src/main/java/org/apache/rocketmq/example/namespace/ProducerWithNamespace.java:34-51 | example/src/main/java/org/apache/rocketmq/example/quickstart/Producer.java:39-124 | example/src/main/java/org/apache/rocketmq/example/simple/Producer.java:32-51 | example/src/main/java/org/apache/rocketmq/example/tracemessage/TraceProducer.java:35-60 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 18 lines, 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 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. Left alone, the next edit has to be made 4 times and the copies will drift further apart.
D4 · Code Duplication· Edited copies of one member (3 members, 17+ corresponding lines) · ×3
Edited copies of one member (3 members, 17+ corresponding lines) remoting/src/main/java/org/apache/rocketmq/remoting/netty/NettyLogger.java:72— remoting/src/main/java/org/apache/rocketmq/remoting/netty/NettyLogger.java:72-88 | remoting/src/main/java/org/apache/rocketmq/remoting/netty/NettyLogger.java:110-126 | remoting/src/main/java/org/apache/rocketmq/remoting/netty/NettyLogger.java:167-183 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 17 lines, 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 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. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
Edited copies of one member (3 members, 17+ corresponding lines) namesrv/src/main/java/org/apache/rocketmq/namesrv/kvconfig/KVConfigManager.java:114— namesrv/src/main/java/org/apache/rocketmq/namesrv/kvconfig/KVConfigManager.java:114-132 | namesrv/src/main/java/org/apache/rocketmq/namesrv/kvconfig/KVConfigManager.java:134-152 | namesrv/src/main/java/org/apache/rocketmq/namesrv/kvconfig/KVConfigManager.java:154-170 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 17 lines, 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 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. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
Edited copies of one member (3 members, 17+ corresponding lines) tools/src/main/java/org/apache/rocketmq/tools/admin/DefaultMQAdminExtImpl.java:1186— tools/src/main/java/org/apache/rocketmq/tools/admin/DefaultMQAdminExtImpl.java:1186-1202 | tools/src/main/java/org/apache/rocketmq/tools/admin/DefaultMQAdminExtImpl.java:1224-1240 | tools/src/main/java/org/apache/rocketmq/tools/admin/DefaultMQAdminExtImpl.java:1263-1279 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 17 lines, 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 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. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
Duplicated block (34 lines × 2) client/src/main/java/org/apache/rocketmq/client/impl/consumer/ConsumeMessageConcurrentlyService.java:97— client/src/main/java/org/apache/rocketmq/client/impl/consumer/ConsumeMessageConcurrentlyService.java:97-130 | client/src/main/java/org/apache/rocketmq/client/impl/consumer/ConsumeMessagePopConcurrentlyService.java:81-114 — 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 7 separate duplicated blocks between them, totalling at least 117 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:97` 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:96` calls `setBrokerName` and `client/src/main/java/org/apache/rocketmq/client/impl/consumer/ConsumeMessagePopConcurrentlyService.java:79` 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:1193— store/src/main/java/org/apache/rocketmq/store/ConsumeQueue.java:1193-1226 | store/src/main/java/org/apache/rocketmq/store/queue/BatchConsumeQueue.java:1124-1157 — 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:1193` 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:1235— store/src/main/java/org/apache/rocketmq/store/ConsumeQueue.java:1235-1268 | store/src/main/java/org/apache/rocketmq/store/queue/BatchConsumeQueue.java:1165-1198 — 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:1235` 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 (30 lines × 2) auth/src/main/java/org/apache/rocketmq/auth/authorization/manager/AuthorizationMetadataManagerImpl.java:65— auth/src/main/java/org/apache/rocketmq/auth/authorization/manager/AuthorizationMetadataManagerImpl.java:65-94 | auth/src/main/java/org/apache/rocketmq/auth/authorization/manager/AuthorizationMetadataManagerImpl.java:98-127 — 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 (30 lines × 2) store/src/main/java/org/apache/rocketmq/store/rocksdb/RocksDBOptionsFactory.java:270— store/src/main/java/org/apache/rocketmq/store/rocksdb/RocksDBOptionsFactory.java:270-299 | store/src/main/java/org/apache/rocketmq/store/rocksdb/RocksDBOptionsFactory.java:321-350 — 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/rocksdb/RocksDBOptionsFactory.java:270` 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 (30 lines × 2) broker/src/main/java/org/apache/rocketmq/broker/config/v1/RocksDBLmqSubscriptionGroupManager.java:25— broker/src/main/java/org/apache/rocketmq/broker/config/v1/RocksDBLmqSubscriptionGroupManager.java:25-54 | broker/src/main/java/org/apache/rocketmq/broker/subscription/LmqSubscriptionGroupManager.java:25-54 — before extracting anything, compare `broker/src/main/java/org/apache/rocketmq/broker/config/v1/RocksDBLmqSubscriptionGroupManager.java` and `broker/src/main/java/org/apache/rocketmq/broker/subscription/LmqSubscriptionGroupManager.java` as WHOLE FILES: 92% 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.
Duplicated block (23 lines × 2) store/src/main/java/org/apache/rocketmq/store/timer/TimerMessageStore.java:1211— store/src/main/java/org/apache/rocketmq/store/timer/TimerMessageStore.java:1211-1233 | store/src/main/java/org/apache/rocketmq/store/timer/rocksdb/TimerMessageRocksDBStore.java:354-376 — 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/timer/TimerMessageStore.java:1211` 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 (23 lines × 2) tieredstore/src/main/java/org/apache/rocketmq/tieredstore/metrics/TieredStoreMetricsManager.java:178— tieredstore/src/main/java/org/apache/rocketmq/tieredstore/metrics/TieredStoreMetricsManager.java:178-200 | tieredstore/src/main/java/org/apache/rocketmq/tieredstore/metrics/TieredStoreMetricsManager.java:211-233 — 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:178` 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:210` calls `setUnit` and `tieredstore/src/main/java/org/apache/rocketmq/tieredstore/metrics/TieredStoreMetricsManager.java:177` 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 (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 6 separate duplicated blocks between them, totalling at least 61 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) broker/src/main/java/org/apache/rocketmq/broker/processor/AdminBrokerProcessor.java:613— broker/src/main/java/org/apache/rocketmq/broker/processor/AdminBrokerProcessor.java:613-634 | broker/src/main/java/org/apache/rocketmq/broker/processor/AdminBrokerProcessor.java:694-715 — 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:613` 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 (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:614— store/src/main/java/org/apache/rocketmq/store/dledger/DLedgerCommitLog.java:614-635 | store/src/main/java/org/apache/rocketmq/store/dledger/DLedgerCommitLog.java:758-779 — 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:614` 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:2337— client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:2337-2356 | client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:2366-2384 — 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:2337` 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:2333` calls `setValue` and `client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:2362` 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:442— client/src/main/java/org/apache/rocketmq/client/impl/consumer/RebalanceImpl.java:442-461 | client/src/main/java/org/apache/rocketmq/client/impl/consumer/RebalanceImpl.java:562-580 — 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:442` 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–20 lines × 2) client/src/main/java/org/apache/rocketmq/client/impl/factory/MQClientInstance.java:699— client/src/main/java/org/apache/rocketmq/client/impl/factory/MQClientInstance.java:699-718 | client/src/main/java/org/apache/rocketmq/client/impl/factory/MQClientInstance.java:779-797 — 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:699` 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 × 3) broker/src/main/java/org/apache/rocketmq/broker/transaction/TransactionMetrics.java:185— broker/src/main/java/org/apache/rocketmq/broker/transaction/TransactionMetrics.java:185-203 | common/src/main/java/org/apache/rocketmq/common/ConfigManager.java:93-111 | store/src/main/java/org/apache/rocketmq/store/timer/TimerMetrics.java:228-246 — before extracting anything, compare `broker/src/main/java/org/apache/rocketmq/broker/transaction/TransactionMetrics.java` and `store/src/main/java/org/apache/rocketmq/store/timer/TimerMetrics.java` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 54 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/transaction/TransactionMetrics.java:185` 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 lines × 3) controller/src/main/java/org/apache/rocketmq/controller/ControllerStartup.java:130— controller/src/main/java/org/apache/rocketmq/controller/ControllerStartup.java:130-148 | namesrv/src/main/java/org/apache/rocketmq/namesrv/NamesrvStartup.java:162-180 | namesrv/src/main/java/org/apache/rocketmq/namesrv/NamesrvStartup.java:201-219 — 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:338-356 — 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–17 lines × 2) client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:1359— client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:1359-1375 | client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:1393-1408 — 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:1359` 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/MQClientAPIImpl.java:2206— client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:2206-2221 | client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:2288-2304 — 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:2206` 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) store/src/main/java/org/apache/rocketmq/store/CommitLog.java:1131— store/src/main/java/org/apache/rocketmq/store/CommitLog.java:1131-1146 | store/src/main/java/org/apache/rocketmq/store/CommitLog.java:1287-1303 — 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:1131` 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/processor/AdminBrokerProcessor.java:568— broker/src/main/java/org/apache/rocketmq/broker/processor/AdminBrokerProcessor.java:568-580 | broker/src/main/java/org/apache/rocketmq/broker/processor/AdminBrokerProcessor.java:658-670 | broker/src/main/java/org/apache/rocketmq/broker/processor/AdminBrokerProcessor.java:728-740 — 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. ★ 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:657` calls `getTopicName` and `broker/src/main/java/org/apache/rocketmq/broker/processor/AdminBrokerProcessor.java:567` 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 × 3) client/src/main/java/org/apache/rocketmq/client/impl/mqclient/MQClientAPIExt.java:512— client/src/main/java/org/apache/rocketmq/client/impl/mqclient/MQClientAPIExt.java:512-524 | client/src/main/java/org/apache/rocketmq/client/impl/mqclient/MQClientAPIExt.java:548-560 | client/src/main/java/org/apache/rocketmq/client/impl/mqclient/MQClientAPIExt.java:584-596 — 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:512` 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 × 3) store/src/main/java/org/apache/rocketmq/store/rocksdb/RocksDBOptionsFactory.java:82— store/src/main/java/org/apache/rocketmq/store/rocksdb/RocksDBOptionsFactory.java:82-94 | store/src/main/java/org/apache/rocketmq/store/rocksdb/RocksDBOptionsFactory.java:168-180 | store/src/main/java/org/apache/rocketmq/store/rocksdb/RocksDBOptionsFactory.java:296-308 — 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 `store/src/main/java/org/apache/rocketmq/store/rocksdb/RocksDBOptionsFactory.java:168` 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 (11 lines × 4) common/src/main/java/org/apache/rocketmq/common/UtilAll.java:368— common/src/main/java/org/apache/rocketmq/common/UtilAll.java:368-378 | common/src/main/java/org/apache/rocketmq/common/compression/Lz4Compressor.java:60-70 | common/src/main/java/org/apache/rocketmq/common/compression/ZlibCompressor.java:63-73 | 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 59 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:368` 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:379` 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) client/src/main/java/org/apache/rocketmq/client/impl/consumer/DefaultLitePullConsumerImpl.java:176— client/src/main/java/org/apache/rocketmq/client/impl/consumer/DefaultLitePullConsumerImpl.java:176-186 | client/src/main/java/org/apache/rocketmq/client/impl/consumer/DefaultLitePullConsumerImpl.java:188-198 | 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 (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 (10 lines × 6) client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:3600— client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:3600-3609 | client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:3616-3625 | client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:3631-3640 | client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:3677-3686 | client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:3693-3702 | client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:3708-3717 — 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/MQClientAPIImpl.java:3600` 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 × 6) client/src/main/java/org/apache/rocketmq/client/impl/admin/MqClientAdminImpl.java:142— client/src/main/java/org/apache/rocketmq/client/impl/admin/MqClientAdminImpl.java:142-151 | client/src/main/java/org/apache/rocketmq/client/impl/admin/MqClientAdminImpl.java:160-169 | client/src/main/java/org/apache/rocketmq/client/impl/admin/MqClientAdminImpl.java:176-185 | client/src/main/java/org/apache/rocketmq/client/impl/admin/MqClientAdminImpl.java:192-201 | client/src/main/java/org/apache/rocketmq/client/impl/admin/MqClientAdminImpl.java:208-217 | client/src/main/java/org/apache/rocketmq/client/impl/admin/MqClientAdminImpl.java:224-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:142` 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 `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 (10 lines × 6) tools/src/main/java/org/apache/rocketmq/tools/command/auth/CreateAclSubCommand.java:55— tools/src/main/java/org/apache/rocketmq/tools/command/auth/CreateAclSubCommand.java:55-64 | tools/src/main/java/org/apache/rocketmq/tools/command/auth/CreateUserSubCommand.java:52-61 | tools/src/main/java/org/apache/rocketmq/tools/command/auth/DeleteAclSubCommand.java:52-61 | tools/src/main/java/org/apache/rocketmq/tools/command/auth/UpdateAclSubCommand.java:55-64 | tools/src/main/java/org/apache/rocketmq/tools/command/topic/RemappingStaticTopicSubCommand.java:63-72 | tools/src/main/java/org/apache/rocketmq/tools/command/topic/UpdateStaticTopicSubCommand.java:64-73 — before extracting anything, compare `tools/src/main/java/org/apache/rocketmq/tools/command/auth/CreateAclSubCommand.java` and `tools/src/main/java/org/apache/rocketmq/tools/command/auth/CreateUserSubCommand.java` as WHOLE FILES: this scan already matched 13 separate duplicated blocks between them, totalling at least 114 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 (9–10 lines × 5) broker/src/main/java/org/apache/rocketmq/broker/processor/NotificationProcessor.java:137— broker/src/main/java/org/apache/rocketmq/broker/processor/NotificationProcessor.java:137-145 | broker/src/main/java/org/apache/rocketmq/broker/processor/PeekMessageProcessor.java:119-127 | broker/src/main/java/org/apache/rocketmq/broker/processor/PollingInfoProcessor.java:94-102 | broker/src/main/java/org/apache/rocketmq/broker/processor/PopLiteMessageProcessor.java:213-222 | broker/src/main/java/org/apache/rocketmq/broker/processor/PopMessageProcessor.java:305-314 — 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 5 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/NotificationProcessor.java:137` 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. ★ 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/NotificationProcessor.java:147` calls `isLiteConsumer`, `nextInt` and `broker/src/main/java/org/apache/rocketmq/broker/processor/PopMessageProcessor.java:316` 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 × 5) store/src/main/java/org/apache/rocketmq/store/rocksdb/RocksDBOptionsFactory.java:87— store/src/main/java/org/apache/rocketmq/store/rocksdb/RocksDBOptionsFactory.java:87-95 | store/src/main/java/org/apache/rocketmq/store/rocksdb/RocksDBOptionsFactory.java:173-181 | store/src/main/java/org/apache/rocketmq/store/rocksdb/RocksDBOptionsFactory.java:249-258 | store/src/main/java/org/apache/rocketmq/store/rocksdb/RocksDBOptionsFactory.java:301-309 | store/src/main/java/org/apache/rocketmq/store/rocksdb/RocksDBOptionsFactory.java:352-360 — 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 `store/src/main/java/org/apache/rocketmq/store/rocksdb/RocksDBOptionsFactory.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. 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, `store/src/main/java/org/apache/rocketmq/store/rocksdb/RocksDBOptionsFactory.java:171` calls `setCompactionOptionsUniversal` and `store/src/main/java/org/apache/rocketmq/store/rocksdb/RocksDBOptionsFactory.java:247` 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–10 lines × 5) tools/src/main/java/org/apache/rocketmq/tools/command/auth/CreateAclSubCommand.java:123— tools/src/main/java/org/apache/rocketmq/tools/command/auth/CreateAclSubCommand.java:123-131 | tools/src/main/java/org/apache/rocketmq/tools/command/auth/CreateUserSubCommand.java:92-101 | tools/src/main/java/org/apache/rocketmq/tools/command/auth/DeleteAclSubCommand.java:91-99 | tools/src/main/java/org/apache/rocketmq/tools/command/auth/DeleteUserSubCommand.java:80-88 | tools/src/main/java/org/apache/rocketmq/tools/command/auth/UpdateAclSubCommand.java:123-132 — before extracting anything, compare `tools/src/main/java/org/apache/rocketmq/tools/command/auth/CreateAclSubCommand.java` and `tools/src/main/java/org/apache/rocketmq/tools/command/auth/CreateUserSubCommand.java` as WHOLE FILES: this scan already matched 13 separate duplicated blocks between them, totalling at least 114 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/auth/CreateAclSubCommand.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. 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) broker/src/main/java/org/apache/rocketmq/broker/out/BrokerOuterAPI.java:434— broker/src/main/java/org/apache/rocketmq/broker/out/BrokerOuterAPI.java:434-443 | broker/src/main/java/org/apache/rocketmq/broker/out/BrokerOuterAPI.java:633-641 | client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:3410-3418 | client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:3584-3591 — 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:195— client/src/main/java/org/apache/rocketmq/client/impl/MQAdminImpl.java:195-202 | client/src/main/java/org/apache/rocketmq/client/impl/MQAdminImpl.java:214-221 | client/src/main/java/org/apache/rocketmq/client/impl/MQAdminImpl.java:232-239 | client/src/main/java/org/apache/rocketmq/client/impl/MQAdminImpl.java:250-257 — 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:195` 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:156— controller/src/main/java/org/apache/rocketmq/controller/ControllerStartup.java:156-164 | namesrv/src/main/java/org/apache/rocketmq/namesrv/NamesrvStartup.java:231-238 | 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 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 4 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 4 times. Read the line range as the matched WINDOW rather than a finished unit: at `controller/src/main/java/org/apache/rocketmq/controller/ControllerStartup.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.
Duplicated block (7–8 lines × 2) broker/src/main/java/org/apache/rocketmq/broker/pop/PopConsumerService.java:156— broker/src/main/java/org/apache/rocketmq/broker/pop/PopConsumerService.java:156-162 | broker/src/main/java/org/apache/rocketmq/broker/processor/PopMessageProcessor.java:853-860 — 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/pop/PopConsumerService.java:156` 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–8 lines × 2) controller/src/main/java/org/apache/rocketmq/controller/impl/manager/RaftReplicasInfoManager.java:175— controller/src/main/java/org/apache/rocketmq/controller/impl/manager/RaftReplicasInfoManager.java:175-181 | controller/src/main/java/org/apache/rocketmq/controller/impl/manager/ReplicasInfoManager.java:635-642 — 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 `controller/src/main/java/org/apache/rocketmq/controller/impl/manager/RaftReplicasInfoManager.java:175` 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–8 lines × 2) store/src/main/java/org/apache/rocketmq/store/AllocateMappedFileService.java:81— store/src/main/java/org/apache/rocketmq/store/AllocateMappedFileService.java:81-88 | store/src/main/java/org/apache/rocketmq/store/AllocateMappedFileService.java:98-104 — 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:81` 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) client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:2645— client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:2645-2651 | client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:2723-2729 | client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:2755-2761 | client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:2926-2932 | client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:2955-2961 — 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:2645` 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) store/src/main/java/org/apache/rocketmq/store/rocksdb/RocksDBOptionsFactory.java:53— store/src/main/java/org/apache/rocketmq/store/rocksdb/RocksDBOptionsFactory.java:53-59 | store/src/main/java/org/apache/rocketmq/store/rocksdb/RocksDBOptionsFactory.java:105-111 | store/src/main/java/org/apache/rocketmq/store/rocksdb/RocksDBOptionsFactory.java:228-234 | store/src/main/java/org/apache/rocketmq/store/rocksdb/RocksDBOptionsFactory.java:270-276 | store/src/main/java/org/apache/rocketmq/store/rocksdb/RocksDBOptionsFactory.java:321-327 — 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 `store/src/main/java/org/apache/rocketmq/store/rocksdb/RocksDBOptionsFactory.java:228` 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 (7 lines × 5) 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/SwitchTimerEngineSubCommand.java:80-86 | 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:201-210 — 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 7 separate duplicated blocks between them, totalling at least 71 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.
Change-coupling hub: ChangeInvisibleTimeProcessor.java → AckMessageProcessor.java, PopBufferMergeService.java, PopReviveService.java broker/src/main/java/org/apache/rocketmq/broker/processor/ChangeInvisibleTimeProcessor.java— `broker/src/main/java/org/apache/rocketmq/broker/processor/ChangeInvisibleTimeProcessor.java` changes together with 3 other files — `broker/src/main/java/org/apache/rocketmq/broker/processor/AckMessageProcessor.java`, `broker/src/main/java/org/apache/rocketmq/broker/processor/PopBufferMergeService.java`, `broker/src/main/java/org/apache/rocketmq/broker/processor/PopReviveService.java` — none of which declares a dependency on it: one file is the hub of 3 separate couplings, not 3 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 3.
Change-coupling hub: ClusterMessageService.java → DefaultMessagingProcessor.java, MessagingProcessor.java, LocalMessageService.java proxy/src/main/java/org/apache/rocketmq/proxy/service/message/ClusterMessageService.java— `proxy/src/main/java/org/apache/rocketmq/proxy/service/message/ClusterMessageService.java` changes together with 3 other files — `proxy/src/main/java/org/apache/rocketmq/proxy/processor/DefaultMessagingProcessor.java`, `proxy/src/main/java/org/apache/rocketmq/proxy/processor/MessagingProcessor.java`, `proxy/src/main/java/org/apache/rocketmq/proxy/service/message/LocalMessageService.java` — none of which declares a dependency on it: one file is the hub of 3 separate couplings, not 3 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 3.
D4 · Code Duplication· Members sharing a duplicated core (8 members, 50+ identical tokens) · ×2
Members sharing a duplicated core (8 members, 50+ identical tokens) client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:434— client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:434-453 | client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:473-501 | client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:1542-1557 | client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:1683-1707 | client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:2184-2200 | client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:2263-2281 | client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:2897-2916 | client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:3347-3373 — These 8 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 8 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 8 times.
Members sharing a duplicated core (8 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/lite/GetLiteClientInfoSubCommand.java:65-101 | tools/src/main/java/org/apache/rocketmq/tools/command/lite/GetLiteGroupInfoSubCommand.java:72-165 | tools/src/main/java/org/apache/rocketmq/tools/command/lite/GetLiteTopicInfoSubCommand.java:66-123 | tools/src/main/java/org/apache/rocketmq/tools/command/lite/TriggerLiteDispatchSubCommand.java:63-99 | 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 8 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 8 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 8 times.
D4 · Code Duplication· Members sharing a duplicated core (5 members, 50+ identical tokens) · ×2
Members sharing a duplicated core (5 members, 50+ identical tokens) broker/src/main/java/org/apache/rocketmq/broker/processor/DefaultPullMessageResultHandler.java:88— broker/src/main/java/org/apache/rocketmq/broker/processor/DefaultPullMessageResultHandler.java:88-224 | broker/src/main/java/org/apache/rocketmq/broker/processor/PeekMessageProcessor.java:79-225 | broker/src/main/java/org/apache/rocketmq/broker/processor/PopMessageProcessor.java:221-647 | broker/src/main/java/org/apache/rocketmq/broker/processor/QueryMessageProcessor.java:88-150 | broker/src/main/java/org/apache/rocketmq/broker/processor/QueryMessageProcessor.java:153-213 — 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:202— remoting/src/main/java/org/apache/rocketmq/remoting/rpc/RpcClientImpl.java:202-220 | remoting/src/main/java/org/apache/rocketmq/remoting/rpc/RpcClientImpl.java:248-266 | remoting/src/main/java/org/apache/rocketmq/remoting/rpc/RpcClientImpl.java:285-304 | remoting/src/main/java/org/apache/rocketmq/remoting/rpc/RpcClientImpl.java:306-325 | remoting/src/main/java/org/apache/rocketmq/remoting/rpc/RpcClientImpl.java:327-346 — 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.
D4 · Code Duplication· Edited copy of a member (85 corresponding lines) · ×2
Edited copy of a member (85 corresponding lines) client/src/main/java/org/apache/rocketmq/client/impl/consumer/ConsumeMessageConcurrentlyService.java:338— client/src/main/java/org/apache/rocketmq/client/impl/consumer/ConsumeMessageConcurrentlyService.java:338-422 | client/src/main/java/org/apache/rocketmq/client/impl/consumer/ConsumeMessagePopConcurrentlyService.java:345-437 — These two members are one piece of code written twice and then edited apart: 85 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 (85 corresponding lines) store/src/main/java/org/apache/rocketmq/store/ConsumeQueue.java:1184— store/src/main/java/org/apache/rocketmq/store/ConsumeQueue.java:1184-1268 | store/src/main/java/org/apache/rocketmq/store/queue/BatchConsumeQueue.java:1102-1198 — These two members are one piece of code written twice and then edited apart: 85 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 (49 corresponding lines) · ×2
Edited copy of a member (49 corresponding lines) remoting/src/main/java/org/apache/rocketmq/remoting/netty/NettyRemotingAbstract.java:234— remoting/src/main/java/org/apache/rocketmq/remoting/netty/NettyRemotingAbstract.java:234-283 | remoting/src/main/java/org/apache/rocketmq/remoting/netty/NettyRemotingAbstract.java:286-334 — These two members are one piece of code written twice and then edited apart: 49 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 (49 corresponding lines) store/src/main/java/org/apache/rocketmq/store/ha/DefaultHAConnection.java:153— store/src/main/java/org/apache/rocketmq/store/ha/DefaultHAConnection.java:153-201 | store/src/main/java/org/apache/rocketmq/store/ha/autoswitch/AutoSwitchHAConnection.java:246-294 — These two members are one piece of code written twice and then edited apart: 49 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 (55 corresponding lines) · ×2
Edited copy of a member (55 corresponding lines) store/src/main/java/org/apache/rocketmq/store/queue/BatchConsumeQueue.java:231— store/src/main/java/org/apache/rocketmq/store/queue/BatchConsumeQueue.java:231-285 | store/src/main/java/org/apache/rocketmq/store/queue/SparseConsumeQueue.java:54-111 — These two members are one piece of code written twice and then edited apart: 55 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 (55 corresponding lines) broker/src/main/java/org/apache/rocketmq/broker/out/BrokerOuterAPI.java:1210— broker/src/main/java/org/apache/rocketmq/broker/out/BrokerOuterAPI.java:1210-1264 | client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:750-807 — These two members are one piece of code written twice and then edited apart: 55 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 (39 corresponding lines) · ×2
Edited copy of a member (39 corresponding lines) broker/src/main/java/org/apache/rocketmq/broker/failover/EscapeBridge.java:178— broker/src/main/java/org/apache/rocketmq/broker/failover/EscapeBridge.java:178-217 | broker/src/main/java/org/apache/rocketmq/broker/failover/EscapeBridge.java:251-289 — These two members are one piece of code written twice and then edited apart: 39 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 (39 corresponding lines) broker/src/main/java/org/apache/rocketmq/broker/topic/TopicConfigManager.java:389— broker/src/main/java/org/apache/rocketmq/broker/topic/TopicConfigManager.java:389-434 | broker/src/main/java/org/apache/rocketmq/broker/topic/TopicConfigManager.java:436-474 — These two members are one piece of code written twice and then edited apart: 39 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 (53 corresponding lines) · ×2
Edited copy of a member (53 corresponding lines) broker/src/main/java/org/apache/rocketmq/broker/client/rebalance/RebalanceLockManager.java:52— broker/src/main/java/org/apache/rocketmq/broker/client/rebalance/RebalanceLockManager.java:52-104 | broker/src/main/java/org/apache/rocketmq/broker/client/rebalance/RebalanceLockManager.java:124-190 — These two members are one piece of code written twice and then edited apart: 53 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 (53 corresponding lines) store/src/main/java/org/apache/rocketmq/store/timer/TimerMessageStore.java:1191— store/src/main/java/org/apache/rocketmq/store/timer/TimerMessageStore.java:1191-1243 | store/src/main/java/org/apache/rocketmq/store/timer/rocksdb/TimerMessageRocksDBStore.java:333-385 — These two members are one piece of code written twice and then edited apart: 53 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) · ×2
Edited copy of a member (33 corresponding lines) broker/src/main/java/org/apache/rocketmq/broker/processor/AdminBrokerProcessor.java:1667— broker/src/main/java/org/apache/rocketmq/broker/processor/AdminBrokerProcessor.java:1667-1699 | broker/src/main/java/org/apache/rocketmq/broker/processor/AdminBrokerProcessor.java:1701-1739 — 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.
Edited copy of a member (33 corresponding lines) broker/src/main/java/org/apache/rocketmq/broker/client/ConsumerManager.java:355— broker/src/main/java/org/apache/rocketmq/broker/client/ConsumerManager.java:355-387 | broker/src/main/java/org/apache/rocketmq/broker/client/ProducerManager.java:107-143 — 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 copies of one member (3 members, 23+ corresponding lines) · ×2
Edited copies of one member (3 members, 23+ corresponding lines) client/src/main/java/org/apache/rocketmq/client/trace/hook/ConsumeMessageOpenTracingHookImpl.java:49— client/src/main/java/org/apache/rocketmq/client/trace/hook/ConsumeMessageOpenTracingHookImpl.java:49-78 | client/src/main/java/org/apache/rocketmq/client/trace/hook/EndTransactionOpenTracingHookImpl.java:45-70 | client/src/main/java/org/apache/rocketmq/client/trace/hook/SendMessageOpenTracingHookImpl.java:45-67 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 23 lines, 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 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. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
Edited copies of one member (3 members, 23+ corresponding lines) client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:843— client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:843-865 | client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:870-893 | client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:1050-1072 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 23 lines, 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 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. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication· Edited copy of a member (27 corresponding lines) · ×2
Edited copy of a member (27 corresponding lines) controller/src/main/java/org/apache/rocketmq/controller/impl/DLedgerController.java:187— controller/src/main/java/org/apache/rocketmq/controller/impl/DLedgerController.java:187-213 | controller/src/main/java/org/apache/rocketmq/controller/impl/JRaftControllerStateMachine.java:187-214 — 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) broker/src/main/java/org/apache/rocketmq/broker/failover/EscapeBridge.java:341— broker/src/main/java/org/apache/rocketmq/broker/failover/EscapeBridge.java:341-367 | broker/src/main/java/org/apache/rocketmq/broker/processor/PopReviveService.java:308-334 — 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.
D4 · Code Duplication· Edited copy of a member (29 corresponding lines) · ×2
Edited copy of a member (29 corresponding lines) client/src/main/java/org/apache/rocketmq/client/impl/producer/DefaultMQProducerImpl.java:1622— client/src/main/java/org/apache/rocketmq/client/impl/producer/DefaultMQProducerImpl.java:1622-1650 | client/src/main/java/org/apache/rocketmq/client/impl/producer/DefaultMQProducerImpl.java:1682-1710 — 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.
Edited copy of a member (29 corresponding lines) broker/src/main/java/org/apache/rocketmq/broker/pop/PopConsumerService.java:665— broker/src/main/java/org/apache/rocketmq/broker/pop/PopConsumerService.java:665-693 | broker/src/main/java/org/apache/rocketmq/broker/processor/PopReviveService.java:166-194 — 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 copies of one member (3 members, 16+ corresponding lines) · ×2
Edited copies of one member (3 members, 16+ corresponding lines) client/src/main/java/org/apache/rocketmq/client/impl/consumer/ConsumeMessageOrderlyService.java:341— client/src/main/java/org/apache/rocketmq/client/impl/consumer/ConsumeMessageOrderlyService.java:341-362 | client/src/main/java/org/apache/rocketmq/client/impl/consumer/ConsumeMessagePopOrderlyService.java:255-275 | client/src/main/java/org/apache/rocketmq/client/impl/consumer/DefaultMQPushConsumerImpl.java:787-802 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 16 lines, 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 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. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
Edited copies of one member (3 members, 16+ corresponding lines) broker/src/main/java/org/apache/rocketmq/broker/config/v1/RocksDBConsumerOffsetManager.java:52— broker/src/main/java/org/apache/rocketmq/broker/config/v1/RocksDBConsumerOffsetManager.java:52-67 | broker/src/main/java/org/apache/rocketmq/broker/config/v1/RocksDBSubscriptionGroupManager.java:51-66 | broker/src/main/java/org/apache/rocketmq/broker/config/v1/RocksDBTopicConfigManager.java:45-60 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 16 lines, 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 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. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication· Edited copies of one member (4 members, 19+ corresponding lines) · ×2
Edited copies of one member (4 members, 19+ corresponding lines) broker/src/main/java/org/apache/rocketmq/broker/coldctr/ColdDataCgCtrService.java:75— broker/src/main/java/org/apache/rocketmq/broker/coldctr/ColdDataCgCtrService.java:75-96 | broker/src/main/java/org/apache/rocketmq/broker/coldctr/ColdDataPullRequestHoldService.java:62-80 | broker/src/main/java/org/apache/rocketmq/broker/longpolling/PullRequestHoldService.java:69-91 | store/src/main/java/org/apache/rocketmq/store/CommitLog.java:2396-2421 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 19 lines, 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 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. Left alone, the next edit has to be made 4 times and the copies will drift further apart.
Edited copies of one member (4 members, 19+ corresponding lines) client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:2594— client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:2594-2613 | client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:2643-2661 | client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:2715-2739 | client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:2746-2771 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 19 lines, 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 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. Left alone, the next edit has to be made 4 times and the copies will drift further apart.
D4 · Code Duplication· Edited copies of one member (5 members, 14+ corresponding lines) · ×2
Edited copies of one member (5 members, 14+ corresponding lines) proxy/src/main/java/org/apache/rocketmq/proxy/processor/ConsumerProcessor.java:426— proxy/src/main/java/org/apache/rocketmq/proxy/processor/ConsumerProcessor.java:426-441 | proxy/src/main/java/org/apache/rocketmq/proxy/processor/ConsumerProcessor.java:444-459 | proxy/src/main/java/org/apache/rocketmq/proxy/processor/ConsumerProcessor.java:462-476 | proxy/src/main/java/org/apache/rocketmq/proxy/processor/ConsumerProcessor.java:537-550 | proxy/src/main/java/org/apache/rocketmq/proxy/processor/ConsumerProcessor.java:552-565 — These 5 members are one piece of code written 5 times and then edited apart: every two of them correspond over at least 14 lines, 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 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. Left alone, the next edit has to be made 5 times and the copies will drift further apart.
Edited copies of one member (5 members, 14+ corresponding lines) client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:3051— client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:3051-3066 | client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:3322-3343 | client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:3386-3401 | client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:3642-3655 | client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:3719-3732 — These 5 members are one piece of code written 5 times and then edited apart: every two of them correspond over at least 14 lines, 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 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. Left alone, the next edit has to be made 5 times and the copies will drift further apart.
D4 · Code Duplication· Edited copies of one member (5 members, 17+ corresponding lines) · ×2
Edited copies of one member (5 members, 17+ corresponding lines) broker/src/main/java/org/apache/rocketmq/broker/out/BrokerOuterAPI.java:1276— broker/src/main/java/org/apache/rocketmq/broker/out/BrokerOuterAPI.java:1276-1303 | client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:2092-2118 | client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:2121-2137 | client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:2920-2941 | client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:2950-2970 — These 5 members are one piece of code written 5 times and then edited apart: every two of them correspond over at least 17 lines, 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 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. Left alone, the next edit has to be made 5 times and the copies will drift further apart.
Edited copies of one member (5 members, 17+ corresponding lines) example/src/main/java/org/apache/rocketmq/example/simple/AclClient.java:82— example/src/main/java/org/apache/rocketmq/example/simple/AclClient.java:82-101 | example/src/main/java/org/apache/rocketmq/example/simple/PopConsumer.java:36-53 | example/src/main/java/org/apache/rocketmq/example/simple/PushConsumer.java:32-53 | example/src/main/java/org/apache/rocketmq/example/tracemessage/OpenTracingPushConsumer.java:37-56 | example/src/main/java/org/apache/rocketmq/example/tracemessage/TracePushConsumer.java:32-48 — These 5 members are one piece of code written 5 times and then edited apart: every two of them correspond over at least 17 lines, 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 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. Left alone, the next edit has to be made 5 times and the copies will drift further apart.
D4 · Code Duplication· Edited copies of one member (4 members, 14+ corresponding lines) · ×2
Edited copies of one member (4 members, 14+ corresponding lines) client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:456— client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:456-469 | client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:504-519 | client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:3260-3277 | client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:3303-3318 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 14 lines, 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 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. Left alone, the next edit has to be made 4 times and the copies will drift further apart.
Edited copies of one member (4 members, 14+ corresponding lines) client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:1886— client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:1886-1901 | client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:2665-2678 | client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:2681-2694 | client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:2698-2711 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 14 lines, 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 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. Left alone, the next edit has to be made 4 times and the copies will drift further apart.
D4 · Code Duplication· Edited copies of one member (4 members, 16+ corresponding lines) · ×2
Edited copies of one member (4 members, 16+ corresponding lines) store/src/main/java/org/apache/rocketmq/store/StoreStatsService.java:393— store/src/main/java/org/apache/rocketmq/store/StoreStatsService.java:393-408 | store/src/main/java/org/apache/rocketmq/store/StoreStatsService.java:410-426 | store/src/main/java/org/apache/rocketmq/store/StoreStatsService.java:428-445 | store/src/main/java/org/apache/rocketmq/store/StoreStatsService.java:478-495 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 16 lines, 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 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. Left alone, the next edit has to be made 4 times and the copies will drift further apart.
Edited copies of one member (4 members, 16+ corresponding lines) broker/src/main/java/org/apache/rocketmq/broker/metrics/BatchSplittingMetricExporter.java:467— broker/src/main/java/org/apache/rocketmq/broker/metrics/BatchSplittingMetricExporter.java:467-482 | broker/src/main/java/org/apache/rocketmq/broker/metrics/BatchSplittingMetricExporter.java:495-510 | broker/src/main/java/org/apache/rocketmq/broker/metrics/BatchSplittingMetricExporter.java:523-539 | broker/src/main/java/org/apache/rocketmq/broker/metrics/BatchSplittingMetricExporter.java:552-570 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 16 lines, 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 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. Left alone, the next edit has to be made 4 times and the copies will drift further apart.
D4 · Code Duplication· Edited copies of one member (3 members, 19+ corresponding lines) · ×2
Edited copies of one member (3 members, 19+ corresponding lines) broker/src/main/java/org/apache/rocketmq/broker/metrics/BrokerMetricsManager.java:309— broker/src/main/java/org/apache/rocketmq/broker/metrics/BrokerMetricsManager.java:309-327 | controller/src/main/java/org/apache/rocketmq/controller/metrics/ControllerMetricsManager.java:181-199 | proxy/src/main/java/org/apache/rocketmq/proxy/metrics/ProxyMetricsManager.java:116-134 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 19 lines, 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 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. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
Edited copies of one member (3 members, 19+ corresponding lines) client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:3774— client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:3774-3792 | proxy/src/main/java/org/apache/rocketmq/proxy/remoting/RemotingProtocolServer.java:276-299 | remoting/src/main/java/org/apache/rocketmq/remoting/RemotingClient.java:51-75 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 19 lines, 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 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. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication· Edited copies of one member (4 members, 9+ corresponding lines) · ×2
Edited copies of one member (4 members, 9+ corresponding lines) client/src/main/java/org/apache/rocketmq/client/impl/MQAdminImpl.java:159— client/src/main/java/org/apache/rocketmq/client/impl/MQAdminImpl.java:159-167 | client/src/main/java/org/apache/rocketmq/client/impl/consumer/DefaultLitePullConsumerImpl.java:1282-1290 | client/src/main/java/org/apache/rocketmq/client/impl/consumer/DefaultMQPullConsumerImpl.java:153-161 | client/src/main/java/org/apache/rocketmq/client/impl/consumer/DefaultMQPushConsumerImpl.java:212-220 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 9 lines, 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 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. Left alone, the next edit has to be made 4 times and the copies will drift further apart.
Edited copies of one member (4 members, 9+ corresponding lines) store/src/main/java/org/apache/rocketmq/store/CommitLog.java:266— store/src/main/java/org/apache/rocketmq/store/CommitLog.java:266-276 | store/src/main/java/org/apache/rocketmq/store/CommitLog.java:278-286 | store/src/main/java/org/apache/rocketmq/store/CommitLog.java:320-330 | store/src/main/java/org/apache/rocketmq/store/CommitLog.java:1439-1451 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 9 lines, 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 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. Left alone, the next edit has to be made 4 times and the copies will drift further apart.
D4 · Code Duplication· Edited copies of one member (5 members, 9+ corresponding lines) · ×2
Edited copies of one member (5 members, 9+ corresponding lines) common/src/main/java/org/apache/rocketmq/common/stats/MomentStatsItemSet.java:87— common/src/main/java/org/apache/rocketmq/common/stats/MomentStatsItemSet.java:87-95 | common/src/main/java/org/apache/rocketmq/common/stats/MomentStatsItemSet.java:97-105 | common/src/main/java/org/apache/rocketmq/common/stats/StatsItemSet.java:180-188 | common/src/main/java/org/apache/rocketmq/common/stats/StatsItemSet.java:190-198 | common/src/main/java/org/apache/rocketmq/common/stats/StatsItemSet.java:200-208 — These 5 members are one piece of code written 5 times and then edited apart: every two of them correspond over at least 9 lines, 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 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. Left alone, the next edit has to be made 5 times and the copies will drift further apart.
Edited copies of one member (5 members, 9+ corresponding lines) broker/src/main/java/org/apache/rocketmq/broker/out/BrokerOuterAPI.java:1355— broker/src/main/java/org/apache/rocketmq/broker/out/BrokerOuterAPI.java:1355-1363 | broker/src/main/java/org/apache/rocketmq/broker/out/BrokerOuterAPI.java:1412-1421 | broker/src/main/java/org/apache/rocketmq/broker/out/BrokerOuterAPI.java:1424-1433 | client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:3441-3449 | client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:3807-3816 — These 5 members are one piece of code written 5 times and then edited apart: every two of them correspond over at least 9 lines, 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 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. Left alone, the next edit has to be made 5 times and the copies will drift further apart.
D4 · Code Duplication· Edited copies of one member (4 members, 8+ corresponding lines) · ×2
Edited copies of one member (4 members, 8+ corresponding lines) remoting/src/main/java/org/apache/rocketmq/remoting/netty/NettyRemotingClient.java:1163— remoting/src/main/java/org/apache/rocketmq/remoting/netty/NettyRemotingClient.java:1163-1171 | remoting/src/main/java/org/apache/rocketmq/remoting/netty/NettyRemotingClient.java:1174-1183 | remoting/src/main/java/org/apache/rocketmq/remoting/netty/NettyRemotingClient.java:1186-1195 | remoting/src/main/java/org/apache/rocketmq/remoting/netty/NettyRemotingClient.java:1224-1231 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 8 lines, 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 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. Left alone, the next edit has to be made 4 times and the copies will drift further apart.
Edited copies of one member (4 members, 8+ corresponding lines) client/src/main/java/org/apache/rocketmq/client/impl/consumer/PopRequest.java:80— client/src/main/java/org/apache/rocketmq/client/impl/consumer/PopRequest.java:80-87 | common/src/main/java/org/apache/rocketmq/common/message/MessageQueue.java:68-75 | common/src/main/java/org/apache/rocketmq/common/message/MessageQueueForC.java:61-68 | remoting/src/main/java/org/apache/rocketmq/remoting/protocol/subscription/GroupForbidden.java:56-63 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 8 lines, 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 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. Left alone, the next edit has to be made 4 times and the copies will drift further apart.
D4 · Code Duplication· Edited copies of one member (3 members, 8+ corresponding lines) · ×2
Edited copies of one member (3 members, 8+ corresponding lines) broker/src/main/java/org/apache/rocketmq/broker/processor/PopMessageProcessor.java:147— broker/src/main/java/org/apache/rocketmq/broker/processor/PopMessageProcessor.java:147-155 | broker/src/main/java/org/apache/rocketmq/broker/processor/PopMessageProcessor.java:157-164 | broker/src/main/java/org/apache/rocketmq/broker/processor/PopMessageProcessor.java:166-174 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 8 lines, 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 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. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
Edited copies of one member (3 members, 8+ corresponding lines) client/src/main/java/org/apache/rocketmq/client/impl/consumer/ConsumeMessageConcurrentlyService.java:295— client/src/main/java/org/apache/rocketmq/client/impl/consumer/ConsumeMessageConcurrentlyService.java:295-304 | client/src/main/java/org/apache/rocketmq/client/impl/consumer/ConsumeMessagePopConcurrentlyService.java:282-291 | store/src/main/java/org/apache/rocketmq/store/DefaultMessageStore.java:2155-2162 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 8 lines, 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 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. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication· Edited copies of one member (4 members, 11+ corresponding lines) · ×2
Edited copies of one member (4 members, 11+ corresponding lines) remoting/src/main/java/org/apache/rocketmq/remoting/protocol/header/AckMessageRequestHeader.java:100— remoting/src/main/java/org/apache/rocketmq/remoting/protocol/header/AckMessageRequestHeader.java:100-110 | remoting/src/main/java/org/apache/rocketmq/remoting/protocol/header/ChangeInvisibleTimeRequestHeader.java:127-139 | remoting/src/main/java/org/apache/rocketmq/remoting/protocol/header/ConsumeMessageDirectlyResultRequestHeader.java:111-121 | remoting/src/main/java/org/apache/rocketmq/remoting/protocol/header/PopLiteMessageRequestHeader.java:126-137 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 11 lines, 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 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. Left alone, the next edit has to be made 4 times and the copies will drift further apart.
Edited copies of one member (4 members, 11+ corresponding lines) tools/src/main/java/org/apache/rocketmq/tools/admin/DefaultMQAdminExtImpl.java:1051— tools/src/main/java/org/apache/rocketmq/tools/admin/DefaultMQAdminExtImpl.java:1051-1061 | tools/src/main/java/org/apache/rocketmq/tools/admin/DefaultMQAdminExtImpl.java:1065-1075 | tools/src/main/java/org/apache/rocketmq/tools/admin/DefaultMQAdminExtImpl.java:1136-1146 | tools/src/main/java/org/apache/rocketmq/tools/admin/DefaultMQAdminExtImpl.java:1593-1603 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 11 lines, 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 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. Left alone, the next edit has to be made 4 times and the copies will drift further apart.
D4 · Code Duplication· Edited copies of one member (3 members, 4+ corresponding lines) · ×2
Edited copies of one member (3 members, 4+ corresponding lines) broker/src/main/java/org/apache/rocketmq/broker/offset/ConsumerOffsetManager.java:382— broker/src/main/java/org/apache/rocketmq/broker/offset/ConsumerOffsetManager.java:382-386 | broker/src/main/java/org/apache/rocketmq/broker/subscription/SubscriptionGroupManager.java:448-451 | broker/src/main/java/org/apache/rocketmq/broker/topic/TopicConfigManager.java:794-797 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 4 lines, 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 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. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
Edited copies of one member (3 members, 4+ corresponding lines) tools/src/main/java/org/apache/rocketmq/tools/command/consumer/ConsumerStatusSubCommand.java:38— tools/src/main/java/org/apache/rocketmq/tools/command/consumer/ConsumerStatusSubCommand.java:38-41 | tools/src/main/java/org/apache/rocketmq/tools/command/consumer/ConsumerSubCommand.java:38-41 | tools/src/main/java/org/apache/rocketmq/tools/command/producer/ProducerSubCommand.java:34-37 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 4 lines, 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 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. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
Duplicated block (32 lines × 2) client/src/main/java/org/apache/rocketmq/client/impl/consumer/ConsumeMessageConcurrentlyService.java:152— client/src/main/java/org/apache/rocketmq/client/impl/consumer/ConsumeMessageConcurrentlyService.java:152-183 | client/src/main/java/org/apache/rocketmq/client/impl/consumer/ConsumeMessagePopConcurrentlyService.java:141-172 — 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 7 separate duplicated blocks between them, totalling at least 117 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 (32 lines × 2) tools/src/main/java/org/apache/rocketmq/tools/command/auth/CreateAclSubCommand.java:87— tools/src/main/java/org/apache/rocketmq/tools/command/auth/CreateAclSubCommand.java:87-118 | tools/src/main/java/org/apache/rocketmq/tools/command/auth/UpdateAclSubCommand.java:87-118 — before extracting anything, compare `tools/src/main/java/org/apache/rocketmq/tools/command/auth/CreateAclSubCommand.java` and `tools/src/main/java/org/apache/rocketmq/tools/command/auth/UpdateAclSubCommand.java` as WHOLE FILES: this scan already matched 16 separate duplicated blocks between them, totalling at least 163 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/auth/CreateAclSubCommand.java:87` 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 (25 lines × 2) client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:1116— client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:1116-1140 | client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:1235-1259 — 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 (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 (24 lines × 2) client/src/main/java/org/apache/rocketmq/client/impl/producer/DefaultMQProducerImpl.java:686— client/src/main/java/org/apache/rocketmq/client/impl/producer/DefaultMQProducerImpl.java:686-709 | client/src/main/java/org/apache/rocketmq/client/impl/producer/DefaultMQProducerImpl.java:1336-1359 — 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:686` 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 (17–18 lines × 3) broker/src/main/java/org/apache/rocketmq/broker/config/v1/RocksDBConsumerOffsetManager.java:311— broker/src/main/java/org/apache/rocketmq/broker/config/v1/RocksDBConsumerOffsetManager.java:311-328 | broker/src/main/java/org/apache/rocketmq/broker/config/v1/RocksDBSubscriptionGroupManager.java:380-397 | broker/src/main/java/org/apache/rocketmq/broker/config/v1/RocksDBTopicConfigManager.java:275-291 — before extracting anything, compare `broker/src/main/java/org/apache/rocketmq/broker/config/v1/RocksDBConsumerOffsetManager.java` and `broker/src/main/java/org/apache/rocketmq/broker/config/v1/RocksDBSubscriptionGroupManager.java` as WHOLE FILES: this scan already matched 7 separate duplicated blocks between them, totalling at least 98 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/config/v1/RocksDBConsumerOffsetManager.java:311` 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–18 lines × 3) broker/src/main/java/org/apache/rocketmq/broker/processor/AdminBrokerProcessor.java:1976— broker/src/main/java/org/apache/rocketmq/broker/processor/AdminBrokerProcessor.java:1976-1993 | broker/src/main/java/org/apache/rocketmq/broker/processor/AdminBrokerProcessor.java:2030-2046 | 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:1976` 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 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:211— remoting/src/main/java/org/apache/rocketmq/remoting/protocol/header/ExtraInfoUtil.java:211-226 | remoting/src/main/java/org/apache/rocketmq/remoting/protocol/header/ExtraInfoUtil.java:242-257 | remoting/src/main/java/org/apache/rocketmq/remoting/protocol/header/ExtraInfoUtil.java:269-284 — 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:211` 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:176-191 — 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:677— store/src/main/java/org/apache/rocketmq/store/stats/BrokerStatsManager.java:677-690 | store/src/main/java/org/apache/rocketmq/store/stats/BrokerStatsManager.java:694-709 — 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 (31 lines × 2) store/src/main/java/org/apache/rocketmq/store/CommitLog.java:1036— store/src/main/java/org/apache/rocketmq/store/CommitLog.java:1036-1066 | store/src/main/java/org/apache/rocketmq/store/CommitLog.java:1197-1227 — 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/CommitLog.java:1033` calls `get`, `updateMaxMessageSize`, `generateKey` and `store/src/main/java/org/apache/rocketmq/store/CommitLog.java:1195` 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 (31 lines × 2) broker/src/main/java/org/apache/rocketmq/broker/config/v1/RocksDBLmqTopicConfigManager.java:26— broker/src/main/java/org/apache/rocketmq/broker/config/v1/RocksDBLmqTopicConfigManager.java:26-56 | broker/src/main/java/org/apache/rocketmq/broker/topic/LmqTopicConfigManager.java:25-55 — before extracting anything, compare `broker/src/main/java/org/apache/rocketmq/broker/config/v1/RocksDBLmqTopicConfigManager.java` and `broker/src/main/java/org/apache/rocketmq/broker/topic/LmqTopicConfigManager.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. 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 × 5) client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:441— client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:441-453 | client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:490-501 | client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:2189-2200 | client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:2270-2281 | client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:2905-2916 — 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:441` 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 × 5) store/src/main/java/org/apache/rocketmq/store/rocksdb/RocksDBOptionsFactory.java:46— store/src/main/java/org/apache/rocketmq/store/rocksdb/RocksDBOptionsFactory.java:46-57 | store/src/main/java/org/apache/rocketmq/store/rocksdb/RocksDBOptionsFactory.java:135-146 | store/src/main/java/org/apache/rocketmq/store/rocksdb/RocksDBOptionsFactory.java:221-232 | store/src/main/java/org/apache/rocketmq/store/rocksdb/RocksDBOptionsFactory.java:263-274 | store/src/main/java/org/apache/rocketmq/store/rocksdb/RocksDBOptionsFactory.java:314-325 — 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. 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 × 3) client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:2667— client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:2667-2678 | client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:2683-2694 | client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:2700-2711 — 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:2667` 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 (9–11 lines × 4) store/src/main/java/org/apache/rocketmq/store/CommitLog.java:391— store/src/main/java/org/apache/rocketmq/store/CommitLog.java:391-400 | store/src/main/java/org/apache/rocketmq/store/CommitLog.java:857-867 | store/src/main/java/org/apache/rocketmq/store/queue/BatchConsumeQueue.java:263-271 | store/src/main/java/org/apache/rocketmq/store/queue/SparseConsumeQueue.java:92-100 — there are 4 copies across 3 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. Read the line range as the matched WINDOW rather than a finished unit: at `store/src/main/java/org/apache/rocketmq/store/CommitLog.java:391` 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, `store/src/main/java/org/apache/rocketmq/store/CommitLog.java:856` calls `getMessageStore`, `onCommitLogDispatch` and `store/src/main/java/org/apache/rocketmq/store/queue/SparseConsumeQueue.java:90` 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–11 lines × 4) example/src/main/java/org/apache/rocketmq/example/filter/SqlFilterConsumer.java:39— example/src/main/java/org/apache/rocketmq/example/filter/SqlFilterConsumer.java:39-49 | example/src/main/java/org/apache/rocketmq/example/filter/TagFilterConsumer.java:35-45 | example/src/main/java/org/apache/rocketmq/example/lmq/LMQPushConsumer.java:61-69 | example/src/main/java/org/apache/rocketmq/example/simple/PushConsumer.java:43-51 — 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 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. ★ 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/simple/PushConsumer.java:42` calls `setConsumeTimestamp` and `example/src/main/java/org/apache/rocketmq/example/lmq/LMQPushConsumer.java:60` 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–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 38 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 (8–9 lines × 6) broker/src/main/java/org/apache/rocketmq/broker/processor/DefaultPullMessageResultHandler.java:153— broker/src/main/java/org/apache/rocketmq/broker/processor/DefaultPullMessageResultHandler.java:153-160 | broker/src/main/java/org/apache/rocketmq/broker/processor/PeekMessageProcessor.java:200-207 | broker/src/main/java/org/apache/rocketmq/broker/processor/PopMessageProcessor.java:465-472 | broker/src/main/java/org/apache/rocketmq/broker/processor/PopMessageProcessor.java:619-626 | broker/src/main/java/org/apache/rocketmq/broker/processor/QueryMessageProcessor.java:125-133 | broker/src/main/java/org/apache/rocketmq/broker/processor/QueryMessageProcessor.java:187-195 — there are 6 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 6 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:153` 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 × 6) broker/src/main/java/org/apache/rocketmq/broker/processor/NotificationProcessor.java:135— broker/src/main/java/org/apache/rocketmq/broker/processor/NotificationProcessor.java:135-142 | broker/src/main/java/org/apache/rocketmq/broker/processor/PeekMessageProcessor.java:117-124 | broker/src/main/java/org/apache/rocketmq/broker/processor/PollingInfoProcessor.java:92-99 | broker/src/main/java/org/apache/rocketmq/broker/processor/PopLiteMessageProcessor.java:211-219 | broker/src/main/java/org/apache/rocketmq/broker/processor/PopMessageProcessor.java:303-311 | broker/src/main/java/org/apache/rocketmq/broker/processor/PullMessageProcessor.java:335-342 — 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 6 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/NotificationProcessor.java:135` 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/PullMessageProcessor.java:343` calls `setForbiddenType` and `broker/src/main/java/org/apache/rocketmq/broker/processor/NotificationProcessor.java:143` 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 × 4) client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:1744— client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:1744-1752 | client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:1954-1962 | client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:1992-2000 | client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:2010-2018 — 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:1989` calls `properties2String` and `client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:2007` 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:1023— store/src/main/java/org/apache/rocketmq/store/CommitLog.java:1023-1031 | store/src/main/java/org/apache/rocketmq/store/CommitLog.java:1187-1195 | store/src/main/java/org/apache/rocketmq/store/dledger/DLedgerCommitLog.java:530-538 | store/src/main/java/org/apache/rocketmq/store/dledger/DLedgerCommitLog.java:660-668 — 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:1033` calls `get`, `updateMaxMessageSize`, `generateKey` and `store/src/main/java/org/apache/rocketmq/store/CommitLog.java:1197` 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) broker/src/main/java/org/apache/rocketmq/broker/processor/AdminBrokerProcessor.java:1004— broker/src/main/java/org/apache/rocketmq/broker/processor/AdminBrokerProcessor.java:1004-1010 | broker/src/main/java/org/apache/rocketmq/broker/processor/AdminBrokerProcessor.java:1045-1051 | container/src/main/java/org/apache/rocketmq/container/BrokerContainerProcessor.java:243-250 — before extracting anything, compare `broker/src/main/java/org/apache/rocketmq/broker/processor/AdminBrokerProcessor.java` and `container/src/main/java/org/apache/rocketmq/container/BrokerContainerProcessor.java` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 48 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/processor/AdminBrokerProcessor.java:1004` 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:1011` calls `string2Properties` and `broker/src/main/java/org/apache/rocketmq/broker/processor/AdminBrokerProcessor.java:1052` 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:732— client/src/main/java/org/apache/rocketmq/client/impl/factory/MQClientInstance.java:732-738 | client/src/main/java/org/apache/rocketmq/client/impl/factory/MQClientInstance.java:818-824 | client/src/main/java/org/apache/rocketmq/client/impl/factory/MQClientInstance.java:1159-1166 — 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:732` 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) client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:2618— client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:2618-2624 | client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:2810-2816 | client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:2840-2846 | client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:2869-2875 — 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:2618` 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:332— tools/src/main/java/org/apache/rocketmq/tools/admin/DefaultMQAdminExtImpl.java:332-338 | tools/src/main/java/org/apache/rocketmq/tools/admin/DefaultMQAdminExtImpl.java:522-528 | tools/src/main/java/org/apache/rocketmq/tools/admin/DefaultMQAdminExtImpl.java:1109-1115 | tools/src/main/java/org/apache/rocketmq/tools/admin/DefaultMQAdminExtImpl.java:1160-1166 — 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:332` 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–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/queue/ConsumeQueueStore.java:787— store/src/main/java/org/apache/rocketmq/store/queue/ConsumeQueueStore.java:787-792 | store/src/main/java/org/apache/rocketmq/store/queue/ConsumeQueueStore.java:802-808 — 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/queue/ConsumeQueueStore.java:787` 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:2123— client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:2123-2128 | client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:2618-2623 | client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:2810-2815 | client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:2840-2845 | client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:2869-2874 — 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:2123` 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:2598— client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:2598-2603 | client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:2618-2623 | client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:2810-2815 | client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:2840-2845 | client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:2869-2874 — 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:2598` 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 × 4) broker/src/main/java/org/apache/rocketmq/broker/config/v2/ConsumerOffsetManagerV2.java:78— broker/src/main/java/org/apache/rocketmq/broker/config/v2/ConsumerOffsetManagerV2.java:78-83 | broker/src/main/java/org/apache/rocketmq/broker/config/v2/ConsumerOffsetManagerV2.java:89-94 | broker/src/main/java/org/apache/rocketmq/broker/config/v2/ConsumerOffsetManagerV2.java:239-244 | broker/src/main/java/org/apache/rocketmq/broker/config/v2/ConsumerOffsetManagerV2.java:260-265 — 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.
Duplicated block (6 lines × 4) client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:1444— client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:1444-1449 | client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:2460-2465 | client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:2487-2492 | client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:2790-2795 — 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:1444` 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.
D4 · Code Duplication· Edited copies of one member (3 members, 29+ corresponding lines) · ×2
Edited copies of one member (3 members, 29+ corresponding lines) tools/src/main/java/org/apache/rocketmq/tools/admin/DefaultMQAdminExtImpl.java:321— tools/src/main/java/org/apache/rocketmq/tools/admin/DefaultMQAdminExtImpl.java:321-356 | tools/src/main/java/org/apache/rocketmq/tools/admin/DefaultMQAdminExtImpl.java:1097-1132 | tools/src/main/java/org/apache/rocketmq/tools/admin/DefaultMQAdminExtImpl.java:1152-1180 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 29 lines, 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 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. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
Edited copies of one member (3 members, 29+ corresponding lines) tools/src/main/java/org/apache/rocketmq/tools/command/broker/GetBrokerEpochSubCommand.java:62— tools/src/main/java/org/apache/rocketmq/tools/command/broker/GetBrokerEpochSubCommand.java:62-90 | tools/src/main/java/org/apache/rocketmq/tools/command/ha/GetSyncStateSetSubCommand.java:68-96 | tools/src/main/java/org/apache/rocketmq/tools/command/ha/HAStatusSubCommand.java:65-93 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 29 lines, 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 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. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
Duplicated block (8 lines × 27) example/src/main/java/org/apache/rocketmq/example/operation/Consumer.java:79— example/src/main/java/org/apache/rocketmq/example/operation/Consumer.java:79-86 | example/src/main/java/org/apache/rocketmq/example/operation/Producer.java:73-80 | tools/src/main/java/org/apache/rocketmq/tools/command/auth/CopyAclsSubCommand.java:49-56 | tools/src/main/java/org/apache/rocketmq/tools/command/auth/CopyUsersSubCommand.java:49-56 | tools/src/main/java/org/apache/rocketmq/tools/command/auth/CreateAclSubCommand.java:61-68 | tools/src/main/java/org/apache/rocketmq/tools/command/auth/CreateUserSubCommand.java:58-65 | tools/src/main/java/org/apache/rocketmq/tools/command/auth/UpdateAclSubCommand.java:61-68 | tools/src/main/java/org/apache/rocketmq/tools/command/consumer/SetConsumeModeSubCommand.java:56-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/lite/GetLiteClientInfoSubCommand.java:46-53 | tools/src/main/java/org/apache/rocketmq/tools/command/lite/GetLiteGroupInfoSubCommand.java:53-60 | tools/src/main/java/org/apache/rocketmq/tools/command/lite/TriggerLiteDispatchSubCommand.java:44-51 | tools/src/main/java/org/apache/rocketmq/tools/command/message/PrintMessageByQueueCommand.java:117-124 | tools/src/main/java/org/apache/rocketmq/tools/command/message/QueryMsgByIdSubCommand.java:197-204 | tools/src/main/java/org/apache/rocketmq/tools/command/message/QueryMsgByKeySubCommand.java:50-57 | tools/src/main/java/org/apache/rocketmq/tools/command/message/QueryMsgByOffsetSubCommand.java:49-56 | 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:83-90 | tools/src/main/java/org/apache/rocketmq/tools/command/offset/SkipAccumulationSubCommand.java:50-57 | tools/src/main/java/org/apache/rocketmq/tools/command/queue/CheckRocksdbCqWriteProgressCommand.java:49-56 | tools/src/main/java/org/apache/rocketmq/tools/command/queue/QueryConsumeQueueCommand.java:61-68 | tools/src/main/java/org/apache/rocketmq/tools/command/topic/UpdateStaticTopicSubCommand.java:70-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 6 separate duplicated blocks between them, totalling at least 61 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, `example/src/main/java/org/apache/rocketmq/example/operation/Consumer.java:87` calls `setRequired` and `tools/src/main/java/org/apache/rocketmq/tools/command/queue/CheckRocksdbCqWriteProgressCommand.java:57` 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 × 27) 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/auth/CreateAclSubCommand.java:69-76 | tools/src/main/java/org/apache/rocketmq/tools/command/broker/BrokerConsumeStatsSubCommand.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:59-66 | 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/lite/GetLiteGroupInfoSubCommand.java:57-64 | tools/src/main/java/org/apache/rocketmq/tools/command/lite/TriggerLiteDispatchSubCommand.java:48-55 | 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:72-79 | tools/src/main/java/org/apache/rocketmq/tools/command/message/QueryMsgByIdSubCommand.java:201-208 | tools/src/main/java/org/apache/rocketmq/tools/command/message/QueryMsgByKeySubCommand.java:54-61 | tools/src/main/java/org/apache/rocketmq/tools/command/message/QueryMsgByOffsetSubCommand.java:61-68 | tools/src/main/java/org/apache/rocketmq/tools/command/message/QueryMsgByUniqueKeySubCommand.java:164-171 | 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/offset/ResetOffsetByTimeOldCommand.java:91-98 | tools/src/main/java/org/apache/rocketmq/tools/command/offset/SkipAccumulationSubCommand.java:54-61 | tools/src/main/java/org/apache/rocketmq/tools/command/queue/QueryConsumeQueueCommand.java:69-76 | 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/auth/CreateAclSubCommand.java` as WHOLE FILES: this scan already matched 10 separate duplicated blocks between them, totalling at least 75 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/lite/GetLiteGroupInfoSubCommand.java:53` calls `setRequired`, `addOption`, `Option` and `tools/src/main/java/org/apache/rocketmq/tools/command/broker/BrokerConsumeStatsSubCommand.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 × 13) 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/auth/CreateAclSubCommand.java:70-77 | 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:52-59 | 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:169-176 | 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 — 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/auth/CreateAclSubCommand.java` as WHOLE FILES: this scan already matched 10 separate duplicated blocks between them, totalling at least 75 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 (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 (6 lines × 28) 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/auth/CopyAclsSubCommand.java:49-54 | tools/src/main/java/org/apache/rocketmq/tools/command/auth/CopyUsersSubCommand.java:49-54 | tools/src/main/java/org/apache/rocketmq/tools/command/auth/CreateAclSubCommand.java:60-66 | tools/src/main/java/org/apache/rocketmq/tools/command/auth/CreateUserSubCommand.java:57-63 | tools/src/main/java/org/apache/rocketmq/tools/command/auth/UpdateAclSubCommand.java:60-66 | 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:46-51 | tools/src/main/java/org/apache/rocketmq/tools/command/controller/UpdateControllerConfigSubCommand.java:46-51 | tools/src/main/java/org/apache/rocketmq/tools/command/lite/GetLiteClientInfoSubCommand.java:46-51 | tools/src/main/java/org/apache/rocketmq/tools/command/lite/GetLiteGroupInfoSubCommand.java:53-58 | tools/src/main/java/org/apache/rocketmq/tools/command/lite/GetLiteTopicInfoSubCommand.java:51-56 | tools/src/main/java/org/apache/rocketmq/tools/command/lite/TriggerLiteDispatchSubCommand.java:44-49 | tools/src/main/java/org/apache/rocketmq/tools/command/message/PrintMessageByQueueCommand.java:117-122 | tools/src/main/java/org/apache/rocketmq/tools/command/message/QueryMsgByIdSubCommand.java:197-202 | tools/src/main/java/org/apache/rocketmq/tools/command/message/QueryMsgByKeySubCommand.java:50-55 | tools/src/main/java/org/apache/rocketmq/tools/command/message/QueryMsgByOffsetSubCommand.java:49-54 | tools/src/main/java/org/apache/rocketmq/tools/command/message/SendMessageCommand.java:50-55 | tools/src/main/java/org/apache/rocketmq/tools/command/namesrv/UpdateKvConfigCommand.java:41-46 | tools/src/main/java/org/apache/rocketmq/tools/command/offset/CloneGroupOffsetCommand.java:47-52 | tools/src/main/java/org/apache/rocketmq/tools/command/offset/GetConsumerStatusCommand.java:45-50 | tools/src/main/java/org/apache/rocketmq/tools/command/offset/ResetOffsetByTimeCommand.java:49-54 | tools/src/main/java/org/apache/rocketmq/tools/command/offset/ResetOffsetByTimeOldCommand.java:83-88 | tools/src/main/java/org/apache/rocketmq/tools/command/offset/SkipAccumulationSubCommand.java:50-55 | tools/src/main/java/org/apache/rocketmq/tools/command/queue/CheckRocksdbCqWriteProgressCommand.java:49-54 | tools/src/main/java/org/apache/rocketmq/tools/command/queue/QueryConsumeQueueCommand.java:61-66 | tools/src/main/java/org/apache/rocketmq/tools/command/topic/UpdateStaticTopicSubCommand.java:69-75 — 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 6 separate duplicated blocks between them, totalling at least 61 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/auth/CopyAclsSubCommand.java:49` 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 × 28) 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/auth/CreateAclSubCommand.java:68-74 | tools/src/main/java/org/apache/rocketmq/tools/command/broker/BrokerConsumeStatsSubCommand.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:58-64 | 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/lite/GetLiteGroupInfoSubCommand.java:56-62 | tools/src/main/java/org/apache/rocketmq/tools/command/lite/TriggerLiteDispatchSubCommand.java:47-53 | 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:72-77 | tools/src/main/java/org/apache/rocketmq/tools/command/message/QueryMsgByIdSubCommand.java:200-206 | tools/src/main/java/org/apache/rocketmq/tools/command/message/QueryMsgByKeySubCommand.java:53-59 | tools/src/main/java/org/apache/rocketmq/tools/command/message/QueryMsgByOffsetSubCommand.java:60-66 | tools/src/main/java/org/apache/rocketmq/tools/command/message/QueryMsgByUniqueKeySubCommand.java:164-169 | 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/offset/ResetOffsetByTimeOldCommand.java:90-96 | 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:68-74 | 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/auth/CreateAclSubCommand.java` as WHOLE FILES: this scan already matched 10 separate duplicated blocks between them, totalling at least 75 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/lite/GetLiteGroupInfoSubCommand.java:54` calls `addOption`, `Option` and `tools/src/main/java/org/apache/rocketmq/tools/command/broker/BrokerConsumeStatsSubCommand.java:70` 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.
DefaultAuthorizationContextBuilder.build (cyclomatic 108) auth/src/main/java/org/apache/rocketmq/auth/authorization/builder/DefaultAuthorizationContextBuilder.java:193— DefaultAuthorizationContextBuilder.build has cyclomatic complexity 108 (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 66) broker/src/main/java/org/apache/rocketmq/broker/BrokerController.java:1523— BrokerController.shutdownBasicService has cyclomatic complexity 66 (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 61) broker/src/main/java/org/apache/rocketmq/broker/processor/PopMessageProcessor.java:220— PopMessageProcessor.processRequest has cyclomatic complexity 61 (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.
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.
PullMessageProcessor.processRequest (cyclomatic 47) broker/src/main/java/org/apache/rocketmq/broker/processor/PullMessageProcessor.java:304— PullMessageProcessor.processRequest has cyclomatic complexity 47 (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.registerBroker (cyclomatic 43) namesrv/src/main/java/org/apache/rocketmq/namesrv/routeinfo/RouteInfoManager.java:226— RouteInfoManager.registerBroker has cyclomatic complexity 43 (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:162— 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.
PopReviveService.consumeReviveMessage (cyclomatic 38) broker/src/main/java/org/apache/rocketmq/broker/processor/PopReviveService.java:336— PopReviveService.consumeReviveMessage has cyclomatic complexity 38 (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:1027— 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.
MQAdminImpl.queryMessage (cyclomatic 38) client/src/main/java/org/apache/rocketmq/client/impl/MQAdminImpl.java:326— MQAdminImpl.queryMessage has cyclomatic complexity 38 (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.
DefaultMessageStore.getMessage (cyclomatic 38) store/src/main/java/org/apache/rocketmq/store/DefaultMessageStore.java:866— DefaultMessageStore.getMessage has cyclomatic complexity 38 (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 37) broker/src/main/java/org/apache/rocketmq/broker/BrokerController.java:1832— BrokerController.startBasicService 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.
CommitLog.asyncPutMessage (cyclomatic 37) store/src/main/java/org/apache/rocketmq/store/CommitLog.java:999— 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.
RebalanceImpl.updateMessageQueueAssignment (cyclomatic 36) client/src/main/java/org/apache/rocketmq/client/impl/consumer/RebalanceImpl.java:508— 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.
DefaultMQProducerImpl.sendDefaultImpl (cyclomatic 33) client/src/main/java/org/apache/rocketmq/client/impl/producer/DefaultMQProducerImpl.java:738— DefaultMQProducerImpl.sendDefaultImpl 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.checkMessageAndReturnSize (cyclomatic 33) store/src/main/java/org/apache/rocketmq/store/CommitLog.java:481— CommitLog.checkMessageAndReturnSize 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.
MessageStoreDispatcherImpl.doScheduleDispatch (cyclomatic 32) tieredstore/src/main/java/org/apache/rocketmq/tieredstore/core/MessageStoreDispatcherImpl.java:133— MessageStoreDispatcherImpl.doScheduleDispatch has cyclomatic complexity 32 (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.
PopBufferMergeService.scan (cyclomatic 31) broker/src/main/java/org/apache/rocketmq/broker/processor/PopBufferMergeService.java:226— PopBufferMergeService.scan 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.asyncPutMessages (cyclomatic 31) store/src/main/java/org/apache/rocketmq/store/CommitLog.java:1172— 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.
PopMessageProcessor.popMsgFromQueue (cyclomatic 30) broker/src/main/java/org/apache/rocketmq/broker/processor/PopMessageProcessor.java:676— PopMessageProcessor.popMsgFromQueue has cyclomatic complexity 30 (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.cleanItemListMoreThanSecondGen (cyclomatic 29) broker/src/main/java/org/apache/rocketmq/broker/topic/TopicQueueMappingCleanService.java:212— TopicQueueMappingCleanService.cleanItemListMoreThanSecondGen 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.
PopConsumerService.popAsync (cyclomatic 29) broker/src/main/java/org/apache/rocketmq/broker/pop/PopConsumerService.java:355— PopConsumerService.popAsync 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:92— 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.
PullTaskImpl.run (cyclomatic 29) client/src/main/java/org/apache/rocketmq/client/impl/consumer/DefaultLitePullConsumerImpl.java:890— 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.
ConsumeQueue.correctMinOffset (cyclomatic 29) store/src/main/java/org/apache/rocketmq/store/ConsumeQueue.java:554— ConsumeQueue.correctMinOffset 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.
ConsumeRequest.run (cyclomatic 28) client/src/main/java/org/apache/rocketmq/client/impl/consumer/ConsumeMessageOrderlyService.java:390— 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.
MessageRocksDBStorage.queryOffsetForIndex (cyclomatic 28) store/src/main/java/org/apache/rocketmq/store/rocksdb/MessageRocksDBStorage.java:150— MessageRocksDBStorage.queryOffsetForIndex 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.
ConsumeQueue.binarySearchInQueueByTime (cyclomatic 28) store/src/main/java/org/apache/rocketmq/store/ConsumeQueue.java:234— 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.
DefaultMQProducerImpl.sendKernelImpl (cyclomatic 27) client/src/main/java/org/apache/rocketmq/client/impl/producer/DefaultMQProducerImpl.java:911— 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.
IndexRocksDBStore.buildIndex (cyclomatic 27) store/src/main/java/org/apache/rocketmq/store/index/rocksdb/IndexRocksDBStore.java:142— IndexRocksDBStore.buildIndex has cyclomatic complexity 27 (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.
RocksDBConsumeQueueTable.binarySearchInCQByTime (cyclomatic 26) store/src/main/java/org/apache/rocketmq/store/queue/RocksDBConsumeQueueTable.java:182— RocksDBConsumeQueueTable.binarySearchInCQByTime 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.
TimerMessageStore.checkAndReviseMetrics (cyclomatic 26) store/src/main/java/org/apache/rocketmq/store/timer/TimerMessageStore.java:1293— TimerMessageStore.checkAndReviseMetrics 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.
TimerMessageStore.dequeue (cyclomatic 26) store/src/main/java/org/apache/rocketmq/store/timer/TimerMessageStore.java:1018— 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.
CommitLog.recoverAbnormally (cyclomatic 26) store/src/main/java/org/apache/rocketmq/store/CommitLog.java:768— CommitLog.recoverAbnormally 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.
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.
SendMessageProcessor.sendMessage (cyclomatic 25) broker/src/main/java/org/apache/rocketmq/broker/processor/SendMessageProcessor.java:243— SendMessageProcessor.sendMessage 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.
TimerMessageStore.shutdown (cyclomatic 25) store/src/main/java/org/apache/rocketmq/store/timer/TimerMessageStore.java:562— TimerMessageStore.shutdown 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.
ConsumerLagCalculator.processAllGroup (cyclomatic 24) broker/src/main/java/org/apache/rocketmq/broker/metrics/ConsumerLagCalculator.java:146— ConsumerLagCalculator.processAllGroup 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:385— 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.
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.
NotificationProcessor.processRequest (cyclomatic 23) broker/src/main/java/org/apache/rocketmq/broker/processor/NotificationProcessor.java:89— NotificationProcessor.processRequest 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.
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.
RouteInfoManager.pickupTopicRouteData (cyclomatic 23) namesrv/src/main/java/org/apache/rocketmq/namesrv/routeinfo/RouteInfoManager.java:700— 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.
ProxyAdminAuthInterceptor.interceptCall (cyclomatic 23) proxy/src/main/java/org/apache/rocketmq/proxy/grpc/admin/ProxyAdminAuthInterceptor.java:140— ProxyAdminAuthInterceptor.interceptCall 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:645— 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.
SubscriptionFilterHandler.register (cyclomatic 22) broker/src/main/java/org/apache/rocketmq/broker/filter/ConsumerFilterManager.java:421— SubscriptionFilterHandler.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.
ProxyAdminGrpcService.queryMessage (cyclomatic 22) proxy/src/main/java/org/apache/rocketmq/proxy/grpc/admin/ProxyAdminGrpcService.java:1105— ProxyAdminGrpcService.queryMessage 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 22) store/src/main/java/org/apache/rocketmq/store/ha/autoswitch/AutoSwitchHAClient.java:484— HAClientReader.processReadResult 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.
DefaultMessageStore.shutdown (cyclomatic 22) store/src/main/java/org/apache/rocketmq/store/DefaultMessageStore.java:520— DefaultMessageStore.shutdown 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.
AbstractSendMessageProcessor.msgCheck (cyclomatic 21) broker/src/main/java/org/apache/rocketmq/broker/processor/AbstractSendMessageProcessor.java:464— AbstractSendMessageProcessor.msgCheck 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:78— 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:159— 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.
MQClientInstance.updateTopicRouteInfoFromNameServer (cyclomatic 21) client/src/main/java/org/apache/rocketmq/client/impl/factory/MQClientInstance.java:933— 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:1113— 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.
PullMessageRequestHeader.decode (cyclomatic 21) remoting/src/main/java/org/apache/rocketmq/remoting/protocol/header/PullMessageRequestHeader.java:107— PullMessageRequestHeader.decode 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.
SubscriptionData.equals (cyclomatic 21) remoting/src/main/java/org/apache/rocketmq/remoting/protocol/heartbeat/SubscriptionData.java:130— 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.
RemotingCommand.decodeCommandCustomHeaderDirectly (cyclomatic 21) remoting/src/main/java/org/apache/rocketmq/remoting/protocol/RemotingCommand.java:282— RemotingCommand.decodeCommandCustomHeaderDirectly 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.
TimerMessageRocksDBStore.doPut (cyclomatic 21) store/src/main/java/org/apache/rocketmq/store/timer/rocksdb/TimerMessageRocksDBStore.java:333— TimerMessageRocksDBStore.doPut 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.doPut (cyclomatic 21) store/src/main/java/org/apache/rocketmq/store/timer/TimerMessageStore.java:1191— TimerMessageStore.doPut 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:888— 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.
DefaultAuthorizationContextBuilder.build (cyclomatic 20) auth/src/main/java/org/apache/rocketmq/auth/authorization/builder/DefaultAuthorizationContextBuilder.java:116— DefaultAuthorizationContextBuilder.build 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.
BrokerMetricsManager.init (cyclomatic 20) broker/src/main/java/org/apache/rocketmq/broker/metrics/BrokerMetricsManager.java:342— BrokerMetricsManager.init 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.
BrokerController.<init> (cyclomatic 20) broker/src/main/java/org/apache/rocketmq/broker/BrokerController.java:365— BrokerController.<init> 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.
PullAPIWrapper.processPullResult (cyclomatic 20) client/src/main/java/org/apache/rocketmq/client/impl/consumer/PullAPIWrapper.java:73— PullAPIWrapper.processPullResult 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.
AbstractRocksDBStorage.iterate (cyclomatic 20) common/src/main/java/org/apache/rocketmq/common/config/AbstractRocksDBStorage.java:336— AbstractRocksDBStorage.iterate 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.
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.
ReputMessageService.doReput (cyclomatic 20) store/src/main/java/org/apache/rocketmq/store/DefaultMessageStore.java:2723— ReputMessageService.doReput 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.
DefaultConsumerIdsChangeListener.handle (cyclomatic 19) broker/src/main/java/org/apache/rocketmq/broker/client/DefaultConsumerIdsChangeListener.java:64— DefaultConsumerIdsChangeListener.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.
PopLiteLongPollingService.run (cyclomatic 19) broker/src/main/java/org/apache/rocketmq/broker/longpolling/PopLiteLongPollingService.java:74— PopLiteLongPollingService.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.
PopLongPollingService.run (cyclomatic 19) broker/src/main/java/org/apache/rocketmq/broker/longpolling/PopLongPollingService.java:94— 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.
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:626— 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.
RebalancePushImpl.computePullFromWhereWithException (cyclomatic 19) client/src/main/java/org/apache/rocketmq/client/impl/consumer/RebalancePushImpl.java:166— 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.
BrokerContainerProcessor.addBroker (cyclomatic 19) container/src/main/java/org/apache/rocketmq/container/BrokerContainerProcessor.java:85— BrokerContainerProcessor.addBroker 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:292— 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.
ProxyAdminGrpcService.deleteSubscription (cyclomatic 19) proxy/src/main/java/org/apache/rocketmq/proxy/grpc/admin/ProxyAdminGrpcService.java:801— ProxyAdminGrpcService.deleteSubscription 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.
GrpcConverter.buildSystemProperties (cyclomatic 19) proxy/src/main/java/org/apache/rocketmq/proxy/grpc/v2/common/GrpcConverter.java:123— GrpcConverter.buildSystemProperties 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:271— 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.
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.
TimerDequeueGetMessageService.run (cyclomatic 19) store/src/main/java/org/apache/rocketmq/store/timer/TimerMessageStore.java:1707— 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:2429— 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.
DefaultAuthorizationContextBuilder.buildContextByAnnotation (cyclomatic 18) auth/src/main/java/org/apache/rocketmq/auth/authorization/builder/DefaultAuthorizationContextBuilder.java:655— DefaultAuthorizationContextBuilder.buildContextByAnnotation 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.
EndTransactionProcessor.processRequest (cyclomatic 18) broker/src/main/java/org/apache/rocketmq/broker/processor/EndTransactionProcessor.java:60— 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.
ConsumeRequest.run (cyclomatic 18) client/src/main/java/org/apache/rocketmq/client/impl/consumer/ConsumeMessagePopConcurrentlyService.java:345— 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.
ReceiveMessageActivity.receiveMessage (cyclomatic 18) proxy/src/main/java/org/apache/rocketmq/proxy/grpc/v2/consumer/ReceiveMessageActivity.java:61— 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.
AbstractWriteSocketService.run (cyclomatic 18) store/src/main/java/org/apache/rocketmq/store/ha/autoswitch/AutoSwitchHAConnection.java:645— 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.
IndexService.buildIndex (cyclomatic 18) store/src/main/java/org/apache/rocketmq/store/index/IndexService.java:224— IndexService.buildIndex 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.
DefaultAppendMessageCallback.doAppend (cyclomatic 18) store/src/main/java/org/apache/rocketmq/store/CommitLog.java:1990— DefaultAppendMessageCallback.doAppend 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:107— 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.
ConsumerManager.doChannelCloseEvent (cyclomatic 17) broker/src/main/java/org/apache/rocketmq/broker/client/ConsumerManager.java:137— ConsumerManager.doChannelCloseEvent 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.
ProducerManager.doChannelCloseEvent (cyclomatic 17) broker/src/main/java/org/apache/rocketmq/broker/client/ProducerManager.java:145— ProducerManager.doChannelCloseEvent 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.
AdminBrokerProcessor.resetOffsetInner (cyclomatic 17) broker/src/main/java/org/apache/rocketmq/broker/processor/AdminBrokerProcessor.java:2296— AdminBrokerProcessor.resetOffsetInner 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. This is NOT this file's highest cyclomatic complexity: AdminBrokerProcessor.processRequest (cyclomatic 76) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
BrokerStartup.buildBrokerController (cyclomatic 17) broker/src/main/java/org/apache/rocketmq/broker/BrokerStartup.java:162— BrokerStartup.buildBrokerController 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.
MQClientInstance.sendHeartbeatToAllBrokerConcurrently (cyclomatic 17) client/src/main/java/org/apache/rocketmq/client/impl/factory/MQClientInstance.java:862— MQClientInstance.sendHeartbeatToAllBrokerConcurrently 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.
AbstractRocksDBStorage.shutdown (cyclomatic 17) common/src/main/java/org/apache/rocketmq/common/config/AbstractRocksDBStorage.java:509— AbstractRocksDBStorage.shutdown 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.
MixAll.properties2Object (cyclomatic 17) common/src/main/java/org/apache/rocketmq/common/MixAll.java:403— MixAll.properties2Object 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:106— 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.
BatchConsumeQueue.estimateMessageCount (cyclomatic 17) store/src/main/java/org/apache/rocketmq/store/queue/BatchConsumeQueue.java:1102— 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:434— 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.
TimerDequeuePutMessageService.run (cyclomatic 17) store/src/main/java/org/apache/rocketmq/store/timer/TimerMessageStore.java:1611— TimerDequeuePutMessageService.run 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.
TransMessageRocksDBStore.buildTransIndex (cyclomatic 17) store/src/main/java/org/apache/rocketmq/store/transaction/TransMessageRocksDBStore.java:106— TransMessageRocksDBStore.buildTransIndex 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.
CommitLog.recoverNormally (cyclomatic 17) store/src/main/java/org/apache/rocketmq/store/CommitLog.java:348— CommitLog.recoverNormally 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.
ConsumerManager.registerConsumer (cyclomatic 16) broker/src/main/java/org/apache/rocketmq/broker/client/ConsumerManager.java:227— ConsumerManager.registerConsumer 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.
BrokerMetricsManager.shutdown (cyclomatic 16) broker/src/main/java/org/apache/rocketmq/broker/metrics/BrokerMetricsManager.java:858— BrokerMetricsManager.shutdown has cyclomatic complexity 16 (threshold 15). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
AckMessageProcessor.appendAck (cyclomatic 16) broker/src/main/java/org/apache/rocketmq/broker/processor/AckMessageProcessor.java:193— 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.
AckMessageProcessor.processRequest (cyclomatic 16) broker/src/main/java/org/apache/rocketmq/broker/processor/AckMessageProcessor.java:118— AckMessageProcessor.processRequest 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.
AdminBrokerProcessor.deleteTopicList (cyclomatic 16) broker/src/main/java/org/apache/rocketmq/broker/processor/AdminBrokerProcessor.java:813— AdminBrokerProcessor.deleteTopicList 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. This is NOT this file's highest cyclomatic complexity: AdminBrokerProcessor.processRequest (cyclomatic 76) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
PopBufferMergeService.addAk (cyclomatic 16) broker/src/main/java/org/apache/rocketmq/broker/processor/PopBufferMergeService.java:534— 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.
TransactionalMessageServiceImpl.batchSendOpMessage (cyclomatic 16) broker/src/main/java/org/apache/rocketmq/broker/transaction/queue/TransactionalMessageServiceImpl.java:698— TransactionalMessageServiceImpl.batchSendOpMessage 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:338— 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.
DefaultMQPushConsumerImpl.processPopResult (cyclomatic 16) client/src/main/java/org/apache/rocketmq/client/impl/consumer/DefaultMQPushConsumerImpl.java:621— DefaultMQPushConsumerImpl.processPopResult 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.
DefaultMQProducerImpl.sendMessageInTransaction (cyclomatic 16) client/src/main/java/org/apache/rocketmq/client/impl/producer/DefaultMQProducerImpl.java:1433— DefaultMQProducerImpl.sendMessageInTransaction 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.
RouteInfoManager.unRegisterBroker (cyclomatic 16) namesrv/src/main/java/org/apache/rocketmq/namesrv/routeinfo/RouteInfoManager.java:571— 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.
ProxyAdminGrpcService.buildAdminMessage (cyclomatic 16) proxy/src/main/java/org/apache/rocketmq/proxy/grpc/admin/ProxyAdminGrpcService.java:1376— ProxyAdminGrpcService.buildAdminMessage 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.
ProxyAdminGrpcService.verifyMessage (cyclomatic 16) proxy/src/main/java/org/apache/rocketmq/proxy/grpc/admin/ProxyAdminGrpcService.java:1237— ProxyAdminGrpcService.verifyMessage 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.
SendMessageActivity.buildMessageProperty (cyclomatic 16) proxy/src/main/java/org/apache/rocketmq/proxy/grpc/v2/producer/SendMessageActivity.java:216— SendMessageActivity.buildMessageProperty 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.
DLedgerCommitLog.asyncPutMessage (cyclomatic 16) store/src/main/java/org/apache/rocketmq/store/dledger/DLedgerCommitLog.java:542— 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.
TimerMessageStore.enqueue (cyclomatic 16) store/src/main/java/org/apache/rocketmq/store/timer/TimerMessageStore.java:754— TimerMessageStore.enqueue 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.
AllocateMappedFileService.mmapOperation (cyclomatic 16) store/src/main/java/org/apache/rocketmq/store/AllocateMappedFileService.java:173— AllocateMappedFileService.mmapOperation 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.
AllocateMappedFileService.putRequestAndReturnMappedFile (cyclomatic 16) store/src/main/java/org/apache/rocketmq/store/AllocateMappedFileService.java:63— AllocateMappedFileService.putRequestAndReturnMappedFile 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.
ConsumeQueue.estimateMessageCount (cyclomatic 16) store/src/main/java/org/apache/rocketmq/store/ConsumeQueue.java:1184— 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.
IndexStoreFile.queryAsyncFromSegmentFile (cyclomatic 16) tieredstore/src/main/java/org/apache/rocketmq/tieredstore/index/IndexStoreFile.java:368— IndexStoreFile.queryAsyncFromSegmentFile 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.
TieredStoreMetricsManager.init (cyclomatic 16) tieredstore/src/main/java/org/apache/rocketmq/tieredstore/metrics/TieredStoreMetricsManager.java:146— TieredStoreMetricsManager.init 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.
TieredMessageStore.getMessageAsync (cyclomatic 16) tieredstore/src/main/java/org/apache/rocketmq/tieredstore/TieredMessageStore.java:229— TieredMessageStore.getMessageAsync 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.
Hotspot: auth/src/main/java/org/apache/rocketmq/auth/authorization/builder/DefaultAuthorizationContextBuilder.java auth/src/main/java/org/apache/rocketmq/auth/authorization/builder/DefaultAuthorizationContextBuilder.java:193— auth/src/main/java/org/apache/rocketmq/auth/authorization/builder/DefaultAuthorizationContextBuilder.java changed 4 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 108 in DefaultAuthorizationContextBuilder.build at line 193. 2 of those changes were fix/bug commits, and the other 2 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 2026-08-12..2026-11-10, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-12 16:16:28 +08:00' --until='2026-11-10 16:16:28 +08:00' --full-history --no-merges -- auth/src/main/java/org/apache/rocketmq/auth/authorization/builder/DefaultAuthorizationContextBuilder.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.
FixmeComment broker/src/main/java/org/apache/rocketmq/broker/processor/PopReviveService.java:369— // 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:162— 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.
DefaultAuthorizationContextBuilder.build (cognitive 125) auth/src/main/java/org/apache/rocketmq/auth/authorization/builder/DefaultAuthorizationContextBuilder.java:193— DefaultAuthorizationContextBuilder.build has cognitive complexity 125 (threshold 15). Drivers by points: if/else 39 (87 pts), loops 11 (25 pts), ternaries 3 (8 pts), boolean chains 2, error handling 2, match/switch 1 (nesting depth added 67). 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.queryMessage (cognitive 122) client/src/main/java/org/apache/rocketmq/client/impl/MQAdminImpl.java:326— MQAdminImpl.queryMessage has cognitive complexity 122 (threshold 15). Drivers by points: if/else 26 (86 pts), loops 6 (23 pts), boolean chains 9, error handling 1 (4 pts) (nesting depth added 80). 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 115) broker/src/main/java/org/apache/rocketmq/broker/processor/PopReviveService.java:336— PopReviveService.consumeReviveMessage has cognitive complexity 115 (threshold 15). Drivers by points: if/else 29 (88 pts), boolean chains 8, loops 3 (8 pts), ternaries 2 (8 pts), error handling 1 (3 pts) (nesting depth added 72). 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.getMessage (cognitive 111) store/src/main/java/org/apache/rocketmq/store/DefaultMessageStore.java:866— DefaultMessageStore.getMessage has cognitive complexity 111 (threshold 15). Drivers by points: if/else 30 (93 pts), boolean chains 7, loops 2 (7 pts), 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.
DefaultMQProducerImpl.sendDefaultImpl (cognitive 101) client/src/main/java/org/apache/rocketmq/client/impl/producer/DefaultMQProducerImpl.java:738— DefaultMQProducerImpl.sendDefaultImpl has cognitive complexity 101 (threshold 15). Drivers by points: if/else 22 (72 pts), error handling 4 (16 pts), ternaries 2 (5 pts), match/switch 1 (4 pts), boolean chains 2, loops 1 (2 pts) (nesting depth added 69). 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.
PopMessageProcessor.processRequest (cognitive 90) broker/src/main/java/org/apache/rocketmq/broker/processor/PopMessageProcessor.java:220— PopMessageProcessor.processRequest has cognitive complexity 90 (threshold 15). Drivers by points: if/else 52 (66 pts), error handling 6 (11 pts), boolean chains 7, ternaries 4, loops 1, match/switch 1 (nesting depth added 19). 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.
RouteInfoManager.registerBroker (cognitive 82) namesrv/src/main/java/org/apache/rocketmq/namesrv/routeinfo/RouteInfoManager.java:226— RouteInfoManager.registerBroker has cognitive complexity 82 (threshold 15). Drivers by points: if/else 24 (55 pts), boolean chains 13, 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.
ConsumeQueue.binarySearchInQueueByTime (cognitive 82) store/src/main/java/org/apache/rocketmq/store/ConsumeQueue.java:234— 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.
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.
PullMessageProcessor.processRequest (cognitive 78) broker/src/main/java/org/apache/rocketmq/broker/processor/PullMessageProcessor.java:304— PullMessageProcessor.processRequest has cognitive complexity 78 (threshold 15). Drivers by points: if/else 38 (65 pts), boolean chains 8, error handling 2 (4 pts), 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.
CommitLog.recoverAbnormally (cognitive 72) store/src/main/java/org/apache/rocketmq/store/CommitLog.java:768— CommitLog.recoverAbnormally has cognitive complexity 72 (threshold 15). Drivers by points: if/else 25 (62 pts), boolean chains 4, loops 2 (4 pts), error handling 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.
CommitLog.checkMessageAndReturnSize (cognitive 71) store/src/main/java/org/apache/rocketmq/store/CommitLog.java:481— CommitLog.checkMessageAndReturnSize has cognitive complexity 71 (threshold 15). Drivers by points: if/else 27 (57 pts), loops 1 (5 pts), ternaries 1 (4 pts), boolean chains 3, error handling 1, match/switch 1 (nesting depth added 37). 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.
ConsumeRequest.run (cognitive 70) client/src/main/java/org/apache/rocketmq/client/impl/consumer/ConsumeMessageOrderlyService.java:390— 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.
PopBufferMergeService.scan (cognitive 69) broker/src/main/java/org/apache/rocketmq/broker/processor/PopBufferMergeService.java:226— PopBufferMergeService.scan has cognitive complexity 69 (threshold 15). Drivers by points: if/else 22 (54 pts), loops 3 (9 pts), boolean chains 6 (nesting depth added 38). 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 68) broker/src/main/java/org/apache/rocketmq/broker/BrokerController.java:1523— BrokerController.shutdownBasicService has cognitive complexity 68 (threshold 15). Drivers by points: if/else 62 (65 pts), loops 2, boolean chains 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.
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:508— 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.
MQClientInstance.updateTopicRouteInfoFromNameServer (cognitive 64) client/src/main/java/org/apache/rocketmq/client/impl/factory/MQClientInstance.java:933— 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.
HAClientReader.processReadResult (cognitive 63) store/src/main/java/org/apache/rocketmq/store/ha/autoswitch/AutoSwitchHAClient.java:484— HAClientReader.processReadResult has cognitive complexity 63 (threshold 15). Drivers by points: if/else 14 (49 pts), loops 2 (5 pts), ternaries 1 (4 pts), match/switch 1 (3 pts), boolean chains 1, error handling 1 (nesting depth added 43). 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 61) broker/src/main/java/org/apache/rocketmq/broker/metrics/ConsumerLagCalculator.java:146— ConsumerLagCalculator.processAllGroup has cognitive complexity 61 (threshold 15). Drivers by points: if/else 17 (52 pts), boolean chains 6, loops 2 (3 pts) (nesting depth added 36). 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.
TopicQueueMappingCleanService.cleanItemListMoreThanSecondGen (cognitive 60) broker/src/main/java/org/apache/rocketmq/broker/topic/TopicQueueMappingCleanService.java:212— TopicQueueMappingCleanService.cleanItemListMoreThanSecondGen has cognitive complexity 60 (threshold 15). Drivers by points: if/else 16 (40 pts), loops 6 (11 pts), error handling 3 (6 pts), boolean chains 3 (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.
TimerMessageStore.checkAndReviseMetrics (cognitive 60) store/src/main/java/org/apache/rocketmq/store/timer/TimerMessageStore.java:1293— TimerMessageStore.checkAndReviseMetrics has cognitive complexity 60 (threshold 15). Drivers by points: if/else 19 (42 pts), loops 8 (12 pts), ternaries 1 (4 pts), boolean chains 1, error handling 1 (nesting depth added 30). 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:890— 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.
DefaultMQProducerImpl.sendKernelImpl (cognitive 55) client/src/main/java/org/apache/rocketmq/client/impl/producer/DefaultMQProducerImpl.java:911— 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.
RemotingHelper.invokeSync (cognitive 55) remoting/src/main/java/org/apache/rocketmq/remoting/common/RemotingHelper.java:106— 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.
TimerDequeueGetMessageService.run (cognitive 54) store/src/main/java/org/apache/rocketmq/store/timer/TimerMessageStore.java:1707— 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.
ConsumeQueue.correctMinOffset (cognitive 53) store/src/main/java/org/apache/rocketmq/store/ConsumeQueue.java:554— ConsumeQueue.correctMinOffset has cognitive complexity 53 (threshold 15). Drivers by points: if/else 23 (44 pts), loops 2 (4 pts), boolean chains 3, error handling 1 (2 pts) (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.
PullAPIWrapper.processPullResult (cognitive 51) client/src/main/java/org/apache/rocketmq/client/impl/consumer/PullAPIWrapper.java:73— PullAPIWrapper.processPullResult has cognitive complexity 51 (threshold 15). Drivers by points: if/else 12 (34 pts), loops 4 (11 pts), boolean chains 3, error handling 1 (3 pts) (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.
AbstractWriteSocketService.run (cognitive 51) store/src/main/java/org/apache/rocketmq/store/ha/autoswitch/AutoSwitchHAConnection.java:645— 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.
RocksDBConsumeQueueTable.binarySearchInCQByTime (cognitive 50) store/src/main/java/org/apache/rocketmq/store/queue/RocksDBConsumeQueueTable.java:182— RocksDBConsumeQueueTable.binarySearchInCQByTime has cognitive complexity 50 (threshold 15). Drivers by points: if/else 16 (33 pts), match/switch 4 (10 pts), loops 3 (7 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.
ConsumeQueue.truncateDirtyLogicFiles (cognitive 50) store/src/main/java/org/apache/rocketmq/store/ConsumeQueue.java:420— 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.
ProducerManager.doChannelCloseEvent (cognitive 49) broker/src/main/java/org/apache/rocketmq/broker/client/ProducerManager.java:145— ProducerManager.doChannelCloseEvent has cognitive complexity 49 (threshold 15). Drivers by points: if/else 11 (41 pts), loops 2 (5 pts), boolean chains 3 (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.
PullMessageProcessor.rewriteResponseForStaticTopic (cognitive 49) broker/src/main/java/org/apache/rocketmq/broker/processor/PullMessageProcessor.java:159— 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.
MessageRocksDBStorage.queryOffsetForIndex (cognitive 49) store/src/main/java/org/apache/rocketmq/store/rocksdb/MessageRocksDBStorage.java:150— MessageRocksDBStorage.queryOffsetForIndex has cognitive complexity 49 (threshold 15). Drivers by points: if/else 13 (30 pts), boolean chains 11, error handling 2 (5 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.
PullRequestHoldService.notifyMessageArriving (cognitive 48) broker/src/main/java/org/apache/rocketmq/broker/longpolling/PullRequestHoldService.java:123— PullRequestHoldService.notifyMessageArriving has cognitive complexity 48 (threshold 15). Drivers by points: if/else 8 (28 pts), error handling 3 (16 pts), loops 1 (3 pts), boolean chains 1 (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.
RouteInfoManager.pickupTopicRouteData (cognitive 48) namesrv/src/main/java/org/apache/rocketmq/namesrv/routeinfo/RouteInfoManager.java:700— 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.
PopLiteLongPollingService.run (cognitive 47) broker/src/main/java/org/apache/rocketmq/broker/longpolling/PopLiteLongPollingService.java:74— PopLiteLongPollingService.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.
PopLongPollingService.run (cognitive 47) broker/src/main/java/org/apache/rocketmq/broker/longpolling/PopLongPollingService.java:94— 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.
DefaultAuthorizationContextBuilder.buildContextByAnnotation (cognitive 46) auth/src/main/java/org/apache/rocketmq/auth/authorization/builder/DefaultAuthorizationContextBuilder.java:655— DefaultAuthorizationContextBuilder.buildContextByAnnotation has cognitive complexity 46 (threshold 15). Drivers by points: if/else 15 (39 pts), loops 2 (5 pts), boolean chains 2 (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.
BrokerController.startBasicService (cognitive 46) broker/src/main/java/org/apache/rocketmq/broker/BrokerController.java:1832— BrokerController.startBasicService has cognitive complexity 46 (threshold 15). Drivers by points: if/else 32 (42 pts), boolean chains 2, loops 2 (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.
MQClientAPIImpl.processPopResponse (cognitive 46) client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:1113— 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.
IndexRocksDBStore.buildIndex (cognitive 46) store/src/main/java/org/apache/rocketmq/store/index/rocksdb/IndexRocksDBStore.java:142— IndexRocksDBStore.buildIndex has cognitive complexity 46 (threshold 15). Drivers by points: if/else 11 (22 pts), loops 4 (11 pts), error handling 4 (9 pts), boolean chains 3, 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.
AbstractSendMessageProcessor.consumerSendMsgBack (cognitive 45) broker/src/main/java/org/apache/rocketmq/broker/processor/AbstractSendMessageProcessor.java:92— 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.
DefaultMQPushConsumerImpl.processPopResult (cognitive 45) client/src/main/java/org/apache/rocketmq/client/impl/consumer/DefaultMQPushConsumerImpl.java:621— DefaultMQPushConsumerImpl.processPopResult has cognitive complexity 45 (threshold 15). Drivers by points: if/else 10 (27 pts), loops 4 (12 pts), error handling 1 (5 pts), boolean chains 1 (nesting depth added 29). 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.
RemotingCommand.decodeCommandCustomHeaderDirectly (cognitive 45) remoting/src/main/java/org/apache/rocketmq/remoting/protocol/RemotingCommand.java:282— RemotingCommand.decodeCommandCustomHeaderDirectly has cognitive complexity 45 (threshold 15). Drivers by points: if/else 13 (32 pts), error handling 2 (6 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.
PopMessageProcessor.popMsgFromQueue (cognitive 44) broker/src/main/java/org/apache/rocketmq/broker/processor/PopMessageProcessor.java:676— PopMessageProcessor.popMsgFromQueue has cognitive complexity 44 (threshold 15). Drivers by points: if/else 18 (23 pts), error handling 6 (12 pts), boolean chains 5, loops 2 (4 pts) (nesting depth added 13). 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.
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.
ReputMessageService.doReput (cognitive 43) store/src/main/java/org/apache/rocketmq/store/DefaultMessageStore.java:2723— ReputMessageService.doReput has cognitive complexity 43 (threshold 15). Drivers by points: if/else 12 (31 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.
ConsumerFilterManager.decode (cognitive 42) broker/src/main/java/org/apache/rocketmq/broker/filter/ConsumerFilterManager.java:244— ConsumerFilterManager.decode has cognitive complexity 42 (threshold 15). Drivers by points: if/else 7 (22 pts), loops 4 (10 pts), ternaries 1 (5 pts), error handling 1 (4 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.
SubscriptionFilterHandler.register (cognitive 42) broker/src/main/java/org/apache/rocketmq/broker/filter/ConsumerFilterManager.java:421— SubscriptionFilterHandler.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.
PopConsumerService.popAsync (cognitive 42) broker/src/main/java/org/apache/rocketmq/broker/pop/PopConsumerService.java:355— PopConsumerService.popAsync has cognitive complexity 42 (threshold 15). Drivers by points: if/else 16 (26 pts), boolean chains 9, ternaries 3 (4 pts), loops 1 (2 pts), error handling 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.
UtilAll.getIP (cognitive 42) common/src/main/java/org/apache/rocketmq/common/UtilAll.java:597— UtilAll.getIP has cognitive complexity 42 (threshold 15). Drivers by points: if/else 11 (37 pts), loops 2 (3 pts), boolean chains 1, 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.
TimerDequeuePutMessageService.run (cognitive 42) store/src/main/java/org/apache/rocketmq/store/timer/TimerMessageStore.java:1611— TimerDequeuePutMessageService.run has cognitive complexity 42 (threshold 15). Drivers by points: if/else 11 (28 pts), loops 3 (6 pts), error handling 2 (5 pts), boolean chains 3 (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.
DLedgerCommitLog.dledgerRecoverAbnormally (cognitive 41) store/src/main/java/org/apache/rocketmq/store/dledger/DLedgerCommitLog.java:320— DLedgerCommitLog.dledgerRecoverAbnormally has cognitive complexity 41 (threshold 15). Drivers by points: if/else 14 (37 pts), loops 2 (4 pts) (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.
MessageStoreDispatcherImpl.doScheduleDispatch (cognitive 41) tieredstore/src/main/java/org/apache/rocketmq/tieredstore/core/MessageStoreDispatcherImpl.java:133— MessageStoreDispatcherImpl.doScheduleDispatch has cognitive complexity 41 (threshold 15). Drivers by points: if/else 28 (34 pts), boolean chains 5, error handling 1, loops 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.
CommitLog.asyncPutMessage (cognitive 40) store/src/main/java/org/apache/rocketmq/store/CommitLog.java:999— 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.
ConsumerManager.doChannelCloseEvent (cognitive 39) broker/src/main/java/org/apache/rocketmq/broker/client/ConsumerManager.java:137— ConsumerManager.doChannelCloseEvent has cognitive complexity 39 (threshold 15). Drivers by points: if/else 11 (33 pts), boolean chains 3, loops 2 (3 pts) (nesting depth added 23). 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.
DefaultMQPushConsumerImpl.checkConfig (cognitive 39) client/src/main/java/org/apache/rocketmq/client/impl/consumer/DefaultMQPushConsumerImpl.java:1027— 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.
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.
MappedFileQueue.getConsumeQueueMappedFileByTime (cognitive 39) store/src/main/java/org/apache/rocketmq/store/MappedFileQueue.java:107— 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.
BrokerMetricsManager.shutdown (cognitive 38) broker/src/main/java/org/apache/rocketmq/broker/metrics/BrokerMetricsManager.java:858— BrokerMetricsManager.shutdown has cognitive complexity 38 (threshold 15). Drivers by points: loops 8 (24 pts), if/else 8 (14 pts) (nesting depth added 22). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
AdminBrokerProcessor.fetchAllConsumeStatsInBroker (cognitive 38) broker/src/main/java/org/apache/rocketmq/broker/processor/AdminBrokerProcessor.java:2737— AdminBrokerProcessor.fetchAllConsumeStatsInBroker has cognitive complexity 38 (threshold 15). Drivers by points: if/else 7 (26 pts), loops 3 (6 pts), error handling 1 (4 pts), boolean chains 2 (nesting depth added 25). 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.
ConsumeQueue.estimateMessageCount (cognitive 37) store/src/main/java/org/apache/rocketmq/store/ConsumeQueue.java:1184— 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.
DefaultMessageStore.shutdown (cognitive 37) store/src/main/java/org/apache/rocketmq/store/DefaultMessageStore.java:520— DefaultMessageStore.shutdown has cognitive complexity 37 (threshold 15). Drivers by points: if/else 18 (30 pts), error handling 3 (6 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.
AdminBrokerProcessor.lockBatchMQ (cognitive 36) broker/src/main/java/org/apache/rocketmq/broker/processor/AdminBrokerProcessor.java:1538— 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.
MQClientInstance.topicRouteData2TopicPublishInfo (cognitive 36) client/src/main/java/org/apache/rocketmq/client/impl/factory/MQClientInstance.java:261— 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.
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.
IndexService.buildIndex (cognitive 36) store/src/main/java/org/apache/rocketmq/store/index/IndexService.java:224— IndexService.buildIndex has cognitive complexity 36 (threshold 15). Drivers by points: if/else 11 (29 pts), loops 1 (3 pts), boolean chains 2, match/switch 1 (2 pts) (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.
CombineConsumeQueueStore.verifyAndInitOffsetForAllStore (cognitive 36) store/src/main/java/org/apache/rocketmq/store/queue/CombineConsumeQueueStore.java:242— CombineConsumeQueueStore.verifyAndInitOffsetForAllStore has cognitive complexity 36 (threshold 15). Drivers by points: if/else 7 (26 pts), loops 3 (6 pts), boolean chains 4 (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.
TimerMessageStore.dequeue (cognitive 36) store/src/main/java/org/apache/rocketmq/store/timer/TimerMessageStore.java:1018— 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.
SendMessageProcessor.sendMessage (cognitive 35) broker/src/main/java/org/apache/rocketmq/broker/processor/SendMessageProcessor.java:243— SendMessageProcessor.sendMessage has cognitive complexity 35 (threshold 15). Drivers by points: if/else 22 (28 pts), boolean chains 6, ternaries 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.
BatchConsumeQueue.estimateMessageCount (cognitive 35) store/src/main/java/org/apache/rocketmq/store/queue/BatchConsumeQueue.java:1102— 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:503— 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.
ConsumerLagCalculator.calculateMessageCount (cognitive 34) broker/src/main/java/org/apache/rocketmq/broker/metrics/ConsumerLagCalculator.java:522— 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.
RebalancePushImpl.computePullFromWhereWithException (cognitive 34) client/src/main/java/org/apache/rocketmq/client/impl/consumer/RebalancePushImpl.java:166— 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.
LocalMessageService.popMessage (cognitive 34) proxy/src/main/java/org/apache/rocketmq/proxy/service/message/LocalMessageService.java:271— 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.
CommitLog.recoverNormally (cognitive 34) store/src/main/java/org/apache/rocketmq/store/CommitLog.java:348— CommitLog.recoverNormally has cognitive complexity 34 (threshold 15). Drivers by points: if/else 14 (27 pts), loops 2 (4 pts), boolean chains 3 (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.
BrokerMetricsManager.init (cognitive 33) broker/src/main/java/org/apache/rocketmq/broker/metrics/BrokerMetricsManager.java:342— BrokerMetricsManager.init has cognitive complexity 33 (threshold 15). Drivers by points: if/else 15 (24 pts), loops 2 (5 pts), boolean chains 2, ternaries 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.
PeekMessageProcessor.processRequest (cognitive 33) broker/src/main/java/org/apache/rocketmq/broker/processor/PeekMessageProcessor.java:78— 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.
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.
RouteInfoManager.unRegisterBroker (cognitive 33) namesrv/src/main/java/org/apache/rocketmq/namesrv/routeinfo/RouteInfoManager.java:571— 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.
NettyRemotingClient.updateNameServerAddressList (cognitive 33) remoting/src/main/java/org/apache/rocketmq/remoting/netty/NettyRemotingClient.java:517— 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.
TimerMessageStore.shutdown (cognitive 33) store/src/main/java/org/apache/rocketmq/store/timer/TimerMessageStore.java:562— TimerMessageStore.shutdown has cognitive complexity 33 (threshold 15). Drivers by points: if/else 21 (27 pts), loops 2 (4 pts), error handling 1 (2 pts) (nesting depth added 9). 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.
TimerMessageStore.warmDequeue (cognitive 33) store/src/main/java/org/apache/rocketmq/store/timer/TimerMessageStore.java:888— 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:1172— 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.
BrokerContainerProcessor.addBroker (cognitive 32) container/src/main/java/org/apache/rocketmq/container/BrokerContainerProcessor.java:85— BrokerContainerProcessor.addBroker has cognitive complexity 32 (threshold 15). Drivers by points: if/else 11 (18 pts), error handling 3 (5 pts), loops 2 (4 pts), match/switch 1 (3 pts), boolean chains 2 (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.
Broker2Client.resetOffset (cognitive 31) broker/src/main/java/org/apache/rocketmq/broker/client/net/Broker2Client.java:120— Broker2Client.resetOffset has cognitive complexity 31 (threshold 15). Drivers by points: if/else 13 (19 pts), error handling 2 (7 pts), loops 2 (3 pts), 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.
NotificationProcessor.processRequest (cognitive 31) broker/src/main/java/org/apache/rocketmq/broker/processor/NotificationProcessor.java:89— NotificationProcessor.processRequest has cognitive complexity 31 (threshold 15). Drivers by points: if/else 20 (26 pts), boolean chains 3, error handling 1 (2 pts) (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.
MQAdminImpl.createTopic (cognitive 31) client/src/main/java/org/apache/rocketmq/client/impl/MQAdminImpl.java:85— 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.
CleanCommitLogService.isSpaceToDelete (cognitive 31) store/src/main/java/org/apache/rocketmq/store/DefaultMessageStore.java:2429— 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.
DefaultConsumerIdsChangeListener.handle (cognitive 30) broker/src/main/java/org/apache/rocketmq/broker/client/DefaultConsumerIdsChangeListener.java:64— DefaultConsumerIdsChangeListener.handle has cognitive complexity 30 (threshold 15). Drivers by points: if/else 9 (21 pts), loops 1 (4 pts), boolean chains 3, match/switch 1, ternaries 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.
AbstractSendMessageProcessor.msgCheck (cognitive 30) broker/src/main/java/org/apache/rocketmq/broker/processor/AbstractSendMessageProcessor.java:464— AbstractSendMessageProcessor.msgCheck has cognitive complexity 30 (threshold 15). Drivers by points: if/else 14 (23 pts), boolean chains 7 (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.
AckMessageProcessor.appendAck (cognitive 30) broker/src/main/java/org/apache/rocketmq/broker/processor/AckMessageProcessor.java:193— AckMessageProcessor.appendAck has cognitive complexity 30 (threshold 15). Drivers by points: if/else 14 (23 pts), boolean chains 3, error handling 1 (2 pts), loops 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.
ControllerMetricsManager.init (cognitive 30) controller/src/main/java/org/apache/rocketmq/controller/metrics/ControllerMetricsManager.java:292— 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.
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.
TlsHelper.buildSslContext (cognitive 30) remoting/src/main/java/org/apache/rocketmq/remoting/netty/TlsHelper.java:96— 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.
AbstractWriteSocketService.transferToSlave (cognitive 30) store/src/main/java/org/apache/rocketmq/store/ha/autoswitch/AutoSwitchHAConnection.java:569— AbstractWriteSocketService.transferToSlave has cognitive complexity 30 (threshold 15). Drivers by points: if/else 15 (29 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.
BatchConsumeQueue.truncateDirtyLogicFiles (cognitive 30) store/src/main/java/org/apache/rocketmq/store/queue/BatchConsumeQueue.java:395— 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:137— 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.
AckMessageProcessor.processRequest (cognitive 29) broker/src/main/java/org/apache/rocketmq/broker/processor/AckMessageProcessor.java:118— AckMessageProcessor.processRequest has cognitive complexity 29 (threshold 15). Drivers by points: if/else 13 (22 pts), boolean chains 3, error handling 1 (2 pts), loops 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.
EndTransactionProcessor.processRequest (cognitive 29) broker/src/main/java/org/apache/rocketmq/broker/processor/EndTransactionProcessor.java:60— 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.
MixAll.properties2Object (cognitive 29) common/src/main/java/org/apache/rocketmq/common/MixAll.java:403— MixAll.properties2Object has cognitive complexity 29 (threshold 15). Drivers by points: if/else 10 (20 pts), boolean chains 5, 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.
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.
HAServerReader.processReadResult (cognitive 29) store/src/main/java/org/apache/rocketmq/store/ha/autoswitch/AutoSwitchHAConnection.java:306— HAServerReader.processReadResult has cognitive complexity 29 (threshold 15). Drivers by points: if/else 8 (25 pts), match/switch 1 (3 pts), loops 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.
IndexFile.selectPhyOffset (cognitive 29) store/src/main/java/org/apache/rocketmq/store/index/IndexFile.java:204— 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) store/src/main/java/org/apache/rocketmq/store/kv/CompactionStore.java: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.
TimerMessageStore.enqueue (cognitive 29) store/src/main/java/org/apache/rocketmq/store/timer/TimerMessageStore.java:754— TimerMessageStore.enqueue has cognitive complexity 29 (threshold 15). Drivers by points: if/else 13 (22 pts), loops 2 (4 pts), error handling 2 (3 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.
ConcurrentReputMessageService.doReput (cognitive 29) store/src/main/java/org/apache/rocketmq/store/DefaultMessageStore.java:3022— 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.
RebalanceImpl.updateProcessQueueTableInRebalance (cognitive 28) client/src/main/java/org/apache/rocketmq/client/impl/consumer/RebalanceImpl.java:426— 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.
MQClientInstance.sendHeartbeatToAllBrokerConcurrently (cognitive 28) client/src/main/java/org/apache/rocketmq/client/impl/factory/MQClientInstance.java:862— MQClientInstance.sendHeartbeatToAllBrokerConcurrently has cognitive complexity 28 (threshold 15). Drivers by points: if/else 9 (17 pts), loops 3 (5 pts), error handling 3 (4 pts), boolean chains 2 (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.
NetworkUtil.getLocalInetAddressList (cognitive 28) common/src/main/java/org/apache/rocketmq/common/utils/NetworkUtil.java:93— NetworkUtil.getLocalInetAddressList has cognitive complexity 28 (threshold 15). Drivers by points: if/else 7 (24 pts), loops 2 (3 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.
TimerMessageStore.recoverAndRevise (cognitive 28) store/src/main/java/org/apache/rocketmq/store/timer/TimerMessageStore.java:434— 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:1628— 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.
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.
QueryAssignmentProcessor.doLoadBalance (cognitive 27) broker/src/main/java/org/apache/rocketmq/broker/processor/QueryAssignmentProcessor.java:159— QueryAssignmentProcessor.doLoadBalance has cognitive complexity 27 (threshold 15). Drivers by points: if/else 12 (23 pts), error handling 1 (2 pts), boolean chains 1, 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.
RebalanceImpl.lockAll (cognitive 27) client/src/main/java/org/apache/rocketmq/client/impl/consumer/RebalanceImpl.java:182— 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.
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:309— 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.
ProxyAdminAuthInterceptor.interceptCall (cognitive 27) proxy/src/main/java/org/apache/rocketmq/proxy/grpc/admin/ProxyAdminAuthInterceptor.java:140— ProxyAdminAuthInterceptor.interceptCall has cognitive complexity 27 (threshold 15). Drivers by points: if/else 9 (13 pts), boolean chains 8, error handling 3, ternaries 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.
MappedFileQueue.deleteExpiredFileByOffsetForTimerLog (cognitive 27) store/src/main/java/org/apache/rocketmq/store/MappedFileQueue.java:600— 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.
ConsumerOffsetManager.queryMinOffsetInAllGroup (cognitive 26) broker/src/main/java/org/apache/rocketmq/broker/offset/ConsumerOffsetManager.java:327— 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.
BrokerFastFailure.cleanExpiredRequestInQueue (cognitive 26) broker/src/main/java/org/apache/rocketmq/broker/latency/BrokerFastFailure.java:122— 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.
BrokerController.<init> (cognitive 26) broker/src/main/java/org/apache/rocketmq/broker/BrokerController.java:365— BrokerController.<init> has cognitive complexity 26 (threshold 15). Drivers by points: ternaries 9 (14 pts), if/else 8, boolean chains 4 (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.
RebalanceImpl.rebalanceByTopic (cognitive 26) client/src/main/java/org/apache/rocketmq/client/impl/consumer/RebalanceImpl.java:268— RebalanceImpl.rebalanceByTopic has cognitive complexity 26 (threshold 15). Drivers by points: if/else 9 (20 pts), error handling 1 (3 pts), boolean chains 2, match/switch 1 (nesting depth added 13). 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.
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.
AdminModelConverter.toAccumulation (cognitive 26) proxy/src/main/java/org/apache/rocketmq/proxy/grpc/admin/AdminModelConverter.java:170— AdminModelConverter.toAccumulation has cognitive complexity 26 (threshold 15). Drivers by points: if/else 6 (17 pts), boolean chains 5, loops 3 (4 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.
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.
BatchConsumeQueue.binarySearchRight (cognitive 26) store/src/main/java/org/apache/rocketmq/store/queue/BatchConsumeQueue.java:878— 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.
CombineConsumeQueueStore.processConsumeQueuesForTopic (cognitive 26) store/src/main/java/org/apache/rocketmq/store/queue/CombineConsumeQueueStore.java:519— CombineConsumeQueueStore.processConsumeQueuesForTopic has cognitive complexity 26 (threshold 15). Drivers by points: if/else 5 (11 pts), ternaries 2 (8 pts), loops 2 (3 pts), boolean chains 2, error handling 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.
AllocateMappedFileService.putRequestAndReturnMappedFile (cognitive 26) store/src/main/java/org/apache/rocketmq/store/AllocateMappedFileService.java:63— AllocateMappedFileService.putRequestAndReturnMappedFile has cognitive complexity 26 (threshold 15). Drivers by points: if/else 15 (22 pts), error handling 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.
DefaultAuthorizationContextBuilder.build (cognitive 25) auth/src/main/java/org/apache/rocketmq/auth/authorization/builder/DefaultAuthorizationContextBuilder.java:116— DefaultAuthorizationContextBuilder.build has cognitive complexity 25 (threshold 15). Drivers by points: if/else 19 (25 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.
AuthMigrator.createAcl (cognitive 25) auth/src/main/java/org/apache/rocketmq/auth/migration/AuthMigrator.java:115— AuthMigrator.createAcl has cognitive complexity 25 (threshold 15). Drivers by points: if/else 12 (21 pts), loops 2 (4 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.
TopicConfigManager.createTopicInSendMessageMethod (cognitive 25) broker/src/main/java/org/apache/rocketmq/broker/topic/TopicConfigManager.java:265— TopicConfigManager.createTopicInSendMessageMethod has cognitive complexity 25 (threshold 15). Drivers by points: if/else 11 (24 pts), error handling 1 (nesting depth added 13). 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.addAk (cognitive 25) broker/src/main/java/org/apache/rocketmq/broker/processor/PopBufferMergeService.java:534— 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.
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.
ReceiveMessageActivity.receiveMessage (cognitive 25) proxy/src/main/java/org/apache/rocketmq/proxy/grpc/v2/consumer/ReceiveMessageActivity.java:61— ReceiveMessageActivity.receiveMessage has cognitive complexity 25 (threshold 15). Drivers by points: if/else 13 (16 pts), ternaries 2 (4 pts), boolean chains 3, error handling 2 (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.
HAProxyMessageForwarder.buildHAProxyMessage (cognitive 25) proxy/src/main/java/org/apache/rocketmq/proxy/remoting/protocol/http2proxy/HAProxyMessageForwarder.java:89— HAProxyMessageForwarder.buildHAProxyMessage has cognitive complexity 25 (threshold 15). Drivers by points: if/else 9 (22 pts), loops 1 (2 pts), ternaries 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.
MessageQueueSelector.buildWrite (cognitive 25) proxy/src/main/java/org/apache/rocketmq/proxy/service/route/MessageQueueSelector.java:106— 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.
SubscriptionData.equals (cognitive 25) remoting/src/main/java/org/apache/rocketmq/remoting/protocol/heartbeat/SubscriptionData.java:130— 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.
AllocateMappedFileService.mmapOperation (cognitive 25) store/src/main/java/org/apache/rocketmq/store/AllocateMappedFileService.java:173— AllocateMappedFileService.mmapOperation has cognitive complexity 25 (threshold 15). Drivers by points: if/else 9 (13 pts), error handling 4 (8 pts), boolean chains 2, ternaries 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.
AckMessageProcessor.appendAckNew (cognitive 24) broker/src/main/java/org/apache/rocketmq/broker/processor/AckMessageProcessor.java:318— AckMessageProcessor.appendAckNew has cognitive complexity 24 (threshold 15). Drivers by points: if/else 9 (17 pts), boolean chains 3, error handling 1 (2 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.
AdminBrokerProcessor.resetOffsetInner (cognitive 24) broker/src/main/java/org/apache/rocketmq/broker/processor/AdminBrokerProcessor.java:2296— AdminBrokerProcessor.resetOffsetInner has cognitive complexity 24 (threshold 15). Drivers by points: if/else 11 (16 pts), loops 3 (4 pts), boolean chains 3, error handling 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.
AdminBrokerProcessor.updateAndCreateTopicList (cognitive 24) broker/src/main/java/org/apache/rocketmq/broker/processor/AdminBrokerProcessor.java:636— AdminBrokerProcessor.updateAndCreateTopicList has cognitive complexity 24 (threshold 15). Drivers by points: if/else 8 (16 pts), loops 3 (4 pts), boolean chains 2, error handling 1, ternaries 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:158— 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:205— 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.
ProxyAdminGrpcService.queryMessage (cognitive 24) proxy/src/main/java/org/apache/rocketmq/proxy/grpc/admin/ProxyAdminGrpcService.java:1105— ProxyAdminGrpcService.queryMessage has cognitive complexity 24 (threshold 15). Drivers by points: if/else 8 (13 pts), ternaries 4 (5 pts), loops 2 (3 pts), boolean chains 1, 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.
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.
AcceptSocketService.run (cognitive 24) store/src/main/java/org/apache/rocketmq/store/ha/DefaultHAService.java:342— 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.
AdaptiveBackOffSpinLockImpl.swap (cognitive 24) store/src/main/java/org/apache/rocketmq/store/lock/AdaptiveBackOffSpinLockImpl.java:109— AdaptiveBackOffSpinLockImpl.swap has cognitive complexity 24 (threshold 15). Drivers by points: if/else 12 (18 pts), error handling 1 (3 pts), loops 1 (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.
DefaultAppendMessageCallback.doAppend (cognitive 24) store/src/main/java/org/apache/rocketmq/store/CommitLog.java:1990— DefaultAppendMessageCallback.doAppend has cognitive complexity 24 (threshold 15). Drivers by points: if/else 9 (15 pts), error handling 2 (5 pts), ternaries 2, boolean chains 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.
MappedFileQueue.findMappedFileByOffset (cognitive 24) store/src/main/java/org/apache/rocketmq/store/MappedFileQueue.java:695— 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.
FlatMessageFile.getQueueOffsetByTimeAsync (cognitive 24) tieredstore/src/main/java/org/apache/rocketmq/tieredstore/file/FlatMessageFile.java:274— FlatMessageFile.getQueueOffsetByTimeAsync has cognitive complexity 24 (threshold 15). Drivers by points: if/else 12 (18 pts), loops 3 (4 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.
AdminBrokerProcessor.getConsumeStats (cognitive 23) broker/src/main/java/org/apache/rocketmq/broker/processor/AdminBrokerProcessor.java:2053— AdminBrokerProcessor.getConsumeStats has cognitive complexity 23 (threshold 15). Drivers by points: if/else 6 (19 pts), loops 2 (3 pts), 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.
TransactionalMessageServiceImpl.batchSendOpMessage (cognitive 23) broker/src/main/java/org/apache/rocketmq/broker/transaction/queue/TransactionalMessageServiceImpl.java:698— TransactionalMessageServiceImpl.batchSendOpMessage has cognitive complexity 23 (threshold 15). Drivers by points: if/else 8 (15 pts), boolean chains 3, loops 2 (3 pts), error handling 1, ternaries 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.
MixAll.object2Properties (cognitive 23) common/src/main/java/org/apache/rocketmq/common/MixAll.java:370— 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.
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.
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.
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.
DefaultMappedFile.appendMessagesInner (cognitive 23) store/src/main/java/org/apache/rocketmq/store/logfile/DefaultMappedFile.java:351— DefaultMappedFile.appendMessagesInner has cognitive complexity 23 (threshold 15). Drivers by points: if/else 11 (19 pts), error handling 1 (3 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.
BatchConsumeQueue.recover (cognitive 23) store/src/main/java/org/apache/rocketmq/store/queue/BatchConsumeQueue.java:231— 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.
TransMessageRocksDBStore.buildTransIndex (cognitive 23) store/src/main/java/org/apache/rocketmq/store/transaction/TransMessageRocksDBStore.java:106— TransMessageRocksDBStore.buildTransIndex has cognitive complexity 23 (threshold 15). Drivers by points: if/else 11 (16 pts), error handling 2 (3 pts), boolean chains 2, loops 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.
GroupCommitService.doCommit (cognitive 23) store/src/main/java/org/apache/rocketmq/store/CommitLog.java:1731— 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.
DefaultMessageStore.queryMessage (cognitive 23) store/src/main/java/org/apache/rocketmq/store/DefaultMessageStore.java:1454— DefaultMessageStore.queryMessage has cognitive complexity 23 (threshold 15). Drivers by points: if/else 7 (15 pts), error handling 1 (3 pts), loops 2 (3 pts), boolean chains 2 (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.
ProducerManager.registerProducer (cognitive 22) broker/src/main/java/org/apache/rocketmq/broker/client/ProducerManager.java:206— ProducerManager.registerProducer has cognitive complexity 22 (threshold 15). Drivers by points: if/else 11 (18 pts), boolean chains 2, 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.
PopBufferMergeService.scanCommitOffset (cognitive 22) broker/src/main/java/org/apache/rocketmq/broker/processor/PopBufferMergeService.java:136— 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:400— 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.
ConsumeRequest.run (cognitive 22) client/src/main/java/org/apache/rocketmq/client/impl/consumer/ConsumeMessagePopConcurrentlyService.java:345— 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:75— 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.
RebalanceImpl.doRebalance (cognitive 22) client/src/main/java/org/apache/rocketmq/client/impl/consumer/RebalanceImpl.java:232— RebalanceImpl.doRebalance has cognitive complexity 22 (threshold 15). Drivers by points: if/else 6 (17 pts), error handling 1 (3 pts), 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.
MQClientInstance.checkClientInBroker (cognitive 22) client/src/main/java/org/apache/rocketmq/client/impl/factory/MQClientInstance.java:534— 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.
TraceDataEncoder.decoderFromTraceDataString (cognitive 22) client/src/main/java/org/apache/rocketmq/client/trace/TraceDataEncoder.java:39— TraceDataEncoder.decoderFromTraceDataString has cognitive complexity 22 (threshold 15). Drivers by points: if/else 11 (20 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.
RouteInfoManager.cleanTopicByUnRegisterRequests (cognitive 22) namesrv/src/main/java/org/apache/rocketmq/namesrv/routeinfo/RouteInfoManager.java:652— 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.
ProxyAdminGrpcService.buildListSubscriptionResponse (cognitive 22) proxy/src/main/java/org/apache/rocketmq/proxy/grpc/admin/ProxyAdminGrpcService.java:494— ProxyAdminGrpcService.buildListSubscriptionResponse has cognitive complexity 22 (threshold 15). Drivers by points: if/else 3 (8 pts), ternaries 2 (6 pts), boolean chains 4, loops 3 (4 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.
ProxyAdminGrpcService.deleteSubscription (cognitive 22) proxy/src/main/java/org/apache/rocketmq/proxy/grpc/admin/ProxyAdminGrpcService.java:801— ProxyAdminGrpcService.deleteSubscription has cognitive complexity 22 (threshold 15). Drivers by points: if/else 10 (12 pts), boolean chains 4, loops 3, ternaries 2, error handling 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.
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.
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.
IndexService.queryOffset (cognitive 22) store/src/main/java/org/apache/rocketmq/store/index/IndexService.java:173— IndexService.queryOffset has cognitive complexity 22 (threshold 15). Drivers by points: if/else 7 (18 pts), loops 1 (2 pts), boolean chains 1, error handling 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.
DefaultMessageStore.queryMessage (cognitive 22) store/src/main/java/org/apache/rocketmq/store/DefaultMessageStore.java:1398— DefaultMessageStore.queryMessage has cognitive complexity 22 (threshold 15). Drivers by points: if/else 7 (15 pts), error handling 1 (3 pts), loops 2 (3 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.
TieredStoreMetricsManager.init (cognitive 22) tieredstore/src/main/java/org/apache/rocketmq/tieredstore/metrics/TieredStoreMetricsManager.java:146— TieredStoreMetricsManager.init has cognitive complexity 22 (threshold 15). Drivers by points: if/else 7 (11 pts), error handling 3 (5 pts), boolean chains 3, loops 3 (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.
Broker2Client.getConsumeStatus (cognitive 21) broker/src/main/java/org/apache/rocketmq/broker/client/net/Broker2Client.java:245— 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.
ConsumerFilterManager.clean (cognitive 21) broker/src/main/java/org/apache/rocketmq/broker/filter/ConsumerFilterManager.java:318— ConsumerFilterManager.clean has cognitive complexity 21 (threshold 15). Drivers by points: if/else 4 (14 pts), ternaries 1 (4 pts), loops 2 (3 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.
AdminBrokerProcessor.queryConsumeQueue (cognitive 21) broker/src/main/java/org/apache/rocketmq/broker/processor/AdminBrokerProcessor.java:2967— 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:1231— 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:655— 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.fillOpRemoveMap (cognitive 21) broker/src/main/java/org/apache/rocketmq/broker/transaction/queue/TransactionalMessageServiceImpl.java:379— 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.
ConsumeMessageConcurrentlyService.submitConsumeRequest (cognitive 21) client/src/main/java/org/apache/rocketmq/client/impl/consumer/ConsumeMessageConcurrentlyService.java:147— 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:137— 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.
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.
GrpcConverter.buildSystemProperties (cognitive 21) proxy/src/main/java/org/apache/rocketmq/proxy/grpc/v2/common/GrpcConverter.java:123— GrpcConverter.buildSystemProperties has cognitive complexity 21 (threshold 15). Drivers by points: if/else 18 (19 pts), boolean chains 1, ternaries 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.
RemotingProtocolServer.cleanExpiredRequestInQueue (cognitive 21) proxy/src/main/java/org/apache/rocketmq/proxy/remoting/RemotingProtocolServer.java:369— 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.
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.
CorrectLogicOffsetService.needCorrect (cognitive 21) store/src/main/java/org/apache/rocketmq/store/queue/ConsumeQueueStore.java:759— 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.
GroupCheckService.doCommit (cognitive 21) store/src/main/java/org/apache/rocketmq/store/CommitLog.java:1842— 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.putMessagePositionInfo (cognitive 21) store/src/main/java/org/apache/rocketmq/store/ConsumeQueue.java:836— ConsumeQueue.putMessagePositionInfo has cognitive complexity 21 (threshold 15). Drivers by points: if/else 10 (19 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.
ConsumeQueue.putMessagePositionInfoWrapper (cognitive 21) store/src/main/java/org/apache/rocketmq/store/ConsumeQueue.java:725— 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.
IndexStoreFile.queryAsyncFromSegmentFile (cognitive 21) tieredstore/src/main/java/org/apache/rocketmq/tieredstore/index/IndexStoreFile.java:368— IndexStoreFile.queryAsyncFromSegmentFile has cognitive complexity 21 (threshold 15). Drivers by points: if/else 12 (15 pts), boolean chains 3, ternaries 1 (2 pts), loops 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.
RebalanceLockManager.tryLockBatch (cognitive 20) broker/src/main/java/org/apache/rocketmq/broker/client/rebalance/RebalanceLockManager.java:123— 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.
ConsumerManager.registerConsumer (cognitive 20) broker/src/main/java/org/apache/rocketmq/broker/client/ConsumerManager.java:227— ConsumerManager.registerConsumer has cognitive complexity 20 (threshold 15). Drivers by points: if/else 8 (10 pts), ternaries 2 (5 pts), boolean chains 4, 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.
AdminBrokerProcessor.deleteTopicList (cognitive 20) broker/src/main/java/org/apache/rocketmq/broker/processor/AdminBrokerProcessor.java:813— AdminBrokerProcessor.deleteTopicList has cognitive complexity 20 (threshold 15). Drivers by points: if/else 6 (10 pts), loops 3 (4 pts), ternaries 3, error handling 2, 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.
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:1158— 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.
AbstractRocksDBStorage.iterate (cognitive 20) common/src/main/java/org/apache/rocketmq/common/config/AbstractRocksDBStorage.java:336— AbstractRocksDBStorage.iterate has cognitive complexity 20 (threshold 15). Drivers by points: if/else 14 (15 pts), boolean chains 4, 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.
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.
PullMessageRequestHeader.decode (cognitive 20) remoting/src/main/java/org/apache/rocketmq/remoting/protocol/header/PullMessageRequestHeader.java:107— PullMessageRequestHeader.decode has cognitive complexity 20 (threshold 15). Drivers by points: if/else 20. 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.
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.
BatchConsumeQueue.getBatchMsgIndexBuffer (cognitive 20) store/src/main/java/org/apache/rocketmq/store/queue/BatchConsumeQueue.java:674— 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:765— 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:209— 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.
MessageRocksDBStorage.writeRecordsForTrans (cognitive 20) store/src/main/java/org/apache/rocketmq/store/rocksdb/MessageRocksDBStorage.java:487— MessageRocksDBStorage.writeRecordsForTrans has cognitive complexity 20 (threshold 15). Drivers by points: if/else 8 (14 pts), boolean chains 4, error handling 1, loops 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.
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.
LiteEventDispatcher.selectAndDispatch (cognitive 19) broker/src/main/java/org/apache/rocketmq/broker/lite/LiteEventDispatcher.java:118— LiteEventDispatcher.selectAndDispatch has cognitive complexity 19 (threshold 15). Drivers by points: if/else 9 (16 pts), loops 2 (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.
OrderInfo.getLockFreeTimestamp (cognitive 19) broker/src/main/java/org/apache/rocketmq/broker/pop/orderly/QueueLevelConsumerManager.java:576— 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. This shape REPEATS in the file: one other method here (OrderInfo.getMaxLockFreeTimestamp) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
OrderInfo.getMaxLockFreeTimestamp (cognitive 19) broker/src/main/java/org/apache/rocketmq/broker/pop/orderly/QueueLevelConsumerManager.java:604— OrderInfo.getMaxLockFreeTimestamp 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. This shape REPEATS in the file: one other method here (OrderInfo.getLockFreeTimestamp) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
OrderInfo.needBlock (cognitive 19) broker/src/main/java/org/apache/rocketmq/broker/pop/orderly/QueueLevelConsumerManager.java:545— 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.
ClientManageProcessor.heartBeat (cognitive 19) broker/src/main/java/org/apache/rocketmq/broker/processor/ClientManageProcessor.java:73— 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.
NotificationProcessor.hasMsgFromQueue (cognitive 19) broker/src/main/java/org/apache/rocketmq/broker/processor/NotificationProcessor.java:250— NotificationProcessor.hasMsgFromQueue has cognitive complexity 19 (threshold 15). Drivers by points: if/else 7 (14 pts), loops 1 (3 pts), 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.
PopReviveService.mergeAndRevive (cognitive 19) broker/src/main/java/org/apache/rocketmq/broker/processor/PopReviveService.java:496— 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.
BrokerController.recoverAndInitService (cognitive 19) broker/src/main/java/org/apache/rocketmq/broker/BrokerController.java:930— BrokerController.recoverAndInitService has cognitive complexity 19 (threshold 15). Drivers by points: if/else 7 (10 pts), boolean chains 5, error handling 1 (3 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.
BrokerStartup.buildBrokerController (cognitive 19) broker/src/main/java/org/apache/rocketmq/broker/BrokerStartup.java:162— BrokerStartup.buildBrokerController has cognitive complexity 19 (threshold 15). Drivers by points: if/else 9 (11 pts), boolean chains 2, error handling 1 (2 pts), loops 1 (2 pts), match/switch 1 (2 pts) (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.
ConsumeMessageConcurrentlyService.processConsumeResult (cognitive 19) client/src/main/java/org/apache/rocketmq/client/impl/consumer/ConsumeMessageConcurrentlyService.java:202— 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:338— 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.
ProcessQueue.removeMessage (cognitive 19) client/src/main/java/org/apache/rocketmq/client/impl/consumer/ProcessQueue.java:187— ProcessQueue.removeMessage has cognitive complexity 19 (threshold 15). Drivers by points: if/else 5 (12 pts), ternaries 1 (4 pts), loops 1 (2 pts), error handling 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.
DefaultMQProducerImpl.sendMessageInTransaction (cognitive 19) client/src/main/java/org/apache/rocketmq/client/impl/producer/DefaultMQProducerImpl.java:1433— DefaultMQProducerImpl.sendMessageInTransaction has cognitive complexity 19 (threshold 15). Drivers by points: if/else 7 (12 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.
NetworkUtil.getLocalInetAddress (cognitive 19) common/src/main/java/org/apache/rocketmq/common/utils/NetworkUtil.java:126— NetworkUtil.getLocalInetAddress has cognitive complexity 19 (threshold 15). Drivers by points: if/else 7 (13 pts), loops 3 (5 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.
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.
AdminModelConverter.toConsumerRunningInfo (cognitive 19) proxy/src/main/java/org/apache/rocketmq/proxy/grpc/admin/AdminModelConverter.java:308— AdminModelConverter.toConsumerRunningInfo has cognitive complexity 19 (threshold 15). Drivers by points: if/else 7 (11 pts), loops 4 (8 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.
ProxyAdminGrpcService.buildAdminMessage (cognitive 19) proxy/src/main/java/org/apache/rocketmq/proxy/grpc/admin/ProxyAdminGrpcService.java:1376— ProxyAdminGrpcService.buildAdminMessage has cognitive complexity 19 (threshold 15). Drivers by points: if/else 10 (14 pts), boolean chains 3, loops 2 (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.
ProxyAdminGrpcService.verifyMessage (cognitive 19) proxy/src/main/java/org/apache/rocketmq/proxy/grpc/admin/ProxyAdminGrpcService.java:1237— ProxyAdminGrpcService.verifyMessage has cognitive complexity 19 (threshold 15). Drivers by points: if/else 8 (9 pts), ternaries 3 (5 pts), boolean chains 3, error handling 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.
DefaultAdminService.createTopicOnBroker (cognitive 19) proxy/src/main/java/org/apache/rocketmq/proxy/service/admin/DefaultAdminService.java:142— 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.
NettyRemotingClient.closeChannel (cognitive 19) remoting/src/main/java/org/apache/rocketmq/remoting/netty/NettyRemotingClient.java:468— NettyRemotingClient.closeChannel has cognitive complexity 19 (threshold 15). Drivers by points: if/else 7 (13 pts), error handling 2 (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.
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.
DLedgerCommitLog.asyncPutMessages (cognitive 19) store/src/main/java/org/apache/rocketmq/store/dledger/DLedgerCommitLog.java:645— 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.
CleanConsumeQueueService.deleteExpiredFiles (cognitive 19) store/src/main/java/org/apache/rocketmq/store/queue/ConsumeQueueStore.java:878— CleanConsumeQueueService.deleteExpiredFiles has cognitive complexity 19 (threshold 15). Drivers by points: if/else 3 (7 pts), error handling 1 (5 pts), loops 2 (5 pts), boolean chains 2 (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.
MessageRocksDBStorage.writeRecordsForIndex (cognitive 19) store/src/main/java/org/apache/rocketmq/store/rocksdb/MessageRocksDBStorage.java:266— MessageRocksDBStorage.writeRecordsForIndex has cognitive complexity 19 (threshold 15). Drivers by points: if/else 6 (10 pts), boolean chains 5, error handling 2 (3 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.
MessageRocksDBStorage.writeRecordsForTimer (cognitive 19) store/src/main/java/org/apache/rocketmq/store/rocksdb/MessageRocksDBStorage.java:337— MessageRocksDBStorage.writeRecordsForTimer has cognitive complexity 19 (threshold 15). Drivers by points: if/else 8 (13 pts), error handling 2 (3 pts), boolean chains 2, loops 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.
TimerMessageRocksDBStore.doPut (cognitive 19) store/src/main/java/org/apache/rocketmq/store/timer/rocksdb/TimerMessageRocksDBStore.java:333— TimerMessageRocksDBStore.doPut has cognitive complexity 19 (threshold 15). Drivers by points: if/else 9 (16 pts), match/switch 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.
TimerSysTopicScanService.scanSysTimerTopic (cognitive 19) store/src/main/java/org/apache/rocketmq/store/timer/rocksdb/TimerMessageRocksDBStore.java:435— TimerSysTopicScanService.scanSysTimerTopic has cognitive complexity 19 (threshold 15). Drivers by points: if/else 10 (15 pts), error handling 2 (3 pts), loops 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.
TimerMessageStore.doPut (cognitive 19) store/src/main/java/org/apache/rocketmq/store/timer/TimerMessageStore.java:1191— TimerMessageStore.doPut has cognitive complexity 19 (threshold 15). Drivers by points: if/else 8 (15 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.
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.
CommitLogInputStream.read (cognitive 19) tieredstore/src/main/java/org/apache/rocketmq/tieredstore/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.
MessageFormatUtil.splitMessageBuffer (cognitive 19) tieredstore/src/main/java/org/apache/rocketmq/tieredstore/util/MessageFormatUtil.java:104— MessageFormatUtil.splitMessageBuffer has cognitive complexity 19 (threshold 15). Drivers by points: if/else 7 (11 pts), ternaries 2 (4 pts), boolean chains 3, loops 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.
TopicQueueMappingManager.updateTopicQueueMapping (cognitive 18) broker/src/main/java/org/apache/rocketmq/broker/topic/TopicQueueMappingManager.java:69— 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.
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.
LiteEventDispatcher.doFullDispatchForClient (cognitive 18) broker/src/main/java/org/apache/rocketmq/broker/lite/LiteEventDispatcher.java:196— LiteEventDispatcher.doFullDispatchForClient has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (11 pts), ternaries 2 (5 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.
PopLongPollingService.cleanUnusedResource (cognitive 18) broker/src/main/java/org/apache/rocketmq/broker/longpolling/PopLongPollingService.java:365— 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.
BatchSplittingMetricExporter.splitIntoBatches (cognitive 18) broker/src/main/java/org/apache/rocketmq/broker/metrics/BatchSplittingMetricExporter.java:296— BatchSplittingMetricExporter.splitIntoBatches has cognitive complexity 18 (threshold 15). Drivers by points: if/else 5 (12 pts), loops 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.
BrokerOuterAPI.getAllSubscriptionGroupConfig (cognitive 18) broker/src/main/java/org/apache/rocketmq/broker/out/BrokerOuterAPI.java:922— BrokerOuterAPI.getAllSubscriptionGroupConfig has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (17 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. This shape REPEATS in the file: one other method here (BrokerOuterAPI.getAllTopicConfig) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
BrokerOuterAPI.getAllTopicConfig (cognitive 18) broker/src/main/java/org/apache/rocketmq/broker/out/BrokerOuterAPI.java:770— BrokerOuterAPI.getAllTopicConfig has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (17 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. This shape REPEATS in the file: one other method here (BrokerOuterAPI.getAllSubscriptionGroupConfig) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
BrokerOuterAPI.processSendResponse (cognitive 18) broker/src/main/java/org/apache/rocketmq/broker/out/BrokerOuterAPI.java:1206— 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.
QueueLevelConsumerManager.autoClean (cognitive 18) broker/src/main/java/org/apache/rocketmq/broker/pop/orderly/QueueLevelConsumerManager.java:308— QueueLevelConsumerManager.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.
SendMessageProcessor.handleRetryAndDLQ (cognitive 18) broker/src/main/java/org/apache/rocketmq/broker/processor/SendMessageProcessor.java:181— 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:565— 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.
LocalFileOffsetStore.readOffset (cognitive 18) client/src/main/java/org/apache/rocketmq/client/consumer/store/LocalFileOffsetStore.java:104— 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.
DefaultMQPushConsumerImpl.start (cognitive 18) client/src/main/java/org/apache/rocketmq/client/impl/consumer/DefaultMQPushConsumerImpl.java:924— DefaultMQPushConsumerImpl.start has cognitive complexity 18 (threshold 15). Drivers by points: if/else 8 (13 pts), match/switch 2 (4 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.
MQClientInstance.sendHeartbeatToBrokerV2 (cognitive 18) client/src/main/java/org/apache/rocketmq/client/impl/factory/MQClientInstance.java:754— MQClientInstance.sendHeartbeatToBrokerV2 has cognitive complexity 18 (threshold 15). Drivers by points: if/else 10 (15 pts), boolean chains 2, 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.
MQClientAPIImpl.getAllSubscriptionGroup (cognitive 18) client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:2972— MQClientAPIImpl.getAllSubscriptionGroup has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (17 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. This shape REPEATS in the file: one other method here (MQClientAPIImpl.getAllTopicConfig) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
MQClientAPIImpl.getAllTopicConfig (cognitive 18) client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:3068— MQClientAPIImpl.getAllTopicConfig has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (17 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. This shape REPEATS in the file: one other method here (MQClientAPIImpl.getAllSubscriptionGroup) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
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.
AbstractRocksDBStorage.shutdown (cognitive 18) common/src/main/java/org/apache/rocketmq/common/config/AbstractRocksDBStorage.java:509— AbstractRocksDBStorage.shutdown has cognitive complexity 18 (threshold 15). Drivers by points: if/else 10, error handling 4 (6 pts), boolean chains 1, loops 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.
ProducerProcessor.sendMessage (cognitive 18) proxy/src/main/java/org/apache/rocketmq/proxy/processor/ProducerProcessor.java:69— ProducerProcessor.sendMessage has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (12 pts), loops 2 (3 pts), boolean chains 2, error handling 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.
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.
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.
BatchConsumeQueue.putBatchMessagePositionInfo (cognitive 18) store/src/main/java/org/apache/rocketmq/store/queue/BatchConsumeQueue.java:579— BatchConsumeQueue.putBatchMessagePositionInfo has cognitive complexity 18 (threshold 15). Drivers by points: if/else 9 (16 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.
RocksDBConsumeQueueTable.binarySearchInCQ (cognitive 18) store/src/main/java/org/apache/rocketmq/store/queue/RocksDBConsumeQueueTable.java:308— 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.
MessageRocksDBStorage.scanRecordsForTrans (cognitive 18) store/src/main/java/org/apache/rocketmq/store/rocksdb/MessageRocksDBStorage.java:557— MessageRocksDBStorage.scanRecordsForTrans has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (10 pts), boolean chains 4, error handling 2 (3 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.
FlushRealTimeService.run (cognitive 18) store/src/main/java/org/apache/rocketmq/store/CommitLog.java:1583— 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.
TieredMessageStore.getMessageAsync (cognitive 18) tieredstore/src/main/java/org/apache/rocketmq/tieredstore/TieredMessageStore.java:229— TieredMessageStore.getMessageAsync has cognitive complexity 18 (threshold 15). Drivers by points: if/else 11 (13 pts), boolean chains 4, 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.
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.
LiteManagerProcessor.getLiteClientInfo (cognitive 17) broker/src/main/java/org/apache/rocketmq/broker/processor/LiteManagerProcessor.java:218— LiteManagerProcessor.getLiteClientInfo has cognitive complexity 17 (threshold 15). Drivers by points: if/else 9 (13 pts), loops 1 (3 pts), boolean chains 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.
PullMessageProcessor.composeResponseHeader (cognitive 17) broker/src/main/java/org/apache/rocketmq/broker/processor/PullMessageProcessor.java:626— 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:130— 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.
1.onSuccess (cognitive 17) client/src/main/java/org/apache/rocketmq/client/impl/consumer/DefaultMQPushConsumerImpl.java:347— 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:490— 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.
MQClientInstance.resetOffset (cognitive 17) client/src/main/java/org/apache/rocketmq/client/impl/factory/MQClientInstance.java:1403— MQClientInstance.resetOffset has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (8 pts), error handling 2 (5 pts), boolean chains 2, loops 2 (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.
MessageBatch.generateFromList (cognitive 17) common/src/main/java/org/apache/rocketmq/common/message/MessageBatch.java:42— MessageBatch.generateFromList has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (14 pts), boolean chains 2, 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.
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.
ReplicasInfoManager.cleanBrokerData (cognitive 17) controller/src/main/java/org/apache/rocketmq/controller/impl/manager/ReplicasInfoManager.java:425— 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.
ProxyAdminGrpcService.queryTimeSpan (cognitive 17) proxy/src/main/java/org/apache/rocketmq/proxy/grpc/admin/ProxyAdminGrpcService.java:1529— ProxyAdminGrpcService.queryTimeSpan has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (9 pts), loops 4, error handling 2 (3 pts), boolean chains 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.
SendMessageActivity.buildMessageProperty (cognitive 17) proxy/src/main/java/org/apache/rocketmq/proxy/grpc/v2/producer/SendMessageActivity.java:216— SendMessageActivity.buildMessageProperty has cognitive complexity 17 (threshold 15). Drivers by points: if/else 13 (15 pts), loops 2 (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.
ClusterTransactionService.scanProducerHeartBeat (cognitive 17) proxy/src/main/java/org/apache/rocketmq/proxy/service/transaction/ClusterTransactionService.java:129— ClusterTransactionService.scanProducerHeartBeat has cognitive complexity 17 (threshold 15). Drivers by points: if/else 8 (12 pts), loops 3, ternaries 1 (2 pts) (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.
NettyRemotingClient.getAndCreateNameserverChannelAsync (cognitive 17) remoting/src/main/java/org/apache/rocketmq/remoting/netty/NettyRemotingClient.java:657— NettyRemotingClient.getAndCreateNameserverChannelAsync has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (12 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.
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.
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.
DefaultMappedFile.flush (cognitive 17) store/src/main/java/org/apache/rocketmq/store/logfile/DefaultMappedFile.java:526— DefaultMappedFile.flush has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (13 pts), error handling 1 (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.
CombineConsumeQueueStore.isMappedFileMatchedRecover (cognitive 17) store/src/main/java/org/apache/rocketmq/store/queue/CombineConsumeQueueStore.java:165— CombineConsumeQueueStore.isMappedFileMatchedRecover has cognitive complexity 17 (threshold 15). Drivers by points: if/else 8 (15 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.
Timeline.scanRecordsToQueue (cognitive 17) store/src/main/java/org/apache/rocketmq/store/timer/rocksdb/Timeline.java:185— Timeline.scanRecordsToQueue has cognitive complexity 17 (threshold 15). Drivers by points: if/else 5 (8 pts), loops 2 (3 pts), boolean chains 2, error handling 1 (2 pts), 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:557— 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.
IndexStoreService.recover (cognitive 17) tieredstore/src/main/java/org/apache/rocketmq/tieredstore/index/IndexStoreService.java:112— IndexStoreService.recover has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (9 pts), error handling 1 (3 pts), loops 2 (3 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.
AclAuthorizationHandler.comparePolicyEntries (cognitive 16) auth/src/main/java/org/apache/rocketmq/auth/authorization/chain/AclAuthorizationHandler.java:121— AclAuthorizationHandler.comparePolicyEntries has cognitive complexity 16 (threshold 15). Drivers by points: if/else 11 (14 pts), ternaries 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.
AuthorizationMetadataManagerImpl.validate (cognitive 16) auth/src/main/java/org/apache/rocketmq/auth/authorization/manager/AuthorizationMetadataManagerImpl.java:238— AuthorizationMetadataManagerImpl.validate has cognitive complexity 16 (threshold 15). Drivers by points: if/else 9 (13 pts), loops 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.
PlainPermissionManager.getAllAclConfig (cognitive 16) auth/src/main/java/org/apache/rocketmq/auth/migration/v1/PlainPermissionManager.java:108— 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.
AclConverter.convertAcl (cognitive 16) broker/src/main/java/org/apache/rocketmq/broker/auth/converter/AclConverter.java:36— AclConverter.convertAcl has cognitive complexity 16 (threshold 15). Drivers by points: if/else 4 (10 pts), loops 3 (6 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.
RocksDBSubscriptionGroupManager.migrateFromSeparateRocksDBs (cognitive 16) broker/src/main/java/org/apache/rocketmq/broker/config/v1/RocksDBSubscriptionGroupManager.java:314— RocksDBSubscriptionGroupManager.migrateFromSeparateRocksDBs has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8 (10 pts), error handling 3 (6 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, 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.
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.
PopLiteLongPollingService.polling (cognitive 16) broker/src/main/java/org/apache/rocketmq/broker/longpolling/PopLiteLongPollingService.java:197— PopLiteLongPollingService.polling has cognitive complexity 16 (threshold 15). Drivers by points: if/else 11 (15 pts), boolean chains 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.
PopConsumerService.handleGetMessageResult (cognitive 16) broker/src/main/java/org/apache/rocketmq/broker/pop/PopConsumerService.java:171— PopConsumerService.handleGetMessageResult has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8 (14 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.
AckMessageProcessor.ackLite (cognitive 16) broker/src/main/java/org/apache/rocketmq/broker/processor/AckMessageProcessor.java:490— AckMessageProcessor.ackLite has cognitive complexity 16 (threshold 15). Drivers by points: if/else 12 (14 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.
AdminBrokerProcessor.switchTimerEngine (cognitive 16) broker/src/main/java/org/apache/rocketmq/broker/processor/AdminBrokerProcessor.java:3656— AdminBrokerProcessor.switchTimerEngine has cognitive complexity 16 (threshold 15). Drivers by points: if/else 10 (13 pts), boolean chains 2, 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.
AdminBrokerProcessor.updateBrokerConfig (cognitive 16) broker/src/main/java/org/apache/rocketmq/broker/processor/AdminBrokerProcessor.java:1130— 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.
PopBufferMergeService.run (cognitive 16) broker/src/main/java/org/apache/rocketmq/broker/processor/PopBufferMergeService.java:91— PopBufferMergeService.run has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (8 pts), error handling 2 (3 pts), loops 2 (3 pts), boolean chains 2 (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.
PopLiteMessageProcessor.popByClientId (cognitive 16) broker/src/main/java/org/apache/rocketmq/broker/processor/PopLiteMessageProcessor.java:246— PopLiteMessageProcessor.popByClientId has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (10 pts), boolean chains 3, loops 2 (3 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.
ScheduleMessageService.start (cognitive 16) broker/src/main/java/org/apache/rocketmq/broker/schedule/ScheduleMessageService.java:135— 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.
SlaveSynchronize.syncTopicConfig (cognitive 16) broker/src/main/java/org/apache/rocketmq/broker/slave/SlaveSynchronize.java:77— SlaveSynchronize.syncTopicConfig has cognitive complexity 16 (threshold 15). Drivers by points: if/else 4 (9 pts), loops 1 (3 pts), boolean chains 2, error handling 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.
TransactionalMessageRocksDBService.checkTransRecordsStatus (cognitive 16) broker/src/main/java/org/apache/rocketmq/broker/transaction/rocksdb/TransactionalMessageRocksDBService.java:126— TransactionalMessageRocksDBService.checkTransRecordsStatus has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (12 pts), error handling 2 (3 pts), loops 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.
RemoteBrokerOffsetStore.persistAll (cognitive 16) client/src/main/java/org/apache/rocketmq/client/consumer/store/RemoteBrokerOffsetStore.java:122— 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.
MQClientInstance.sendHeartbeatToAllBrokerV2 (cognitive 16) client/src/main/java/org/apache/rocketmq/client/impl/factory/MQClientInstance.java:799— MQClientInstance.sendHeartbeatToAllBrokerV2 has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (11 pts), loops 2 (3 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.
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.
BrokerContainerStartup.parseCmdLineToConfig (cognitive 16) container/src/main/java/org/apache/rocketmq/container/BrokerContainerStartup.java:254— BrokerContainerStartup.parseCmdLineToConfig has cognitive complexity 16 (threshold 15). Drivers by points: if/else 10 (11 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.
DefaultElectPolicy.tryElect (cognitive 16) controller/src/main/java/org/apache/rocketmq/controller/elect/impl/DefaultElectPolicy.java:96— 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.
ReceiveMessageResponseStreamWriter.writeAndComplete (cognitive 16) proxy/src/main/java/org/apache/rocketmq/proxy/grpc/v2/consumer/ReceiveMessageResponseStreamWriter.java:60— ReceiveMessageResponseStreamWriter.writeAndComplete has cognitive complexity 16 (threshold 15). Drivers by points: error handling 3 (8 pts), if/else 3 (4 pts), loops 1 (3 pts), 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.
ConsumerProcessor.filterPopResult (cognitive 16) proxy/src/main/java/org/apache/rocketmq/proxy/processor/ConsumerProcessor.java:177— ConsumerProcessor.filterPopResult has cognitive complexity 16 (threshold 15). Drivers by points: if/else 2 (4 pts), error handling 1 (3 pts), match/switch 1 (3 pts), ternaries 1 (3 pts), loops 1 (2 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.
NettyRemotingClient.closeChannel (cognitive 16) remoting/src/main/java/org/apache/rocketmq/remoting/netty/NettyRemotingClient.java:421— 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.
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:502— 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:61— 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.
BatchConsumeQueue.correctMinOffset (cognitive 16) store/src/main/java/org/apache/rocketmq/store/queue/BatchConsumeQueue.java:478— 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.
CombineConsumeQueueStore.<init> (cognitive 16) store/src/main/java/org/apache/rocketmq/store/queue/CombineConsumeQueueStore.java:80— CombineConsumeQueueStore.<init> has cognitive complexity 16 (threshold 15). Drivers by points: if/else 12, boolean chains 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.
RocksDBConsumeQueueOffsetTable.iterateOffsetTable2FindDirty (cognitive 16) store/src/main/java/org/apache/rocketmq/store/queue/RocksDBConsumeQueueOffsetTable.java:335— RocksDBConsumeQueueOffsetTable.iterateOffsetTable2FindDirty has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (13 pts), boolean chains 1, error handling 1, loops 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.
TimerMessageStore.reviseQueueOffset (cognitive 16) store/src/main/java/org/apache/rocketmq/store/timer/TimerMessageStore.java:368— 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.
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.
MessageStoreFetcherImpl.getMessageFromCache (cognitive 16) tieredstore/src/main/java/org/apache/rocketmq/tieredstore/core/MessageStoreFetcherImpl.java:218— MessageStoreFetcherImpl.getMessageFromCache has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (14 pts), loops 1, ternaries 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.
D4 · Code Duplication· Near-duplicate member family (5 members, 21 shared lines) · ×1
Near-duplicate member family (5 members, 21 shared lines) store/src/main/java/org/apache/rocketmq/store/rocksdb/RocksDBOptionsFactory.java:45— store/src/main/java/org/apache/rocketmq/store/rocksdb/RocksDBOptionsFactory.java:45-97 | store/src/main/java/org/apache/rocketmq/store/rocksdb/RocksDBOptionsFactory.java:134-183 | store/src/main/java/org/apache/rocketmq/store/rocksdb/RocksDBOptionsFactory.java:220-260 | store/src/main/java/org/apache/rocketmq/store/rocksdb/RocksDBOptionsFactory.java:262-311 | store/src/main/java/org/apache/rocketmq/store/rocksdb/RocksDBOptionsFactory.java:313-362 — These 5 members are variants of one another: a block of 21 lines reported below appears in every one of them, and the pairwise near-duplicate rows they would otherwise produce are collapsed into this row. Read them 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.
Near-duplicate member pair (66 shared lines) client/src/main/java/org/apache/rocketmq/client/impl/consumer/RebalanceImpl.java:427— client/src/main/java/org/apache/rocketmq/client/impl/consumer/RebalanceImpl.java:427-506 | client/src/main/java/org/apache/rocketmq/client/impl/consumer/RebalanceImpl.java:509-693 — These two members are variants of one another: 66 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 (48 shared lines) store/src/main/java/org/apache/rocketmq/store/CommitLog.java:348— store/src/main/java/org/apache/rocketmq/store/CommitLog.java:348-441 | store/src/main/java/org/apache/rocketmq/store/CommitLog.java:768-915 — These two members are variants of one another: 48 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 (47 shared lines) broker/src/main/java/org/apache/rocketmq/broker/out/BrokerOuterAPI.java:924— broker/src/main/java/org/apache/rocketmq/broker/out/BrokerOuterAPI.java:924-998 | client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:2974-3047 — These two members are variants of one another: 47 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 (38 shared lines) store/src/main/java/org/apache/rocketmq/store/DefaultMessageStore.java:1398— store/src/main/java/org/apache/rocketmq/store/DefaultMessageStore.java:1398-1451 | store/src/main/java/org/apache/rocketmq/store/DefaultMessageStore.java:1455-1501 — These two members are variants of one another: 38 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 (33 shared lines) proxy/src/main/java/org/apache/rocketmq/proxy/service/message/LocalMessageService.java:205— proxy/src/main/java/org/apache/rocketmq/proxy/service/message/LocalMessageService.java:205-268 | proxy/src/main/java/org/apache/rocketmq/proxy/service/message/LocalMessageService.java:272-377 — These two members are variants of one another: 33 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· Members sharing a duplicated core (11 members, 50+ identical tokens) · ×1
Members sharing a duplicated core (11 members, 50+ identical tokens) proxy/src/main/java/org/apache/rocketmq/proxy/grpc/v2/GrpcMessagingApplication.java:209— proxy/src/main/java/org/apache/rocketmq/proxy/grpc/v2/GrpcMessagingApplication.java:209-223 | proxy/src/main/java/org/apache/rocketmq/proxy/grpc/v2/GrpcMessagingApplication.java:226-240 | proxy/src/main/java/org/apache/rocketmq/proxy/grpc/v2/GrpcMessagingApplication.java:243-257 | proxy/src/main/java/org/apache/rocketmq/proxy/grpc/v2/GrpcMessagingApplication.java:261-275 | proxy/src/main/java/org/apache/rocketmq/proxy/grpc/v2/GrpcMessagingApplication.java:294-308 | proxy/src/main/java/org/apache/rocketmq/proxy/grpc/v2/GrpcMessagingApplication.java:312-326 | proxy/src/main/java/org/apache/rocketmq/proxy/grpc/v2/GrpcMessagingApplication.java:329-343 | proxy/src/main/java/org/apache/rocketmq/proxy/grpc/v2/GrpcMessagingApplication.java:347-361 | proxy/src/main/java/org/apache/rocketmq/proxy/grpc/v2/GrpcMessagingApplication.java:365-386 | proxy/src/main/java/org/apache/rocketmq/proxy/grpc/v2/GrpcMessagingApplication.java:389-405 | proxy/src/main/java/org/apache/rocketmq/proxy/grpc/v2/GrpcMessagingApplication.java:409-425 — 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· Edited copies of one member (3 members, 98+ corresponding lines) · ×1
Edited copies of one member (3 members, 98+ corresponding lines) broker/src/main/java/org/apache/rocketmq/broker/metrics/BrokerMetricsManager.java:342— broker/src/main/java/org/apache/rocketmq/broker/metrics/BrokerMetricsManager.java:342-469 | controller/src/main/java/org/apache/rocketmq/controller/metrics/ControllerMetricsManager.java:292-389 | proxy/src/main/java/org/apache/rocketmq/proxy/metrics/ProxyMetricsManager.java:137-239 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 98 lines, 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 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. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication· Edited copy of a member (79 corresponding lines) · ×1
Edited copy of a member (79 corresponding lines) broker/src/main/java/org/apache/rocketmq/broker/processor/AdminBrokerProcessor.java:555— broker/src/main/java/org/apache/rocketmq/broker/processor/AdminBrokerProcessor.java:555-634 | broker/src/main/java/org/apache/rocketmq/broker/processor/AdminBrokerProcessor.java:637-715 — These two members are one piece of code written twice and then edited apart: 79 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 (98 corresponding lines) · ×1
Edited copy of a member (98 corresponding lines) common/src/main/java/org/apache/rocketmq/common/message/MessageDecoder.java:196— common/src/main/java/org/apache/rocketmq/common/message/MessageDecoder.java:196-305 | common/src/main/java/org/apache/rocketmq/common/message/MessageDecoder.java:315-412 — These two members are one piece of code written twice and then edited apart: 98 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 (70 corresponding lines) · ×1
Edited copy of a member (70 corresponding lines) broker/src/main/java/org/apache/rocketmq/broker/out/BrokerOuterAPI.java:772— broker/src/main/java/org/apache/rocketmq/broker/out/BrokerOuterAPI.java:772-850 | client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:3070-3139 — These two members are one piece of code written twice and then edited apart: 70 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 (54 corresponding lines) · ×1
Edited copy of a member (54 corresponding lines) broker/src/main/java/org/apache/rocketmq/broker/processor/ClientManageProcessor.java:73— broker/src/main/java/org/apache/rocketmq/broker/processor/ClientManageProcessor.java:73-156 | broker/src/main/java/org/apache/rocketmq/broker/processor/ClientManageProcessor.java:158-211 — These two members are one piece of code written twice and then edited apart: 54 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 (73 corresponding lines) · ×1
Edited copy of a member (73 corresponding lines) broker/src/main/java/org/apache/rocketmq/broker/longpolling/PopLiteLongPollingService.java:74— broker/src/main/java/org/apache/rocketmq/broker/longpolling/PopLiteLongPollingService.java:74-146 | broker/src/main/java/org/apache/rocketmq/broker/longpolling/PopLongPollingService.java:94-166 — These two members are one piece of code written twice and then edited apart: 73 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 (56 corresponding lines) · ×1
Edited copy of a member (56 corresponding lines) broker/src/main/java/org/apache/rocketmq/broker/BrokerController.java:1967— broker/src/main/java/org/apache/rocketmq/broker/BrokerController.java:1967-2038 | container/src/main/java/org/apache/rocketmq/container/InnerBrokerController.java:70-125 — These two members are one piece of code written twice and then edited apart: 56 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 copies of one member (3 members, 68+ corresponding lines) · ×1
Edited copies of one member (3 members, 68+ corresponding lines) broker/src/main/java/org/apache/rocketmq/broker/config/v1/RocksDBConsumerOffsetManager.java:257— broker/src/main/java/org/apache/rocketmq/broker/config/v1/RocksDBConsumerOffsetManager.java:257-328 | broker/src/main/java/org/apache/rocketmq/broker/config/v1/RocksDBSubscriptionGroupManager.java:314-397 | broker/src/main/java/org/apache/rocketmq/broker/config/v1/RocksDBTopicConfigManager.java:224-291 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 68 lines, 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 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. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication· Edited copy of a member (60 corresponding lines) · ×1
Edited copy of a member (60 corresponding lines) broker/src/main/java/org/apache/rocketmq/broker/processor/AdminBrokerProcessor.java:814— broker/src/main/java/org/apache/rocketmq/broker/processor/AdminBrokerProcessor.java:814-885 | broker/src/main/java/org/apache/rocketmq/broker/processor/AdminBrokerProcessor.java:1840-1899 — These two members are one piece of code written twice and then edited apart: 60 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 (61 corresponding lines) · ×1
Edited copy of a member (61 corresponding lines) store/src/main/java/org/apache/rocketmq/store/queue/BatchConsumeQueue.java:674— store/src/main/java/org/apache/rocketmq/store/queue/BatchConsumeQueue.java:674-734 | store/src/main/java/org/apache/rocketmq/store/queue/BatchConsumeQueue.java:765-825 — These two members are one piece of code written twice and then edited apart: 61 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 (40 corresponding lines) · ×1
Edited copy of a member (40 corresponding lines) broker/src/main/java/org/apache/rocketmq/broker/processor/AdminBrokerProcessor.java:1331— broker/src/main/java/org/apache/rocketmq/broker/processor/AdminBrokerProcessor.java:1331-1373 | broker/src/main/java/org/apache/rocketmq/broker/processor/AdminBrokerProcessor.java:1399-1438 — These two members are one piece of code written twice and then edited apart: 40 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 (42 corresponding lines) · ×1
Edited copy of a member (42 corresponding lines) broker/src/main/java/org/apache/rocketmq/broker/processor/AdminBrokerProcessor.java:922— broker/src/main/java/org/apache/rocketmq/broker/processor/AdminBrokerProcessor.java:922-970 | broker/src/main/java/org/apache/rocketmq/broker/processor/AdminBrokerProcessor.java:1763-1804 — These two members are one piece of code written twice and then edited apart: 42 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 (41 corresponding lines) · ×1
Edited copy of a member (41 corresponding lines) broker/src/main/java/org/apache/rocketmq/broker/longpolling/PopLiteLongPollingService.java:198— broker/src/main/java/org/apache/rocketmq/broker/longpolling/PopLiteLongPollingService.java:198-244 | broker/src/main/java/org/apache/rocketmq/broker/longpolling/PopLongPollingService.java:315-355 — These two members are one piece of code written twice and then edited apart: 41 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 copies of one member (3 members, 32+ corresponding lines) · ×1
Edited copies of one member (3 members, 32+ corresponding lines) broker/src/main/java/org/apache/rocketmq/broker/processor/AdminBrokerProcessor.java:1961— broker/src/main/java/org/apache/rocketmq/broker/processor/AdminBrokerProcessor.java:1961-1998 | broker/src/main/java/org/apache/rocketmq/broker/processor/AdminBrokerProcessor.java:2020-2051 | proxy/src/main/java/org/apache/rocketmq/proxy/remoting/activity/ConsumerManagerActivity.java:96-130 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 32 lines, 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 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. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication· Edited copy of a member (43 corresponding lines) · ×1
Edited copy of a member (43 corresponding lines) store/src/main/java/org/apache/rocketmq/store/ha/DefaultHAClient.java:303— store/src/main/java/org/apache/rocketmq/store/ha/DefaultHAClient.java:303-345 | store/src/main/java/org/apache/rocketmq/store/ha/autoswitch/AutoSwitchHAClient.java:380-430 — These two members are one piece of code written twice and then edited apart: 43 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 (46 corresponding lines) · ×1
Edited copy of a member (46 corresponding lines) remoting/src/main/java/org/apache/rocketmq/remoting/netty/NettyRemotingClient.java:421— remoting/src/main/java/org/apache/rocketmq/remoting/netty/NettyRemotingClient.java:421-466 | remoting/src/main/java/org/apache/rocketmq/remoting/netty/NettyRemotingClient.java:468-514 — These two members are one piece of code written twice and then edited apart: 46 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 (35 corresponding lines) · ×1
Edited copy of a member (35 corresponding lines) container/src/main/java/org/apache/rocketmq/container/BrokerContainer.java:326— container/src/main/java/org/apache/rocketmq/container/BrokerContainer.java:326-360 | container/src/main/java/org/apache/rocketmq/container/BrokerContainer.java:369-404 — These two members are one piece of code written twice and then edited apart: 35 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 copies of one member (3 members, 25+ corresponding lines) · ×1
Edited copies of one member (3 members, 25+ corresponding lines) broker/src/main/java/org/apache/rocketmq/broker/schedule/ScheduleMessageService.java:300— broker/src/main/java/org/apache/rocketmq/broker/schedule/ScheduleMessageService.java:300-332 | proxy/src/main/java/org/apache/rocketmq/proxy/config/ProxyConfig.java:352-376 | store/src/main/java/org/apache/rocketmq/store/DefaultMessageStore.java:291-320 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 25 lines, 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 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. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication· Edited copies of one member (3 members, 27+ corresponding lines) · ×1
Edited copies of one member (3 members, 27+ corresponding lines) client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:2808— client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:2808-2835 | client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:2838-2864 | client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:2867-2893 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 27 lines, 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 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. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication· Edited copies of one member (3 members, 34+ corresponding lines) · ×1
Edited copies of one member (3 members, 34+ corresponding lines) client/src/main/java/org/apache/rocketmq/client/impl/mqclient/MQClientAPIExt.java:479— client/src/main/java/org/apache/rocketmq/client/impl/mqclient/MQClientAPIExt.java:479-524 | client/src/main/java/org/apache/rocketmq/client/impl/mqclient/MQClientAPIExt.java:527-560 | client/src/main/java/org/apache/rocketmq/client/impl/mqclient/MQClientAPIExt.java:563-596 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 34 lines, 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 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. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication· Edited copies of one member (3 members, 28+ corresponding lines) · ×1
Edited copies of one member (3 members, 28+ corresponding lines) broker/src/main/java/org/apache/rocketmq/broker/processor/AdminBrokerProcessor.java:1003— broker/src/main/java/org/apache/rocketmq/broker/processor/AdminBrokerProcessor.java:1003-1041 | broker/src/main/java/org/apache/rocketmq/broker/processor/AdminBrokerProcessor.java:1044-1071 | container/src/main/java/org/apache/rocketmq/container/BrokerContainerProcessor.java:242-281 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 28 lines, 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 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. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication· Edited copies of one member (3 members, 20+ corresponding lines) · ×1
Edited copies of one member (3 members, 20+ corresponding lines) namesrv/src/main/java/org/apache/rocketmq/namesrv/routeinfo/RouteInfoManager.java:1051— namesrv/src/main/java/org/apache/rocketmq/namesrv/routeinfo/RouteInfoManager.java:1051-1070 | namesrv/src/main/java/org/apache/rocketmq/namesrv/routeinfo/RouteInfoManager.java:1072-1091 | namesrv/src/main/java/org/apache/rocketmq/namesrv/routeinfo/RouteInfoManager.java:1093-1113 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 20 lines, 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 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. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication· Edited copy of a member (37 corresponding lines) · ×1
Edited copy of a member (37 corresponding lines) client/src/main/java/org/apache/rocketmq/client/impl/consumer/DefaultLitePullConsumerImpl.java:413— client/src/main/java/org/apache/rocketmq/client/impl/consumer/DefaultLitePullConsumerImpl.java:413-449 | client/src/main/java/org/apache/rocketmq/client/impl/consumer/DefaultMQPullConsumerImpl.java:772-817 — These two members are one piece of code written twice and then edited apart: 37 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 copies of one member (3 members, 22+ corresponding lines) · ×1
Edited copies of one member (3 members, 22+ corresponding lines) client/src/main/java/org/apache/rocketmq/client/impl/consumer/PopRequest.java:90— client/src/main/java/org/apache/rocketmq/client/impl/consumer/PopRequest.java:90-120 | common/src/main/java/org/apache/rocketmq/common/message/MessageQueue.java:78-99 | common/src/main/java/org/apache/rocketmq/common/message/MessageQueueForC.java:71-96 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 22 lines, 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 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. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication· Edited copies of one member (5 members, 20+ corresponding lines) · ×1
Edited copies of one member (5 members, 20+ corresponding lines) broker/src/main/java/org/apache/rocketmq/broker/out/BrokerOuterAPI.java:1010— broker/src/main/java/org/apache/rocketmq/broker/out/BrokerOuterAPI.java:1010-1030 | broker/src/main/java/org/apache/rocketmq/broker/out/BrokerOuterAPI.java:1033-1052 | client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:1354-1375 | client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:1411-1433 | client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:1463-1485 — These 5 members are one piece of code written 5 times and then edited apart: every two of them correspond over at least 20 lines, 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 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. Left alone, the next edit has to be made 5 times and the copies will drift further apart.
D4 · Code Duplication· Edited copies of one member (3 members, 18+ corresponding lines) · ×1
Edited copies of one member (3 members, 18+ corresponding lines) broker/src/main/java/org/apache/rocketmq/broker/offset/ConsumerOffsetManager.java:392— broker/src/main/java/org/apache/rocketmq/broker/offset/ConsumerOffsetManager.java:392-409 | broker/src/main/java/org/apache/rocketmq/broker/subscription/SubscriptionGroupManager.java:367-385 | broker/src/main/java/org/apache/rocketmq/broker/topic/TopicConfigManager.java:676-694 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 18 lines, 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 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. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication· Edited copies of one member (4 members, 17+ corresponding lines) · ×1
Edited copies of one member (4 members, 17+ corresponding lines) client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:2141— client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:2141-2159 | client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:2163-2181 | client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:2307-2326 | client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:2387-2403 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 17 lines, 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 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. Left alone, the next edit has to be made 4 times and the copies will drift further apart.
D4 · Code Duplication· Edited copies of one member (4 members, 20+ corresponding lines) · ×1
Edited copies of one member (4 members, 20+ corresponding lines) common/src/main/java/org/apache/rocketmq/common/UtilAll.java:407— common/src/main/java/org/apache/rocketmq/common/UtilAll.java:407-430 | common/src/main/java/org/apache/rocketmq/common/compression/Lz4Compressor.java:33-52 | common/src/main/java/org/apache/rocketmq/common/compression/ZlibCompressor.java:33-55 | common/src/main/java/org/apache/rocketmq/common/compression/ZstdCompressor.java:33-52 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 20 lines, 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 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. Left alone, the next edit has to be made 4 times and the copies will drift further apart.
D4 · Code Duplication· Edited copies of one member (4 members, 12+ corresponding lines) · ×1
Edited copies of one member (4 members, 12+ corresponding lines) client/src/main/java/org/apache/rocketmq/client/impl/consumer/AssignedMessageQueue.java:122— client/src/main/java/org/apache/rocketmq/client/impl/consumer/AssignedMessageQueue.java:122-136 | client/src/main/java/org/apache/rocketmq/client/impl/consumer/AssignedMessageQueue.java:138-150 | client/src/main/java/org/apache/rocketmq/client/impl/consumer/DefaultLitePullConsumerImpl.java:222-234 | client/src/main/java/org/apache/rocketmq/client/impl/consumer/DefaultLitePullConsumerImpl.java:465-476 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 12 lines, 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 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. Left alone, the next edit has to be made 4 times and the copies will drift further apart.
D4 · Code Duplication· Edited copies of one member (5 members, 16+ corresponding lines) · ×1
Edited copies of one member (5 members, 16+ corresponding lines) broker/src/main/java/org/apache/rocketmq/broker/processor/AdminBrokerProcessor.java:3196— broker/src/main/java/org/apache/rocketmq/broker/processor/AdminBrokerProcessor.java:3196-3212 | namesrv/src/main/java/org/apache/rocketmq/namesrv/processor/DefaultRequestProcessor.java:444-459 | namesrv/src/main/java/org/apache/rocketmq/namesrv/processor/DefaultRequestProcessor.java:552-569 | namesrv/src/main/java/org/apache/rocketmq/namesrv/processor/DefaultRequestProcessor.java:572-589 | namesrv/src/main/java/org/apache/rocketmq/namesrv/processor/DefaultRequestProcessor.java:591-608 — These 5 members are one piece of code written 5 times and then edited apart: every two of them correspond over at least 16 lines, 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 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. Left alone, the next edit has to be made 5 times and the copies will drift further apart.
D4 · Code Duplication· Edited copies of one member (3 members, 7+ corresponding lines) · ×1
Edited copies of one member (3 members, 7+ corresponding lines) common/src/main/java/org/apache/rocketmq/common/UtilAll.java:138— common/src/main/java/org/apache/rocketmq/common/UtilAll.java:138-144 | common/src/main/java/org/apache/rocketmq/common/UtilAll.java:194-205 | common/src/main/java/org/apache/rocketmq/common/UtilAll.java:207-217 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 7 lines, 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 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. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication· Edited copies of one member (5 members, 19+ corresponding lines) · ×1
Edited copies of one member (5 members, 19+ corresponding lines) client/src/main/java/org/apache/rocketmq/client/impl/mqclient/MQClientAPIExt.java:242— client/src/main/java/org/apache/rocketmq/client/impl/mqclient/MQClientAPIExt.java:242-260 | client/src/main/java/org/apache/rocketmq/client/impl/mqclient/MQClientAPIExt.java:267-285 | client/src/main/java/org/apache/rocketmq/client/impl/mqclient/MQClientAPIExt.java:291-309 | client/src/main/java/org/apache/rocketmq/client/impl/mqclient/MQClientAPIExt.java:317-335 | client/src/main/java/org/apache/rocketmq/client/impl/mqclient/MQClientAPIExt.java:342-362 — These 5 members are one piece of code written 5 times and then edited apart: every two of them correspond over at least 19 lines, 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 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. Left alone, the next edit has to be made 5 times and the copies will drift further apart.
D4 · Code Duplication· Edited copies of one member (6 members, 13+ corresponding lines) · ×1
Edited copies of one member (6 members, 13+ corresponding lines) common/src/main/java/org/apache/rocketmq/common/config/AbstractRocksDBStorage.java:192— common/src/main/java/org/apache/rocketmq/common/config/AbstractRocksDBStorage.java:192-205 | common/src/main/java/org/apache/rocketmq/common/config/AbstractRocksDBStorage.java:208-221 | common/src/main/java/org/apache/rocketmq/common/config/AbstractRocksDBStorage.java:235-247 | common/src/main/java/org/apache/rocketmq/common/config/AbstractRocksDBStorage.java:250-262 | common/src/main/java/org/apache/rocketmq/common/config/AbstractRocksDBStorage.java:266-278 | common/src/main/java/org/apache/rocketmq/common/config/AbstractRocksDBStorage.java:311-324 — These 6 members are one piece of code written 6 times and then edited apart: every two of them correspond over at least 13 lines, 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 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. Left alone, the next edit has to be made 6 times and the copies will drift further apart.
D4 · Code Duplication· Edited copies of one member (6 members, 10+ corresponding lines) · ×1
Edited copies of one member (6 members, 10+ corresponding lines) broker/src/main/java/org/apache/rocketmq/broker/transaction/rocksdb/TransactionalMessageRocksDBService.java:191— broker/src/main/java/org/apache/rocketmq/broker/transaction/rocksdb/TransactionalMessageRocksDBService.java:191-200 | store/src/main/java/org/apache/rocketmq/store/index/rocksdb/IndexRocksDBStore.java:274-283 | store/src/main/java/org/apache/rocketmq/store/timer/TimerMessageStore.java:1438-1447 | store/src/main/java/org/apache/rocketmq/store/timer/rocksdb/Timeline.java:160-169 | store/src/main/java/org/apache/rocketmq/store/timer/rocksdb/TimerMessageRocksDBStore.java:395-404 | store/src/main/java/org/apache/rocketmq/store/transaction/TransMessageRocksDBStore.java:279-288 — These 6 members are one piece of code written 6 times and then edited apart: every two of them correspond over at least 10 lines, 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 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. Left alone, the next edit has to be made 6 times and the copies will drift further apart.
D4 · Code Duplication· Edited copy of a member (3 corresponding lines) · ×1
Edited copy of a member (3 corresponding lines) controller/src/main/java/org/apache/rocketmq/controller/impl/event/ListEventSerializer.java:62— controller/src/main/java/org/apache/rocketmq/controller/impl/event/ListEventSerializer.java:62-64 | controller/src/main/java/org/apache/rocketmq/controller/impl/manager/ReplicasInfoManager.java:617-619 — These two members are one piece of code written twice and then edited apart: 3 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 copies of one member (7 members, 6+ corresponding lines) · ×1
Edited copies of one member (7 members, 6+ corresponding lines) broker/src/main/java/org/apache/rocketmq/broker/BrokerPreOnlineService.java:54— broker/src/main/java/org/apache/rocketmq/broker/BrokerPreOnlineService.java:54-59 | broker/src/main/java/org/apache/rocketmq/broker/lite/LiteEventDispatcher.java:343-348 | broker/src/main/java/org/apache/rocketmq/broker/longpolling/PopLiteLongPollingService.java:66-71 | broker/src/main/java/org/apache/rocketmq/broker/longpolling/PopLongPollingService.java:86-91 | broker/src/main/java/org/apache/rocketmq/broker/processor/PopBufferMergeService.java:83-88 | broker/src/main/java/org/apache/rocketmq/broker/processor/PopLiteMessageProcessor.java:455-460 | broker/src/main/java/org/apache/rocketmq/broker/transaction/TransactionalMessageCheckService.java:35-40 — These 7 members are one piece of code written 7 times and then edited apart: every two of them correspond over at least 6 lines, 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 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. Left alone, the next edit has to be made 7 times and the copies will drift further apart.
D4 · Code Duplication· Edited copies of one member (5 members, 10+ corresponding lines) · ×1
Edited copies of one member (5 members, 10+ corresponding lines) proxy/src/main/java/org/apache/rocketmq/proxy/grpc/v2/common/GrpcConverter.java:57— proxy/src/main/java/org/apache/rocketmq/proxy/grpc/v2/common/GrpcConverter.java:57-66 | proxy/src/main/java/org/apache/rocketmq/proxy/grpc/v2/common/GrpcValidator.java:40-49 | proxy/src/main/java/org/apache/rocketmq/proxy/grpc/v2/common/ResponseBuilder.java:56-65 | proxy/src/main/java/org/apache/rocketmq/proxy/grpc/v2/common/ResponseWriter.java:34-43 | proxy/src/main/java/org/apache/rocketmq/proxy/remoting/common/RemotingConverter.java:32-41 — These 5 members are one piece of code written 5 times and then edited apart: every two of them correspond over at least 10 lines, 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 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. Left alone, the next edit has to be made 5 times and the copies will drift further apart.
D4 · Code Duplication· Edited copy of a member (5 corresponding lines) · ×1
Edited copy of a member (5 corresponding lines) store/src/main/java/org/apache/rocketmq/store/queue/RocksDBConsumeQueueOffsetTable.java:718— store/src/main/java/org/apache/rocketmq/store/queue/RocksDBConsumeQueueOffsetTable.java:718-722 | store/src/main/java/org/apache/rocketmq/store/queue/RocksDBConsumeQueueTable.java:347-351 — These two members are one piece of code written twice and then edited apart: 5 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 copies of one member (4 members, 7+ corresponding lines) · ×1
Edited copies of one member (4 members, 7+ corresponding lines) broker/src/main/java/org/apache/rocketmq/broker/pop/orderly/QueueLevelConsumerOrderInfoLockManager.java:184— broker/src/main/java/org/apache/rocketmq/broker/pop/orderly/QueueLevelConsumerOrderInfoLockManager.java:184-190 | remoting/src/main/java/org/apache/rocketmq/remoting/protocol/header/GetConsumerStatusRequestHeader.java:71-77 | remoting/src/main/java/org/apache/rocketmq/remoting/protocol/header/GetMaxOffsetRequestHeader.java:84-90 | remoting/src/main/java/org/apache/rocketmq/remoting/protocol/subscription/SimpleSubscriptionData.java:85-92 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 7 lines, 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 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. Left alone, the next edit has to be made 4 times and the copies will drift further apart.
Duplicated block (58 lines × 2) common/src/main/java/org/apache/rocketmq/common/stats/StatsItem.java:95— common/src/main/java/org/apache/rocketmq/common/stats/StatsItem.java:95-152 | common/src/main/java/org/apache/rocketmq/common/stats/StatsItemSet.java:50-107 — 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: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.
Duplicated block (43 lines × 2) client/src/main/java/org/apache/rocketmq/client/impl/consumer/ConsumeMessageOrderlyService.java:104— client/src/main/java/org/apache/rocketmq/client/impl/consumer/ConsumeMessageOrderlyService.java:104-146 | client/src/main/java/org/apache/rocketmq/client/impl/consumer/ConsumeMessagePopOrderlyService.java:95-137 — 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 10 separate duplicated blocks between them, totalling at least 133 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:104` 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:364— common/src/main/java/org/apache/rocketmq/common/UtilAll.java:364-401 | common/src/main/java/org/apache/rocketmq/common/compression/ZlibCompressor.java:59-96 — 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 59 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 (27–28 lines × 3) broker/src/main/java/org/apache/rocketmq/broker/config/v1/RocksDBConsumerOffsetManager.java:262— broker/src/main/java/org/apache/rocketmq/broker/config/v1/RocksDBConsumerOffsetManager.java:262-289 | broker/src/main/java/org/apache/rocketmq/broker/config/v1/RocksDBSubscriptionGroupManager.java:319-346 | broker/src/main/java/org/apache/rocketmq/broker/config/v1/RocksDBTopicConfigManager.java:229-255 — before extracting anything, compare `broker/src/main/java/org/apache/rocketmq/broker/config/v1/RocksDBConsumerOffsetManager.java` and `broker/src/main/java/org/apache/rocketmq/broker/config/v1/RocksDBSubscriptionGroupManager.java` as WHOLE FILES: this scan already matched 7 separate duplicated blocks between them, totalling at least 98 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/config/v1/RocksDBConsumerOffsetManager.java:262` 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 (26 lines × 2) broker/src/main/java/org/apache/rocketmq/broker/out/BrokerOuterAPI.java:949— broker/src/main/java/org/apache/rocketmq/broker/out/BrokerOuterAPI.java:949-974 | client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:2998-3023 — 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:949` 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–26 lines × 2) client/src/main/java/org/apache/rocketmq/client/impl/consumer/RebalanceImpl.java:478— client/src/main/java/org/apache/rocketmq/client/impl/consumer/RebalanceImpl.java:478-503 | client/src/main/java/org/apache/rocketmq/client/impl/consumer/RebalanceImpl.java:640-663 — 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:478` 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 (24–25 lines × 2) store/src/main/java/org/apache/rocketmq/store/DefaultMessageStore.java:1427— store/src/main/java/org/apache/rocketmq/store/DefaultMessageStore.java:1427-1451 | store/src/main/java/org/apache/rocketmq/store/DefaultMessageStore.java:1478-1501 — 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:1427` 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–24 lines × 3) client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:2812— client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:2812-2835 | client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:2842-2864 | client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:2871-2893 — 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:2812` 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:94— broker/src/main/java/org/apache/rocketmq/broker/processor/ClientManageProcessor.java:94-117 | broker/src/main/java/org/apache/rocketmq/broker/processor/ClientManageProcessor.java:171-189 — 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: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. 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 (22–24 lines × 2) common/src/main/java/org/apache/rocketmq/common/config/ConfigHelper.java:50— common/src/main/java/org/apache/rocketmq/common/config/ConfigHelper.java:50-73 | store/src/main/java/org/apache/rocketmq/store/rocksdb/RocksDBOptionsFactory.java:107-128 — 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 (26–27 lines × 2) store/src/main/java/org/apache/rocketmq/store/CommitLog.java:416— store/src/main/java/org/apache/rocketmq/store/CommitLog.java:416-441 | store/src/main/java/org/apache/rocketmq/store/CommitLog.java:889-915 — 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:416` 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 (22–23 lines × 2) broker/src/main/java/org/apache/rocketmq/broker/processor/NotificationProcessor.java:162— broker/src/main/java/org/apache/rocketmq/broker/processor/NotificationProcessor.java:162-184 | broker/src/main/java/org/apache/rocketmq/broker/processor/PopMessageProcessor.java:335-356 — 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/NotificationProcessor.java:162` 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 (21–22 lines × 2) controller/src/main/java/org/apache/rocketmq/controller/impl/DLedgerController.java:191— controller/src/main/java/org/apache/rocketmq/controller/impl/DLedgerController.java:191-211 | controller/src/main/java/org/apache/rocketmq/controller/impl/JRaftControllerStateMachine.java:193-214 — 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 `controller/src/main/java/org/apache/rocketmq/controller/impl/JRaftControllerStateMachine.java:193` 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. 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:280— proxy/src/main/java/org/apache/rocketmq/proxy/remoting/RemotingProtocolServer.java:280-299 | 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:280` 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 (18–21 lines × 2) broker/src/main/java/org/apache/rocketmq/broker/config/v1/RocksDBConsumerOffsetManager.java:302— broker/src/main/java/org/apache/rocketmq/broker/config/v1/RocksDBConsumerOffsetManager.java:302-322 | broker/src/main/java/org/apache/rocketmq/broker/config/v1/RocksDBTopicConfigManager.java:268-285 — before extracting anything, compare `broker/src/main/java/org/apache/rocketmq/broker/config/v1/RocksDBConsumerOffsetManager.java` and `broker/src/main/java/org/apache/rocketmq/broker/config/v1/RocksDBTopicConfigManager.java` as WHOLE FILES: this scan already matched 8 separate duplicated blocks between them, totalling at least 119 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/config/v1/RocksDBConsumerOffsetManager.java:302` 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 (21 lines × 2) broker/src/main/java/org/apache/rocketmq/broker/transaction/TransactionMetrics.java:197— broker/src/main/java/org/apache/rocketmq/broker/transaction/TransactionMetrics.java:197-217 | store/src/main/java/org/apache/rocketmq/store/timer/TimerMetrics.java:240-260 — before extracting anything, compare `broker/src/main/java/org/apache/rocketmq/broker/transaction/TransactionMetrics.java` and `store/src/main/java/org/apache/rocketmq/store/timer/TimerMetrics.java` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 54 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/transaction/TransactionMetrics.java:197` 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 (20–21 lines × 2) client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:928— client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:928-948 | proxy/src/main/java/org/apache/rocketmq/proxy/service/message/LocalMessageService.java:454-473 — 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: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 (18–20 lines × 2) broker/src/main/java/org/apache/rocketmq/broker/out/BrokerOuterAPI.java:1563— broker/src/main/java/org/apache/rocketmq/broker/out/BrokerOuterAPI.java:1563-1580 | client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:1087-1106 — 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. 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) 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 (16–17 lines × 4) client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:2339— client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:2339-2355 | client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:2368-2383 | client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:3157-3173 | client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:3526-3542 — 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:2339` 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–17 lines × 3) broker/src/main/java/org/apache/rocketmq/broker/config/v1/RocksDBConsumerOffsetManager.java:96— broker/src/main/java/org/apache/rocketmq/broker/config/v1/RocksDBConsumerOffsetManager.java:96-111 | broker/src/main/java/org/apache/rocketmq/broker/config/v1/RocksDBSubscriptionGroupManager.java:112-126 | broker/src/main/java/org/apache/rocketmq/broker/config/v1/RocksDBTopicConfigManager.java:94-110 — before extracting anything, compare `broker/src/main/java/org/apache/rocketmq/broker/config/v1/RocksDBConsumerOffsetManager.java` and `broker/src/main/java/org/apache/rocketmq/broker/config/v1/RocksDBSubscriptionGroupManager.java` as WHOLE FILES: this scan already matched 7 separate duplicated blocks between them, totalling at least 98 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/config/v1/RocksDBConsumerOffsetManager.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. 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 (15–16 lines × 2) client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:2599— client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:2599-2613 | client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:2646-2661 — 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:2599` 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–16 lines × 2) proxy/src/main/java/org/apache/rocketmq/proxy/service/message/LocalMessageService.java:230— proxy/src/main/java/org/apache/rocketmq/proxy/service/message/LocalMessageService.java:230-241 | proxy/src/main/java/org/apache/rocketmq/proxy/service/message/LocalMessageService.java:299-314 — 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:230` 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 (11–15 lines × 2) client/src/main/java/org/apache/rocketmq/client/impl/producer/DefaultMQProducerImpl.java:1629— client/src/main/java/org/apache/rocketmq/client/impl/producer/DefaultMQProducerImpl.java:1629-1639 | client/src/main/java/org/apache/rocketmq/client/impl/producer/DefaultMQProducerImpl.java:1659-1673 — 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:1629` 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–15 lines × 2) store/src/main/java/org/apache/rocketmq/store/CommitLog.java:390— store/src/main/java/org/apache/rocketmq/store/CommitLog.java:390-403 | store/src/main/java/org/apache/rocketmq/store/CommitLog.java:856-870 — 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:390` 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 × 4) client/src/main/java/org/apache/rocketmq/client/impl/consumer/ConsumeMessageConcurrentlyService.java:120— client/src/main/java/org/apache/rocketmq/client/impl/consumer/ConsumeMessageConcurrentlyService.java:120-133 | client/src/main/java/org/apache/rocketmq/client/impl/consumer/ConsumeMessageOrderlyService.java:136-149 | client/src/main/java/org/apache/rocketmq/client/impl/consumer/ConsumeMessagePopConcurrentlyService.java:104-117 | client/src/main/java/org/apache/rocketmq/client/impl/consumer/ConsumeMessagePopOrderlyService.java:127-140 — 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 4 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/ConsumeMessageConcurrentlyService.java:120` 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 × 3) store/src/main/java/org/apache/rocketmq/store/rocksdb/RocksDBOptionsFactory.java:148— store/src/main/java/org/apache/rocketmq/store/rocksdb/RocksDBOptionsFactory.java:148-161 | store/src/main/java/org/apache/rocketmq/store/rocksdb/RocksDBOptionsFactory.java:276-289 | store/src/main/java/org/apache/rocketmq/store/rocksdb/RocksDBOptionsFactory.java:327-340 — 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 `store/src/main/java/org/apache/rocketmq/store/rocksdb/RocksDBOptionsFactory.java:148` 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 (8–13 lines × 31) proxy/src/main/java/org/apache/rocketmq/proxy/ProxyStartup.java:191— proxy/src/main/java/org/apache/rocketmq/proxy/ProxyStartup.java:191-198 | tools/src/main/java/org/apache/rocketmq/tools/command/broker/BrokerConsumeStatsSubCommand.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/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/ClusterListSubCommand.java:50-57 | tools/src/main/java/org/apache/rocketmq/tools/command/cluster/ClusterSendMsgRTCommand.java:57-64 | 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:51-58 | tools/src/main/java/org/apache/rocketmq/tools/command/consumer/UpdateSubGroupSubCommand.java:63-70 | tools/src/main/java/org/apache/rocketmq/tools/command/consumer/UpdateSubGroupSubCommand.java:89-101 | tools/src/main/java/org/apache/rocketmq/tools/command/export/ExportMetadataCommand.java:57-64 | tools/src/main/java/org/apache/rocketmq/tools/command/export/ExportPopRecordCommand.java:47-54 | 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:76-85 | tools/src/main/java/org/apache/rocketmq/tools/command/message/QueryMsgByIdSubCommand.java:205-212 | tools/src/main/java/org/apache/rocketmq/tools/command/message/QueryMsgByKeySubCommand.java:58-65 | tools/src/main/java/org/apache/rocketmq/tools/command/message/QueryMsgByUniqueKeySubCommand.java:168-175 | tools/src/main/java/org/apache/rocketmq/tools/command/message/QueryMsgByUniqueKeySubCommand.java:180-187 | 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:73-80 | 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 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 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: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. 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/BrokerConsumeStatsSubCommand.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–12 lines × 4) broker/src/main/java/org/apache/rocketmq/broker/processor/NotificationProcessor.java:115— broker/src/main/java/org/apache/rocketmq/broker/processor/NotificationProcessor.java:115-125 | broker/src/main/java/org/apache/rocketmq/broker/processor/PeekMessageProcessor.java:98-108 | broker/src/main/java/org/apache/rocketmq/broker/processor/PollingInfoProcessor.java:73-83 | broker/src/main/java/org/apache/rocketmq/broker/processor/PopMessageProcessor.java:279-290 — 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 4 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/NotificationProcessor.java:115` 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–12 lines × 3) broker/src/main/java/org/apache/rocketmq/broker/processor/NotificationProcessor.java:127— broker/src/main/java/org/apache/rocketmq/broker/processor/NotificationProcessor.java:127-135 | broker/src/main/java/org/apache/rocketmq/broker/processor/PollingInfoProcessor.java:85-92 | broker/src/main/java/org/apache/rocketmq/broker/processor/PopMessageProcessor.java:292-303 — 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 9 separate duplicated blocks between them, totalling at least 88 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:127` 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–12 lines × 2) store/src/main/java/org/apache/rocketmq/store/DefaultMessageStore.java:1410— store/src/main/java/org/apache/rocketmq/store/DefaultMessageStore.java:1410-1421 | store/src/main/java/org/apache/rocketmq/store/DefaultMessageStore.java:1465-1473 — 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:1410` 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–11 lines × 3) client/src/main/java/org/apache/rocketmq/client/impl/factory/MQClientInstance.java:722— client/src/main/java/org/apache/rocketmq/client/impl/factory/MQClientInstance.java:722-731 | client/src/main/java/org/apache/rocketmq/client/impl/factory/MQClientInstance.java:801-809 | client/src/main/java/org/apache/rocketmq/client/impl/factory/MQClientInstance.java:864-874 — 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 after the matched lines, `client/src/main/java/org/apache/rocketmq/client/impl/factory/MQClientInstance.java:876` calls `getAndIncrement` and `client/src/main/java/org/apache/rocketmq/client/impl/factory/MQClientInstance.java:732` 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–12 lines × 2) broker/src/main/java/org/apache/rocketmq/broker/client/ConsumerManager.java:239— broker/src/main/java/org/apache/rocketmq/broker/client/ConsumerManager.java:239-250 | broker/src/main/java/org/apache/rocketmq/broker/client/ConsumerManager.java:290-299 — 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/ConsumerManager.java:239` 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 (10 lines × 8) client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:440— client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:440-449 | client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:489-498 | client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:1545-1554 | client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:1695-1704 | client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:2188-2197 | client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:2269-2278 | client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:2904-2913 | client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:3361-3370 — 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. 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 × 4) broker/src/main/java/org/apache/rocketmq/broker/processor/NotificationProcessor.java:129— broker/src/main/java/org/apache/rocketmq/broker/processor/NotificationProcessor.java:129-136 | broker/src/main/java/org/apache/rocketmq/broker/processor/PeekMessageProcessor.java:112-118 | broker/src/main/java/org/apache/rocketmq/broker/processor/PollingInfoProcessor.java:87-93 | broker/src/main/java/org/apache/rocketmq/broker/processor/PopMessageProcessor.java:296-305 — 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 4 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/NotificationProcessor.java:129` 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 (7–10 lines × 3) broker/src/main/java/org/apache/rocketmq/broker/processor/NotificationProcessor.java:107— broker/src/main/java/org/apache/rocketmq/broker/processor/NotificationProcessor.java:107-113 | broker/src/main/java/org/apache/rocketmq/broker/processor/PollingInfoProcessor.java:65-71 | broker/src/main/java/org/apache/rocketmq/broker/processor/PopMessageProcessor.java:268-277 — 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 9 separate duplicated blocks between them, totalling at least 88 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:107` 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 × 4) broker/src/main/java/org/apache/rocketmq/broker/processor/DefaultPullMessageResultHandler.java:141— broker/src/main/java/org/apache/rocketmq/broker/processor/DefaultPullMessageResultHandler.java:141-143 | broker/src/main/java/org/apache/rocketmq/broker/processor/PeekMessageProcessor.java:189-197 | broker/src/main/java/org/apache/rocketmq/broker/processor/PopMessageProcessor.java:455-463 | broker/src/main/java/org/apache/rocketmq/broker/processor/PopMessageProcessor.java:608-617 — there are 4 copies across 3 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. 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:141` 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:141` 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–10 lines × 2) client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:3268— client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:3268-3277 | client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:3311-3318 — 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:3268` 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 × 34) proxy/src/main/java/org/apache/rocketmq/proxy/ProxyStartup.java:194— proxy/src/main/java/org/apache/rocketmq/proxy/ProxyStartup.java:194-203 | tools/src/main/java/org/apache/rocketmq/tools/command/auth/ListAclSubCommand.java:62-71 | tools/src/main/java/org/apache/rocketmq/tools/command/broker/BrokerConsumeStatsSubCommand.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/GetColdDataFlowCtrInfoSubCommand.java:58-66 | 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/ClusterListSubCommand.java:53-62 | tools/src/main/java/org/apache/rocketmq/tools/command/cluster/ClusterSendMsgRTCommand.java:72-81 | tools/src/main/java/org/apache/rocketmq/tools/command/consumer/ConsumerProgressSubCommand.java:72-80 | tools/src/main/java/org/apache/rocketmq/tools/command/export/ExportPopRecordCommand.java:50-58 | 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/lite/GetLiteGroupInfoSubCommand.java:60-69 | tools/src/main/java/org/apache/rocketmq/tools/command/lite/TriggerLiteDispatchSubCommand.java:51-60 | 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:95-108 | tools/src/main/java/org/apache/rocketmq/tools/command/message/QueryMsgByIdSubCommand.java:220-229 | tools/src/main/java/org/apache/rocketmq/tools/command/message/QueryMsgByKeySubCommand.java:73-82 | tools/src/main/java/org/apache/rocketmq/tools/command/message/QueryMsgByOffsetSubCommand.java:64-72 | tools/src/main/java/org/apache/rocketmq/tools/command/message/QueryMsgByUniqueKeySubCommand.java:187-196 | 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:76-85 | tools/src/main/java/org/apache/rocketmq/tools/command/offset/ResetOffsetByTimeOldCommand.java:94-103 | tools/src/main/java/org/apache/rocketmq/tools/command/offset/SkipAccumulationSubCommand.java:57-65 | tools/src/main/java/org/apache/rocketmq/tools/command/queue/QueryConsumeQueueCommand.java:76-85 | 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 34 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 34 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:194` 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:192` 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 (9 lines × 7) client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:1628— client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:1628-1636 | client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:3599-3607 | client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:3615-3623 | client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:3630-3638 | client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:3676-3684 | client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:3692-3700 | client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:3707-3715 — 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. 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 × 5) remoting/src/main/java/org/apache/rocketmq/remoting/rpc/RpcClientImpl.java:212— remoting/src/main/java/org/apache/rocketmq/remoting/rpc/RpcClientImpl.java:212-220 | remoting/src/main/java/org/apache/rocketmq/remoting/rpc/RpcClientImpl.java:258-266 | remoting/src/main/java/org/apache/rocketmq/remoting/rpc/RpcClientImpl.java:296-304 | remoting/src/main/java/org/apache/rocketmq/remoting/rpc/RpcClientImpl.java:317-325 | remoting/src/main/java/org/apache/rocketmq/remoting/rpc/RpcClientImpl.java:338-346 — 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:212` 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 (5–9 lines × 2) broker/src/main/java/org/apache/rocketmq/broker/pop/PopConsumerService.java:727— broker/src/main/java/org/apache/rocketmq/broker/pop/PopConsumerService.java:727-735 | broker/src/main/java/org/apache/rocketmq/broker/processor/PopReviveService.java:126-130 — 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/pop/PopConsumerService.java:727` 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 (8 lines × 34) proxy/src/main/java/org/apache/rocketmq/proxy/ProxyStartup.java:192— proxy/src/main/java/org/apache/rocketmq/proxy/ProxyStartup.java:192-199 | tools/src/main/java/org/apache/rocketmq/tools/command/broker/BrokerConsumeStatsSubCommand.java:71-78 | tools/src/main/java/org/apache/rocketmq/tools/command/broker/DeleteExpiredCommitLogSubCommand.java:47-54 | tools/src/main/java/org/apache/rocketmq/tools/command/broker/SendMsgStatusCommand.java:59-66 | tools/src/main/java/org/apache/rocketmq/tools/command/broker/UpdateBrokerConfigSubCommand.java:47-54 | tools/src/main/java/org/apache/rocketmq/tools/command/cluster/ClusterListSubCommand.java:51-58 | tools/src/main/java/org/apache/rocketmq/tools/command/cluster/ClusterSendMsgRTCommand.java:58-65 | tools/src/main/java/org/apache/rocketmq/tools/command/consumer/ConsumerStatusSubCommand.java:57-64 | tools/src/main/java/org/apache/rocketmq/tools/command/consumer/UpdateSubGroupSubCommand.java:60-67 | tools/src/main/java/org/apache/rocketmq/tools/command/consumer/UpdateSubGroupSubCommand.java:91-98 | tools/src/main/java/org/apache/rocketmq/tools/command/export/ExportMetadataCommand.java:58-65 | tools/src/main/java/org/apache/rocketmq/tools/command/export/ExportPopRecordCommand.java:48-55 | tools/src/main/java/org/apache/rocketmq/tools/command/ha/GetSyncStateSetSubCommand.java:50-57 | tools/src/main/java/org/apache/rocketmq/tools/command/ha/HAStatusSubCommand.java:51-58 | tools/src/main/java/org/apache/rocketmq/tools/command/lite/GetLiteGroupInfoSubCommand.java:58-65 | tools/src/main/java/org/apache/rocketmq/tools/command/lite/TriggerLiteDispatchSubCommand.java:49-56 | tools/src/main/java/org/apache/rocketmq/tools/command/message/CheckMsgSendRTCommand.java:50-57 | tools/src/main/java/org/apache/rocketmq/tools/command/message/ConsumeMessageCommand.java:80-87 | tools/src/main/java/org/apache/rocketmq/tools/command/message/PrintMessageByQueueCommand.java:126-133 | tools/src/main/java/org/apache/rocketmq/tools/command/message/PrintMessageSubCommand.java:73-80 | tools/src/main/java/org/apache/rocketmq/tools/command/message/QueryMsgByIdSubCommand.java:202-209 | tools/src/main/java/org/apache/rocketmq/tools/command/message/QueryMsgByKeySubCommand.java:55-62 | tools/src/main/java/org/apache/rocketmq/tools/command/message/QueryMsgByOffsetSubCommand.java:62-69 | tools/src/main/java/org/apache/rocketmq/tools/command/message/QueryMsgByUniqueKeySubCommand.java:165-172 | tools/src/main/java/org/apache/rocketmq/tools/command/message/QueryMsgByUniqueKeySubCommand.java:181-188 | tools/src/main/java/org/apache/rocketmq/tools/command/message/QueryMsgTraceByIdSubCommand.java:45-52 | tools/src/main/java/org/apache/rocketmq/tools/command/message/SendMessageCommand.java:55-62 | tools/src/main/java/org/apache/rocketmq/tools/command/offset/ResetOffsetByTimeCommand.java:66-73 | tools/src/main/java/org/apache/rocketmq/tools/command/offset/ResetOffsetByTimeOldCommand.java:92-99 | tools/src/main/java/org/apache/rocketmq/tools/command/offset/SkipAccumulationSubCommand.java:55-62 | tools/src/main/java/org/apache/rocketmq/tools/command/queue/QueryConsumeQueueCommand.java:70-77 | tools/src/main/java/org/apache/rocketmq/tools/command/topic/RemappingStaticTopicSubCommand.java:70-77 | tools/src/main/java/org/apache/rocketmq/tools/command/topic/UpdateStaticTopicSubCommand.java:75-82 | tools/src/main/java/org/apache/rocketmq/tools/command/topic/UpdateTopicSubCommand.java:67-74 — there are 34 copies across 32 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 34 sites; resolving a subset leaves the remainder to drift apart.
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 (7–8 lines × 6) broker/src/main/java/org/apache/rocketmq/broker/processor/NotificationProcessor.java:114— broker/src/main/java/org/apache/rocketmq/broker/processor/NotificationProcessor.java:114-120 | broker/src/main/java/org/apache/rocketmq/broker/processor/PeekMessageProcessor.java:97-103 | broker/src/main/java/org/apache/rocketmq/broker/processor/PollingInfoProcessor.java:72-78 | broker/src/main/java/org/apache/rocketmq/broker/processor/PopLiteMessageProcessor.java:191-198 | broker/src/main/java/org/apache/rocketmq/broker/processor/PopMessageProcessor.java:278-285 | broker/src/main/java/org/apache/rocketmq/broker/processor/PullMessageProcessor.java:351-357 — 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 6 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/NotificationProcessor.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. ★ 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:358` calls `setForbiddenType` and `broker/src/main/java/org/apache/rocketmq/broker/processor/NotificationProcessor.java:121` 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) client/src/main/java/org/apache/rocketmq/client/impl/factory/MQClientInstance.java:667— client/src/main/java/org/apache/rocketmq/client/impl/factory/MQClientInstance.java:667-673 | client/src/main/java/org/apache/rocketmq/client/impl/factory/MQClientInstance.java:721-727 | client/src/main/java/org/apache/rocketmq/client/impl/factory/MQClientInstance.java:800-806 | client/src/main/java/org/apache/rocketmq/client/impl/factory/MQClientInstance.java:863-870 — 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.
Duplicated block (7 lines × 35) proxy/src/main/java/org/apache/rocketmq/proxy/ProxyStartup.java:194— proxy/src/main/java/org/apache/rocketmq/proxy/ProxyStartup.java:194-200 | tools/src/main/java/org/apache/rocketmq/tools/command/auth/ListAclSubCommand.java:62-68 | tools/src/main/java/org/apache/rocketmq/tools/command/broker/BrokerConsumeStatsSubCommand.java:73-79 | tools/src/main/java/org/apache/rocketmq/tools/command/broker/DeleteExpiredCommitLogSubCommand.java:49-55 | tools/src/main/java/org/apache/rocketmq/tools/command/broker/SendMsgStatusCommand.java:61-67 | tools/src/main/java/org/apache/rocketmq/tools/command/broker/UpdateBrokerConfigSubCommand.java:49-55 | tools/src/main/java/org/apache/rocketmq/tools/command/cluster/ClusterListSubCommand.java:53-59 | tools/src/main/java/org/apache/rocketmq/tools/command/cluster/ClusterSendMsgRTCommand.java:60-66 | tools/src/main/java/org/apache/rocketmq/tools/command/consumer/ConsumerStatusSubCommand.java:59-65 | tools/src/main/java/org/apache/rocketmq/tools/command/consumer/UpdateSubGroupSubCommand.java:62-68 | tools/src/main/java/org/apache/rocketmq/tools/command/consumer/UpdateSubGroupSubCommand.java:93-99 | tools/src/main/java/org/apache/rocketmq/tools/command/export/ExportMetadataCommand.java:60-66 | tools/src/main/java/org/apache/rocketmq/tools/command/export/ExportPopRecordCommand.java:50-56 | 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:53-59 | tools/src/main/java/org/apache/rocketmq/tools/command/lite/GetLiteGroupInfoSubCommand.java:60-66 | tools/src/main/java/org/apache/rocketmq/tools/command/lite/TriggerLiteDispatchSubCommand.java:51-57 | tools/src/main/java/org/apache/rocketmq/tools/command/message/CheckMsgSendRTCommand.java:52-58 | 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:75-81 | tools/src/main/java/org/apache/rocketmq/tools/command/message/QueryMsgByIdSubCommand.java:204-210 | tools/src/main/java/org/apache/rocketmq/tools/command/message/QueryMsgByKeySubCommand.java:57-63 | tools/src/main/java/org/apache/rocketmq/tools/command/message/QueryMsgByOffsetSubCommand.java:64-70 | tools/src/main/java/org/apache/rocketmq/tools/command/message/QueryMsgByUniqueKeySubCommand.java:167-173 | tools/src/main/java/org/apache/rocketmq/tools/command/message/QueryMsgByUniqueKeySubCommand.java:183-189 | 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/offset/ResetOffsetByTimeOldCommand.java:94-100 | tools/src/main/java/org/apache/rocketmq/tools/command/offset/SkipAccumulationSubCommand.java:57-63 | tools/src/main/java/org/apache/rocketmq/tools/command/queue/QueryConsumeQueueCommand.java:72-78 | tools/src/main/java/org/apache/rocketmq/tools/command/topic/RemappingStaticTopicSubCommand.java:72-78 | tools/src/main/java/org/apache/rocketmq/tools/command/topic/UpdateStaticTopicSubCommand.java:77-83 | tools/src/main/java/org/apache/rocketmq/tools/command/topic/UpdateTopicSubCommand.java:69-75 — there are 35 copies across 33 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 35 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/BrokerConsumeStatsSubCommand.java:81` calls `Option`, `setRequired`, `addOption` and `proxy/src/main/java/org/apache/rocketmq/proxy/ProxyStartup.java:202` 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 × 11) proxy/src/main/java/org/apache/rocketmq/proxy/grpc/v2/GrpcMessagingApplication.java:217— proxy/src/main/java/org/apache/rocketmq/proxy/grpc/v2/GrpcMessagingApplication.java:217-223 | proxy/src/main/java/org/apache/rocketmq/proxy/grpc/v2/GrpcMessagingApplication.java:234-240 | proxy/src/main/java/org/apache/rocketmq/proxy/grpc/v2/GrpcMessagingApplication.java:251-257 | proxy/src/main/java/org/apache/rocketmq/proxy/grpc/v2/GrpcMessagingApplication.java:269-275 | proxy/src/main/java/org/apache/rocketmq/proxy/grpc/v2/GrpcMessagingApplication.java:302-308 | proxy/src/main/java/org/apache/rocketmq/proxy/grpc/v2/GrpcMessagingApplication.java:320-326 | proxy/src/main/java/org/apache/rocketmq/proxy/grpc/v2/GrpcMessagingApplication.java:337-343 | proxy/src/main/java/org/apache/rocketmq/proxy/grpc/v2/GrpcMessagingApplication.java:355-361 | proxy/src/main/java/org/apache/rocketmq/proxy/grpc/v2/GrpcMessagingApplication.java:380-386 | proxy/src/main/java/org/apache/rocketmq/proxy/grpc/v2/GrpcMessagingApplication.java:398-405 | proxy/src/main/java/org/apache/rocketmq/proxy/grpc/v2/GrpcMessagingApplication.java:418-425 — 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. 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:217` 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:191— proxy/src/main/java/org/apache/rocketmq/proxy/ProxyStartup.java:191-196 | tools/src/main/java/org/apache/rocketmq/tools/command/broker/BrokerConsumeStatsSubCommand.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/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:51-56 | tools/src/main/java/org/apache/rocketmq/tools/command/consumer/UpdateSubGroupSubCommand.java:62-68 | tools/src/main/java/org/apache/rocketmq/tools/command/consumer/UpdateSubGroupSubCommand.java:93-99 | tools/src/main/java/org/apache/rocketmq/tools/command/export/ExportMetadataCommand.java:57-62 | tools/src/main/java/org/apache/rocketmq/tools/command/export/ExportPopRecordCommand.java:46-52 | 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:75-83 | tools/src/main/java/org/apache/rocketmq/tools/command/message/QueryMsgByIdSubCommand.java:204-210 | tools/src/main/java/org/apache/rocketmq/tools/command/message/QueryMsgByKeySubCommand.java:57-63 | tools/src/main/java/org/apache/rocketmq/tools/command/message/QueryMsgByUniqueKeySubCommand.java:167-173 | tools/src/main/java/org/apache/rocketmq/tools/command/message/QueryMsgByUniqueKeySubCommand.java:183-189 | 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:72-78 | 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 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 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/export/ExportPopRecordCommand.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. 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/BrokerConsumeStatsSubCommand.java:71` calls `addOption`, `Option` and `proxy/src/main/java/org/apache/rocketmq/proxy/ProxyStartup.java:191` 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 × 5) broker/src/main/java/org/apache/rocketmq/broker/config/v2/ConsumerOffsetManagerV2.java:76— broker/src/main/java/org/apache/rocketmq/broker/config/v2/ConsumerOffsetManagerV2.java:76-80 | broker/src/main/java/org/apache/rocketmq/broker/config/v2/ConsumerOffsetManagerV2.java:87-91 | broker/src/main/java/org/apache/rocketmq/broker/config/v2/ConsumerOffsetManagerV2.java:123-127 | broker/src/main/java/org/apache/rocketmq/broker/config/v2/ConsumerOffsetManagerV2.java:131-135 | broker/src/main/java/org/apache/rocketmq/broker/config/v2/ConsumerOffsetManagerV2.java:237-241 — 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.
Duplicated block (4–5 lines × 3) client/src/main/java/org/apache/rocketmq/client/impl/consumer/ConsumeMessageOrderlyService.java:342— client/src/main/java/org/apache/rocketmq/client/impl/consumer/ConsumeMessageOrderlyService.java:342-346 | client/src/main/java/org/apache/rocketmq/client/impl/consumer/ConsumeMessagePopOrderlyService.java:256-260 | client/src/main/java/org/apache/rocketmq/client/impl/consumer/DefaultMQPushConsumerImpl.java:788-791 — 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 10 separate duplicated blocks between them, totalling at least 133 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:342` 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 (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 × 3) 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/PopLiteMessageResponseHeader.java:1-86 | 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/PopLiteMessageResponseHeader.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 `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-66 | 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 (62 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-62 | remoting/src/main/java/org/apache/rocketmq/remoting/protocol/header/QueryConsumeQueueRequestHeader.java:1-82 | remoting/src/main/java/org/apache/rocketmq/remoting/protocol/header/ResetOffsetRequestHeader.java:1-101 — 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 (69 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-69 | remoting/src/main/java/org/apache/rocketmq/remoting/protocol/header/StatisticsMessagesRequestHeader.java:1-80 — 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 `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 (86 lines × 2) remoting/src/main/java/org/apache/rocketmq/remoting/protocol/header/PopLiteMessageResponseHeader.java:1— remoting/src/main/java/org/apache/rocketmq/remoting/protocol/header/PopLiteMessageResponseHeader.java:1-86 | 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/PopLiteMessageResponseHeader.java` and `remoting/src/main/java/org/apache/rocketmq/remoting/protocol/header/PopMessageResponseHeader.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 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 `remoting/src/main/java/org/apache/rocketmq/remoting/protocol/header/PopLiteMessageResponseHeader.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 (56 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-56 | remoting/src/main/java/org/apache/rocketmq/remoting/protocol/header/ResetOffsetRequestHeader.java:1-101 | remoting/src/main/java/org/apache/rocketmq/remoting/protocol/header/UpdateGroupForbiddenRequestHeader.java:1-70 — 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: 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 `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 (57 lines × 2) remoting/src/main/java/org/apache/rocketmq/remoting/protocol/header/ResetOffsetRequestHeader.java:1— remoting/src/main/java/org/apache/rocketmq/remoting/protocol/header/ResetOffsetRequestHeader.java:1-101 | remoting/src/main/java/org/apache/rocketmq/remoting/protocol/header/ViewMessageRequestHeader.java:1-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 `remoting/src/main/java/org/apache/rocketmq/remoting/protocol/header/ResetOffsetRequestHeader.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:36-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.
Duplicated block (53 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-53 | remoting/src/main/java/org/apache/rocketmq/remoting/protocol/header/namesrv/GetKVConfigRequestHeader.java:1-53 | remoting/src/main/java/org/apache/rocketmq/remoting/protocol/header/namesrv/PutKVConfigRequestHeader.java:1-63 — 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: 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 `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.
Duplicated block (76 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-76 | remoting/src/main/java/org/apache/rocketmq/remoting/protocol/header/namesrv/RegisterBrokerRequestHeader.java:1-129 | remoting/src/main/java/org/apache/rocketmq/remoting/protocol/header/namesrv/UnRegisterBrokerRequestHeader.java:1-78 — 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: 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. 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 (8 lines × 5) auth/src/main/java/org/apache/rocketmq/auth/authentication/enums/SubjectType.java:35— auth/src/main/java/org/apache/rocketmq/auth/authentication/enums/SubjectType.java:35-42 | auth/src/main/java/org/apache/rocketmq/auth/authentication/enums/UserType.java:38-45 | auth/src/main/java/org/apache/rocketmq/auth/authorization/enums/PolicyType.java:37-44 | common/src/main/java/org/apache/rocketmq/common/action/Action.java:53-60 | common/src/main/java/org/apache/rocketmq/common/resource/ResourceType.java:45-52 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 5 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 5 times. 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· Near-duplicate member family (5 members, 18 shared lines) · ×1
Near-duplicate member family (5 members, 18 shared lines) tools/src/main/java/org/apache/rocketmq/tools/command/auth/CreateAclSubCommand.java:48— tools/src/main/java/org/apache/rocketmq/tools/command/auth/CreateAclSubCommand.java:48-81 | tools/src/main/java/org/apache/rocketmq/tools/command/auth/CreateUserSubCommand.java:45-70 | tools/src/main/java/org/apache/rocketmq/tools/command/auth/UpdateAclSubCommand.java:48-81 | tools/src/main/java/org/apache/rocketmq/tools/command/topic/UpdateStaticTopicSubCommand.java:55-86 | tools/src/main/java/org/apache/rocketmq/tools/command/topic/UpdateTopicSubCommand.java:49-94 — These 5 members are variants of one another: a block of 18 lines reported below appears in every one of them, and the pairwise near-duplicate rows they would otherwise produce are collapsed into this row. Read them 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.
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.
Near-duplicate member pair (36 shared lines) tools/src/main/java/org/apache/rocketmq/tools/command/consumer/UpdateSubGroupListSubCommand.java:70— tools/src/main/java/org/apache/rocketmq/tools/command/consumer/UpdateSubGroupListSubCommand.java:70-118 | tools/src/main/java/org/apache/rocketmq/tools/command/topic/UpdateTopicListSubCommand.java:68-117 — These two members are variants of one another: 36 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· Members sharing a duplicated core (9 members, 50+ identical tokens) · ×1
Members sharing a duplicated core (9 members, 50+ identical tokens) tools/src/main/java/org/apache/rocketmq/tools/command/auth/CopyAclsSubCommand.java:65— tools/src/main/java/org/apache/rocketmq/tools/command/auth/CopyAclsSubCommand.java:65-112 | tools/src/main/java/org/apache/rocketmq/tools/command/auth/CopyUsersSubCommand.java:65-125 | tools/src/main/java/org/apache/rocketmq/tools/command/auth/CreateAclSubCommand.java:85-144 | tools/src/main/java/org/apache/rocketmq/tools/command/auth/CreateUserSubCommand.java:74-114 | tools/src/main/java/org/apache/rocketmq/tools/command/auth/DeleteAclSubCommand.java:70-112 | tools/src/main/java/org/apache/rocketmq/tools/command/auth/DeleteUserSubCommand.java:66-101 | tools/src/main/java/org/apache/rocketmq/tools/command/auth/UpdateAclSubCommand.java:85-145 | tools/src/main/java/org/apache/rocketmq/tools/command/auth/UpdateUserSubCommand.java:79-119 | tools/src/main/java/org/apache/rocketmq/tools/command/topic/UpdateTopicPermSubCommand.java:73-166 — 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.
D4 · Code Duplication· Edited copy of a member (84 corresponding lines) · ×1
Edited copy of a member (84 corresponding lines) tools/src/main/java/org/apache/rocketmq/tools/admin/DefaultMQAdminExtImpl.java:1351— tools/src/main/java/org/apache/rocketmq/tools/admin/DefaultMQAdminExtImpl.java:1351-1434 | tools/src/main/java/org/apache/rocketmq/tools/admin/DefaultMQAdminExtImpl.java:1438-1531 — These two members are one piece of code written twice and then edited apart: 84 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 (71 corresponding lines) · ×1
Edited copy of a member (71 corresponding lines) tools/src/main/java/org/apache/rocketmq/tools/command/consumer/ConsumerStatusSubCommand.java:75— tools/src/main/java/org/apache/rocketmq/tools/command/consumer/ConsumerStatusSubCommand.java:75-153 | tools/src/main/java/org/apache/rocketmq/tools/command/consumer/ConsumerSubCommand.java:67-137 — These two members are one piece of code written twice and then edited apart: 71 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 copies of one member (3 members, 24+ corresponding lines) · ×1
Edited copies of one member (3 members, 24+ corresponding lines) tools/src/main/java/org/apache/rocketmq/tools/command/broker/CleanExpiredCQSubCommand.java:54— tools/src/main/java/org/apache/rocketmq/tools/command/broker/CleanExpiredCQSubCommand.java:54-77 | tools/src/main/java/org/apache/rocketmq/tools/command/broker/CleanUnusedTopicCommand.java:54-77 | tools/src/main/java/org/apache/rocketmq/tools/command/broker/DeleteExpiredCommitLogSubCommand.java:61-87 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 24 lines, 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 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. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication· Edited copies of one member (3 members, 30+ corresponding lines) · ×1
Edited copies of one member (3 members, 30+ corresponding lines) tools/src/main/java/org/apache/rocketmq/tools/command/broker/BrokerStatusSubCommand.java:66— tools/src/main/java/org/apache/rocketmq/tools/command/broker/BrokerStatusSubCommand.java:66-95 | tools/src/main/java/org/apache/rocketmq/tools/command/namesrv/AddWritePermSubCommand.java:49-79 | tools/src/main/java/org/apache/rocketmq/tools/command/namesrv/WipeWritePermSubCommand.java:49-82 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 30 lines, 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 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. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
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:79-81 — 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 (20 lines × 3) tools/src/main/java/org/apache/rocketmq/tools/command/broker/GetBrokerEpochSubCommand.java:71— tools/src/main/java/org/apache/rocketmq/tools/command/broker/GetBrokerEpochSubCommand.java:71-90 | tools/src/main/java/org/apache/rocketmq/tools/command/ha/GetSyncStateSetSubCommand.java:77-96 | tools/src/main/java/org/apache/rocketmq/tools/command/ha/HAStatusSubCommand.java:74-93 — before extracting anything, compare `tools/src/main/java/org/apache/rocketmq/tools/command/ha/GetSyncStateSetSubCommand.java` and `tools/src/main/java/org/apache/rocketmq/tools/command/ha/HAStatusSubCommand.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. Read the line range as the matched WINDOW rather than a finished unit: at `tools/src/main/java/org/apache/rocketmq/tools/command/broker/GetBrokerEpochSubCommand.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. ★ 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:94` 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 (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:66-82 | tools/src/main/java/org/apache/rocketmq/tools/command/broker/GetColdDataFlowCtrInfoSubCommand.java:71-81 — 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:81` 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–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 (12 lines × 4) tools/src/main/java/org/apache/rocketmq/tools/command/auth/GetAclSubCommand.java:86— tools/src/main/java/org/apache/rocketmq/tools/command/auth/GetAclSubCommand.java:86-97 | tools/src/main/java/org/apache/rocketmq/tools/command/auth/GetUserSubCommand.java:86-97 | tools/src/main/java/org/apache/rocketmq/tools/command/auth/ListAclSubCommand.java:92-103 | tools/src/main/java/org/apache/rocketmq/tools/command/auth/ListUserSubCommand.java:87-98 — before extracting anything, compare `tools/src/main/java/org/apache/rocketmq/tools/command/auth/GetAclSubCommand.java` and `tools/src/main/java/org/apache/rocketmq/tools/command/auth/GetUserSubCommand.java` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 49 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/auth/GetAclSubCommand.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 (9–12 lines × 3) example/src/main/java/org/apache/rocketmq/example/filter/SqlFilterConsumer.java:41— example/src/main/java/org/apache/rocketmq/example/filter/SqlFilterConsumer.java:41-51 | example/src/main/java/org/apache/rocketmq/example/filter/TagFilterConsumer.java:37-48 | example/src/main/java/org/apache/rocketmq/example/simple/PushConsumer.java:45-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 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 `example/src/main/java/org/apache/rocketmq/example/filter/SqlFilterConsumer.java:41` 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 × 3) tools/src/main/java/org/apache/rocketmq/tools/command/consumer/UpdateSubGroupSubCommand.java:218— tools/src/main/java/org/apache/rocketmq/tools/command/consumer/UpdateSubGroupSubCommand.java:218-228 | 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/consumer/UpdateSubGroupSubCommand.java` and `tools/src/main/java/org/apache/rocketmq/tools/command/topic/UpdateOrderConfCommand.java` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 42 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/consumer/UpdateSubGroupSubCommand.java:218` 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 × 6) tools/src/main/java/org/apache/rocketmq/tools/command/auth/CreateAclSubCommand.java:133— tools/src/main/java/org/apache/rocketmq/tools/command/auth/CreateAclSubCommand.java:133-143 | tools/src/main/java/org/apache/rocketmq/tools/command/auth/CreateUserSubCommand.java:103-113 | tools/src/main/java/org/apache/rocketmq/tools/command/auth/DeleteAclSubCommand.java:101-111 | tools/src/main/java/org/apache/rocketmq/tools/command/auth/DeleteUserSubCommand.java:90-100 | tools/src/main/java/org/apache/rocketmq/tools/command/auth/UpdateAclSubCommand.java:134-144 | tools/src/main/java/org/apache/rocketmq/tools/command/auth/UpdateUserSubCommand.java:108-118 — before extracting anything, compare `tools/src/main/java/org/apache/rocketmq/tools/command/auth/CreateAclSubCommand.java` and `tools/src/main/java/org/apache/rocketmq/tools/command/auth/CreateUserSubCommand.java` as WHOLE FILES: this scan already matched 13 separate duplicated blocks between them, totalling at least 114 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/auth/CreateAclSubCommand.java:133` 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–10 lines × 16) tools/src/main/java/org/apache/rocketmq/tools/command/auth/CreateAclSubCommand.java:49— tools/src/main/java/org/apache/rocketmq/tools/command/auth/CreateAclSubCommand.java:49-58 | tools/src/main/java/org/apache/rocketmq/tools/command/auth/CreateUserSubCommand.java:46-55 | tools/src/main/java/org/apache/rocketmq/tools/command/auth/DeleteAclSubCommand.java:46-55 | tools/src/main/java/org/apache/rocketmq/tools/command/auth/DeleteUserSubCommand.java:46-55 | tools/src/main/java/org/apache/rocketmq/tools/command/auth/GetAclSubCommand.java:51-60 | tools/src/main/java/org/apache/rocketmq/tools/command/auth/GetUserSubCommand.java:50-59 | tools/src/main/java/org/apache/rocketmq/tools/command/auth/ListAclSubCommand.java:51-60 | tools/src/main/java/org/apache/rocketmq/tools/command/auth/ListUserSubCommand.java:51-60 | tools/src/main/java/org/apache/rocketmq/tools/command/auth/UpdateAclSubCommand.java:49-58 | tools/src/main/java/org/apache/rocketmq/tools/command/auth/UpdateUserSubCommand.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/broker/SwitchTimerEngineSubCommand.java:47-55 | tools/src/main/java/org/apache/rocketmq/tools/command/consumer/UpdateSubGroupListSubCommand.java:52-58 | tools/src/main/java/org/apache/rocketmq/tools/command/lite/GetBrokerLiteInfoSubCommand.java:46-55 | tools/src/main/java/org/apache/rocketmq/tools/command/topic/UpdateTopicListSubCommand.java:52-57 | 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/auth/CreateAclSubCommand.java` and `tools/src/main/java/org/apache/rocketmq/tools/command/auth/CreateUserSubCommand.java` as WHOLE FILES: this scan already matched 13 separate duplicated blocks between them, totalling at least 114 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/auth/DeleteUserSubCommand.java:58` calls `setRequired` and `tools/src/main/java/org/apache/rocketmq/tools/command/auth/GetAclSubCommand.java:63` 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–10 lines × 4) tools/src/main/java/org/apache/rocketmq/tools/command/auth/DeleteUserSubCommand.java:68— tools/src/main/java/org/apache/rocketmq/tools/command/auth/DeleteUserSubCommand.java:68-77 | tools/src/main/java/org/apache/rocketmq/tools/command/auth/GetAclSubCommand.java:72-80 | tools/src/main/java/org/apache/rocketmq/tools/command/auth/GetUserSubCommand.java:72-80 | tools/src/main/java/org/apache/rocketmq/tools/command/auth/ListUserSubCommand.java:73-81 — before extracting anything, compare `tools/src/main/java/org/apache/rocketmq/tools/command/auth/DeleteUserSubCommand.java` and `tools/src/main/java/org/apache/rocketmq/tools/command/auth/GetAclSubCommand.java` as WHOLE FILES: this scan already matched 4 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 `tools/src/main/java/org/apache/rocketmq/tools/command/auth/DeleteUserSubCommand.java:68` 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–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 (7–9 lines × 20) tools/src/main/java/org/apache/rocketmq/tools/command/broker/BrokerConsumeStatsSubCommand.java:73— tools/src/main/java/org/apache/rocketmq/tools/command/broker/BrokerConsumeStatsSubCommand.java:73-79 | tools/src/main/java/org/apache/rocketmq/tools/command/broker/UpdateBrokerConfigSubCommand.java:49-55 | tools/src/main/java/org/apache/rocketmq/tools/command/cluster/ClusterSendMsgRTCommand.java:60-66 | tools/src/main/java/org/apache/rocketmq/tools/command/consumer/ConsumerStatusSubCommand.java:59-65 | tools/src/main/java/org/apache/rocketmq/tools/command/consumer/UpdateSubGroupSubCommand.java:62-68 | tools/src/main/java/org/apache/rocketmq/tools/command/consumer/UpdateSubGroupSubCommand.java:93-99 | tools/src/main/java/org/apache/rocketmq/tools/command/export/ExportMetadataCommand.java:60-66 | tools/src/main/java/org/apache/rocketmq/tools/command/ha/GetSyncStateSetSubCommand.java:52-58 | 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:75-83 | tools/src/main/java/org/apache/rocketmq/tools/command/message/QueryMsgByIdSubCommand.java:204-210 | tools/src/main/java/org/apache/rocketmq/tools/command/message/QueryMsgByKeySubCommand.java:57-63 | tools/src/main/java/org/apache/rocketmq/tools/command/message/QueryMsgByUniqueKeySubCommand.java:167-173 | tools/src/main/java/org/apache/rocketmq/tools/command/message/QueryMsgByUniqueKeySubCommand.java:183-189 | 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:72-78 | tools/src/main/java/org/apache/rocketmq/tools/command/topic/UpdateTopicSubCommand.java:69-75 — before extracting anything, compare `tools/src/main/java/org/apache/rocketmq/tools/command/broker/BrokerConsumeStatsSubCommand.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 46 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 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–9 lines × 11) tools/src/main/java/org/apache/rocketmq/tools/command/auth/CreateAclSubCommand.java:54— tools/src/main/java/org/apache/rocketmq/tools/command/auth/CreateAclSubCommand.java:54-62 | tools/src/main/java/org/apache/rocketmq/tools/command/auth/CreateUserSubCommand.java:51-59 | tools/src/main/java/org/apache/rocketmq/tools/command/auth/DeleteAclSubCommand.java:51-59 | tools/src/main/java/org/apache/rocketmq/tools/command/auth/DeleteUserSubCommand.java:51-59 | tools/src/main/java/org/apache/rocketmq/tools/command/auth/UpdateAclSubCommand.java:54-62 | tools/src/main/java/org/apache/rocketmq/tools/command/auth/UpdateUserSubCommand.java:51-59 | tools/src/main/java/org/apache/rocketmq/tools/command/broker/SwitchTimerEngineSubCommand.java:51-59 | tools/src/main/java/org/apache/rocketmq/tools/command/consumer/UpdateSubGroupListSubCommand.java:55-63 | tools/src/main/java/org/apache/rocketmq/tools/command/topic/RemappingStaticTopicSubCommand.java:62-70 | tools/src/main/java/org/apache/rocketmq/tools/command/topic/UpdateStaticTopicSubCommand.java:63-71 | tools/src/main/java/org/apache/rocketmq/tools/command/topic/UpdateTopicListSubCommand.java:54-61 — before extracting anything, compare `tools/src/main/java/org/apache/rocketmq/tools/command/auth/CreateAclSubCommand.java` and `tools/src/main/java/org/apache/rocketmq/tools/command/auth/CreateUserSubCommand.java` as WHOLE FILES: this scan already matched 13 separate duplicated blocks between them, totalling at least 114 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/auth/DeleteAclSubCommand.java:61` calls `Option`, `setRequired`, `addOption` and `tools/src/main/java/org/apache/rocketmq/tools/command/auth/DeleteUserSubCommand.java:61` 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 × 9) tools/src/main/java/org/apache/rocketmq/tools/command/auth/CopyAclsSubCommand.java:103— tools/src/main/java/org/apache/rocketmq/tools/command/auth/CopyAclsSubCommand.java:103-112 | tools/src/main/java/org/apache/rocketmq/tools/command/auth/CopyUsersSubCommand.java:116-125 | tools/src/main/java/org/apache/rocketmq/tools/command/auth/CreateAclSubCommand.java:135-144 | tools/src/main/java/org/apache/rocketmq/tools/command/auth/CreateUserSubCommand.java:105-114 | tools/src/main/java/org/apache/rocketmq/tools/command/auth/DeleteAclSubCommand.java:103-112 | tools/src/main/java/org/apache/rocketmq/tools/command/auth/DeleteUserSubCommand.java:92-101 | tools/src/main/java/org/apache/rocketmq/tools/command/auth/UpdateAclSubCommand.java:136-145 | tools/src/main/java/org/apache/rocketmq/tools/command/auth/UpdateUserSubCommand.java:110-119 | tools/src/main/java/org/apache/rocketmq/tools/command/topic/UpdateTopicPermSubCommand.java:158-166 — before extracting anything, compare `tools/src/main/java/org/apache/rocketmq/tools/command/auth/CopyAclsSubCommand.java` and `tools/src/main/java/org/apache/rocketmq/tools/command/auth/CopyUsersSubCommand.java` as WHOLE FILES: this scan already matched 8 separate duplicated blocks between them, totalling at least 66 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/auth/CopyAclsSubCommand.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 (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–9 lines × 3) example/src/main/java/org/apache/rocketmq/example/lmq/LMQPushConsumer.java:60— example/src/main/java/org/apache/rocketmq/example/lmq/LMQPushConsumer.java:60-68 | example/src/main/java/org/apache/rocketmq/example/lmq/LMQPushPopConsumer.java:61-68 | example/src/main/java/org/apache/rocketmq/example/simple/PopConsumer.java:40-47 — 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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `example/src/main/java/org/apache/rocketmq/example/lmq/LMQPushPopConsumer.java:70` calls `setClientRebalance` and `example/src/main/java/org/apache/rocketmq/example/lmq/LMQPushConsumer.java:69` 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–9 lines × 2) tools/src/main/java/org/apache/rocketmq/tools/command/broker/SwitchTimerEngineSubCommand.java:79— tools/src/main/java/org/apache/rocketmq/tools/command/broker/SwitchTimerEngineSubCommand.java:79-84 | tools/src/main/java/org/apache/rocketmq/tools/command/consumer/DeleteSubscriptionGroupCommand.java:83-91 — 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/broker/SwitchTimerEngineSubCommand.java:79` 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 (8 lines × 25) 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/auth/CopyAclsSubCommand.java:50-57 | tools/src/main/java/org/apache/rocketmq/tools/command/auth/CopyUsersSubCommand.java:50-57 | tools/src/main/java/org/apache/rocketmq/tools/command/auth/CreateAclSubCommand.java:66-73 | tools/src/main/java/org/apache/rocketmq/tools/command/auth/CreateUserSubCommand.java:59-66 | tools/src/main/java/org/apache/rocketmq/tools/command/auth/UpdateAclSubCommand.java:70-77 | 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:56-63 | tools/src/main/java/org/apache/rocketmq/tools/command/controller/CleanControllerBrokerMetaSubCommand.java:52-59 | tools/src/main/java/org/apache/rocketmq/tools/command/lite/GetLiteGroupInfoSubCommand.java:54-61 | tools/src/main/java/org/apache/rocketmq/tools/command/lite/TriggerLiteDispatchSubCommand.java:45-52 | tools/src/main/java/org/apache/rocketmq/tools/command/message/PrintMessageByQueueCommand.java:122-129 | tools/src/main/java/org/apache/rocketmq/tools/command/message/QueryMsgByIdSubCommand.java:198-205 | tools/src/main/java/org/apache/rocketmq/tools/command/message/QueryMsgByKeySubCommand.java:51-58 | tools/src/main/java/org/apache/rocketmq/tools/command/message/QueryMsgByOffsetSubCommand.java:58-65 | 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:88-95 | 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:66-73 | 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 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 25 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 25 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/offset/CloneGroupOffsetCommand.java:62` calls `addOption` and `tools/src/main/java/org/apache/rocketmq/tools/command/auth/CopyAclsSubCommand.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 × 18) 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/auth/CreateAclSubCommand.java:62-69 | tools/src/main/java/org/apache/rocketmq/tools/command/auth/UpdateAclSubCommand.java:62-69 | 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/lite/GetLiteClientInfoSubCommand.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:50-57 | 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:84-91 | tools/src/main/java/org/apache/rocketmq/tools/command/queue/QueryConsumeQueueCommand.java:62-69 | 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 6 separate duplicated blocks between them, totalling at least 61 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 × 12) tools/src/main/java/org/apache/rocketmq/tools/command/auth/CopyAclsSubCommand.java:52— tools/src/main/java/org/apache/rocketmq/tools/command/auth/CopyAclsSubCommand.java:52-61 | tools/src/main/java/org/apache/rocketmq/tools/command/auth/CopyUsersSubCommand.java:52-61 | tools/src/main/java/org/apache/rocketmq/tools/command/auth/CreateUserSubCommand.java:61-70 | tools/src/main/java/org/apache/rocketmq/tools/command/auth/DeleteAclSubCommand.java:57-66 | tools/src/main/java/org/apache/rocketmq/tools/command/auth/UpdateAclSubCommand.java:72-81 | 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:67-75 | tools/src/main/java/org/apache/rocketmq/tools/command/offset/GetConsumerStatusCommand.java:48-57 | tools/src/main/java/org/apache/rocketmq/tools/command/topic/TopicStatusSubCommand.java:51-58 — before extracting anything, compare `tools/src/main/java/org/apache/rocketmq/tools/command/auth/CopyAclsSubCommand.java` and `tools/src/main/java/org/apache/rocketmq/tools/command/auth/CopyUsersSubCommand.java` as WHOLE FILES: this scan already matched 8 separate duplicated blocks between them, totalling at least 66 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/auth/CopyAclsSubCommand.java:52` 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/auth/CopyAclsSubCommand.java:50` 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 (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:55-62 | 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 6 separate duplicated blocks between them, totalling at least 61 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 × 8) 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/lite/GetLiteClientInfoSubCommand.java:66-73 | tools/src/main/java/org/apache/rocketmq/tools/command/lite/GetLiteGroupInfoSubCommand.java:73-80 | tools/src/main/java/org/apache/rocketmq/tools/command/lite/GetLiteTopicInfoSubCommand.java:67-73 | tools/src/main/java/org/apache/rocketmq/tools/command/lite/TriggerLiteDispatchSubCommand.java:64-71 | 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/lite/GetLiteClientInfoSubCommand.java` and `tools/src/main/java/org/apache/rocketmq/tools/command/lite/GetLiteGroupInfoSubCommand.java` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 30 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. ★ 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/lite/GetLiteClientInfoSubCommand.java:74` calls `getOptionValue`, `trim` and `tools/src/main/java/org/apache/rocketmq/tools/command/lite/GetLiteTopicInfoSubCommand.java:74` 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 × 27) 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/auth/CopyAclsSubCommand.java:52-58 | tools/src/main/java/org/apache/rocketmq/tools/command/auth/CopyUsersSubCommand.java:52-58 | tools/src/main/java/org/apache/rocketmq/tools/command/auth/CreateAclSubCommand.java:68-74 | tools/src/main/java/org/apache/rocketmq/tools/command/auth/CreateUserSubCommand.java:61-67 | tools/src/main/java/org/apache/rocketmq/tools/command/auth/DeleteAclSubCommand.java:57-63 | tools/src/main/java/org/apache/rocketmq/tools/command/auth/UpdateAclSubCommand.java:72-78 | 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:58-64 | tools/src/main/java/org/apache/rocketmq/tools/command/controller/CleanControllerBrokerMetaSubCommand.java:54-60 | tools/src/main/java/org/apache/rocketmq/tools/command/lite/GetLiteGroupInfoSubCommand.java:56-62 | tools/src/main/java/org/apache/rocketmq/tools/command/lite/TriggerLiteDispatchSubCommand.java:47-53 | tools/src/main/java/org/apache/rocketmq/tools/command/message/PrintMessageByQueueCommand.java:124-130 | tools/src/main/java/org/apache/rocketmq/tools/command/message/QueryMsgByIdSubCommand.java:200-206 | tools/src/main/java/org/apache/rocketmq/tools/command/message/QueryMsgByKeySubCommand.java:53-59 | tools/src/main/java/org/apache/rocketmq/tools/command/message/QueryMsgByOffsetSubCommand.java:60-66 | 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:90-96 | 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:68-74 | 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 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 27 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 27 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/auth/CreateAclSubCommand.java:76` calls `Option`, `setRequired`, `addOption` and `tools/src/main/java/org/apache/rocketmq/tools/command/auth/CopyAclsSubCommand.java:60` 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 × 21) tools/src/main/java/org/apache/rocketmq/tools/command/auth/CopyAclsSubCommand.java:48— tools/src/main/java/org/apache/rocketmq/tools/command/auth/CopyAclsSubCommand.java:48-54 | tools/src/main/java/org/apache/rocketmq/tools/command/auth/CopyUsersSubCommand.java:48-54 | tools/src/main/java/org/apache/rocketmq/tools/command/controller/ReElectMasterSubCommand.java:45-51 | tools/src/main/java/org/apache/rocketmq/tools/command/controller/UpdateControllerConfigSubCommand.java:45-51 | tools/src/main/java/org/apache/rocketmq/tools/command/lite/GetLiteClientInfoSubCommand.java:45-51 | tools/src/main/java/org/apache/rocketmq/tools/command/lite/GetLiteGroupInfoSubCommand.java:52-58 | tools/src/main/java/org/apache/rocketmq/tools/command/lite/GetLiteTopicInfoSubCommand.java:50-56 | tools/src/main/java/org/apache/rocketmq/tools/command/lite/TriggerLiteDispatchSubCommand.java:43-49 | tools/src/main/java/org/apache/rocketmq/tools/command/message/PrintMessageByQueueCommand.java:116-122 | tools/src/main/java/org/apache/rocketmq/tools/command/message/QueryMsgByIdSubCommand.java:196-202 | tools/src/main/java/org/apache/rocketmq/tools/command/message/QueryMsgByKeySubCommand.java:49-55 | tools/src/main/java/org/apache/rocketmq/tools/command/message/QueryMsgByOffsetSubCommand.java:48-54 | tools/src/main/java/org/apache/rocketmq/tools/command/message/SendMessageCommand.java:49-55 | tools/src/main/java/org/apache/rocketmq/tools/command/namesrv/UpdateKvConfigCommand.java:40-46 | tools/src/main/java/org/apache/rocketmq/tools/command/offset/CloneGroupOffsetCommand.java:46-52 | tools/src/main/java/org/apache/rocketmq/tools/command/offset/GetConsumerStatusCommand.java:44-50 | tools/src/main/java/org/apache/rocketmq/tools/command/offset/ResetOffsetByTimeCommand.java:48-54 | tools/src/main/java/org/apache/rocketmq/tools/command/offset/ResetOffsetByTimeOldCommand.java:82-88 | tools/src/main/java/org/apache/rocketmq/tools/command/offset/SkipAccumulationSubCommand.java:49-55 | tools/src/main/java/org/apache/rocketmq/tools/command/queue/CheckRocksdbCqWriteProgressCommand.java:48-54 | tools/src/main/java/org/apache/rocketmq/tools/command/queue/QueryConsumeQueueCommand.java:60-66 — before extracting anything, compare `tools/src/main/java/org/apache/rocketmq/tools/command/auth/CopyAclsSubCommand.java` and `tools/src/main/java/org/apache/rocketmq/tools/command/auth/CopyUsersSubCommand.java` as WHOLE FILES: this scan already matched 8 separate duplicated blocks between them, totalling at least 66 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:54` calls `setRequired` and `tools/src/main/java/org/apache/rocketmq/tools/command/queue/CheckRocksdbCqWriteProgressCommand.java:57` 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 × 20) 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/auth/CreateAclSubCommand.java:60-66 | tools/src/main/java/org/apache/rocketmq/tools/command/auth/CreateUserSubCommand.java:57-63 | tools/src/main/java/org/apache/rocketmq/tools/command/auth/UpdateAclSubCommand.java:60-66 | 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/lite/GetLiteClientInfoSubCommand.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:52-58 | 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:86-92 | tools/src/main/java/org/apache/rocketmq/tools/command/queue/QueryConsumeQueueCommand.java:64-70 | 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 6 separate duplicated blocks between them, totalling at least 61 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/auth/CreateUserSubCommand.java:65` 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 × 16) tools/src/main/java/org/apache/rocketmq/tools/command/auth/CreateAclSubCommand.java:52— tools/src/main/java/org/apache/rocketmq/tools/command/auth/CreateAclSubCommand.java:52-60 | tools/src/main/java/org/apache/rocketmq/tools/command/auth/CreateUserSubCommand.java:49-57 | tools/src/main/java/org/apache/rocketmq/tools/command/auth/DeleteAclSubCommand.java:49-57 | tools/src/main/java/org/apache/rocketmq/tools/command/auth/DeleteUserSubCommand.java:49-57 | tools/src/main/java/org/apache/rocketmq/tools/command/auth/GetAclSubCommand.java:54-62 | tools/src/main/java/org/apache/rocketmq/tools/command/auth/GetUserSubCommand.java:53-61 | tools/src/main/java/org/apache/rocketmq/tools/command/auth/ListAclSubCommand.java:54-62 | tools/src/main/java/org/apache/rocketmq/tools/command/auth/ListUserSubCommand.java:54-62 | tools/src/main/java/org/apache/rocketmq/tools/command/auth/UpdateAclSubCommand.java:52-60 | tools/src/main/java/org/apache/rocketmq/tools/command/auth/UpdateUserSubCommand.java:49-57 | tools/src/main/java/org/apache/rocketmq/tools/command/broker/SwitchTimerEngineSubCommand.java:49-57 | tools/src/main/java/org/apache/rocketmq/tools/command/consumer/UpdateSubGroupListSubCommand.java:53-61 | tools/src/main/java/org/apache/rocketmq/tools/command/topic/RemappingStaticTopicSubCommand.java:60-68 | tools/src/main/java/org/apache/rocketmq/tools/command/topic/UpdateStaticTopicSubCommand.java:61-69 | tools/src/main/java/org/apache/rocketmq/tools/command/topic/UpdateTopicListSubCommand.java:53-59 | 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/auth/CreateAclSubCommand.java` and `tools/src/main/java/org/apache/rocketmq/tools/command/auth/CreateUserSubCommand.java` as WHOLE FILES: this scan already matched 13 separate duplicated blocks between them, totalling at least 114 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 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/auth/DeleteUserSubCommand.java:58` calls `setRequired` and `tools/src/main/java/org/apache/rocketmq/tools/command/auth/GetAclSubCommand.java:63` 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 (7 lines × 14) 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/auth/CreateAclSubCommand.java:72-78 | 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:54-60 | 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:171-177 | 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 — 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/auth/CreateAclSubCommand.java` as WHOLE FILES: this scan already matched 10 separate duplicated blocks between them, totalling at least 75 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/broker/UpdateBrokerConfigSubCommand.java:61` calls `Option`, `setRequired`, `addOption` and `tools/src/main/java/org/apache/rocketmq/tools/command/auth/CreateAclSubCommand.java:80` 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 × 7) 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/SwitchTimerEngineSubCommand.java:80-85 | 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:201-209 | 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 7 separate duplicated blocks between them, totalling at least 71 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 (5 lines × 17) tools/src/main/java/org/apache/rocketmq/tools/command/auth/CreateAclSubCommand.java:52— tools/src/main/java/org/apache/rocketmq/tools/command/auth/CreateAclSubCommand.java:52-58 | tools/src/main/java/org/apache/rocketmq/tools/command/auth/CreateUserSubCommand.java:49-55 | tools/src/main/java/org/apache/rocketmq/tools/command/auth/DeleteAclSubCommand.java:49-55 | tools/src/main/java/org/apache/rocketmq/tools/command/auth/DeleteUserSubCommand.java:49-55 | tools/src/main/java/org/apache/rocketmq/tools/command/auth/GetAclSubCommand.java:54-60 | tools/src/main/java/org/apache/rocketmq/tools/command/auth/GetUserSubCommand.java:53-59 | tools/src/main/java/org/apache/rocketmq/tools/command/auth/ListAclSubCommand.java:54-60 | tools/src/main/java/org/apache/rocketmq/tools/command/auth/ListUserSubCommand.java:54-60 | tools/src/main/java/org/apache/rocketmq/tools/command/auth/UpdateAclSubCommand.java:52-58 | tools/src/main/java/org/apache/rocketmq/tools/command/auth/UpdateUserSubCommand.java:49-55 | tools/src/main/java/org/apache/rocketmq/tools/command/broker/SwitchTimerEngineSubCommand.java:49-55 | tools/src/main/java/org/apache/rocketmq/tools/command/consumer/UpdateSubGroupListSubCommand.java:53-58 | tools/src/main/java/org/apache/rocketmq/tools/command/lite/GetBrokerLiteInfoSubCommand.java:49-55 | tools/src/main/java/org/apache/rocketmq/tools/command/topic/RemappingStaticTopicSubCommand.java:59-66 | tools/src/main/java/org/apache/rocketmq/tools/command/topic/UpdateStaticTopicSubCommand.java:60-67 | tools/src/main/java/org/apache/rocketmq/tools/command/topic/UpdateTopicListSubCommand.java:53-57 | tools/src/main/java/org/apache/rocketmq/tools/command/topic/UpdateTopicSubCommand.java:53-59 — before extracting anything, compare `tools/src/main/java/org/apache/rocketmq/tools/command/auth/CreateAclSubCommand.java` and `tools/src/main/java/org/apache/rocketmq/tools/command/auth/CreateUserSubCommand.java` as WHOLE FILES: this scan already matched 13 separate duplicated blocks between them, totalling at least 114 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/auth/DeleteUserSubCommand.java:58` calls `setRequired` and `tools/src/main/java/org/apache/rocketmq/tools/command/auth/GetAclSubCommand.java:63` 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 (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/lite/GetParentTopicInfoSubCommand.java:44-50 | 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 — 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.
Off the main sequence: rocketmq-remoting — rocketmq-remoting: abstractness 0.07, instability 0.20, distance 0.73 — zone of pain — concrete and depended on by 4 project(s), so it's rigid to change.
IC1 · Incompleteness & stubs· Empty method body · ×1
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.
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 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 controller/src/main/java/org/apache/rocketmq/controller/impl/manager/ReplicasInfoManager.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/DefaultMQPullConsumerImpl.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/MappedFileQueue.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/protocol/statictopic/TopicQueueMappingUtils.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/MQAdminExt.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/message/MessageDecoder.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 controller/src/main/java/org/apache/rocketmq/controller/impl/DLedgerController.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/MixAll.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/UtilAll.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/admin/MqClientAdminImpl.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/StoreStatsService.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/protocol/RemotingCommand.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/ClientConfig.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/ConsumeQueueExt.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/ProduceAccumulator.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/consumer/DefaultMQPullConsumer.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/MQAdminUtils.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/queue/RocksDBConsumeQueueTable.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 controller/src/main/java/org/apache/rocketmq/controller/ControllerManager.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 controller/src/main/java/org/apache/rocketmq/controller/processor/ControllerRequestProcessor.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/ReplyMessageProcessor.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 tieredstore/src/main/java/org/apache/rocketmq/tieredstore/metrics/TieredStoreMetricsManager.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 controller/src/main/java/org/apache/rocketmq/controller/impl/JRaftControllerStateMachine.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/ConsumerManageProcessor.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.
Duplicated predicate broker/src/main/java/org/apache/rocketmq/broker/config/v2/ConsumerOffsetManagerV2.java:458— `!MixAll.isLmq(topic) || !MixAll.isLmq(group)` appears character-identically in 2 files — broker/src/main/java/org/apache/rocketmq/broker/config/v2/ConsumerOffsetManagerV2.java, broker/src/main/java/org/apache/rocketmq/broker/offset/LmqConsumerOffsetManager.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 proxy/src/main/java/org/apache/rocketmq/proxy/processor/ProducerProcessor.java:80— `!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/impl/MQAdminImpl.java:472— `!StringUtils.isEmpty(indexType) && MessageConst.INDEX_TAG_TYPE.equals(indexType)` appears character-identically in 2 files — client/src/main/java/org/apache/rocketmq/client/impl/MQAdminImpl.java, store/src/main/java/org/apache/rocketmq/store/index/IndexService.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:221— `!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/config/v1/RocksDBConsumerOffsetManager.java:96— `!UtilAll.isPathExists(this.configFilePath()) && !UtilAll.isPathExists(this.configFilePath() + ".bak")` appears character-identically in 3 files — broker/src/main/java/org/apache/rocketmq/broker/config/v1/RocksDBConsumerOffsetManager.java, broker/src/main/java/org/apache/rocketmq/broker/config/v1/RocksDBSubscriptionGroupManager.java, broker/src/main/java/org/apache/rocketmq/broker/config/v1/RocksDBTopicConfigManager.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:1981— `!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:1213— `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 broker/src/main/java/org/apache/rocketmq/broker/pop/PopConsumerService.java:174— `GetMessageStatus.FOUND.equals(result.getStatus()) && !result.getMessageQueueOffset().isEmpty()` appears character-identically in 2 files — broker/src/main/java/org/apache/rocketmq/broker/pop/PopConsumerService.java, broker/src/main/java/org/apache/rocketmq/broker/processor/PopLiteMessageProcessor.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/pop/PopConsumerService.java:253— `GetMessageStatus.OFFSET_TOO_SMALL.equals(result.getStatus()) || GetMessageStatus.OFFSET_OVERFLOW_BADLY.equals(result.getStatus()) || GetMess…` appears character-identically in 2 files — broker/src/main/java/org/apache/rocketmq/broker/pop/PopConsumerService.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 auth/src/main/java/org/apache/rocketmq/auth/authentication/context/AuthenticationContext.java:63— `StringUtils.isBlank(key) || value == null` appears character-identically in 2 files — auth/src/main/java/org/apache/rocketmq/auth/authentication/context/AuthenticationContext.java, auth/src/main/java/org/apache/rocketmq/auth/authorization/context/AuthorizationContext.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:2813— `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 broker/src/main/java/org/apache/rocketmq/broker/processor/AdminBrokerProcessor.java:3671— `StringUtils.isEmpty(engineType) || !MessageConst.TIMER_ENGINE_ROCKSDB_TIMELINE.equals(engineType) && !MessageConst.TIMER_ENGINE_FILE_TIME_WH…` appears character-identically in 2 files — broker/src/main/java/org/apache/rocketmq/broker/processor/AdminBrokerProcessor.java, tools/src/main/java/org/apache/rocketmq/tools/command/broker/SwitchTimerEngineSubCommand.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/config/v2/ConsumerOffsetManagerV2.java:453— `Strings.isNullOrEmpty(topic) || Strings.isNullOrEmpty(group) || queueId < 0 || offset < 0` appears character-identically in 3 files — broker/src/main/java/org/apache/rocketmq/broker/config/v2/ConsumerOffsetManagerV2.java, broker/src/main/java/org/apache/rocketmq/broker/offset/ConsumerOffsetManager.java, broker/src/main/java/org/apache/rocketmq/broker/offset/LmqConsumerOffsetManager.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:523— `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:128— `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:258— `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 broker/src/main/java/org/apache/rocketmq/broker/offset/ConsumerOffsetManager.java:79— `arrays.length == 2 && group.equals(arrays[1])` appears character-identically in 2 files — broker/src/main/java/org/apache/rocketmq/broker/offset/ConsumerOffsetManager.java, broker/src/main/java/org/apache/rocketmq/broker/offset/LmqConsumerOffsetManager.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:1232— `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/subscription/SubscriptionGroupManager.java:326— `beginIndex != 0 && (StringUtils.isBlank(dataVersion) || !Objects.equals(DataVersion.fromJson(dataVersion, DataVersion.class), getDataVersion…` appears character-identically in 2 files — broker/src/main/java/org/apache/rocketmq/broker/subscription/SubscriptionGroupManager.java, broker/src/main/java/org/apache/rocketmq/broker/topic/TopicConfigManager.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/metrics/ConsumerLagCalculator.java:210— `brokerConfig.isEnableRetryTopicV2() && brokerConfig.isRetrieveMessageFromPopRetryTopicV1()` appears character-identically in 2 files — broker/src/main/java/org/apache/rocketmq/broker/metrics/ConsumerLagCalculator.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/longpolling/LmqPullRequestHoldService.java:34— `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:944— `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 proxy/src/main/java/org/apache/rocketmq/proxy/grpc/admin/ProxyAdminGrpcService.java:227— `clusterInfo == null || clusterInfo.getBrokerAddrTable() == null` appears character-identically in 3 files — proxy/src/main/java/org/apache/rocketmq/proxy/grpc/admin/ProxyAdminGrpcService.java, remoting/src/main/java/org/apache/rocketmq/remoting/rpc/ClientMetadata.java, tools/src/main/java/org/apache/rocketmq/tools/command/topic/GetTopicConfigSubCommand.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.
Interpolated log message defeats structured logging store/src/main/java/org/apache/rocketmq/store/AllocateMappedFileService.java:114— `warn` at line 114 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 store/src/main/java/org/apache/rocketmq/store/AllocateMappedFileService.java:125— `warn` at line 125 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 store/src/main/java/org/apache/rocketmq/store/AllocateMappedFileService.java:135— `warn` at line 135 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 store/src/main/java/org/apache/rocketmq/store/AllocateMappedFileService.java:162— `info` 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.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 store/src/main/java/org/apache/rocketmq/store/AllocateMappedFileService.java:167— `info` at line 167 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 store/src/main/java/org/apache/rocketmq/store/AllocateMappedFileService.java:180— `warn` at line 180 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 store/src/main/java/org/apache/rocketmq/store/AllocateMappedFileService.java:185— `warn` 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.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 store/src/main/java/org/apache/rocketmq/store/AllocateMappedFileService.java:212— `warn` at line 212 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 store/src/main/java/org/apache/rocketmq/store/AllocateMappedFileService.java:232— `warn` at line 232 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 store/src/main/java/org/apache/rocketmq/store/AllocateMappedFileService.java:236— `warn` at line 236 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 store/src/main/java/org/apache/rocketmq/store/CommitLog.java:787— `info` at line 787 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 store/src/main/java/org/apache/rocketmq/store/ConsumeQueue.java:129— `info` at line 129 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 store/src/main/java/org/apache/rocketmq/store/ConsumeQueue.java:165— `info` at line 165 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 store/src/main/java/org/apache/rocketmq/store/ConsumeQueue.java:175— `info` at line 175 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 store/src/main/java/org/apache/rocketmq/store/ConsumeQueue.java:183— `info` at line 183 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 store/src/main/java/org/apache/rocketmq/store/ConsumeQueue.java:186— `info` at line 186 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 store/src/main/java/org/apache/rocketmq/store/ConsumeQueue.java:759— `warn` at line 759 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 store/src/main/java/org/apache/rocketmq/store/ConsumeQueue.java:810— `warn` at line 810 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 store/src/main/java/org/apache/rocketmq/store/ConsumeQueue.java:870— `info` at line 870 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 store/src/main/java/org/apache/rocketmq/store/ConsumeQueueExt.java:274— `error` at line 274 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 store/src/main/java/org/apache/rocketmq/store/ConsumeQueueExt.java:295— `info` at line 295 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 store/src/main/java/org/apache/rocketmq/store/ConsumeQueueExt.java:338— `info` 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.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 store/src/main/java/org/apache/rocketmq/store/ConsumeQueueExt.java:342— `info` at line 342 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 store/src/main/java/org/apache/rocketmq/store/DefaultMessageStore.java:874— `warn` at line 874 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 store/src/main/java/org/apache/rocketmq/store/DefaultMessageStore.java:938— `warn` at line 938 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.
+ 15 more in this group — see findings.md.
P10 · Library API & versioning· Implementation type on the public API · ×32
Implementation type on the public API auth/src/main/java/org/apache/rocketmq/auth/authentication/manager/AuthenticationMetadataManagerImpl.java:35— 1 public type in `org.apache.rocketmq.auth.authentication.manager` is marked as implementation by its own namespace, folder or name: `AuthenticationMetadataManagerImpl` (auth/src/main/java/org/apache/rocketmq/auth/authentication/manager/AuthenticationMetadataManagerImpl.java:35, name ends in `Impl`). While it is public, every consumer of the library can bind to it, so changing it is a breaking change for those consumers.
Implementation type on the public API auth/src/main/java/org/apache/rocketmq/auth/authorization/manager/AuthorizationMetadataManagerImpl.java:42— 1 public type in `org.apache.rocketmq.auth.authorization.manager` is marked as implementation by its own namespace, folder or name: `AuthorizationMetadataManagerImpl` (auth/src/main/java/org/apache/rocketmq/auth/authorization/manager/AuthorizationMetadataManagerImpl.java:42, name ends in `Impl`). While it is public, every consumer of the library can bind to it, so changing it is a breaking change for those consumers.
Implementation type on the public API broker/src/main/java/org/apache/rocketmq/broker/lite/LiteShardingImpl.java:31— 2 public types in `org.apache.rocketmq.broker.lite` are marked as implementation by their own namespace, folder or name: `LiteShardingImpl` (broker/src/main/java/org/apache/rocketmq/broker/lite/LiteShardingImpl.java:31, name ends in `Impl`), `LiteSubscriptionRegistryImpl` (broker/src/main/java/org/apache/rocketmq/broker/lite/LiteSubscriptionRegistryImpl.java:51, name ends in `Impl`). While they are public, every consumer of the library can bind to them, so changing them is a breaking change for those consumers.
Implementation type on the public API broker/src/main/java/org/apache/rocketmq/broker/transaction/queue/TransactionalMessageServiceImpl.java:54— 1 public type in `org.apache.rocketmq.broker.transaction.queue` is marked as implementation by its own namespace, folder or name: `TransactionalMessageServiceImpl` (broker/src/main/java/org/apache/rocketmq/broker/transaction/queue/TransactionalMessageServiceImpl.java:54, name ends in `Impl`). While it is public, every consumer of the library can bind to it, so changing it is a breaking change for those consumers.
Implementation type on the public API client/src/main/java/org/apache/rocketmq/client/consumer/MQPullConsumerScheduleService.java:163— 1 public type in `org.apache.rocketmq.client.consumer` is marked as implementation by its own namespace, folder or name: `PullTaskImpl` (client/src/main/java/org/apache/rocketmq/client/consumer/MQPullConsumerScheduleService.java:163, name ends in `Impl`). While it is public, every consumer of the library can bind to it, so changing it is a breaking change for those consumers.
Implementation type on the public API client/src/main/java/org/apache/rocketmq/client/impl/ClientRemotingProcessor.java:60— 6 public types in `org.apache.rocketmq.client.impl` are marked as implementation by their own namespace, folder or name: `ClientRemotingProcessor` (client/src/main/java/org/apache/rocketmq/client/impl/ClientRemotingProcessor.java:60, `impl`), `CommunicationMode` (client/src/main/java/org/apache/rocketmq/client/impl/CommunicationMode.java:19, `impl`), `FindBrokerResult` (client/src/main/java/org/apache/rocketmq/client/impl/FindBrokerResult.java:19, `impl`), `MQAdminImpl` (client/src/main/java/org/apache/rocketmq/client/impl/MQAdminImpl.java:63, `impl`), `MQClientAPIImpl` (client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:275, `impl`), `MQClientManager` (client/src/main/java/org/apache/rocketmq/client/impl/MQClientManager.java:29, `impl`). While they are public, every consumer of the library can bind to them, so changing them is a breaking change for those consumers.
Implementation type on the public API client/src/main/java/org/apache/rocketmq/client/impl/admin/MqClientAdminImpl.java:73— 1 public type in `org.apache.rocketmq.client.impl.admin` is marked as implementation by its own namespace, folder or name: `MqClientAdminImpl` (client/src/main/java/org/apache/rocketmq/client/impl/admin/MqClientAdminImpl.java:73, `impl`). While it is public, every consumer of the library can bind to it, so changing it is a breaking change for those consumers.
Implementation type on the public API client/src/main/java/org/apache/rocketmq/client/impl/consumer/AbstractConsumeMessageService.java:27— 26 public types in `org.apache.rocketmq.client.impl.consumer` are marked as implementation by their own namespace, folder or name: `AbstractConsumeMessageService` (client/src/main/java/org/apache/rocketmq/client/impl/consumer/AbstractConsumeMessageService.java:27, `impl`), `AssignedMessageQueue` (client/src/main/java/org/apache/rocketmq/client/impl/consumer/AssignedMessageQueue.java:26, `impl`), `ConsumeMessageConcurrentlyService` (client/src/main/java/org/apache/rocketmq/client/impl/consumer/ConsumeMessageConcurrentlyService.java:46, `impl`), `ConsumeMessageOrderlyService` (client/src/main/java/org/apache/rocketmq/client/impl/consumer/ConsumeMessageOrderlyService.java:48, `impl`), `ConsumeMessagePopConcurrentlyService` (client/src/main/java/org/apache/rocketmq/client/impl/consumer/ConsumeMessagePopConcurrentlyService.java:48, `impl`), `ConsumeMessagePopOrderlyService` (client/src/main/java/org/apache/rocketmq/client/impl/consumer/ConsumeMessagePopOrderlyService.java:45, `impl`), `ConsumeMessageService` (client/src/main/java/org/apache/rocketmq/client/impl/consumer/ConsumeMessageService.java:24, `impl`), `DefaultLitePullConsumerImpl` (client/src/main/java/org/apache/rocketmq/client/impl/consumer/DefaultLitePullConsumerImpl.java:79, `impl`), and 18 more. While they are public, every consumer of the library can bind to them, so changing them is a breaking change for those consumers.
Implementation type on the public API client/src/main/java/org/apache/rocketmq/client/impl/factory/MQClientInstance.java:96— 1 public type in `org.apache.rocketmq.client.impl.factory` is marked as implementation by its own namespace, folder or name: `MQClientInstance` (client/src/main/java/org/apache/rocketmq/client/impl/factory/MQClientInstance.java:96, `impl`). While it is public, every consumer of the library can bind to it, so changing it is a breaking change for those consumers.
Implementation type on the public API client/src/main/java/org/apache/rocketmq/client/impl/mqclient/DoNothingClientRemotingProcessor.java:24— 3 public types in `org.apache.rocketmq.client.impl.mqclient` are marked as implementation by their own namespace, folder or name: `DoNothingClientRemotingProcessor` (client/src/main/java/org/apache/rocketmq/client/impl/mqclient/DoNothingClientRemotingProcessor.java:24, `impl`), `MQClientAPIExt` (client/src/main/java/org/apache/rocketmq/client/impl/mqclient/MQClientAPIExt.java:97, `impl`), `MQClientAPIFactory` (client/src/main/java/org/apache/rocketmq/client/impl/mqclient/MQClientAPIFactory.java:36, `impl`). While they are public, every consumer of the library can bind to them, so changing them is a breaking change for those consumers.
Implementation type on the public API client/src/main/java/org/apache/rocketmq/client/impl/producer/DefaultMQProducerImpl.java:101— 4 public types in `org.apache.rocketmq.client.impl.producer` are marked as implementation by their own namespace, folder or name: `DefaultMQProducerImpl` (client/src/main/java/org/apache/rocketmq/client/impl/producer/DefaultMQProducerImpl.java:101, `impl`), `MQProducerInner` (client/src/main/java/org/apache/rocketmq/client/impl/producer/MQProducerInner.java:25, `impl`), `TopicPublishInfo` (client/src/main/java/org/apache/rocketmq/client/impl/producer/TopicPublishInfo.java:28, `impl`), `QueueFilter` (client/src/main/java/org/apache/rocketmq/client/impl/producer/TopicPublishInfo.java:35, `impl`). While they are public, every consumer of the library can bind to them, so changing them is a breaking change for those consumers.
Implementation type on the public API client/src/main/java/org/apache/rocketmq/client/latency/LatencyFaultToleranceImpl.java:34— 1 public type in `org.apache.rocketmq.client.latency` is marked as implementation by its own namespace, folder or name: `LatencyFaultToleranceImpl` (client/src/main/java/org/apache/rocketmq/client/latency/LatencyFaultToleranceImpl.java:34, name ends in `Impl`). While it is public, every consumer of the library can bind to it, so changing it is a breaking change for those consumers.
Implementation type on the public API client/src/main/java/org/apache/rocketmq/client/trace/hook/ConsumeMessageOpenTracingHookImpl.java:35— 6 public types in `org.apache.rocketmq.client.trace.hook` are marked as implementation by their own namespace, folder or name: `ConsumeMessageOpenTracingHookImpl` (client/src/main/java/org/apache/rocketmq/client/trace/hook/ConsumeMessageOpenTracingHookImpl.java:35, name ends in `Impl`), `ConsumeMessageTraceHookImpl` (client/src/main/java/org/apache/rocketmq/client/trace/hook/ConsumeMessageTraceHookImpl.java:34, name ends in `Impl`), `EndTransactionOpenTracingHookImpl` (client/src/main/java/org/apache/rocketmq/client/trace/hook/EndTransactionOpenTracingHookImpl.java:31, name ends in `Impl`), `EndTransactionTraceHookImpl` (client/src/main/java/org/apache/rocketmq/client/trace/hook/EndTransactionTraceHookImpl.java:33, name ends in `Impl`), `SendMessageOpenTracingHookImpl` (client/src/main/java/org/apache/rocketmq/client/trace/hook/SendMessageOpenTracingHookImpl.java:31, name ends in `Impl`), `SendMessageTraceHookImpl` (client/src/main/java/org/apache/rocketmq/client/trace/hook/SendMessageTraceHookImpl.java:30, name ends in `Impl`). While they are public, every consumer of the library can bind to them, so changing them is a breaking change for those consumers.
Implementation type on the public API common/src/main/java/org/apache/rocketmq/common/ThreadFactoryImpl.java:26— 1 public type in `org.apache.rocketmq.common` is marked as implementation by its own namespace, folder or name: `ThreadFactoryImpl` (common/src/main/java/org/apache/rocketmq/common/ThreadFactoryImpl.java:26, name ends in `Impl`). While it is public, every consumer of the library can bind to it, so changing it is a breaking change for those consumers.
Implementation type on the public API common/src/main/java/org/apache/rocketmq/common/filter/impl/Op.java:20— 5 public types in `org.apache.rocketmq.common.filter.impl` are marked as implementation by their own namespace, folder or name: `Op` (common/src/main/java/org/apache/rocketmq/common/filter/impl/Op.java:20, `impl`), `Operand` (common/src/main/java/org/apache/rocketmq/common/filter/impl/Operand.java:20, `impl`), `Operator` (common/src/main/java/org/apache/rocketmq/common/filter/impl/Operator.java:20, `impl`), `PolishExpr` (common/src/main/java/org/apache/rocketmq/common/filter/impl/PolishExpr.java:28, `impl`), `Type` (common/src/main/java/org/apache/rocketmq/common/filter/impl/Type.java:20, `impl`). While they are public, every consumer of the library can bind to them, so changing them is a breaking change for those consumers.
Implementation type on the public API controller/src/main/java/org/apache/rocketmq/controller/elect/impl/DefaultElectPolicy.java:29— 1 public type in `org.apache.rocketmq.controller.elect.impl` is marked as implementation by its own namespace, folder or name: `DefaultElectPolicy` (controller/src/main/java/org/apache/rocketmq/controller/elect/impl/DefaultElectPolicy.java:29, `impl`). While it is public, every consumer of the library can bind to it, so changing it is a breaking change for those consumers.
Implementation type on the public API controller/src/main/java/org/apache/rocketmq/controller/impl/DLedgerController.java:87— 4 public types in `org.apache.rocketmq.controller.impl` are marked as implementation by their own namespace, folder or name: `DLedgerController` (controller/src/main/java/org/apache/rocketmq/controller/impl/DLedgerController.java:87, `impl`), `DLedgerControllerStateMachine` (controller/src/main/java/org/apache/rocketmq/controller/impl/DLedgerControllerStateMachine.java:35, `impl`), `JRaftController` (controller/src/main/java/org/apache/rocketmq/controller/impl/JRaftController.java:67, `impl`), `JRaftControllerStateMachine` (controller/src/main/java/org/apache/rocketmq/controller/impl/JRaftControllerStateMachine.java:78, `impl`). While they are public, every consumer of the library can bind to them, so changing them is a breaking change for those consumers.
Implementation type on the public API controller/src/main/java/org/apache/rocketmq/controller/impl/closure/ControllerClosure.java:32— 1 public type in `org.apache.rocketmq.controller.impl.closure` is marked as implementation by its own namespace, folder or name: `ControllerClosure` (controller/src/main/java/org/apache/rocketmq/controller/impl/closure/ControllerClosure.java:32, `impl`). While it is public, every consumer of the library can bind to it, so changing it is a breaking change for those consumers.
Implementation type on the public API controller/src/main/java/org/apache/rocketmq/controller/impl/event/AlterSyncStateSetEvent.java:26— 10 public types in `org.apache.rocketmq.controller.impl.event` are marked as implementation by their own namespace, folder or name: `AlterSyncStateSetEvent` (controller/src/main/java/org/apache/rocketmq/controller/impl/event/AlterSyncStateSetEvent.java:26, `impl`), `ApplyBrokerIdEvent` (controller/src/main/java/org/apache/rocketmq/controller/impl/event/ApplyBrokerIdEvent.java:23, `impl`), `CleanBrokerDataEvent` (controller/src/main/java/org/apache/rocketmq/controller/impl/event/CleanBrokerDataEvent.java:22, `impl`), `ControllerResult` (controller/src/main/java/org/apache/rocketmq/controller/impl/event/ControllerResult.java:23, `impl`), `ElectMasterEvent` (controller/src/main/java/org/apache/rocketmq/controller/impl/event/ElectMasterEvent.java:23, `impl`), `EventMessage` (controller/src/main/java/org/apache/rocketmq/controller/impl/event/EventMessage.java:22, `impl`), `EventSerializer` (controller/src/main/java/org/apache/rocketmq/controller/impl/event/EventSerializer.java:25, `impl`), `EventType` (controller/src/main/java/org/apache/rocketmq/controller/impl/event/EventType.java:22, `impl`), and 2 more. While they are public, every consumer of the library can bind to them, so changing them is a breaking change for those consumers.
Implementation type on the public API controller/src/main/java/org/apache/rocketmq/controller/impl/heartbeat/BrokerIdentityInfo.java:23— 4 public types in `org.apache.rocketmq.controller.impl.heartbeat` are marked as implementation by their own namespace, folder or name: `BrokerIdentityInfo` (controller/src/main/java/org/apache/rocketmq/controller/impl/heartbeat/BrokerIdentityInfo.java:23, `impl`), `BrokerLiveInfo` (controller/src/main/java/org/apache/rocketmq/controller/impl/heartbeat/BrokerLiveInfo.java:22, `impl`), `DefaultBrokerHeartbeatManager` (controller/src/main/java/org/apache/rocketmq/controller/impl/heartbeat/DefaultBrokerHeartbeatManager.java:41, `impl`), `RaftBrokerHeartBeatManager` (controller/src/main/java/org/apache/rocketmq/controller/impl/heartbeat/RaftBrokerHeartBeatManager.java:53, `impl`). While they are public, every consumer of the library can bind to them, so changing them is a breaking change for those consumers.
Implementation type on the public API controller/src/main/java/org/apache/rocketmq/controller/impl/manager/BrokerReplicaInfo.java:33— 5 public types in `org.apache.rocketmq.controller.impl.manager` are marked as implementation by their own namespace, folder or name: `BrokerReplicaInfo` (controller/src/main/java/org/apache/rocketmq/controller/impl/manager/BrokerReplicaInfo.java:33, `impl`), `RaftReplicasInfoManager` (controller/src/main/java/org/apache/rocketmq/controller/impl/manager/RaftReplicasInfoManager.java:48, `impl`), `BrokerValidPredicateWithInvokeTime` (controller/src/main/java/org/apache/rocketmq/controller/impl/manager/RaftReplicasInfoManager.java:222, `impl`), `ReplicasInfoManager` (controller/src/main/java/org/apache/rocketmq/controller/impl/manager/ReplicasInfoManager.java:76, `impl`), `SyncStateInfo` (controller/src/main/java/org/apache/rocketmq/controller/impl/manager/SyncStateInfo.java:28, `impl`). While they are public, every consumer of the library can bind to them, so changing them is a breaking change for those consumers.
Implementation type on the public API controller/src/main/java/org/apache/rocketmq/controller/impl/task/BrokerCloseChannelRequest.java:24— 9 public types in `org.apache.rocketmq.controller.impl.task` are marked as implementation by their own namespace, folder or name: `BrokerCloseChannelRequest` (controller/src/main/java/org/apache/rocketmq/controller/impl/task/BrokerCloseChannelRequest.java:24, `impl`), `BrokerCloseChannelResponse` (controller/src/main/java/org/apache/rocketmq/controller/impl/task/BrokerCloseChannelResponse.java:22, `impl`), `CheckNotActiveBrokerRequest` (controller/src/main/java/org/apache/rocketmq/controller/impl/task/CheckNotActiveBrokerRequest.java:22, `impl`), `CheckNotActiveBrokerResponse` (controller/src/main/java/org/apache/rocketmq/controller/impl/task/CheckNotActiveBrokerResponse.java:22, `impl`), `GetBrokerLiveInfoRequest` (controller/src/main/java/org/apache/rocketmq/controller/impl/task/GetBrokerLiveInfoRequest.java:23, `impl`), `GetBrokerLiveInfoResponse` (controller/src/main/java/org/apache/rocketmq/controller/impl/task/GetBrokerLiveInfoResponse.java:22, `impl`), `GetSyncStateDataRequest` (controller/src/main/java/org/apache/rocketmq/controller/impl/task/GetSyncStateDataRequest.java:22, `impl`), `RaftBrokerHeartBeatEventRequest` (controller/src/main/java/org/apache/rocketmq/controller/impl/task/RaftBrokerHeartBeatEventRequest.java:24, `impl`), and 1 more. While they are public, every consumer of the library can bind to them, so changing them is a breaking change for those consumers.
Implementation type on the public API openmessaging/src/main/java/io/openmessaging/rocketmq/MessagingAccessPointImpl.java:32— 1 public type in `io.openmessaging.rocketmq` is marked as implementation by its own namespace, folder or name: `MessagingAccessPointImpl` (openmessaging/src/main/java/io/openmessaging/rocketmq/MessagingAccessPointImpl.java:32, name ends in `Impl`). While it is public, every consumer of the library can bind to it, so changing it is a breaking change for those consumers.
Implementation type on the public API openmessaging/src/main/java/io/openmessaging/rocketmq/consumer/PullConsumerImpl.java:42— 2 public types in `io.openmessaging.rocketmq.consumer` are marked as implementation by their own namespace, folder or name: `PullConsumerImpl` (openmessaging/src/main/java/io/openmessaging/rocketmq/consumer/PullConsumerImpl.java:42, name ends in `Impl`), `PushConsumerImpl` (openmessaging/src/main/java/io/openmessaging/rocketmq/consumer/PushConsumerImpl.java:44, name ends in `Impl`). While they are public, every consumer of the library can bind to them, so changing them is a breaking change for those consumers.
Implementation type on the public API openmessaging/src/main/java/io/openmessaging/rocketmq/domain/BytesMessageImpl.java:26— 2 public types in `io.openmessaging.rocketmq.domain` are marked as implementation by their own namespace, folder or name: `BytesMessageImpl` (openmessaging/src/main/java/io/openmessaging/rocketmq/domain/BytesMessageImpl.java:26, name ends in `Impl`), `SendResultImpl` (openmessaging/src/main/java/io/openmessaging/rocketmq/domain/SendResultImpl.java:22, name ends in `Impl`). While they are public, every consumer of the library can bind to them, so changing them is a breaking change for those consumers.
Fat interface: LitePullConsumer (31 abstract methods) client/src/main/java/org/apache/rocketmq/client/consumer/LitePullConsumer.java:27— `LitePullConsumer` declares 31 abstract methods: `assign`, `assignment`, `buildSubscriptionsForHeartbeat`, `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 31 declarations carry 24 distinct name(s), so part of the width is overloading rather than separate responsibilities — but 24 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 (20 abstract methods) client/src/main/java/org/apache/rocketmq/client/consumer/MQPullConsumer.java:29— `MQPullConsumer` declares 20 abstract methods under just 10 distinct name(s): `fetchConsumeOffset`, `fetchMessageQueuesInBalance`, `pull`, `pull`, `pull`, `pull`, `pull`, `pull`, `pull`, `pull`, `pull`, `pullBlockIfNotFound`, `pullBlockIfNotFound`, `pullBlockIfNotFoundWithMessageSelector`, `pullBlockIfNotFoundWithMessageSelector`, `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 20 separate responsibilities: a caller binds to 10 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 20 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 (34 abstract methods) client/src/main/java/org/apache/rocketmq/client/producer/MQProducer.java:29— `MQProducer` declares 34 abstract methods under just 8 distinct name(s): `fetchPublishMessageQueues`, `recallMessage`, `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 34 separate responsibilities: a caller binds to 8 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 34 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.
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: MessagingProcessor (39 abstract methods) proxy/src/main/java/org/apache/rocketmq/proxy/processor/MessagingProcessor.java:51— `MessagingProcessor` declares 39 abstract methods: `ackMessage`, `ackMessage`, `addReceiptHandle`, `addTransactionSubscription`, `batchAckMessage`, `changeInvisibleTime`, `doChannelCloseEvent`, `endTransaction`, `findConsumerChannel`, `findProducerChannel`, `forwardMessageToDeadLetterQueue`, `forwardMessageToDeadLetterQueue`, `getConsumerGroupInfo`, `getMaxOffset`, `getMetadataService`, `getMinOffset`, `getProxyRelayService`, `getSubscriptionGroupConfig`, `getTopicRouteDataForProxy`, `getUnackedMessageCount`, `lockBatchMQ`, `popMessage`, `pullMessage`, `queryConsumerOffset`, `recallMessage`, `registerConsumer`, `registerConsumerListener`, `registerProducer`, `registerProducerListener`, `removeReceiptHandle`, `request`, `requestOneway`, `sendMessage`, `syncLiteSubscription`, `unRegisterConsumer`, `unRegisterProducer`, `unlockBatchMQ`, `updateConsumerOffset`, `updateConsumerOffsetAsync`. 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 37 distinct name(s), so part of the width is overloading rather than separate responsibilities — but 37 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: AdminService (19 abstract methods) proxy/src/main/java/org/apache/rocketmq/proxy/service/admin/AdminService.java:37— `AdminService` declares 19 abstract methods: `createTopicOnBroker`, `createTopicOnTopicBrokerIfNotExist`, `deleteSubscriptionGroup`, `getBrokerClusterInfo`, `getConsumeStats`, `getConsumerConnectionList`, `getSubscriptionGroupConfig`, `getTopicConfig`, `getTopicRouteData`, `getTopicStats`, `queryConsumeTimeSpan`, `queryMessage`, `queryTopicConsumeByWho`, `queryTopicsByConsumer`, `resetOffset`, `searchOffsetByTimestamp`, `topicExist`, `updateSubscriptionGroupConfig`, `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.
Fat interface: MessageService (19 abstract methods) proxy/src/main/java/org/apache/rocketmq/proxy/service/message/MessageService.java:48— `MessageService` declares 19 abstract methods: `ackMessage`, `batchAckMessage`, `changeInvisibleTime`, `endTransactionOneway`, `getMaxOffset`, `getMinOffset`, `lockBatchMQ`, `popLiteMessage`, `popMessage`, `pullMessage`, `queryConsumerOffset`, `recallMessage`, `request`, `requestOneway`, `sendMessage`, `sendMessageBack`, `unlockBatchMQ`, `updateConsumerOffset`, `updateConsumerOffsetAsync`. 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: MappedFile (50 abstract methods) store/src/main/java/org/apache/rocketmq/store/logfile/MappedFile.java:36— `MappedFile` declares 50 abstract methods: `appendMessage`, `appendMessage`, `appendMessage`, `appendMessage`, `appendMessage`, `appendMessageUsingFileChannel`, `appendMessages`, `cleanResources`, `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`, and 10 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 50 declarations carry 45 distinct name(s), so part of the width is overloading rather than separate responsibilities — but 45 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 (26 abstract methods) store/src/main/java/org/apache/rocketmq/store/queue/ConsumeQueueInterface.java:28— `ConsumeQueueInterface` declares 26 abstract methods: `assignQueueOffset`, `correctMinOffset`, `estimateMessageCount`, `get`, `getCQType`, `getCqUnitAndStoreTime`, `getEarliestUnit`, `getEarliestUnitAndStoreTime`, `getLastOffset`, `getLatestUnit`, `getMaxOffsetInQueue`, `getMaxPhysicOffset`, `getMessageTotalInQueue`, `getMinLogicOffset`, `getMinOffsetInQueue`, `getOffsetInQueueByTime`, `getOffsetInQueueByTime`, `getQueueId`, `getTopic`, `getTotalSize`, `getUnitSize`, `increaseQueueOffset`, `initializeWithOffset`, `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 26 declarations carry 24 distinct name(s), so part of the width is overloading rather than separate responsibilities — but 24 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 (25 abstract methods) store/src/main/java/org/apache/rocketmq/store/queue/ConsumeQueueStoreInterface.java:28— `ConsumeQueueStoreInterface` declares 25 abstract methods: `assignQueueOffset`, `checkSelf`, `cleanExpired`, `deleteTopic`, `destroy`, `findOrCreateConsumeQueue`, `flush`, `getConsumeQueue`, `getConsumeQueueTable`, `getLmqNum`, `getLmqQueueOffset`, `getMaxOffset`, `getMinOffsetInQueue`, `getOffsetInQueueByTime`, `getTotalSize`, `increaseLmqOffset`, `increaseQueueOffset`, `isLmqExist`, `load`, `putMessagePositionInfoWrapper`, `recover`, `recoverOffsetTable`, `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. 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 (124 abstract methods) store/src/main/java/org/apache/rocketmq/store/MessageStore.java:58— `MessageStore` declares 124 abstract methods: `addDispatcher`, `appendToCommitLog`, `assignOffset`, `calcDeltaChecksum`, `checkInDiskByConsumeOffset`, `checkInMemByConsumeOffset`, `checkInStoreByConsumeOffset`, `checkMessageAndReturnSize`, `cleanExpiredConsumerQueue`, `cleanUnusedTopic`, `deleteTopics`, `destroy`, `dispatchBehindBytes`, `dispatchBehindMilliseconds`, `estimateMessageCount`, `executeDeleteFilesManually`, `findConsumeQueue`, `flush`, `flushBehindBytes`, `getAliveReplicaNumInGroup`, `getAllocateMappedFileService`, `getBrokerInitMaxOffset`, `getBrokerStatsManager`, `getBulkCommitLogData`, `getCommitLog`, `getCommitLogData`, `getCommitLogOffsetInQueue`, `getConfirmOffset`, `getConsumeQueue`, `getData`, `getDispatcherList`, `getEarliestMessageTime`, `getEarliestMessageTime`, `getEarliestMessageTimeAsync`, `getFlushedWhere`, `getHARuntimeInfo`, `getHaService`, `getLastFileFromOffset`, `getLastMappedFile`, `getMasterFlushedOffset`, and 84 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 124 declarations carry 115 distinct name(s), so part of the width is overloading rather than separate responsibilities — but 115 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: FlatFileInterface (29 abstract methods) tieredstore/src/main/java/org/apache/rocketmq/tieredstore/file/FlatFileInterface.java:28— `FlatFileInterface` declares 29 abstract methods: `appendCommitLog`, `appendCommitLog`, `appendConsumeQueue`, `commitAsync`, `destroy`, `destroyExpiredFile`, `getCommitLogAsync`, `getCommitLogCommitOffset`, `getCommitLogMaxOffset`, `getCommitLogMinOffset`, `getConsumeQueueAsync`, `getConsumeQueueAsync`, `getConsumeQueueCommitOffset`, `getConsumeQueueMaxOffset`, `getConsumeQueueMinOffset`, `getFileLock`, `getFirstMessageOffset`, `getMaxStoreTimestamp`, `getMessageAsync`, `getMessageQueue`, `getMinStoreTimestamp`, `getQueueOffsetByTimeAsync`, `getTopicId`, `initOffset`, `isClosed`, `isFlatFileInit`, `release`, `rollingFile`, `shutdown`. 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 29 declarations carry 27 distinct name(s), so part of the width is overloading rather than separate responsibilities — but 27 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: MetadataStore (17 abstract methods) tieredstore/src/main/java/org/apache/rocketmq/tieredstore/metadata/MetadataStore.java:29— `MetadataStore` declares 17 abstract methods under just 15 distinct name(s): `addQueue`, `addTopic`, `deleteFileSegment`, `deleteFileSegment`, `deleteQueue`, `deleteTopic`, `destroy`, `getFileSegment`, `getQueue`, `getTopic`, `iterateFileSegment`, `iterateFileSegment`, `iterateQueue`, `iterateTopic`, `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. That is an OVERLOAD SET, not 17 separate responsibilities: a caller binds to 15 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 17 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: MQAdminExt (126 abstract methods) tools/src/main/java/org/apache/rocketmq/tools/admin/MQAdminExt.java:79— `MQAdminExt` declares 126 abstract methods: `addBrokerToContainer`, `addWritePermOfBroker`, `checkRocksdbCqWriteProgress`, `cleanControllerBrokerData`, `cleanExpiredConsumerQueue`, `cleanExpiredConsumerQueueByAddr`, `cleanUnusedTopic`, `cleanUnusedTopicByAddr`, `cloneGroupOffset`, `consumeMessageDirectly`, `consumeMessageDirectly`, `createAcl`, `createAcl`, `createAndUpdateKvConfig`, `createAndUpdateSubscriptionGroupConfig`, `createAndUpdateSubscriptionGroupConfigList`, `createAndUpdateTopicConfig`, `createAndUpdateTopicConfigList`, `createOrUpdateOrderConf`, `createStaticTopic`, `createUser`, `createUser`, `deleteAcl`, `deleteExpiredCommitLog`, `deleteExpiredCommitLogByAddr`, `deleteKvConfig`, `deleteSubscriptionGroup`, `deleteSubscriptionGroup`, `deleteTopic`, `deleteTopicInBroker`, `deleteTopicInBrokerConcurrent`, `deleteTopicInNameServer`, `deleteTopicInNameServer`, `deleteUser`, `electMaster`, `examineBrokerClusterInfo`, `examineConsumeStats`, `examineConsumeStats`, `examineConsumeStats`, `examineConsumeStats`, and 86 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 126 declarations carry 112 distinct name(s), so part of the width is overloading rather than separate responsibilities — but 112 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.
Off-boarding risk: anonymized user #1 — If anonymized user #1 becomes unavailable, 9 significant file(s) lose their only recent owner: tieredstore/src/main/java/org/apache/rocketmq/tieredstore/core/MessageStoreDispatcherImpl.java, tieredstore/src/main/java/org/apache/rocketmq/tieredstore/provider/FileSegment.java, tieredstore/src/main/java/org/apache/rocketmq/tieredstore/provider/PosixFileSegment.java, broker/src/main/java/org/apache/rocketmq/broker/pop/PopConsumerRocksdbStore.java, tieredstore/src/main/java/org/apache/rocketmq/tieredstore/file/FlatFileStore.java, store/src/main/java/org/apache/rocketmq/store/rocksdb/CqCompactionFilterJni.java, tieredstore/src/main/java/org/apache/rocketmq/tieredstore/MessageStoreExecutor.java, tieredstore/src/main/java/org/apache/rocketmq/tieredstore/file/FlatCommitLogFile.java (+1 more). Pair on, review, or document these before any departure.
Off-boarding risk: anonymized user #2 — If anonymized user #2 becomes unavailable, 7 significant file(s) lose their only recent owner: remoting/src/main/java/org/apache/rocketmq/remoting/protocol/RocketMQSerializable.java, common/src/main/java/org/apache/rocketmq/common/message/MessageClientIDSetter.java, client/src/main/java/org/apache/rocketmq/client/producer/RequestFutureHolder.java, common/src/main/java/org/apache/rocketmq/common/message/MessageVersion.java, broker/src/main/java/org/apache/rocketmq/broker/transaction/TransactionMetricsFlushService.java, remoting/src/main/java/org/apache/rocketmq/remoting/metrics/RemotingMetricsConstant.java, remoting/src/main/java/org/apache/rocketmq/remoting/protocol/FastCodesHeader.java. Pair on, review, or document these before any departure.
Off-boarding risk: anonymized user #3 — If anonymized user #3 becomes unavailable, 7 significant file(s) lose their only recent owner: proxy/src/main/java/org/apache/rocketmq/proxy/remoting/activity/ConsumerManagerActivity.java, tools/src/main/java/org/apache/rocketmq/tools/command/cluster/ClusterSendMsgRTCommand.java, tools/src/main/java/org/apache/rocketmq/tools/command/broker/GetBrokerEpochSubCommand.java, proxy/src/main/java/org/apache/rocketmq/proxy/config/Configuration.java, tools/src/main/java/org/apache/rocketmq/tools/monitor/DefaultMonitorListener.java, common/src/main/java/org/apache/rocketmq/common/compression/ZlibCompressor.java, proxy/src/main/java/org/apache/rocketmq/proxy/service/channel/InvocationChannel.java. Pair on, review, or document these before any departure.
Off-boarding risk: anonymized user #4 — If anonymized user #4 becomes unavailable, 5 significant file(s) lose their only recent owner: broker/src/main/java/org/apache/rocketmq/broker/lite/LiteEventDispatcher.java, broker/src/main/java/org/apache/rocketmq/broker/longpolling/PopLiteLongPollingService.java, proxy/src/main/java/org/apache/rocketmq/proxy/processor/ClientProcessor.java, tools/src/main/java/org/apache/rocketmq/tools/command/lite/GetLiteGroupInfoSubCommand.java, tools/src/main/java/org/apache/rocketmq/tools/command/offset/ResetOffsetByTimeCommand.java. Pair on, review, or document these before any departure.
Off-boarding risk: anonymized user #5 — If anonymized user #5 becomes unavailable, 3 significant file(s) lose their only recent owner: controller/src/main/java/org/apache/rocketmq/controller/impl/manager/RaftReplicasInfoManager.java, common/src/main/java/org/apache/rocketmq/common/message/MessageQueue.java, controller/src/main/java/org/apache/rocketmq/controller/impl/heartbeat/BrokerIdentityInfo.java. Pair on, review, or document these before any departure.
Off-boarding risk: anonymized user #6 — If anonymized user #6 becomes unavailable, 3 significant file(s) lose their only recent owner: common/src/main/java/org/apache/rocketmq/common/utils/CheckpointFile.java, tools/src/main/java/org/apache/rocketmq/tools/command/auth/UpdateUserSubCommand.java, tools/src/main/java/org/apache/rocketmq/tools/command/auth/CreateUserSubCommand.java. Pair on, review, or document these before any departure.
X23 · Unguarded diagnostic materialisation· Diagnostic log message is built whether or not it is wanted · ×5
Diagnostic log message is built whether or not it is wanted tieredstore/src/main/java/org/apache/rocketmq/tieredstore/file/FlatMessageFile.java:348— `debug` at line 348 is called with an argument built by `JSON.toJSONString(queryLog)` (line 349), whose cost grows with the collection it walks. Java evaluates a call's arguments BEFORE entering the method, so that join/projection runs in full every time this line is reached — and then the level check inside the logger discards the string it produced, because debug is a level a shipped configuration normally leaves off. Nothing here decides beforehand whether the message is wanted: no `isDebugEnabled`/`isTraceEnabled` test, no debug flag, no lambda or `Supplier` the logger calls only when the level is on.
Diagnostic log message is built whether or not it is wanted store/src/main/java/org/apache/rocketmq/store/DefaultMessageStore.java:1407— `debug` at line 1407 is called with an argument built by `JSON.toJSONString(queryOffsetResult)` (line 1407), whose cost grows with the collection it walks. Java evaluates a call's arguments BEFORE entering the method, so that join/projection runs in full every time this line is reached — and then the level check inside the logger discards the string it produced, because debug is a level a shipped configuration normally leaves off. Nothing here decides beforehand whether the message is wanted: no `isDebugEnabled`/`isTraceEnabled` test, no debug flag, no lambda or `Supplier` the logger calls only when the level is on.
Diagnostic log message is built whether or not it is wanted store/src/main/java/org/apache/rocketmq/store/DefaultMessageStore.java:1410— `debug` at line 1410 is called with an argument built by `JSON.toJSONString(queryOffsetResult)` (line 1410), whose cost grows with the collection it walks. Java evaluates a call's arguments BEFORE entering the method, so that join/projection runs in full every time this line is reached — and then the level check inside the logger discards the string it produced, because debug is a level a shipped configuration normally leaves off. Nothing here decides beforehand whether the message is wanted: no `isDebugEnabled`/`isTraceEnabled` test, no debug flag, no lambda or `Supplier` the logger calls only when the level is on.
Diagnostic log message is built whether or not it is wanted store/src/main/java/org/apache/rocketmq/store/DefaultMessageStore.java:1462— `debug` at line 1462 is called with an argument built by `JSON.toJSONString(queryOffsetResult)` (line 1462), whose cost grows with the collection it walks. Java evaluates a call's arguments BEFORE entering the method, so that join/projection runs in full every time this line is reached — and then the level check inside the logger discards the string it produced, because debug is a level a shipped configuration normally leaves off. Nothing here decides beforehand whether the message is wanted: no `isDebugEnabled`/`isTraceEnabled` test, no debug flag, no lambda or `Supplier` the logger calls only when the level is on.
Diagnostic log message is built whether or not it is wanted store/src/main/java/org/apache/rocketmq/store/DefaultMessageStore.java:1465— `debug` at line 1465 is called with an argument built by `JSON.toJSONString(queryOffsetResult)` (line 1465), whose cost grows with the collection it walks. Java evaluates a call's arguments BEFORE entering the method, so that join/projection runs in full every time this line is reached — and then the level check inside the logger discards the string it produced, because debug is a level a shipped configuration normally leaves off. Nothing here decides beforehand whether the message is wanted: no `isDebugEnabled`/`isTraceEnabled` test, no debug flag, no lambda or `Supplier` the logger calls only when the level is on.
D34 · Knowledge Freshness· Most significant orphaned file · ×3
Most significant orphaned file client/src/main/java/org/apache/rocketmq/client/producer/DefaultMQProducer.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/PullMessageProcessor.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 tools/src/main/java/org/apache/rocketmq/tools/admin/DefaultMQAdminExt.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.
Silent fallback default in catch common/src/main/java/org/apache/rocketmq/common/MixAll.java:220— `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:285— `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:227— `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.
Disabled test broker/src/test/java/org/apache/rocketmq/broker/controller/ReplicasManagerTest.java:62— A test is skipped/ignored — coverage that looks present but never runs. Re-enable it or delete it so the green run means something.
Disabled test broker/src/test/java/org/apache/rocketmq/broker/lite/LiteLifecycleManagerTest.java:198— A test is skipped/ignored — coverage that looks present but never runs. Re-enable it or delete it so the green run means something.
D16 · Bus Factor· Further sole-owners (lower concentration) · ×1
Further sole-owners (lower concentration) — 22 other contributor(s) are each the sole owner of a small amount of code below the off-boarding threshold — folded into the bus-factor score and metrics (62 single-owned of 842 analysed files in total, counted over production source files of roughly 2,400 bytes or more, excluding vendored, generated, example/demo and scaffolding-template trees and test files identified by path convention, largest first; 842 of the 1493 production source files in this repository met that bar). They are anonymized user #7 (2 file(s)), anonymized user #8 (2 file(s)), anonymized user #9 (2 file(s)), anonymized user #10 (2 file(s)), anonymized user #11 (2 file(s)), anonymized user #12 (2 file(s)) (+16 more) — spread or document their files in the same way, at lower priority than the named off-boarding risks above. The files folded here: tools/src/main/java/org/apache/rocketmq/tools/command/consumer/ConsumerProgressSubCommand.java, tools/src/main/java/org/apache/rocketmq/tools/command/message/PrintMessageByQueueCommand.java, store/src/main/java/org/apache/rocketmq/store/AllocateMappedFileService.java, store/src/main/java/org/apache/rocketmq/store/timer/TimerWheel.java, broker/src/main/java/org/apache/rocketmq/broker/BrokerPreOnlineService.java, broker/src/main/java/org/apache/rocketmq/broker/processor/PopInflightMessageCounter.java, proxy/src/main/java/org/apache/rocketmq/proxy/service/transaction/ClusterTransactionService.java, proxy/src/main/java/org/apache/rocketmq/proxy/service/sysmessage/HeartbeatSyncer.java (+20 more).
D26 · Project Cohesion· Projects may be oversized for their cohesion · ×1
Projects may be oversized for their cohesion — 8 of 16 project(s) overshoot their size bounds, lowering Project Cohesion to 0.5/10. The most over is `broker` (40617 LoC, 186 module-visible types across 34 directories). Review these for cohesion — draw the boundary inside the module first (group each responsibility into its own package or directory and keep the cross-boundary members non-public), since splitting a published package moves types between packages and breaks consumers.
D28 · Secrets (history)· Rotate the exposed credentials · ×1
Concentrated knowledge decay — 480 of 864 significant files have no living knowledge, while the repository is still being changed at a low rate (71 commit(s) in the last 90 days) — so this is one repo-wide knowledge-decay state, not 480 separate risks. Counted over 864 of the 1493 production source files in this repository: the rest are under the ~2,400-byte size floor this dimension measures over. The code moved on without the people who understood these files: document them or schedule a read-through before the next change lands in them.
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 tieredstore/src/test/java/org/apache/rocketmq/tieredstore/index/IndexStoreServiceBenchTest.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/253 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): evaluateTypedAnyListResources auth/src/test/java/org/apache/rocketmq/auth/authorization/AuthorizationEvaluatorTest.java:415— Skipped with a documented reason — a deferral, not lazy debt: skipped at run time by a JUnit assumption
Skipped (documented): testCleanExpiredLiteTopic broker/src/test/java/org/apache/rocketmq/broker/lite/LiteLifecycleManagerTest.java:200— Skipped with a documented reason — a deferral, not lazy debt: switched off by @Ignore
Skipped (documented): testInit_tieredStore broker/src/test/java/org/apache/rocketmq/broker/lite/RocksDBLiteLifecycleManagerTest.java:134— Skipped with a documented reason — a deferral, not lazy debt: switched off by @Ignore
Skipped (documented): tombstoneDeletionTest broker/src/test/java/org/apache/rocketmq/broker/pop/PopConsumerRocksdbStoreTest.java:131— Skipped with a documented reason — a deferral, not lazy debt: switched off by @Ignore
Skipped (documented): testBasic broker/src/test/java/org/apache/rocketmq/broker/processor/PopBufferMergeServiceTest.java:116— Skipped with a documented reason — a deferral, not lazy debt: skipped at run time by a JUnit assumption
Skipped (documented): testGetAclRPCHookByFileName client/src/test/java/org/apache/rocketmq/acl/common/AclUtilsTest.java:233— Skipped with a documented reason — a deferral, not lazy debt: skipped at run time by a JUnit assumption
Skipped (documented): testCancellationDoesNotChangeOrdinaryConsumerOffsets client/src/test/java/org/apache/rocketmq/client/impl/consumer/ConsumeMessageExecutorInjectionTest.java:96— 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:209— Skipped with a documented reason — a deferral, not lazy debt: switched off by @Ignore
Skipped (documented): testEpollOwnedGroupsTerminate proxy/src/test/java/org/apache/rocketmq/proxy/grpc/GrpcServerTest.java:90— Skipped with a documented reason — a deferral, not lazy debt: skipped at run time by a JUnit assumption
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:290— Skipped with a documented reason — a deferral, not lazy debt: skipped at run time by a JUnit assumption
Skipped (documented): testTruncateCQ store/src/test/java/org/apache/rocketmq/store/dledger/DLedgerCommitlogTest.java:65— Skipped with a documented reason — a deferral, not lazy debt: switched off by @Ignore
Skipped (documented): multiDirsStorageTest store/src/test/java/org/apache/rocketmq/store/dledger/DLedgerMultiPathTest.java:43— Skipped with a documented reason — a deferral, not lazy debt: skipped at run time by a JUnit assumption
Skipped (documented): testDeleteExpiredFiles store/src/test/java/org/apache/rocketmq/store/dledger/MixCommitlogTest.java:144— 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:37— Skipped with a documented reason — a deferral, not lazy debt: switched off by @Ignore
Skipped (documented): testPutAndGet store/src/test/java/org/apache/rocketmq/store/dledger/MixCommitlogTest.java:80— 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:320— 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): testFileMode_checkAndReviseMetrics_worksNormally store/src/test/java/org/apache/rocketmq/store/timer/TimerEngineSwitchVerifyTest.java:145— Skipped with a documented reason — a deferral, not lazy debt: skipped at run time by a JUnit assumption
Skipped (documented): testRepeatedSwitch_metricsConsistency store/src/test/java/org/apache/rocketmq/store/timer/TimerEngineSwitchVerifyTest.java:501— Skipped with a documented reason — a deferral, not lazy debt: skipped at run time by a JUnit assumption
Skipped (documented): testSchedulerAutoTrigger_skipsWhenSwitchedToRocksDB store/src/test/java/org/apache/rocketmq/store/timer/TimerEngineSwitchVerifyTest.java:385— Skipped with a documented reason — a deferral, not lazy debt: skipped at run time by a JUnit assumption
Skipped (documented): testSwitchBackToFileMode_checkAndReviseMetrics_resumesNormally store/src/test/java/org/apache/rocketmq/store/timer/TimerEngineSwitchVerifyTest.java:326— Skipped with a documented reason — a deferral, not lazy debt: skipped at run time by a JUnit assumption
Skipped (documented): testSwitchToRocksDB_rocksDBOnlyTopicPreserved store/src/test/java/org/apache/rocketmq/store/timer/TimerEngineSwitchVerifyTest.java:192— Skipped with a documented reason — a deferral, not lazy debt: skipped at run time by a JUnit assumption
Skipped (documented): testSwitchToRocksDB_sharedTopicPreserved store/src/test/java/org/apache/rocketmq/store/timer/TimerEngineSwitchVerifyTest.java:261— 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:338— Skipped with a documented reason — a deferral, not lazy debt: skipped at run time by a JUnit assumption
Off the main sequence: rocketmq-common — rocketmq-common: abstractness 0.16, instability 0.00, distance 0.84 — 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 01a1d542-d518-786a-a70f-c44e830b81df · every finding is also locatable in findings.md, and the complete scoring record (with exit codes + durations) in sidecar.json.
Issues: 74 · Warnings: 2218 · Recommendations: 636 · Info: 50 — Appendix A · all findings · full markdown report.
Generated by the Canine Code Analyzer: deterministic code-health analysis. 13-11-2026 @ 14:14 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.