Public report of apache/rocketmq, published 24 October 2026. It has the same score, grades and number of
findings as the full report. The details of security findings (where they are in the code, which known
vulnerabilities and which passwords or keys were found) are left out, so nobody can use them against the project.
Public
Executive reportMeasured under the Code Assurance Index, an open standard for code quality, using its published scoring rules (rubric version 2026.10.5). Watchdog signed this survey and filed it in the standard's public register, where anyone can look it up by its survey ID. Check this survey →
Signed and filed in the standard's public register, 24 October 2026, 05:45 UTC · Survey ID cd_f8523a2d747f4cd0824dc7c04d1ca473
apache/rocketmq
Measured 24 October 2026, 05:42 UTC, at code version 8ab8191
A regression is a drop of 0.5 points or more in the score, or of 2.5 or more out of 10 in a dimension, since the last survey.
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,760 lines of product code in 17 projects, tests not counted · Estimated rebuild effort: about 2.9 person-years · Weakest lens: Code Health, 54
Findings by how serious they are
73 critical1891 serious641 minor
13 dimensions are left out of the score. For each one, Watchdog either couldn't measure it in this code, or found no evidence of the safeguard it looks for, such as a tested backup restore. They count neither for nor against the score, and Limitations lists each one with its reason.
This survey was produced by
Watchdog
Producer
Canine Development
Analyzer
Watchdog engine 1.0.0
Measured
24 October 2026, 05:42 UTC
A measurement, not a certificate. The Code Assurance Index records a number
together with the evidence it was worked out from, so anyone can recalculate it, but it doesn't certify or guarantee
the code. The standard was written by Canine Development, which also builds Watchdog. It is open to any tool that
implements it, and today Watchdog is the only one that does.
A critical security finding is open, such as a library with a known critical vulnerability or a password or key found in the code. The score itself is unchanged, but its band shows At risk until the finding is fixed. See the Security and Compliance lens.
The score is deterministic, which means the same code always gets the same score. Watchdog works it out with tools that follow published rules, and an AI model never decides it, so anyone who applies the same rules to the same code gets the same number. How it is done is explained under Methodology ▸
62of 65 dimensions measured by tools. The other 3 are advisory notes from an AI model, which explain the code but don't count towards the score.
2580of 2605 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.
65dimensions across 6 lenses, read from 222,760 lines of product code in 17 projects.
apache/rocketmq scores 58 out of 100, but it is rated At risk while a critical security finding is open; the score itself is unchanged.
The weakest lens counts most in the score, and here that is Code Health, which scores 54 and is rated Adequate. Its Nullable reference types dimension scores 2 out of 10, and until that reaches 4, Code Health can't be rated higher than Adequate. The first actions are to resolve the 4 Banned license finding(s) in License Compliance and to resolve the 1 No assertions (empty test) finding(s) in Test Quality. The weakest lenses score close to each other, so improving any of them moves the score.
73 findings are critical: 41 in Static Analysis (SAST), 20 in Dependency Vulnerabilities, five in Test Reliability, four in License Compliance, one in Change Coupling, one in Secrets (history) and one in Test Quality.
Watchdog couldn't measure 12 dimensions in this code, among them Code Coverage, Dependency Hygiene and Internal API Consistency, so they are left out of the score. The product code is 222,760 lines, which would take an estimated 2.9 person-years, around €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.
Watchdog compares every finding with the previous survey's. A finding that has only moved to another line in the same file counts as the same finding, so only new findings appear here. Advisory notes from the AI model are left out, because the model words them afresh in every survey.
Fixed since the last survey: 188 findings
These 188 critical or serious findings were in the previous survey, on 10 October 2026, and are gone from this one. The first 100 are listed here.
Test Quality · No assertions: buildConsumerStartOffsetRequestsForTopicReadAndSubscription auth/src/test/java/org/apache/rocketmq/auth/authorization/builder/DefaultAuthorizationContextBuilderTest.java
Test Quality · No assertions: buildGrpcLiteSubscriptionIgnoresLiteTopics auth/src/test/java/org/apache/rocketmq/auth/authorization/builder/DefaultAuthorizationContextBuilderTest.java
Test Quality · No assertions: buildHeartbeatSkipsBlankTopics auth/src/test/java/org/apache/rocketmq/auth/authorization/builder/DefaultAuthorizationContextBuilderTest.java
Test Quality · No assertions: buildLiteHeaderRequests auth/src/test/java/org/apache/rocketmq/auth/authorization/builder/DefaultAuthorizationContextBuilderTest.java
Test Quality · No assertions: buildLiteSubscriptionControlFromBody auth/src/test/java/org/apache/rocketmq/auth/authorization/builder/DefaultAuthorizationContextBuilderTest.java
Test Quality · No assertions: buildRemainingAdminReadRequests auth/src/test/java/org/apache/rocketmq/auth/authorization/builder/DefaultAuthorizationContextBuilderTest.java
Test Quality · No assertions: buildRemainingResourceAdminRequests auth/src/test/java/org/apache/rocketmq/auth/authorization/builder/DefaultAuthorizationContextBuilderTest.java
Test Quality · No assertions: getServiceNameTest broker/src/test/java/org/apache/rocketmq/broker/longpolling/PullRequestHoldServiceTest.java
Test Quality · No assertions: testDeleteSubscriptionGroupInRocksdb broker/src/test/java/org/apache/rocketmq/broker/processor/AdminBrokerProcessorTest.java
Test Quality · No assertions: testDeleteTopicInRocksdb broker/src/test/java/org/apache/rocketmq/broker/processor/AdminBrokerProcessorTest.java
Test Quality · No assertions: testGetAllSubscriptionGroupInRocksdb broker/src/test/java/org/apache/rocketmq/broker/processor/AdminBrokerProcessorTest.java
Test Quality · No assertions: testGetAllSubscriptionGroupWithRequestHeader broker/src/test/java/org/apache/rocketmq/broker/processor/AdminBrokerProcessorTest.java
Test Quality · No assertions: testGetAllTopicConfigInRocksdb broker/src/test/java/org/apache/rocketmq/broker/processor/AdminBrokerProcessorTest.java
Test Quality · No assertions: testGetAllTopicConfigWithRequestHeader broker/src/test/java/org/apache/rocketmq/broker/processor/AdminBrokerProcessorTest.java
Test Quality · No assertions: testGetTopicConfigInRocksdb broker/src/test/java/org/apache/rocketmq/broker/processor/AdminBrokerProcessorTest.java
Test Quality · No assertions: testUpdateAndCreateSubscriptionGroupInRocksdb broker/src/test/java/org/apache/rocketmq/broker/processor/AdminBrokerProcessorTest.java
Test Quality · No assertions: testUpdateAndCreateTopicInRocksdb broker/src/test/java/org/apache/rocketmq/broker/processor/AdminBrokerProcessorTest.java
Test Quality · No assertions: testLitePopEventLossAcrossIterations broker/src/test/java/org/apache/rocketmq/broker/processor/PopLiteMessageProcessorEventLossTest.java
Test Quality · No assertions: testAllocate4Pop broker/src/test/java/org/apache/rocketmq/broker/processor/QueryAssignmentProcessorTest.java
Test Quality · No assertions: testProcessRequest broker/src/test/java/org/apache/rocketmq/broker/processor/SendMessageProcessorTest.java
Test Quality · No assertions: testProcessRequest_CreateMappedFileFailed broker/src/test/java/org/apache/rocketmq/broker/processor/SendMessageProcessorTest.java
Test Quality · No assertions: testProcessRequest_FlushSlaveTimeout broker/src/test/java/org/apache/rocketmq/broker/processor/SendMessageProcessorTest.java
Test Quality · No assertions: testProcessRequest_FlushTimeOut broker/src/test/java/org/apache/rocketmq/broker/processor/SendMessageProcessorTest.java
Test Quality · No assertions: testProcessRequest_MessageIllegal broker/src/test/java/org/apache/rocketmq/broker/processor/SendMessageProcessorTest.java
Test Quality · No assertions: testProcessRequest_PageCacheBusy broker/src/test/java/org/apache/rocketmq/broker/processor/SendMessageProcessorTest.java
Test Quality · No assertions: testProcessRequest_PropertiesTooLong broker/src/test/java/org/apache/rocketmq/broker/processor/SendMessageProcessorTest.java
Test Quality · No assertions: testProcessRequest_ServiceNotAvailable broker/src/test/java/org/apache/rocketmq/broker/processor/SendMessageProcessorTest.java
Test Quality · No assertions: testProcessRequest_SlaveNotAvailable broker/src/test/java/org/apache/rocketmq/broker/processor/SendMessageProcessorTest.java
Test Quality · No assertions: testUpdateAndCreateSubscriptionGroupInRocksdb broker/src/test/java/org/apache/rocketmq/broker/subscription/SubscriptionGroupManagerTest.java
Test Quality · No assertions: testAddAndGet broker/src/test/java/org/apache/rocketmq/broker/transaction/queue/TransactionMetricsTest.java
Test Quality · No assertions: testCleanMetrics broker/src/test/java/org/apache/rocketmq/broker/transaction/queue/TransactionMetricsTest.java
Test Quality · No assertions: testGetTopicPair broker/src/test/java/org/apache/rocketmq/broker/transaction/queue/TransactionMetricsTest.java
Test Quality · No assertions: testGetTransactionCount broker/src/test/java/org/apache/rocketmq/broker/transaction/queue/TransactionMetricsTest.java
Test Quality · No assertions: testPrepareMessage broker/src/test/java/org/apache/rocketmq/broker/transaction/queue/TransactionalMessageServiceImplTest.java
Test Quality · No assertions: test1 client/src/test/java/org/apache/rocketmq/client/consumer/rebalance/AllocateMachineRoomNearByTest.java
Test Quality · No assertions: test2 client/src/test/java/org/apache/rocketmq/client/consumer/rebalance/AllocateMachineRoomNearByTest.java
Test Quality · No assertions: test3 client/src/test/java/org/apache/rocketmq/client/consumer/rebalance/AllocateMachineRoomNearByTest.java
Test Quality · No assertions: testRun10RandomCase client/src/test/java/org/apache/rocketmq/client/consumer/rebalance/AllocateMachineRoomNearByTest.java
Test Quality · No assertions: testAllocate1 client/src/test/java/org/apache/rocketmq/client/consumer/rebalance/AllocateMessageQueueConsitentHashTest.java
Test Quality · No assertions: testAllocate2 client/src/test/java/org/apache/rocketmq/client/consumer/rebalance/AllocateMessageQueueConsitentHashTest.java
Test Quality · No assertions: testRun100RandomCase client/src/test/java/org/apache/rocketmq/client/consumer/rebalance/AllocateMessageQueueConsitentHashTest.java
Test Quality · No assertions: testPullKernelImplWithEmptyFilterServerListForClassFilter client/src/test/java/org/apache/rocketmq/client/impl/consumer/PullAPIWrapperTest.java
Test Quality · No assertions: testPullKernelImplWithMissingBrokerFilterServerForClassFilter client/src/test/java/org/apache/rocketmq/client/impl/consumer/PullAPIWrapperTest.java
Test Quality · No assertions: testPullKernelImplWithMissingFilterServerTableForClassFilter client/src/test/java/org/apache/rocketmq/client/impl/consumer/PullAPIWrapperTest.java
Test Quality · No assertions: testPullKernelImplWithMissingTopicRouteDataForClassFilter client/src/test/java/org/apache/rocketmq/client/impl/consumer/PullAPIWrapperTest.java
Test Quality · No assertions: testMessageId common/src/test/java/org/apache/rocketmq/common/message/MessageDecoderTest.java
Test Quality · No assertions: isIPInRange common/src/test/java/org/apache/rocketmq/common/utils/IPAddressUtilsTest.java
Test Quality · No assertions: isValidCidr common/src/test/java/org/apache/rocketmq/common/utils/IPAddressUtilsTest.java
Test Quality · No assertions: isValidIPOrCidr common/src/test/java/org/apache/rocketmq/common/utils/IPAddressUtilsTest.java
Test Quality · No assertions: isValidIPv6Common common/src/test/java/org/apache/rocketmq/common/utils/IPAddressUtilsTest.java
Test Quality · No assertions: isValidIp common/src/test/java/org/apache/rocketmq/common/utils/IPAddressUtilsTest.java
Test Quality · No assertions: testShutdown common/src/test/java/org/apache/rocketmq/common/ServiceThreadTest.java
Test Quality · No assertions: testRegisterIncrementBrokerData container/src/test/java/org/apache/rocketmq/container/BrokerContainerTest.java
Test Quality · No assertions: testDefaultOwnedGroupsTerminate proxy/src/test/java/org/apache/rocketmq/proxy/grpc/GrpcServerTest.java
Test Quality · No assertions: testExplicitOwnedGroupCounts proxy/src/test/java/org/apache/rocketmq/proxy/grpc/GrpcServerTest.java
Test Quality · No assertions: testEndTransaction proxy/src/test/java/org/apache/rocketmq/proxy/processor/TransactionProcessorTest.java
Test Quality · No assertions: buildHAProxyTLV proxy/src/test/java/org/apache/rocketmq/proxy/remoting/protocol/http2proxy/HAProxyMessageForwarderTest.java
Test Quality · No assertions: testProcessConsumerGroupEventForGrpcV2 proxy/src/test/java/org/apache/rocketmq/proxy/service/sysmessage/HeartbeatSyncerTest.java
Test Quality · No assertions: testProcessConsumerGroupEventForRemoting proxy/src/test/java/org/apache/rocketmq/proxy/service/sysmessage/HeartbeatSyncerTest.java
Test Quality · No assertions: testFromJson remoting/src/test/java/org/apache/rocketmq/remoting/protocol/admin/TopicStatsTableTest.java
Test Quality · No assertions: testGetOffsetTable remoting/src/test/java/org/apache/rocketmq/remoting/protocol/admin/TopicStatsTableTest.java
Test Quality · No assertions: testFastDecode remoting/src/test/java/org/apache/rocketmq/remoting/protocol/header/FastCodesHeaderTest.java
Test Quality · No assertions: testProxyProtocol remoting/src/test/java/org/apache/rocketmq/remoting/ProxyProtocolTest.java
Test Quality · No assertions: basicClientServerIntegrationTest remoting/src/test/java/org/apache/rocketmq/remoting/TlsTest.java
Test Quality · No assertions: clientAcceptsUntrustedServerCert remoting/src/test/java/org/apache/rocketmq/remoting/TlsTest.java
Test Quality · No assertions: disabledServerAcceptUnAuthClient remoting/src/test/java/org/apache/rocketmq/remoting/TlsTest.java
Test Quality · No assertions: reloadSslContextForServer remoting/src/test/java/org/apache/rocketmq/remoting/TlsTest.java
Test Quality · No assertions: serverAcceptsUnAuthClient remoting/src/test/java/org/apache/rocketmq/remoting/TlsTest.java
Test Quality · No assertions: serverAcceptsUntrustedClientCert remoting/src/test/java/org/apache/rocketmq/remoting/TlsTest.java
Test Quality · No assertions: serverNotNeedClientAuth remoting/src/test/java/org/apache/rocketmq/remoting/TlsTest.java
Test Quality · No assertions: serverWantClientAuth_ButClientNoCert remoting/src/test/java/org/apache/rocketmq/remoting/TlsTest.java
Test Quality · No assertions: testDLedgerMessageStoreConfigAccessorsAreDeprecated store/src/test/java/org/apache/rocketmq/store/dledger/DLedgerDeprecationTest.java
Test Quality · No assertions: testAddBroker store/src/test/java/org/apache/rocketmq/store/ha/autoswitch/AutoSwitchHATest.java
Test Quality · No assertions: testCompactionFilter_large store/src/test/java/org/apache/rocketmq/store/rocksdb/CqCompactionFilterJniTest.java
Test Quality · No assertions: testCompactionFilter_small store/src/test/java/org/apache/rocketmq/store/rocksdb/CqCompactionFilterJniTest.java
Test Quality · No assertions: testPut store/src/test/java/org/apache/rocketmq/store/ConsumeQueueExtTest.java
Test Quality · No assertions: testRecoverWithRocksDBOffsets store/src/test/java/org/apache/rocketmq/store/DefaultMessageStoreTest.java
Test Quality · No assertions: testCommitLogMapsRocksDbAndConsumeQueueFailures store/src/test/java/org/apache/rocketmq/store/LmqDispatchTest.java
Test Quality · No assertions: testBatchAckNormallyWithOutPopBuffer test/src/test/java/org/apache/rocketmq/test/client/consumer/pop/BatchAckIT.java
Test Quality · No assertions: testBatchAckNormallyWithPopBuffer test/src/test/java/org/apache/rocketmq/test/client/consumer/pop/BatchAckIT.java
Test Quality · No assertions: testBatchAckOrderly test/src/test/java/org/apache/rocketmq/test/client/consumer/pop/BatchAckIT.java
Test Quality · No assertions: testSendAndRecvBigMsgWhenDisablePopBufferMerge test/src/test/java/org/apache/rocketmq/test/client/consumer/pop/PopBigMessageIT.java
Test Quality · No assertions: testSendAndRecvBigMsgWhenEnablePopBufferMerge test/src/test/java/org/apache/rocketmq/test/client/consumer/pop/PopBigMessageIT.java
Test Quality · No assertions: testPopMessageOrderlyThenChangeInvisibleTime test/src/test/java/org/apache/rocketmq/test/client/consumer/pop/PopOrderlyIT.java
Test Quality · No assertions: testReentrant test/src/test/java/org/apache/rocketmq/test/client/consumer/pop/PopOrderlyIT.java
Test Quality · No assertions: testAddBroker test/src/test/java/org/apache/rocketmq/test/autoswitchrole/AutoSwitchRoleIntegrationTest.java
Test Quality · No assertions: testBasicWorkWhenControllerShutdown test/src/test/java/org/apache/rocketmq/test/autoswitchrole/AutoSwitchRoleIntegrationTest.java
Test Quality · No assertions: testBrokerFailoverWithCompatible test/src/test/java/org/apache/rocketmq/test/container/BrokerFailoverIT.java
Test Quality · No assertions: testBrokerFailoverWithoutCompatible test/src/test/java/org/apache/rocketmq/test/container/BrokerFailoverIT.java
Test Quality · No assertions: testSyncBrokerMemberGroup test/src/test/java/org/apache/rocketmq/test/container/BrokerMemberGroupIT.java
Test Quality · No assertions: reAddSlaveBroker_ConnectionCheck test/src/test/java/org/apache/rocketmq/test/container/SlaveBrokerIT.java
Test Quality · No assertions: syncConsumerOffsetWith3Replicas test/src/test/java/org/apache/rocketmq/test/container/SyncConsumerOffsetIT.java
Test Quality · No assertions: testQueryRoute test/src/test/java/org/apache/rocketmq/test/grpc/v2/ClusterGrpcIT.java
Test Quality · No assertions: testQueryRoute test/src/test/java/org/apache/rocketmq/test/grpc/v2/LocalGrpcIT.java
Test Quality · No assertions: testMultipleResetFutureOffsetWhilePopOrderlyAndAck test/src/test/java/org/apache/rocketmq/test/offset/OffsetResetForPopIT.java
Test Quality · No assertions: testMultipleResetFutureOffsetWhilePopWhenOpenBufferAndAck test/src/test/java/org/apache/rocketmq/test/offset/OffsetResetForPopIT.java
Test Quality · No assertions: testMultipleResetOffsetWhilePopOrderlyAndAck test/src/test/java/org/apache/rocketmq/test/offset/OffsetResetForPopIT.java
Test Quality · No assertions: testMultipleResetOffsetWhilePopWhenOpenBufferAndAck test/src/test/java/org/apache/rocketmq/test/offset/OffsetResetForPopIT.java
Test Quality · No assertions: testResetFutureOffsetWhilePopOrderlyAndAck test/src/test/java/org/apache/rocketmq/test/offset/OffsetResetForPopIT.java
Test Quality · No assertions: testResetFutureOffsetWhilePopWhenOpenBufferAndAck test/src/test/java/org/apache/rocketmq/test/offset/OffsetResetForPopIT.java
Rebuild cost: about €430,000 · Estimate
Cost to rebuild
€140,000 to €710,000, for 2,353 to 7,464 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,760 lines of product code
How the estimate is made: Watchdog prices the hours a team would need to write this code again, at €60 to €95 an hour. Declarations and boilerplate are priced at a fast rate and logic at a slower one, and the logic is then multiplied by the difficulty of the problem and by the quality factor. The estimate can be about 30% off either way, and it moves most with the hourly rate and the difficulty. For this code, every line is priced as straight logic, which keeps the estimate on the low side.
Top priorities
The three actions that raise the score most for the work they take. The full ranked list is in the Roadmap.
1
Resolve the 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 2 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 54 (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 3 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 — a layering smell or cycle. A clean layered graph has none.
Architecture: which parts of the code depend on which
The code is divided into modules, groups of code that each handle one part of the product, and a module depends on another when it uses code from it. The table lists the modules both down the side and across the top, in an order where each module should only use modules listed above it. A number in a cell means the module on that row uses the module in that column, and it counts the pairs of building blocks (types) that connect them. The one thing to look for is a mark above the diagonal line. It means two or more modules use each other in a loop (a dependency cycle), so none of them can be changed, tested or released on its own.
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 · 54% · 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
39
High / Critical
A07:2025 — Authentication Failures
2
High / Critical
Roadmap
First, resolve the four banned license violations and the single empty test in NameServerInstanceTest to ensure compliance and test integrity. Next, address the nineteen high-severity dependency vulnerabilities by updating the project's REDACTED, and begin enforcing nullable reference types by declaring @NullMarked in package or module info files while systematically removing suppressions and annotating actual null cases. Finally, replace interpolated log messages with structured logging across the codebase to improve observability.
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 — 73
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 — 1891
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 — 641
Recorded, with no effect on how the codebase functions.
Present so the survey is complete, not because it needs doing.
Could not be resolved — 13
Something this survey could not settle
from the outside, and which could be critical or serious. Either a control was required and no
positive evidence of it exists in the repository — a backup job that nothing shows was ever restored from proves
nothing about restores — or our own analysis could not run over that part of the tree. This is not a clean
result. These are excluded from the score rather than awarded a pass, so the number on the cover neither
rewards nor penalises them: if you act on this survey without resolving them, you carry that risk yourself. Each
one is named under Limitations.
Methodology & how to trust this report
Watchdog is a deep, periodic assessment — run each sprint, monthly, or quarterly, taking the time to go wider and deeper than a quick check and surfacing in one coherent report what you'd otherwise piece together from a dozen separate tools. It scores deterministically: the same commit yields the same score, every run. 62 of 65 evaluated dimensions are computed purely by tools and static analysis (confidence 1.0); 3 documentation/naming judgement(s) are LLM-assisted and labelled advisory. Overall confidence is 0.9 — the weighted average across measured dimensions; it falls as more of the score leans on LLM-assisted judgement and rises when it's fully tool-backed.
Every figure here is one of three kinds, and we label which: ✓ Measured — a deterministic fact (LoC, complexity, coverage); ~ Modeled — an estimate from a stated model (cost, effort, value-at-risk), always a range with its assumptions, never a precise fact; ◐ Advisory — an LLM prose judgement. We never present a modelled estimate as if it were measured. Perfect or absent scores carry their provenance too (ADR-0011): ✓ Tool-verified means the property itself was measured across the surface; ○ Nothing flagged means the probes came back clean — a claim bounded by what a repository can show; ⊘ Not evidenced means a working control (a tested restore, an automated rollback) showed no positive evidence — absence of evidence is not evidence of a control, so it's excluded from the score rather than awarded a spurious 10; ◐ Sampled · advisory marks an LLM verdict over a bounded sample — advisory, never a deterministic measurement.
What we checked — 65 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, 2580 of 2605 do; the remainder are repo-wide signals — a dimension-level measurement, not a single line. (Every path in this report is repo-relative by construction: paths are normalized at the producer and the report is rejected if any rooted path leaks through.)
Is there a tool behind the number? Every score below names the method that produced it — Roslyn, git, a scanner, or (for a handful of documentation/naming dimensions) an LLM labelled sampled · advisory — not a narrative.
Does re-running give the same result? Run it again on the same commit and the score — and this report, byte for byte — is identical. A report whose numbers move between runs is describing the run, not the code.
This report answers yes to all three. That's the bar to hold any assessment to.
Tools & methods
The actual versions used this run (captured at analysis time) — re-run on the same commit for the identical score.
Method
Backs
Version
Evaluator
Roslyn static analysis
Complexity, cohesion, coupling, dead code, API surface, layering
What ran differently this time — a tool absent, degraded, or that fell back to an estimate. Named openly, not folded silently into the scores. A degraded run also records its exact cause in diagnostics.md.
D8 Code Coverage — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. Coverage NOT READ here — but this repository measures it: a coverage step in CI (`codecov/codecov-action`) shows that coverage is collected and tracked in your own CI. The built-in collector has no runner for this ecosystem (.java), so the analyzer could not read the number — a gap in the analyzer's language coverage, not an unmeasured repo. Not scored. To have the real number read, produce a coverage report in a standard format (JaCoCo XML — `mvn jacoco:report`) and commit it — a hosted scan measures a clone of the repository, so a report that exists only in a working tree, a CI runner's or your own, never reaches it; the artefact is commonly gitignored, so `git add -f` that one file (or un-ignore its path) and commit it alongside the code it measures. You can widen what we reach: optional: produce a coverage report in a standard format (JaCoCo XML — `mvn jacoco:report`) and commit it — a hosted scan measures a clone of the repository, so a report that exists only in a working tree, a CI runner's or your own, never reaches it; the artefact is commonly gitignored, so `git add -f` that one file (or un-ignore its path) and commit it alongside the code it measures — then the real number is read on the next scan.
D11 Test Reliability — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. 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 — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. Not scored — 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.
D22 Internal API Consistency — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. D22 identifies the intentionally-exposed surface from `IsPackable` and `.Contracts` project names, MSBuild conventions read off the loaded project set. This target exposed no such projects, so the probe never ran; this says nothing about whether the repository has a public API. This repository commits no C#/VB source at all, so there was never an MSBuild project set to read these conventions off. That is OUR side and it is 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.
D32 Data Compliance (PII/GDPR) — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. `filter/src/main/java/org/apache/rocketmq/filter/parser/SelectorParser.java` produced a parse error, so every rule in this engine's `gdpr.yml` was absent there. That absence is NOT a clean result: these rules detect personal data crossing a boundary into a log sink, a URL or browser storage, and a file that was never parsed cannot report any of the three. The rest of the tree analysed normally and its rows above stand; only these files are unaccounted for. You can widen what we reach: fix the syntax error (or exclude the file deliberately) and re-scan to cover it.
AX1 Captive dependencies — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check reads Microsoft.Extensions.DependencyInjection registrations in C# and Spring beans in Java/Kotlin only, and this repository defines its own container in broker/src/main/java/org/apache/rocketmq/broker/filter/ConsumerFilterManager.java, whose lifetimes are not modelled yet, so it had nothing of this repository's product to read. That is a gap in this analyzer's language reach — not a finding that the repository is free of what this check looks for.
C1 Data Protection — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. These personal data controls are read from declarative annotations, request middleware, entity/column names and guard methods in a C# source model, and none was loaded on this run, so there was nothing to gather. That is a gap in this analyzer's language reach — not a finding that the repository lacks personal data controls.
C2 Access Controls — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. These authorization controls are read from declarative annotations, request middleware, entity/column names and guard methods in a C# source model, and none was loaded on this run, so there was nothing to gather. That is a gap in this analyzer's language reach — not a finding that the repository lacks authorization controls.
C3 Audit Trail — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. These audit controls are read from declarative annotations, request middleware, entity/column names and guard methods in a C# source model, and none was loaded on this run, so there was nothing to gather. That is a gap in this analyzer's language reach — not a finding that the repository lacks audit controls.
C4 Data Retention — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. These retention controls are read from declarative annotations, request middleware, entity/column names and guard methods in a C# source model, and none was loaded on this run, so there was nothing to gather. That is a gap in this analyzer's language reach — not a finding that the repository lacks retention controls.
C5 Data-Subject Rights — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. These data-subject rights controls are read from declarative annotations, request middleware, entity/column names and guard methods in a C# source model, and none was loaded on this run, so there was nothing to gather. That is a gap in this analyzer's language reach — not a finding that the repository lacks data-subject rights controls.
ED5 Idempotency — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check decides whether a handler's mutation is safe to re-run by recognising its persistence writes (a database save, a repository write, an event publish) and its guards. Those markers are .NET member names, so in this repository's language a write such as `repository.save(order)` is not recognised and a same-named call on an unrelated library type could be. The handlers were found; their idempotency was neither confirmed nor ruled out.
GD1 Unfinished & placeholder code — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check reads C# syntax, F#, JavaScript/TypeScript, Dart, Ruby and Scala source only, and no C#, F#, JavaScript/TypeScript, Dart, Ruby or Scala was found, and this repository's Java, Python, 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 — Watchdog measured this, but not all of it. What it did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. 51 further occurrence(s) are not listed individually; the score already reflects all 91.
S1 Web-Security Posture — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. These web-security controls are read from declarative annotations, request middleware, entity/column names and guard methods in a C# source model, and none was loaded on this run, so there was nothing to gather. That is a gap in this analyzer's language reach — not a finding that the repository lacks web-security controls.
X3 Exception handling — measured, with a gap in what it reached — Watchdog measured this, but not all of it. What it did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. 71 further occurrence(s) are not listed individually; the score already reflects all 111.
X4 Structured logging — measured, with a gap in what it reached — Watchdog measured this, but not all of it. What it did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. 291 further occurrence(s) are not listed individually; the score already reflects all 331.
Repo exclusion declarations (.gitattributes linguist-generated/vendored, .editorconfig generated_code): none declared — every source file was scored.
Limitations & what we did not check
Watchdog assesses the repository exactly as committed, and only the repository. By design it does not reach outside the source tree: the live cloud account, the running CI/CD pipeline, the host's branch-protection and approval rules, the production configuration, or a restore actually exercised against a backup are all out of scope. That boundary is a feature, not a gap — a repo-relative, deterministic scan re-runs identically on any commit and every finding opens at a real file and line, where a live audit can neither be reproduced nor traced. The visible consequence is that controls which leave no in-repo evidence are reported as "not evidenced" and excluded from the score rather than awarded a number a static scan cannot justify.
Per-dimension blind spots
For each dimension that was measured, what a static, repo-only scan structurally cannot see — the honest edge of the measurement, not a failure of it.
D1 Cyclomatic Complexity: Cyclomatic complexity counts branches statically — it cannot tell an essential decision tree from accidental tangle, nor see complexity that lives in data or configuration (large switch-case token tables, DSL lexers/parsers, data-as-code rule tables) rather than control flow: a tokenizer's many single-character cases read as high complexity though each branch is trivial.
D2 Cognitive Complexity: Cognitive-complexity heuristics approximate how hard code is to follow; genuine domain difficulty and well-named intent that eases reading are not captured.
D3 God Classes: "God class" is sized by members and responsibilities visible in the type — a deliberately broad facade over a coherent subsystem can read the same as an accidental grab-bag. For front-end JS the file-length check is cohesion-aware (a single-responsibility module — one class/IIFE — earns a 3× threshold), but cohesion is approximated from top-level declarations, not true dependency structure.
D4 Code Duplication: Duplication is token-similarity — an in-process token-stream comparison over sliding windows, with type-aware normalization — so it finds copy-paste, not semantic duplication expressed differently. Committed machine-written code (scaffolded migrations, designer/codegen output, protobuf/OpenAPI stubs, model snapshots) is EXCLUDED — its repetition is the tool's, not the team's — so the score reflects hand-written duplication only.
D5 Coupling: Coupling is measured between projects/assemblies — runtime coupling through DI, reflection, messaging or shared databases is invisible to a static reference graph.
D6 Cohesion (LCOM4): LCOM4 cohesion is syntactic — it infers connectivity from which methods touch which fields/methods by name, not from real runtime behaviour or intent.
D9 Test Distribution: The test-pyramid shape is inferred from project/folder naming and references, with a single test host bucketed per-file by its path tier and content signals — a suite that names tiers unconventionally and gives no per-file signal can still be mis-bucketed.
D10 Test Quality: Assertion density is structural — it cannot tell a meaningful behavioural assertion from a trivial one, only that an assertion is present.
D13 REDACTED Scanning: REDACTED detection is signature- and entropy-based on the current tree — a secret that does not match a known pattern, or one already rotated, will not be flagged (a clean scan is "nothing matched", not "no secrets exist").
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 is judged by an LLM over a bounded sample of docs — it reads what is written, not whether the docs match the running system, and it is advisory, not a measurement. Its critique rows are drawn from a closed category vocabulary and each row means the same thing in every run, so two scans can be compared row by row; the SET that fires is still a sample, and does not repeat exactly. Measured on one frozen input, six scans at one engine SHA: 2-5 critique rows per scan, 8 distinct rows across the six, 3 of those 8 seen in only one scan. So a D19 row is evidence about the documentation, but a COUNT of D19 rows is not a quantity — never read a change in it as an improvement or a regression.
D21 Naming Consistency: Naming quality is an LLM judgement over a bounded sample — it assesses clarity/consistency of the names it sees, not domain-correctness, and is advisory.
D26 Project Cohesion: Project focus is sized from members/namespaces per project — a project that is broad by deliberate design reads the same as one that has sprawled.
D27 Navigability: Indirection/navigability is structural — it measures hops to follow a call, not whether that indirection buys real flexibility or just ceremony.
D28 Secrets (history): Secret-history scanning sweeps the git log for known patterns — a secret that predates the available history, or never matched a signature, is not found (clean means "nothing matched in the history we can see").
D29 Static Analysis (SAST): SAST findings are pattern-based (semgrep) — it finds classes of bug it has rules for; logic flaws, auth/authorization gaps and issues needing runtime context are out of reach (and clean means "no rule matched").
D30 Dependency Vulnerabilities: CVE matching depends on accurate package/version metadata and on the advisory databases — a vulnerability with no published advisory, or in code not declared as a dependency, is not seen. Coverage needs a RESOLVED graph: an unpinned requirements.txt, or a pom without a resolved build, yields partial coverage rather than a clean verdict. An ecosystem the analyzer cannot scan is reported as unmeasured, never as clean.
D34 Knowledge Freshness: Freshness is decayed commit RECENCY, not comprehension — code read often but rarely committed reads as orphaned, and stable code that genuinely needs no changes is penalised the same as forgotten code; bot/squash commits distort it like the bus factor.
D35 Change Coupling: Change coupling is co-change in COMMITS — files split across separate commits, or coupled only through a shared config/build step, read as uncoupled, and a sweeping commit (rename/format) is excluded so it doesn't couple everything. It shows that files change together, not WHY: a high coupling can be a healthy cohesive pair as readily as a hidden leak.
D43 Malicious Dependencies: Only packages some vulnerability database has already NAMED as malicious are seen — a compromise published in the last hours, or never reported at all, is invisible here, and this dimension reading 10 is not evidence that a dependency is trustworthy. There is no typosquat or dependency-confusion analysis: a package nobody has reported is simply absent from the feeds. Coverage is the dependency scan's: an ecosystem that could not be scanned is disclosed as unmeasured, never as clean.
D44 Platform End-of-Life: The support table is FROZEN, so it goes out of date by losing RECALL: a release that ended support after the table was written is missed until the table is refreshed, and this dimension reading 10 is not evidence that a platform is current. Only platforms the repository DECLARES in a place this pass reads are seen — a runtime named only in a Dockerfile (D31's subject), in a CI workflow (D29's), or in a file this pass does not parse (go.mod, a Gemfile ruby directive) is invisible here, which is why a repository declaring none of them abstains rather than scoring. Only frameworks with a PUBLISHED support policy are tracked: React, Flask and Express publish none, so their age cannot be judged and their absence from a report is not a statement that they are supported.
AX10 Code composition: Role is inferred from namespace/folder convention, not semantics — a domain concept living in a folder named "Services" reads as application, and the split is lines-of-code, not business value. The business-logic-share score is a SOFT, FLOORED signal: it contributes to the Architecture lens but is floored at the Critical gate, so an infrastructure-heavy design (a gateway, an ETL, a driver) is legitimately low without being nuked to zero.
M4 Documentation accuracy: Onboarding quality is an LLM read of the docs/setup present — it cannot run the onboarding or measure how long a real new joiner takes; the verdict is sampled and advisory.
P4 Deployment & Rollback: Approval/branch-protection rules live in repository settings the scan cannot see — only their in-repo evidence (config files, workflows) is checked, so a control enforced purely in the host's settings reads as "not evidenced".
P6 Release Hygiene: Rollback/observability controls are inferred from repo artefacts (pipelines, dashboards-as-code) — controls configured in external tooling, with no in-repo trace, cannot be credited.
The LLM boundary
LLM-set scores this run (3): D19, D21, M4 (model: Local LLM). For these, a model reads a bounded sample and sets the numeric score; each names its own sample and method on its card. They are sampled and advisory by design: they vary at the margins between runs and are never a deterministic measurement. Every other score in this report is tool-computed at confidence 1.0.
What it measures: How tangled the control flow is — methods with many branches are hard to test and change.
Method: Cyclomatic complexity per method (1 + decision points), computed exhaustively across production source; test projects separated by convention. Deterministic.
145 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.
+ 140 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.
Enforce Cyclomatic Complexity in CI to reach Verified (currently Documented). — Hardens enforcement from Documented toward Prevented — provenance only; does not change the score.
Detailed fixes: d1_recommendation.md · top locations in Appendix A, every location in findings.md.
What it measures: How hard the code is for a person to follow, beyond raw branching.
Method: Cognitive complexity per method (Sonar-style nesting-penalized score), computed exhaustively over production code, excluding test projects. Deterministic.
+ 360 more group(s) — more in Appendix A; the complete list is findings.md.
What to do
Bring the 23 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 23 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.
Enforce Cognitive Complexity in CI to reach Verified (currently Documented). — Hardens enforcement from Documented toward Prevented — provenance only; does not change the score.
Detailed fixes: d2_recommendation.md · top locations in Appendix A, every location in findings.md.
Do you agree with this assessment?
D3 · God Classes7.7 / 10Strong✓ Tool-verified
What it measures: Over-large classes that try to do too much ("god classes").
Method: God-class detection by line and method-count thresholds per logical type (partial classes unified), filtered for generated code and registration/contract false positives. Deterministic.
Resolve the 75 TooManyMethods finding(s) in God Classes — start with MessageStoreConfig.java (2), ClientConfig.java (2), BrokerConfig.java. — One of this dimension's main actionable groups (75 warning-level).
Resolve the 59 ClassTooLong finding(s) in God Classes — start with MQClientAPIImpl.java, AdminBrokerProcessor.java, DefaultMessageStore.java. — One of this dimension's main actionable groups (59 warning-level).
Resolve the 46 FileTooLong finding(s) in God Classes — start with MQClientAPIImpl.java, AdminBrokerProcessor.java, DefaultMessageStore.java. — One of this dimension's main actionable groups (46 warning-level).
Enforce God Classes in CI to reach Verified (currently Documented). — Hardens enforcement from Documented toward Prevented — provenance only; does not change the score.
Detailed fixes: d3_recommendation.md · top locations in Appendix A, every location in findings.md.
What it measures: Copy-pasted code that should be shared instead.
Method: Code duplication via token-stream sliding windows with type-aware normalization (locals masked, type names preserved), density-scored per KLoC of production code. Deterministic.
673 duplicated block group(s) detected. A further 60 rows report members as variants of one another; they aggregate block groups already counted above and are not themselves counted. 15 of the 733 are in trees this repository does not ship — vendored, example/demo, fixture and benchmark code — and are ranked below the shipped groups rather than excluded from them: the duplication there is real and is still counted in this dimension's score. The dimensions that publish a production-file census leave those trees out of theirs, so this count is deliberately drawn over the wider population.
+ 189 more group(s) — more in Appendix A; the complete list is findings.md.
What to do
Resolve the 48 Duplicated block (7 lines × 2) finding(s) in Code Duplication — start with AdminBrokerProcessor.java (3), RocksDBSubscriptionGroupManager.java (2), ConsumerOffsetManagerV2.java (2). — One of this dimension's main actionable groups (48 warning-level).
Resolve the 47 Duplicated block (6 lines × 2) finding(s) in Code Duplication — start with AdminBrokerProcessor.java (3), MQClientAPIImpl.java (3), RebalanceImpl.java (2). — One of this dimension's main actionable groups (47 warning-level).
Resolve the 45 Duplicated block (9 lines × 2) finding(s) in Code Duplication — start with EndTransactionProcessor.java (2), ConsumeMessageConcurrentlyService.java (2), ConsumeQueue.java (2). — One of this dimension's main actionable groups (45 warning-level).
Enforce Code Duplication in CI to reach Verified (currently Documented). — Hardens enforcement from Documented toward Verified — provenance only; does not change the score.
Detailed fixes: d4_recommendation.md · top locations in Appendix A, every location in findings.md.
Do you agree with this assessment?
D5 · 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).
Enforce Coupling in CI to reach Verified (currently Documented). — Hardens enforcement from Documented toward Prevented — provenance only; does not change the score.
Detailed fixes: d5_recommendation.md · top locations in Appendix A, every location in findings.md.
What it measures: Whether a class's methods are focused on a single responsibility.
Method: LCOM4 cohesion per production class with at least two methods: connected components of methods sharing state or calls, computed syntactically. Deterministic, not a proxy.
Coverage: Exhaustive · type-level: LCOM4 cohesion computed over every production class — the population is all types, not a name convention.
Resolve the 6 Low cohesion finding(s) in Cohesion (LCOM4) — start with ConfigStorage.java, ConfigContext.java, ProduceAccumulator.java. — One of this dimension's main actionable groups (6 warning-level).
Enforce Cohesion (LCOM4) in CI to reach Verified (currently Documented). — Hardens enforcement from Documented toward Verified — provenance only; does not change the score.
Detailed fixes: d6_recommendation.md · top locations in Appendix A, every location in findings.md.
Do you agree with this assessment?
D9 · Test Distribution10.0 / 10Exemplary✓ Tool-verified
What it measures: Whether the test suite has a healthy mix of unit / integration / end-to-end tests.
Method: Test projects classified (Unit/Integration/BDD/E2E) from compiled metadata; test methods counted exhaustively across projects with placement-agnostic disk fallback. Deterministic.
3668 test methods: 3668 unit, 0 integration, 0 BDD, 0 e2e.
✓ On the Gold path — maintain.
Detailed fixes: d9_recommendation.md.
Do you agree with this assessment?
D10 · Test 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 3668 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).
Enforce Test Quality in CI to reach Verified (currently Documented). — Hardens enforcement from Documented toward Prevented — provenance only; does not change the score.
Detailed fixes: d10_recommendation.md · top locations in Appendix A, every location in findings.md.
What it measures: Whether any secrets (keys, tokens, passwords) have leaked into the code.
Method: In-process native secret scanner (entropy plus signature patterns) across all tracked files; no external tool. A clean result is a measured 10, not no-data zero. Deterministic.
What it measures: 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).
Enforce License Compliance in CI to reach Verified (currently Documented). — Hardens enforcement from Documented toward Verified — provenance only; does not change the score.
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 2 Hotspot finding(s) in Churn × Complexity Hotspots — start with DefaultAuthorizationContextBuilder.java, CommitLog.java. — One of this dimension's main actionable groups (2 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.
63 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 · ×5
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 222760 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 ConsumerOffsetManagerV2.java (2), TieredStoreMetricsManager.java (2), SendMessageProcessor.java. — One of this dimension's main actionable groups (12 warning-level).
Resolve the 9 XxxComment finding(s) in Explicit Debt — start with PullMessageProcessor.java (2), ConsumeQueue.java (2), CommitLog.java (2). — One of this dimension's main actionable groups (9 warning-level).
Resolve the 1 FixmeComment finding(s) in Explicit Debt — start with PopReviveService.java. — One of this dimension's main actionable groups (1 warning-level).
Enforce Explicit Debt in CI to reach Verified (currently Documented). — Hardens enforcement from Documented toward Prevented — provenance only; does not change the score.
Detailed fixes: d17_recommendation.md · top locations in Appendix A, every location in findings.md.
What it measures: Whether the project's documentation is clear, complete, and useful.
Method: Judged by language model at low temperature (0.0-0.1) on a deterministic doc sample (READMEs plus first 25 architecture docs), with two-pass stability filtering. Advisory, sampled.
This repository is well documented with a strong README covering the project (Apache RocketMQ) and its main tiers: a root-level developer guide that explains what it does, how to install/run locally, deploy in Docker/Kubernetes, run tests, and contributes; plus architecture/Docs markdown files documenting each tier's scope. The READMEs are complete for their directories but lack an overview of the repository as a whole (installation, usage) — those belong to the root README and are judged there. All visible documents are well-structured with headings and the outline is present in every one. RocketMQ documentation is clear and complete for its scope: the READMEs describe each directory (Flaky Test Detector Plan, Quorum ACK, example, Slave Acting Master mode) while architecture docs cover the four-part technical architecture and network deployment features. The best-practices document is a well-written guide covering producer, consumer, broker, and NameServer configuration plus reliability strategies such as tags, keys, oneway sending, and consumer status handling. All documents are present and fully outlineable; no missing overview, installation, or usage content. (10 of 25 sampled documents could not be assessed: 1 of 3 evaluation groups failed.)
Documentation: no project overviewREADME.md
✓ On the Gold path — maintain.
Detailed fixes: d19_recommendation.md · top locations in Appendix A, every location in findings.md.
What it measures: Whether names — types, methods, variables — are clear and consistent.
Method: Judged by language model at low temperature (0.0-0.1) on a deterministic random symbol sample (fixed size, not exhaustive), with disclosed confidence band. Advisory, sampled.
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.
76 % of calls cross a namespace and 0 % go through an interface, but 100 % of collaborators are co-located — so a call's collaborators sit together and tracing stays easy. Baseline: small — navigation cost is tolerated.
What it measures: Whether any secrets were ever committed — scanned across the full git history, not just now.
Method: REDACTED scan via TWO gitleaks detect passes in an isolated checkout — the full git history, then a second --no-git pass over the working tree as it stands — merged and de-duplicated by (rule, file, line); each match flagged High. Both invocations are recorded in the audit trail. Exhaustive; when the tool is absent, or when its output cannot be parsed into the expected shape, the dimension is WITHHELD as an explicit measurement gap on our side — unscored and excluded from the lens, never a hedged middling score.
1 finding(s): 0 critical, 1 high, 0 medium, 0 low. Remediation for historically-committed secrets is credential rotation — they remain in history regardless of later deletion.
REDACTED
REDACTED
What to do
Resolve the 1 REDACTED finding(s) in Secrets (history) — start with REDACTED. — One of this dimension's main actionable groups (1 issue-level).
Resolve the 1 Rotate the exposed credentials finding(s) in Secrets (history). — One of this dimension's main actionable groups (1 recommendation-level).
Detailed fixes: d28_recommendation.md · top locations in Appendix A, every location in findings.md.
What it measures: Real static-analysis (SAST) findings — likely security bugs in the code, any language.
Method: Polyglot static analysis via semgrep across the repo using the pinned, image-baked p/security-audit + p/owasp-top-ten rulesets (no scan-time registry fetch); severity rules (ERROR/WARNING/INFO) map to a full-band severity-weighted score. Exhaustive, deterministic; degrades on parse failure.
Coverage: semgrep pattern rules over all files — exhaustive for the rule set, blind to classes of bug without a rule (clean = no rule matched).
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.
Resolve the 19 High CVE finding(s) in Dependency Vulnerabilities — start with REDACTED (19). — One of this dimension's main actionable groups (19 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.
475 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 · ×472REDACTED: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 472 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 (472 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. Scored apart from D30 because the answer is binary: there is no safe version to upgrade to, and the fix is to remove the package and rotate every credential it could have read.
Method: The same dependency scan D30 reads, partitioned on the scanner's own classification rather than rescanned: a row is MALICIOUS when its id is in the `MAL-` space (the ossf/malicious-packages feed) OR its `database_specific.cwe_ids` carries `CWE-506` ("Embedded Malicious Code"). Both channels are structural; the summary text is deliberately NOT read, because a malicious-package record whose summary says only "Critical severity vulnerability" is a real shape ([GHSA redacted]) and a text matcher misses it. Scored BINARY: any surviving row is 0, whatever its severity and however many CVEs sit beside it — a hostile dependency is not a quantity. Applicability and degradation are D30's: NotApplicable only when no ecosystem is readable, and an unscannable ecosystem degrades rather than reading clean. SCORED, not informational.
What it measures: Whether anyone still ships security patches for the platform this repository RUNS ON — the runtime it pins and the framework majors its own constraints hold it to. Separate from D12 because the question differs: a current Django on an end-of-life Python is perfectly up to date and completely unsupported, and the fix is a migration rather than a version bump. What the repository says it merely SUPPORTS is never charged.
Method: End-of-life PLATFORM read from the repository's own declarations and graded against a FROZEN, dated table of vendor support dates — no network, no feed, no API, so this dimension answers identically inside a closed scan fence. Two subjects: a RUNTIME the project pins (a single or all-end-of-life TargetFramework, a .nvmrc or .python-version, a requires-python CAP) and a FRAMEWORK major a dependency constraint cannot move off (a caret, tilde or exact version; `vue@^2.7.16` pins Vue 2). A FLOOR is deliberately never charged — `requires-python = ">=3.8"` states what a package SUPPORTS, not what it runs on — and a multi-target project is charged only when EVERY target is out of support. Runtime 4.0/product capped 8.0, framework 1.5 capped 4.5. The table is safe to freeze because a statement about support that ended in the past cannot become false: it loses recall as it ages, never precision, and a test asserts every entry predates the freeze date. Disjoint from D31 (a container image's OS layer) and D29 (the toolchain a CI workflow installs). Abstains when the repository declares no platform this pass reads — never scores it clean.
0 end-of-life runtime(s) and 0 end-of-life framework(s), read from 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.
What to do
The domain core is a small share of production code, but most of the rest matched no layer vocabulary at all — so this is not yet an anemic-domain finding. The namespace/path convention could not place that code, which makes the composition above a statement about the naming, not about the design. Name the layers (or check that the repository's conventions differ from the ones this check knows) before reading a thin domain into it.
Other · Architecture — Whether the project-reference graph is acyclic (cycles block independent build/deploy and signal eroding boundaries).
Method: Project reference cycles via elementary-DFS over real .csproj references, using the engine shared with D5/D7; cyclic versus acyclic. Exhaustive, deterministic.
Other · Architecture — Whether the codebase has a recognisable, scale-appropriate structure (a named architectural style, or modular enough for its size) rather than being an ad-hoc ball of mud.
Method: Roslyn plus csproj analysis: architecture style detection (DDD, clean, vertical-slice, CQRS) and structure fitness for repo size. Deterministic.
Other · Architecture — Whether interfaces stay focused rather than fat — the Interface-Segregation principle (SOLID 'I').
Method: Roslyn scan: public interface declared-member counts (accessors fold into their property/event); fat-interface threshold (over 15 declared members) flagged per type. Each finding also reports the distinct-OPERATION count — members counted by name, so an overload group counts once — which decides whether it states the caller-side ISP harm or the implementer-side burden of an overload set. TypeScript: exported interfaces that declare behaviour, counted over their REQUIRED operations (method signatures and function-typed properties with no `?`, once per signature) — data-shape interfaces and ambient .d.ts declarations are outside the population; JavaScript declares no interfaces and is not applicable. Deterministic, type-level.
`MQAdminExt` declares 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
`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
`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
`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
`Controller` declares 16 abstract methods: `alterSyncStateSet`, `applyBrokerId`, `cleanBrokerData`, `electMaster`, `getControllerMetadata`, `getNextBrokerId`, `getRemotingServer`, `getReplicaInfo`, `getSyncStateData`, `isLeaderState`, `registerBroker`, `registerBrokerLifecycleListener`, `shutdown`, `startScheduling`, `startup`, `stopScheduling`. Counted over its ABSTRACT methods, once per signature; `default`, `static` and `private` methods and constants are not counted, because no implementer is forced to write them. A wide interface forces every implementer and caller to depend on methods they don't use (the Interface-Segregation 'I' in SOLID). Split it into focused role-interfaces. — controller/src/main/java/org/apache/rocketmq/controller/Controller.java:38
`LitePullConsumer` declares 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
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
`reportFailedMsgs` takes parameters but its body is empty — it accepts inputs and does nothing. Either implement it or remove it. — tools/src/main/java/org/apache/rocketmq/tools/monitor/MonitorService.java:320
A test is skipped/ignored — coverage that looks present but never runs. Re-enable it or delete it so the green run means something. — broker/src/test/java/org/apache/rocketmq/broker/controller/ReplicasManagerTest.java:62
What to do
Finish or delete the unfinished stubs (functions that throw "not implemented", or whose body is empty or a bare constant) — they are dead surface that looks live.
Clear the softer debt: re-enable or delete @Disabled/@Ignore tests, decide whether each empty method or UnsupportedOperationException is deliberate (and say so in a comment), and replace @SuppressWarnings("all") with targeted, justified suppressions.
Maturity · Maturity — Whether the repo and its projects have a README, and whether it's substantive and current.
Method: Filesystem scan: README presence, word count, and headings for depth; git history for staleness. Exhaustive across root and project dirs, deterministic.
What to do
Explain in the README how to run the tests. Add a section called Testing to the README in the repository's top folder, saying how to run the test suite.
Add an 'Architecture' / 'How it works' section to the root README — the high-level shape.
Add a README to the 16 of 18 project(s) that lack one — worth up to 1.8 pts.
Maturity · Maturity — Whether key decisions (ADRs) and the high-level shape (C4/diagrams) are written down.
Method: Filesystem scan: ADR folder/naming conventions or content, plus Mermaid/PlantUML/C4/architecture.md discovery. Exhaustive, deterministic.
No Architecture Decision Records found — no conventional ADR directory, no numbered `NNNN-title` documents in any markup this check reads, and nothing ADR-shaped by content. Design rationale recorded elsewhere (a design-notes tree, a mailing list, pull-request discussion) is not visible to this check and is not re-findable per decision, so a future maintainer cannot ask why one choice was made and get an answer.
What to do
Record your significant design decisions. Write one short document per decision, giving its date, the situation, the decision and its consequences, and keep them together with your other design documents. A docs/adr folder with each file named by number and title is the easiest place to find them.
Maturity · Maturity — Whether the README actually describes the code that exists (LLM-judged, advisory).
Method: Judged by language model at low temperature: README accuracy versus actual projects, within a disclosed tolerance. Advisory, not a measured number.
README advertises Docker containerisation, but no Dockerfile/compose file exists — searched for: `dockerfile`, `docker-compose`, `compose.yaml`, `compose.yml`. Each was matched case- and separator-insensitively against file and directory NAMES anywhere in the tree, and against the CONTENTS of manifest and configuration files (package.json and other *.json, *.csproj, *.props, *.sln/*.slnx, *.yml, *.toml, *.config, tool configs such as eslint.config.js, Dockerfile); the README's own prose never counts, so a claim is never refuted by merely being made. Nothing outside that search was read — a footprint living only in a submodule, in a file type not listed here, or under a name none of those terms matches is not seen, and this row is then wrong. — README.md:29
docs/proxy-admin-zh.md names `apache/rocketmq/v2/admin.proto`, but no file or folder `apache/rocketmq/v2/admin.proto` exists. Checked without a model against the repository: its files and folders, the scripts and dependencies of every package.json, the projects, namespaces, package references and target frameworks of the .NET build, the SDK and Node pins, and the identifiers of every file that is not a document; the documents' own text never counts. A footprint generated at build time, read only by a platform, or living outside this repository is not seen, and this row is then wrong. — docs/proxy-admin-zh.md:13
docs/proxy-admin.md names `apache/rocketmq/v2/admin.proto`, but no file or folder `apache/rocketmq/v2/admin.proto` exists. Checked without a model against the repository: its files and folders, the scripts and dependencies of every package.json, the projects, namespaces, package references and target frameworks of the .NET build, the SDK and Node pins, and the identifiers of every file that is not a document; the documents' own text never counts. A footprint generated at build time, read only by a platform, or living outside this repository is not seen, and this row is then wrong. — docs/proxy-admin.md:19
docs/cn/best_practice.md links to `[](`, but `docs/cn/[](` does not exist. Checked without a model against the repository: its files and folders, the scripts and dependencies of every package.json, the projects, namespaces, package references and target frameworks of the .NET build, the SDK and Node pins, and the identifiers of every file that is not a document; the documents' own text never counts. A footprint generated at build time, read only by a platform, or living outside this repository is not seen, and this row is then wrong. — docs/cn/best_practice.md:373
docs/en/Configuration_Client.md documents the environment variable `VIP_CHANNEL_ENABLED`, but no code, script or configuration file names it. Checked without a model against the repository: its files and folders, the scripts and dependencies of every package.json, the projects, namespaces, package references and target frameworks of the .NET build, the SDK and Node pins, and the identifiers of every file that is not a document; the documents' own text never counts. A footprint generated at build time, read only by a platform, or living outside this repository is not seen, and this row is then wrong. — docs/en/Configuration_Client.md:37
docs/en/Configuration_System.md names `os.sh`, but no file or folder `os.sh` exists. Checked without a model against the repository: its files and folders, the scripts and dependencies of every package.json, the projects, namespaces, package references and target frameworks of the .NET build, the SDK and Node pins, and the identifiers of every file that is not a document; the documents' own text never counts. A footprint generated at build time, read only by a platform, or living outside this repository is not seen, and this row is then wrong. — docs/en/Configuration_System.md:43
docs/en/Native_RocksDB.md documents the environment variable `ROCKSDB_INCLUDE`, but no code, script or configuration file names it. Checked without a model against the repository: its files and folders, the scripts and dependencies of every package.json, the projects, namespaces, package references and target frameworks of the .NET build, the SDK and Node pins, and the identifiers of every file that is not a document; the documents' own text never counts. A footprint generated at build time, read only by a platform, or living outside this repository is not seen, and this row is then wrong. — docs/en/Native_RocksDB.md:144
What to do
Reconcile the README with reality: README advertises Docker containerisation, but no Dockerfile/compose file exists; docs/proxy-admin-zh.md names `apache/rocketmq/v2/admin.proto`, but no file or folder `apache/rocketmq/v2/admin.proto` exists; docs/proxy-admin.md names `apache/rocketmq/v2/admin.proto`, but no file or folder `apache/rocketmq/v2/admin.proto` exists; docs/cn/best_practice.md links to `[](`, but `docs/cn/[](` does not exist; docs/en/Configuration_Client.md documents the environment variable `VIP_CHANNEL_ENABLED`, but no code, script or configuration file names it.
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 & versioning6.0 / 10Adequate✓ 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 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.
1594/1925 types (83%) declared in the published library are public. For a library, every public type is a stability contract — keep implementation types off the surface and expose only the intended API.
What to do
Keep implementation types off the public surface (Java: package-private (no modifier), or leave its package out of `module-info` exports) so internals can change without breaking consumers.
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. — namesrv/src/test/java/org/apache/rocketmq/namesrv/routeinfo/RegisterBrokerBenchmark.java
What to do
Run JMH with the GC profiler (`-prof gc`, or addProfiler(GCProfiler.class)) so allocation rate regressions are visible, not just time.
Readiness · Performance — Whether the code is written to minimise allocations so it doesn't pressure its host's memory manager — buffer/slice views over copies, object pooling, stack or value-type allocation, and buffer writers. Reward-only: credited where present, never penalised where a simpler style is fine.
Method: Production-source scan: density (per 1k LoC) of allocation-aware APIs — in .NET Span/Memory, ArrayPool/ObjectPool, stackalloc, ValueTask, value-type structs, IBufferWriter, string.Create, SkipLocalsInit; off .NET, with comments and strings blanked, Go's sync.Pool, preallocated slices/maps, Grow, strconv.Append* and buf[:0] reuse; the JVM's NIO buffer views, MemorySegment, primitive collections, pools and literal presizes (plus Kotlin primitive arrays and value classes, Scala AnyVal and @specialized); Swift's reserveCapacity, ContiguousArray, withUnsafe* access and ~Copyable. Activated off .NET on the same floor (400 lines, and benchmarks or 8 uses); Rust and garbage-collected scripting languages are not applicable. Reward-only. Deterministic, syntax/text detection.
What to do
Raise allocation-aware density on the hot paths — currently 891 use(s) across 250,947 production line(s) (~3.6/1k). More of the idioms below on the allocation-heavy paths climbs this toward 10.
Java: on hot paths, work through buffer views (ByteBuffer/LongBuffer slices, MemorySegment) instead of copies, avoid boxing with primitive collections (fastutil, Eclipse Collections, HPPC, Trove), presize collections and StringBuilders, and pool expensive buffers (Netty's pooled allocator, commons-pool).
Other · Code Health — Whether the code avoids sync-over-async (deadlock-prone blocking on tasks) and async void.
Method: Roslyn syntax scan: async methods scanned for .Wait()/.GetAwaiter().GetResult() and async-void outside event handlers. Deterministic, hard fact per invocation.
Other · Code Health — Whether any branch is dead by construction — a switch arm whose label can never equal a case-normalised subject, or an `else if` whose predicate the arm above has already swallowed.
Method: Roslyn syntax + semantics: switch labels compared against the subject's own case normaliser, and if/else-if chains checked for a literal an earlier arm's containment test already swallows. Deterministic, provable per finding. Advisory.
Do you agree with this assessment?
X13 · Undrained process stream10.0 / 10Exemplary○ Nothing flagged
Other · Code Health — Whether a child process that has BOTH standard streams redirected drains both — reading one to the end while the other is never read deadlocks once the child fills the unread pipe.
Method: Roslyn syntax + semantics: ProcessStartInfo launches with both streams redirected, checked for a drain of each stream across the enclosing type. On a repository with no .NET source it reads JavaScript/TypeScript off the engine’s own token stream (test, vendored and minified paths not) with the same rule: a `spawn` imported from `child_process` whose stdout and stderr are both pipes (no options, no `stdio`, or `stdio` of `'pipe'`), bound to a local that never leaves its scope, where exactly one of the two streams is read, the other never, and the child’s `close`/`exit` (or the read stream’s end) is awaited; a shell redirect in the call’s arguments or a `kill` of the child suppresses it. The same rule reads Python’s `subprocess.Popen`, Dart’s `Process.start`, Ruby’s `Open3.popen3`, and Scala’s JDK process starts (`new ProcessBuilder(…).start()` with no `redirectErrorStream`/`redirectError`/`redirectOutput`/`inheritIO`, `Runtime.getRuntime.exec`) where one of `getInputStream`/`getErrorStream` is read and the other never while `waitFor()` is called or the read stream is read to its end. Deterministic, provable per finding. Advisory.
Other · Security — Whether a hand-rolled public/private IP check can be walked past — a method that unwraps IPv4-mapped IPv6 but returns the opposite verdict for the same host written as IPv4-compatible, 6to4 or NAT64.
Method: Roslyn syntax + semantics: methods that unwrap IPv4-mapped IPv6 and hand-roll IPv4 range carve-outs, checked for whether the IPv6 branch also accounts for the IPv4-compatible, 6to4 and NAT64 embeddings. Deterministic, provable per finding. Advisory.
Do you agree with this assessment?
X15 · Unvalidated length from an untrusted reader2.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.
`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
`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
`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
What to do
Each finding names the read that takes the length from the input and the site that spends it, and states that the value is never compared in between. Confirm from the two, then bound the length against the remaining stream before using it.
Other · Code Health — Whether a loop that shortens a string until it fits a length budget has a floor — one with none grinds the value down to the empty string, or past it into a negative-length `Substring`.
Method: Roslyn syntax + semantics: while/do loops whose body's only effect on a string is to drop its last character, checked for whether anything — a direct comparison on the length, a body guard, a break — bounds that length below. On a repository with no .NET source it reads JavaScript/TypeScript off the engine’s own token stream (test, vendored and minified paths not) with the same rule: a `while`/`do` loop whose body’s one assignment to a value is `x = x.slice(0, -1)` or `x = x.slice|substring|substr(0, x.length - 1)`, driven by a condition that reads `x.length` only as a term of a larger expression — never compared directly, never tested for truthiness, and with no other read of `x` — and whose body has no `break`, `return`, `throw` or `if` naming `x`. Deterministic, provable per finding. Advisory.
Do you agree with this assessment?
X17 · Uncapped recursion over a caller-supplied document10.0 / 10Exemplary○ Nothing flagged
Other · Security — Whether a walk that recurses through a JSON/XML tree handed in by its caller bounds how deep it will go — an uncapped walk lets the document's nesting choose the stack depth, and the resulting StackOverflowException cannot be caught.
Method: Roslyn syntax + semantics: methods that take a JSON/XML document node and call themselves with a child of it, reachable from an externally-callable member of the same type that accepts a document, checked for any depth parameter, descent counter or threaded arithmetic anywhere in the walk. On a repository with no .NET source it reads TypeScript off the engine’s own token stream (test, vendored, generated and minified paths and `.d.ts` not) with the same rule: a function or method with a parameter typed as a document value — `unknown`, `any`, `object`, `Record<string, unknown|any>`, a JSON alias (`JsonValue`, `JSONObject`, …) or a DOM node global the file does not rebind — that calls itself (bare, or through `this` for a method, or hands itself to a call over the value as in `value.map(walk)`) with something it took out of that value and never through an ancestor accessor such as `closest()` or `parentElement`, that is exported or reached from an exported function (a public method of the same exported class) taking such a value, and that names no depth, level, nesting, recursion, remaining or budget anywhere and threads no `+`/`-` arithmetic through a self-call. Plain JavaScript is not read: with no annotation nothing tells a parsed document from a tree the code built itself. Deterministic, provable per finding. Advisory.
Other · Code Health — Whether a type's disposal matches what it OWNS — releasing what it created, leaving alone what it was handed, and not declaring a finalizer for state that has nothing unmanaged to finalize.
Method: Roslyn syntax + semantics: every assignment to a disposable field is read to decide whether the type CREATED the value or was handed it, and the type's disposal is checked against that answer — an injected interface it disposes, a value it constructed and never releases, a finalizer on a type holding nothing unmanaged, and a disposable local whose every reference is a plain member read. A value handed to a container that disposes its contents (a parent control's `Controls` collection, a component `IContainer`) is released by that container and is not reported; generated code is out of population. On a repository with no .NET source the same ownership questions are read in JavaScript/TypeScript off the engine’s own token stream (test, vendored, generated and minified paths not): a class declaring `dispose()`, `[Symbol.dispose]()` or `[Symbol.asyncDispose]()` that disposes a field it was handed through a constructor parameter typed as a repository interface or resolved by a dependency-injection container; that assigns a field only ever from `new X(…)` of a disposable class and neither releases it anywhere in the class nor names it in its disposal member or a method that member calls, nor hands it to anything else; and a `const`/`let` local built from literals only whose every reference opens a statement operating on a non-release member of it. A class is disposable when every repository declaration of its name declares or inherits a disposal member, or when it is a documented library disposable (`vscode` EventEmitter, CancellationTokenSource and Disposable; three.js geometries, materials, textures, render targets, renderers, controls and composers). The finalizer arm has no JavaScript counterpart: a class cannot declare one. Dart is read for the owned-and-never-released arm: a Flutter `State` (or a class declaring `dispose()`/`close()`) whose library-private field is written only with direct creations of a framework controller, `FocusNode`, `StreamController` or periodic `Timer` (or a `.listen(…)` into a field declared `StreamSubscription`), which nothing in the class or its library releases (`dispose`/`close`/`cancel`) and which is never handed on except as a named argument. Ruby is read for the owned-and-never-released arm and the abandoned-local arm: a class declaring an instance `close`, `dispose`, `shutdown`, `stop`, `disconnect` or `terminate` whose instance variable is written only with a blockless core descriptor creation (`File.open`/`new`, `Tempfile`, `Dir.open`, `IO.popen`, the `socket` and `openssl` socket classes) that no method of the class closes and that is never handed on (passed, returned, stored, exposed by `attr_reader`, delegated) — a class whose superclass or mixin lies outside the repository is not judged — and a blockless creation read through and dropped (`File.open(path).read`) or held in a local that is never closed, returned, passed or stored (a `&:read` block-pass, an `autoclose: false` borrow and a `fileno` hand-over are not abandonment). PHP is read for the same two arms: a class (not a trait, and not one using a trait) declaring an instance `close`, `dispose`, `shutdown`, `stop`, `disconnect` or `terminate` whose `private` property (or a `final` class's `protected` one) is written only with a direct core `fopen`, `tmpfile`, `popen`, `proc_open`, `fsockopen`, `stream_socket_client`/`server` or `opendir` that nothing in the class closes (`fclose`, `pclose`, `closedir`, `unset`, a reset to `null`) and that is never handed on, and a handle held in a function's local, or read through as the argument of a reader, that is never closed, returned, passed, captured or stored; a `php://` stream, `curl_init`, `SplFileObject`, `PDO` and a function the repository declares under the core name are not read. Deterministic, provable per finding. Advisory.
Other · Code Health — Whether a method that temporarily changes state belonging to the whole process — the working directory, an environment variable — puts it back on EVERY path: a restore reached only when nothing throws leaks the change to the rest of the process.
Method: Roslyn syntax + semantics: method bodies that write the process working directory or an environment variable and write it back in the same body, checked for whether that restore sits in a `finally`/`catch` or only on the straight-line path. On a repository with no .NET source the same rule reads production JavaScript/TypeScript off the engine’s own token stream (test, vendored and minified paths not): `process.chdir`, `process.env.NAME =`/`["NAME"] =` and `delete process.env.NAME`, and Deno’s `Deno.chdir`/`Deno.env.set`/`Deno.env.delete`, paired per function body (a nested function or arrow is its own body, and module top-level code is none), where the last write puts back a local the body captured from the same global or deletes a variable the first write set, with at least one statement between them; a write in a `catch`/`finally` of that body silences it. Deterministic, provable per finding. Advisory.
Other · Code Health — Whether an argument guard throws the exception its own condition describes — a guard that rejects a value for being EMPTY and reports it as `NullPointerException` (Java, Kotlin, Scala), `ArgumentError.notNull` (Dart) or `ArgumentNullException` (F#'s `nullArg`) tells the caller a parameter was null when it provably was not.
Method: Roslyn syntax: `throw new ArgumentNullException(nameof(p))` statements controlled by an `if`, whose condition is read for a test that is true of a NON-null `p` — an emptiness test that dereferences it (`p.Count == 0`, `!p.Any()`) or a BCL predicate documented true of the empty value (`string.IsNullOrEmpty(p)`). Deterministic, provable per finding. Advisory.
Other · Code Health — Whether a `when` guard is free of side effects — a guard that increments a counter or assigns while deciding whether its arm matches applies that change during PATTERN MATCHING, on an arm that may not be selected, and skips it entirely when a short-circuit to its left answers first.
Method: Roslyn syntax: `when` guards on case labels and switch-expression arms, read for a mutation (`++`/`--`/assignment) sitting in a position the guard's own `&&`/`||`/`??`/`?:`/`?.` can skip. Deterministic, provable per finding. Advisory.
Other · Code Health — Whether a method that TAKES a lock or semaphore and gives it back from a flag-guarded `finally` returns the value that flag implies — reporting success while the guard hands the primitive back admits a second caller the exclusion was there to keep out, and reporting failure while the guard keeps it leaves nothing to ever give it back.
Method: Roslyn syntax: `try` statements whose `finally` releases a synchronisation primitive under a bare local-bool guard, where the method also TOOK that same primitive before the `try`, checked for a `return` of a bool literal whose value disagrees with the flag state the method's own straight-line assignments put it in. Deterministic, provable per finding. Advisory.
Other · Code Health — Whether the work a diagnostic log line costs is paid only when that line is wanted — C# evaluates a call's arguments BEFORE the call, so a trace/debug message joined or projected out of a collection is built in full on every pass, and then discarded by a sink the shipped configuration leaves switched off.
Method: Roslyn syntax: log calls at a diagnostic level (a `Log`-prefixed method naming Trace/Debug/Verbose, or a bare `Debug`/`Trace`/`Verbose` on a receiver named for a logger), whose argument list is read for a call whose cost scales with a sequence — a LINQ operator, a materialisation, `string.Join`, a serializer — with no enclosing level check or conditional-compilation region. On a repository with no .NET source it reads JavaScript/TypeScript off the engine’s own token stream (test, vendored and minified paths not) with the same rule: a `debug`/`trace`/`verbose` call on a receiver named for a logger, or a `log`-prefixed method naming the level, whose argument calls an array operator (`map`/`filter`/`reduce`/`sort`/…), `Array.from`, `Object.keys/values/entries`, `JSON.stringify`/`util.inspect` over anything but a literal, or an array `join` — outside any arrow or function passed as an argument, which the logger calls only when the level is on — with no enclosing `if`, `&&` or `?:` whose condition names a level, a level string, or the `NODE_ENV`/`__DEV__`/`DEV` build switch. Deterministic, provable per finding. Advisory.
`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
`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
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.
Do you agree with this assessment?
X24 · Document value interpolated into markup unescaped10.0 / 10Exemplary○ Nothing flagged
Other · Security — Whether text read out of the document being converted is escaped before it is written into generated markup — a value the document's author chose, interpolated into an attribute the surrounding literal delimits, can close that attribute and open another.
Method: Roslyn semantic model over the whole compilation: a string-typed `Value`/`InnerText`/`InnerXml`/`Text` member declared inside `DocumentFormat.OpenXml` or `System.Xml` is a taint SOURCE, propagated through assignments, returns, arguments, tuple elements and string composition to its transitive closure, then read at interpolated-string holes that sit in a markup position the surrounding literal itself delimits. Escaper/encoder calls and enclosing validator conditions cut the flow. Flow- and container-insensitive by construction. A second arm needs no provenance at all and reports a type that CONTRADICTS ITSELF — the same expression escaped at one delimited markup hole and interpolated raw at another hole in the same markup position of the same type, which the type's own escaping proves is a defect without knowing where the value came from. On a repository with no .NET source it reads JavaScript/TypeScript off the token stream with the same rule: a DOM read of raw document text (`getAttribute`, `textContent`, `innerText`, `nodeValue`) is the source, propagated through local bindings and string composition, and judged at template-literal and concatenation holes in the same two delimited markup positions; escapers and validating conditions cut it, and documentation-site, test, vendored and minified scripts are not read. Deterministic, provable per finding. Advisory.
Other · Code Health — Whether a value the caller is invited to supply is the value the type actually uses — a constructor parameter stored in a private field that nothing ever reads while the default it was given is spelled out a second time at the site that should have read it, a keyed lookup that falls back to a different setting than the one its key names while the same type falls back to the matching one for that same key, or a culture-sensitive parse given no format provider by a type that feeds its own settable culture to the same kind of parse elsewhere, or a number an entry point writes to standard output under the host's culture while the same entry point formats with the invariant culture elsewhere. Either way, every caller who supplies a value silently gets something else.
Method: Roslyn syntax: private instance fields of a non-partial type assigned in a constructor from one of its own parameters with a `??` fallback, checked for whether anything in the type body reads the field and whether that same fallback expression is spelled out again outside the constructor; and `??` fallbacks onto a member access from a lookup call carrying exactly one string literal, grouped by that key across the type and checked for a fallback member whose folded name disagrees with the key while a sibling site for the same key agrees with it. On a repository with no .NET source the first two arms read JavaScript/TypeScript off the engine’s own token stream (tests included, bundles and vendored paths not): a `#x`, `private` or `private` parameter-property instance field filled in the constructor from a parameter (or one member of one) through `??`/`||` or a parameter default, never read anywhere in the file by name, whose constructed default is spelled again in the class body; and `lookup("key") ?? s.member` grouped by key per class, or per module outside every class. The culture arm has no JavaScript counterpart: its parses take no locale. Deterministic, provable per finding. Advisory.
Other · Code Health — Whether a value handed from a callback to the body that waits on it crosses on something built to be crossed — a `Queue<T>`/`List<T>`/`Dictionary<K,V>` written inside an event handler and read back outside it is mutated by two flows at once, and the semaphore or completion source beside it orders how MANY items exist while leaving the collection's own head, tail and backing array unprotected.
Method: Roslyn syntax: method, accessor, local-function and lambda bodies that declare BOTH a non-thread-safe generic collection (`Queue`/`Stack`/`List`/`Dictionary`/`HashSet`/`Sorted*`/`LinkedList`) and a synchronisation primitive (`SemaphoreSlim`/`TaskCompletionSource`/`ManualResetEvent(Slim)`/`AutoResetEvent`/`CountdownEvent`) as locals, then read for a `+=`-registered lambda that raises that primitive while the body outside every lambda waits on it — and, in that scope, a mutating call on the collection inside the lambda paired with a mention of it outside. Any `lock` in the scope abstains it. On a repository with no .NET source the same handoff is read in Java off the engine’s own token stream (test source sets, vendored and demonstration paths not): an `ArrayList`/`LinkedList`/`ArrayDeque`/`PriorityQueue`/`Hash*`/`LinkedHash*`/`Tree*` local and a `CountDownLatch`/`Semaphore`/`CompletableFuture` local, a lambda or anonymous class that raises the primitive and mutates the collection, and a wait outside it; any `synchronized` or `lock()` abstains the body. Because each of those primitives orders what the callback wrote before raising it, only a touch that provably overlaps the callback is convicted: one after the registration and before the next wait, or one in a loop registered-before, waiting on every pass and not declaring the collection. Deterministic, provable per finding. Advisory.
Do you agree with this assessment?
X27 · Collection changed while being enumerated10.0 / 10Exemplary○ Nothing flagged
Other · Code Health — Whether an enhanced `for` leaves the collection it is walking alone — a body that adds to or removes from the very collection the loop is iterating invalidates the fail-fast iterator it is holding, so the next `next()` throws `ConcurrentModificationException` and the remaining elements are never seen. Whether a `for` loop leaves the `dict`, `set` or `deque` it is walking alone — CPython's iterators over those check that the collection has not changed size since the loop began, so a body that removes from (or empties) the very collection the loop is walking makes the next step raise `RuntimeError: dictionary changed size during iteration` and the remaining items are never seen.
Method: Roslyn syntax + semantics: `foreach` statements whose body calls a structural mutator (`Add`/`Remove`/`Clear`/`Insert`/…) on the very expression the loop is enumerating. Two arms. ARM A — the source is a concrete fragile BCL collection, or a live `Keys`/`Values` view over one, and the mutator resolves to that same collection's own member; concurrent and immutable collections and arrays are outside the population by construction, since their enumerators survive a structural change. ARM B — the source is an argument-less accessor CALL on a receiver whose body is in source: the accessor must return a stored field VERBATIM and a sibling member must structurally change that same field, both read off the implementations rather than from the members' names. A mutation the loop provably exits immediately after (`break`/`return`/`throw`/`goto`), or one written inside a nested loop or a lambda, is counted and never reported. Deterministic, provable per finding. Advisory.
Do you agree with this assessment?
X28 · Index access outside its own emptiness guard10.0 / 10Exemplary○ Nothing flagged
Other · Code Health — Whether a condition that tests a value for emptiness indexes that same value only where the test holds — an `||` written one parenthesis too far to the left leaves an index access outside the guard beside it, so the empty case the guard exists to anticipate reaches the index and throws.
Method: Roslyn syntax only, no semantic model: the OUTERMOST `&&`/`||` of every boolean condition, read for a symbol the condition tests for emptiness (`string.IsNullOrEmpty`/`IsNullOrWhiteSpace`, a `Length`/`Count` comparison against a literal, `Any()`, a `Length`/`Count` pattern, or a comparison against `""`) and ALSO indexes. Each `symbol[...]` access is placed by a boolean-reachability walk from the access up to the outermost connective: an access is COVERED when some enclosing step has it in the right operand and the left operand, under the truth value that step forces, proves the symbol non-empty — a recursion over `&&`/`||` whose true- and false-directions are asymmetric. A finding needs BOTH an uncovered access and a covered one on the same symbol in the same condition, which is the agreeing twin that separates a misplaced parenthesis from an unrelated length test. Bare index accesses with no emptiness test in the condition are neither counted nor reported; a non-identifier receiver and a lambda nested inside the condition are outside the population. Deterministic, provable per finding. Advisory.
Do you agree with this assessment?
X29 · Per-element action decided by a fixed element10.0 / 10Exemplary○ Nothing flagged
Other · Code Health — Whether a decision taken once per element is taken ABOUT that element — a test inside a counted loop that reads a fixed subscript of the very collection its guarded statement indexes by the loop variable applies element zero's answer to all of them, so the elements that differ from it are all handled wrongly, and in the same direction.
Method: Roslyn syntax only, no semantic model: every `for` statement declaring exactly ONE loop variable, and every `if` inside its body that is not under a nested loop or a lambda. A site enters the population when the `if`’s condition never mentions the loop variable while the statement it guards indexes some collection by that variable ALONE (`c[i]`; `c[i + 1]` and `c[i, j]` are outside it). A finding additionally needs the AGREEING TWIN at the same-collection grain: the condition must read THAT SAME collection at a subscript that does not move — written into the condition, or reached through a local declared BEFORE the loop, so an alias bound inside the body is not followed. Both collection expressions must be simple identifiers. On a repository with no .NET source the same rule reads JavaScript/TypeScript off the engine’s own token stream (tests included, bundles and vendored paths not): a `for (let|var|const x = …; …; …)` with one declarator and a braced body, an alias followed only when it is declared before the loop in a block that encloses it and never assigned inside the loop. Deterministic, provable per finding. Advisory.
Other · Code Health — Whether exceptions are handled rather than silently swallowed or rethrown with lost stack traces.
Method: Roslyn syntax scan: every catch clause counted; empty catches and bare rethrows flagged. Population is all catch clauses, not estimated. Deterministic, hard fact.
`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. — auth/src/main/java/org/apache/rocketmq/auth/authorization/AuthorizationCompatibility.java:51
An empty catch block silently discards the error — failures vanish with no log and no rethrow. Log it, handle it, or don't catch it. (×32) — broker/src/main/java/org/apache/rocketmq/broker/controller/ReplicasManager.java:186, broker/src/main/java/org/apache/rocketmq/broker/dledger/DLedgerRoleChangeHandler.java:150, broker/src/main/java/org/apache/rocketmq/broker/dledger/DLedgerRoleChangeHandler.java:173, …
`catch (Exception)` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter. (×7) — client/src/main/java/org/apache/rocketmq/client/impl/producer/DefaultMQProducerImpl.java:167, common/src/main/java/org/apache/rocketmq/common/UtilAll.java:70, common/src/main/java/org/apache/rocketmq/common/UtilAll.java:227, …
What to do
Swallowed exception (caught, then discarded)
Do you agree with this assessment?
X30 · Support guard that admits what it rejects10.0 / 10Exemplary○ Nothing flagged
Other · Code Health — Whether a guard written as a NEGATED `||` says what its author meant — `!(a || b || x != k)` is `!a && !b && x == k` by De Morgan, so a bail-out that mixes capabilities the code needs with a fault it refuses turns inside out: it fires only where the capabilities are ABSENT, and lets every value the fault term names walk straight into the body that cannot handle it.
Method: Roslyn syntax only, no semantic model: every logical-not whose operand is a parenthesised `||` chain of two or more disjuncts, flattened (a left-nested `a || b || c` read once would see `(a || b)` as one disjunct). A site enters the population on that shape alone. A finding additionally needs the disjuncts to DISAGREE in polarity: at least one bare boolean read — an identifier or member access, never an invocation, which is a predicate rather than a capability flag — and at least one `x != <constant>`, the only form that negates into an exact-value pin (`== null` negates into a looser requirement and is outside the fault set). Consistently-polarised disjunctions, all-fault or all-capability, are counted and never reported; a negated `&&` is outside the population entirely. No same-receiver gate: it was measured to cost a real defect and remove no false positive. Deterministic, provable per finding. Advisory.
Other · Code Health — Whether log calls use message templates (queryable) rather than interpolated strings.
Method: Roslyn syntax scan: every log call-site counted; interpolated-string first-argument violations flagged. Population is all log calls, not estimated. On a repository with no .NET source it reads JavaScript/TypeScript off the engine’s own token stream (test, vendored and minified paths not) with the same rule: a `trace`/`debug`/`info`/`warn`/`error`/`fatal`/`verbose`/`silly`/`http`/`log` call on a receiver named for a logger, in a package whose own or an enclosing `package.json` declares a logger that carries values as fields (pino, pino-http, nestjs-pino, Fastify, winston, bunyan, tslog, LogTape, roarr), whose first deciding argument is a template literal with substitutions; an object-literal fields argument is stepped over, a plain string message clears the call. Python is read the same way: a `debug`/`info`/`warning`/`error`/`exception`/`critical`/`log` call on a logger in a file that imports the standard library’s `logging` or structlog (loguru, which formats at the call, is not judged), whose message is a whole f-string with a non-constant field; a `%`-formatted, `.format()`-ed or concatenated message is not convicted, as in C#. PHP is read the same way: a PSR-3 level call (`emergency`…`debug`, `log`) on a logger (`$logger`, `$this->logger`, Laravel’s `Log::`, `logger()`, `\Drupal::logger()`) in a package whose `composer.json` requires a PSR-3 logger or a framework that hands one out (psr/log, Monolog, Laravel, Symfony, Drupal, CakePHP), or a file that imports one, whose message is a double-quoted string interpolating a variable; a single-quoted message clears the call, and `sprintf` or `.` concatenation is not convicted, as in C#. Dart is read the same way: a `trace`/`debug`/`info`/`warn`/`error`/`fatal` call on Sentry’s structured logger (`Sentry.logger`) whose message is a whole string literal interpolating a value (`$name`, `${…}`); the `Sentry.logger.fmt` template API clears the call. Dart that logs only through loggers with one message and no fields (package:logging, package:logger, talker, dart:developer) is not applicable rather than a reach gap. Ruby is read the same way: a `trace`/`debug`/`info`/`warn`/`error`/`fatal` call on the console gem’s `Console` (declared by a Gemfile, gemspec or Gemfile.lock, or required) or, where SemanticLogger, Ougai or dry-logger is declared or required, on a receiver named for a logger (`logger`, `@logger`, `Rails.logger`, `log`), whose first deciding argument is, as the whole argument, a double-quoted string interpolating a non-constant value (`#{…}`, `#@ivar`); a plain literal clears the call, keyword arguments are the fields, and a block, `%`-format or `+` concatenation is not convicted. Ruby that logs only through the standard Logger (Rails.logger) is not applicable rather than a reach gap. Deterministic.
`error` at line 102 is handed a message assembled at the call — a string concatenated with a value, or `String.format` — through SLF4J or log4j 2, so the logger receives one finished string: the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the level is filtered out. Pass a constant pattern and the values beside it instead: `log.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. — auth/src/main/java/org/apache/rocketmq/auth/migration/v1/PlainPermissionManager.java:102
`info` at line 63 is handed a message assembled at the call — a string concatenated with a value, or `String.format` — through SLF4J or log4j 2, so the logger receives one finished string: the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the level is filtered out. Pass a constant pattern and the values beside it instead: `log.info("Order {} moved to {}", orderId, status)`, which keeps the pattern and its arguments apart on the event for a structured encoder (logstash-logback-encoder, log4j 2's JsonTemplateLayout, OpenTelemetry), or `log.atInfo().addKeyValue("order_id", orderId).log("order moved")` with SLF4J 2's fluent API. An exception goes last, as the throwable argument, not into the text. — broker/src/main/java/org/apache/rocketmq/broker/BrokerPreOnlineService.java:63
`info` at line 82 is handed a message assembled at the call — a string concatenated with a value, or `String.format` — through SLF4J or log4j 2, so the logger receives one finished string: the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the level is filtered out. Pass a constant pattern and the values beside it instead: `log.info("Order {} moved to {}", orderId, status)`, which keeps the pattern and its arguments apart on the event for a structured encoder (logstash-logback-encoder, log4j 2's JsonTemplateLayout, OpenTelemetry), or `log.atInfo().addKeyValue("order_id", orderId).log("order moved")` with SLF4J 2's fluent API. An exception goes last, as the throwable argument, not into the text. — broker/src/main/java/org/apache/rocketmq/broker/BrokerPreOnlineService.java:82
`warn` at line 76 is handed a message assembled at the call — a string concatenated with a value, or `String.format` — through SLF4J or log4j 2, so the logger receives one finished string: the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the level is filtered out. Pass a constant pattern and the values beside it instead: `log.warn("Order {} moved to {}", orderId, status)`, which keeps the pattern and its arguments apart on the event for a structured encoder (logstash-logback-encoder, log4j 2's JsonTemplateLayout, OpenTelemetry), or `log.atInfo().addKeyValue("order_id", orderId).log("order moved")` with SLF4J 2's fluent API. An exception goes last, as the throwable argument, not into the text. — broker/src/main/java/org/apache/rocketmq/broker/coldctr/ColdDataPullRequestHoldService.java:76
`warn` at line 92 is handed a message assembled at the call — a string concatenated with a value, or `String.format` — through SLF4J or log4j 2, so the logger receives one finished string: the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the level is filtered out. Pass a constant pattern and the values beside it instead: `log.warn("Order {} moved to {}", orderId, status)`, which keeps the pattern and its arguments apart on the event for a structured encoder (logstash-logback-encoder, log4j 2's JsonTemplateLayout, OpenTelemetry), or `log.atInfo().addKeyValue("order_id", orderId).log("order moved")` with SLF4J 2's fluent API. An exception goes last, as the throwable argument, not into the text. — broker/src/main/java/org/apache/rocketmq/broker/coldctr/ColdDataCgCtrService.java:92
`error` 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.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. (×2) — broker/src/main/java/org/apache/rocketmq/broker/failover/EscapeBridge.java:167, client/src/main/java/org/apache/rocketmq/client/consumer/store/LocalFileOffsetStore.java:167
`error` at line 170 is handed a message assembled at the call — a string concatenated with a value, or `String.format` — through SLF4J or log4j 2, so the logger receives one finished string: the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the level is filtered out. Pass a constant pattern and the values beside it instead: `log.error("Order {} moved to {}", orderId, status)`, which keeps the pattern and its arguments apart on the event for a structured encoder (logstash-logback-encoder, log4j 2's JsonTemplateLayout, OpenTelemetry), or `log.atInfo().addKeyValue("order_id", orderId).log("order moved")` with SLF4J 2's fluent API. An exception goes last, as the throwable argument, not into the text. — broker/src/main/java/org/apache/rocketmq/broker/failover/EscapeBridge.java:170
`error` at line 108 is handed a message assembled at the call — a string concatenated with a value, or `String.format` — through SLF4J or log4j 2, so the logger receives one finished string: the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the level is filtered out. Pass a constant pattern and the values beside it instead: `log.error("Order {} moved to {}", orderId, status)`, which keeps the pattern and its arguments apart on the event for a structured encoder (logstash-logback-encoder, log4j 2's JsonTemplateLayout, OpenTelemetry), or `log.atInfo().addKeyValue("order_id", orderId).log("order moved")` with SLF4J 2's fluent API. An exception goes last, as the throwable argument, not into the text. — broker/src/main/java/org/apache/rocketmq/broker/filter/ExpressionMessageFilter.java:108
`error` at line 149 is handed a message assembled at the call — a string concatenated with a value, or `String.format` — through SLF4J or log4j 2, so the logger receives one finished string: the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the level is filtered out. Pass a constant pattern and the values beside it instead: `log.error("Order {} moved to {}", orderId, status)`, which keeps the pattern and its arguments apart on the event for a structured encoder (logstash-logback-encoder, log4j 2's JsonTemplateLayout, OpenTelemetry), or `log.atInfo().addKeyValue("order_id", orderId).log("order moved")` with SLF4J 2's fluent API. An exception goes last, as the throwable argument, not into the text. — broker/src/main/java/org/apache/rocketmq/broker/filter/ExpressionMessageFilter.java:149
`error` at line 86 is handed a message assembled at the call — a string concatenated with a value, or `String.format` — through SLF4J or log4j 2, so the logger receives one finished string: the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the level is filtered out. Pass a constant pattern and the values beside it instead: `log.error("Order {} moved to {}", orderId, status)`, which keeps the pattern and its arguments apart on the event for a structured encoder (logstash-logback-encoder, log4j 2's JsonTemplateLayout, OpenTelemetry), or `log.atInfo().addKeyValue("order_id", orderId).log("order moved")` with SLF4J 2's fluent API. An exception goes last, as the throwable argument, not into the text. — broker/src/main/java/org/apache/rocketmq/broker/filter/ExpressionForRetryMessageFilter.java:86
`error` at line 267 is handed a message assembled at the call — a string concatenated with a value, or `String.format` — through SLF4J or log4j 2, so the logger receives one finished string: the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the level is filtered out. Pass a constant pattern and the values beside it instead: `log.error("Order {} moved to {}", orderId, status)`, which keeps the pattern and its arguments apart on the event for a structured encoder (logstash-logback-encoder, log4j 2's JsonTemplateLayout, OpenTelemetry), or `log.atInfo().addKeyValue("order_id", orderId).log("order moved")` with SLF4J 2's fluent API. An exception goes last, as the throwable argument, not into the text. — broker/src/main/java/org/apache/rocketmq/broker/filter/ConsumerFilterManager.java:267
`error` at line 75 is handed a message assembled at the call — a string concatenated with a value, or `String.format` — through SLF4J or log4j 2, so the logger receives one finished string: the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the level is filtered out. Pass a constant pattern and the values beside it instead: `log.error("Order {} moved to {}", orderId, status)`, which keeps the pattern and its arguments apart on the event for a structured encoder (logstash-logback-encoder, log4j 2's JsonTemplateLayout, OpenTelemetry), or `log.atInfo().addKeyValue("order_id", orderId).log("order moved")` with SLF4J 2's fluent API. An exception goes last, as the throwable argument, not into the text. — broker/src/main/java/org/apache/rocketmq/broker/latency/BrokerFastFailure.java:75
`warn` at line 142 is handed a message assembled at the call — a string concatenated with a value, or `String.format` — through SLF4J or log4j 2, so the logger receives one finished string: the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the level is filtered out. Pass a constant pattern and the values beside it instead: `log.warn("Order {} moved to {}", orderId, status)`, which keeps the pattern and its arguments apart on the event for a structured encoder (logstash-logback-encoder, log4j 2's JsonTemplateLayout, OpenTelemetry), or `log.atInfo().addKeyValue("order_id", orderId).log("order moved")` with SLF4J 2's fluent API. An exception goes last, as the throwable argument, not into the text. — broker/src/main/java/org/apache/rocketmq/broker/latency/BrokerFastFailure.java:142
`warn` at line 86 is handed a message assembled at the call — a string concatenated with a value, or `String.format` — through SLF4J or log4j 2, so the logger receives one finished string: the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the level is filtered out. Pass a constant pattern and the values beside it instead: `log.warn("Order {} moved to {}", orderId, status)`, which keeps the pattern and its arguments apart on the event for a structured encoder (logstash-logback-encoder, log4j 2's JsonTemplateLayout, OpenTelemetry), or `log.atInfo().addKeyValue("order_id", orderId).log("order moved")` with SLF4J 2's fluent API. An exception goes last, as the throwable argument, not into the text. — broker/src/main/java/org/apache/rocketmq/broker/longpolling/PullRequestHoldService.java:86
`error` at line 406 is handed a message assembled at the call — a string concatenated with a value, or `String.format` — through SLF4J or log4j 2, so the logger receives one finished string: the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the level is filtered out. Pass a constant pattern and the values beside it instead: `log.error("Order {} moved to {}", orderId, status)`, which keeps the pattern and its arguments apart on the event for a structured encoder (logstash-logback-encoder, log4j 2's JsonTemplateLayout, OpenTelemetry), or `log.atInfo().addKeyValue("order_id", orderId).log("order moved")` with SLF4J 2's fluent API. An exception goes last, as the throwable argument, not into the text. — broker/src/main/java/org/apache/rocketmq/broker/offset/ConsumerOffsetManager.java:406
`error` at line 365 is handed a message assembled at the call — a string concatenated with a value, or `String.format` — through SLF4J or log4j 2, so the logger receives one finished string: the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the level is filtered out. Pass a constant pattern and the values beside it instead: `log.error("Order {} moved to {}", orderId, status)`, which keeps the pattern and its arguments apart on the event for a structured encoder (logstash-logback-encoder, log4j 2's JsonTemplateLayout, OpenTelemetry), or `log.atInfo().addKeyValue("order_id", orderId).log("order moved")` with SLF4J 2's fluent API. An exception goes last, as the throwable argument, not into the text. — broker/src/main/java/org/apache/rocketmq/broker/out/BrokerOuterAPI.java:365
`error` at line 395 is handed a message assembled at the call — a string concatenated with a value, or `String.format` — through SLF4J or log4j 2, so the logger receives one finished string: the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the level is filtered out. Pass a constant pattern and the values beside it instead: `log.error("Order {} moved to {}", orderId, status)`, which keeps the pattern and its arguments apart on the event for a structured encoder (logstash-logback-encoder, log4j 2's JsonTemplateLayout, OpenTelemetry), or `log.atInfo().addKeyValue("order_id", orderId).log("order moved")` with SLF4J 2's fluent API. An exception goes last, as the throwable argument, not into the text. — broker/src/main/java/org/apache/rocketmq/broker/out/BrokerOuterAPI.java:395
`error` at line 1163 is handed a message assembled at the call — a string concatenated with a value, or `String.format` — through SLF4J or log4j 2, so the logger receives one finished string: the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the level is filtered out. Pass a constant pattern and the values beside it instead: `log.error("Order {} moved to {}", orderId, status)`, which keeps the pattern and its arguments apart on the event for a structured encoder (logstash-logback-encoder, log4j 2's JsonTemplateLayout, OpenTelemetry), or `log.atInfo().addKeyValue("order_id", orderId).log("order moved")` with SLF4J 2's fluent API. An exception goes last, as the throwable argument, not into the text. — broker/src/main/java/org/apache/rocketmq/broker/out/BrokerOuterAPI.java:1163
`error` at line 1174 is handed a message assembled at the call — a string concatenated with a value, or `String.format` — through SLF4J or log4j 2, so the logger receives one finished string: the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the level is filtered out. Pass a constant pattern and the values beside it instead: `log.error("Order {} moved to {}", orderId, status)`, which keeps the pattern and its arguments apart on the event for a structured encoder (logstash-logback-encoder, log4j 2's JsonTemplateLayout, OpenTelemetry), or `log.atInfo().addKeyValue("order_id", orderId).log("order moved")` with SLF4J 2's fluent API. An exception goes last, as the throwable argument, not into the text. — broker/src/main/java/org/apache/rocketmq/broker/out/BrokerOuterAPI.java:1174
`error` at line 601 is handed a message assembled at the call — a string concatenated with a value, or `String.format` — through SLF4J or log4j 2, so the logger receives one finished string: the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the level is filtered out. Pass a constant pattern and the values beside it instead: `log.error("Order {} moved to {}", orderId, status)`, which keeps the pattern and its arguments apart on the event for a structured encoder (logstash-logback-encoder, log4j 2's JsonTemplateLayout, OpenTelemetry), or `log.atInfo().addKeyValue("order_id", orderId).log("order moved")` with SLF4J 2's fluent API. An exception goes last, as the throwable argument, not into the text. — broker/src/main/java/org/apache/rocketmq/broker/processor/PopBufferMergeService.java:601
`warn` at line 294 is handed a message assembled at the call — a string concatenated with a value, or `String.format` — through SLF4J or log4j 2, so the logger receives one finished string: the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the level is filtered out. Pass a constant pattern and the values beside it instead: `log.warn("Order {} moved to {}", orderId, status)`, which keeps the pattern and its arguments apart on the event for a structured encoder (logstash-logback-encoder, log4j 2's JsonTemplateLayout, OpenTelemetry), or `log.atInfo().addKeyValue("order_id", orderId).log("order moved")` with SLF4J 2's fluent API. An exception goes last, as the throwable argument, not into the text. — broker/src/main/java/org/apache/rocketmq/broker/processor/DefaultPullMessageResultHandler.java:294
`error` at line 449 is handed a message assembled at the call — a string concatenated with a value, or `String.format` — through SLF4J or log4j 2, so the logger receives one finished string: the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the level is filtered out. Pass a constant pattern and the values beside it instead: `log.error("Order {} moved to {}", orderId, status)`, which keeps the pattern and its arguments apart on the event for a structured encoder (logstash-logback-encoder, log4j 2's JsonTemplateLayout, OpenTelemetry), or `log.atInfo().addKeyValue("order_id", orderId).log("order moved")` with SLF4J 2's fluent API. An exception goes last, as the throwable argument, not into the text. — broker/src/main/java/org/apache/rocketmq/broker/processor/AdminBrokerProcessor.java:449
`error` at line 3140 is handed a message assembled at the call — a string concatenated with a value, or `String.format` — through SLF4J or log4j 2, so the logger receives one finished string: the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the level is filtered out. Pass a constant pattern and the values beside it instead: `log.error("Order {} moved to {}", orderId, status)`, which keeps the pattern and its arguments apart on the event for a structured encoder (logstash-logback-encoder, log4j 2's JsonTemplateLayout, OpenTelemetry), or `log.atInfo().addKeyValue("order_id", orderId).log("order moved")` with SLF4J 2's fluent API. An exception goes last, as the throwable argument, not into the text. — broker/src/main/java/org/apache/rocketmq/broker/processor/AdminBrokerProcessor.java:3140
`error` at line 392 is handed a message assembled at the call — a string concatenated with a value, or `String.format` — through SLF4J or log4j 2, so the logger receives one finished string: the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the level is filtered out. Pass a constant pattern and the values beside it instead: `log.error("Order {} moved to {}", orderId, status)`, which keeps the pattern and its arguments apart on the event for a structured encoder (logstash-logback-encoder, log4j 2's JsonTemplateLayout, OpenTelemetry), or `log.atInfo().addKeyValue("order_id", orderId).log("order moved")` with SLF4J 2's fluent API. An exception goes last, as the throwable argument, not into the text. — broker/src/main/java/org/apache/rocketmq/broker/processor/AckMessageProcessor.java:392
`error` at line 382 is handed a message assembled at the call — a string concatenated with a value, or `String.format` — through SLF4J or log4j 2, so the logger receives one finished string: the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the level is filtered out. Pass a constant pattern and the values beside it instead: `log.error("Order {} moved to {}", orderId, status)`, which keeps the pattern and its arguments apart on the event for a structured encoder (logstash-logback-encoder, log4j 2's JsonTemplateLayout, OpenTelemetry), or `log.atInfo().addKeyValue("order_id", orderId).log("order moved")` with SLF4J 2's fluent API. An exception goes last, as the throwable argument, not into the text. — broker/src/main/java/org/apache/rocketmq/broker/subscription/SubscriptionGroupManager.java:382
`info` at line 185 is handed a message assembled at the call — a string concatenated with a value, or `String.format` — through SLF4J or log4j 2, so the logger receives one finished string: the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the level is filtered out. Pass a constant pattern and the values beside it instead: `log.info("Order {} moved to {}", orderId, status)`, which keeps the pattern and its arguments apart on the event for a structured encoder (logstash-logback-encoder, log4j 2's JsonTemplateLayout, OpenTelemetry), or `log.atInfo().addKeyValue("order_id", orderId).log("order moved")` with SLF4J 2's fluent API. An exception goes last, as the throwable argument, not into the text. — broker/src/main/java/org/apache/rocketmq/broker/topic/TopicRouteInfoManager.java:185
`error` at line 691 is handed a message assembled at the call — a string concatenated with a value, or `String.format` — through SLF4J or log4j 2, so the logger receives one finished string: the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the level is filtered out. Pass a constant pattern and the values beside it instead: `log.error("Order {} moved to {}", orderId, status)`, which keeps the pattern and its arguments apart on the event for a structured encoder (logstash-logback-encoder, log4j 2's JsonTemplateLayout, OpenTelemetry), or `log.atInfo().addKeyValue("order_id", orderId).log("order moved")` with SLF4J 2's fluent API. An exception goes last, as the throwable argument, not into the text. — broker/src/main/java/org/apache/rocketmq/broker/topic/TopicConfigManager.java:691
`info` at line 40 is handed a message assembled at the call — a string concatenated with a value, or `String.format` — through SLF4J or log4j 2, so the logger receives one finished string: the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the level is filtered out. Pass a constant pattern and the values beside it instead: `log.info("Order {} moved to {}", orderId, status)`, which keeps the pattern and its arguments apart on the event for a structured encoder (logstash-logback-encoder, log4j 2's JsonTemplateLayout, OpenTelemetry), or `log.atInfo().addKeyValue("order_id", orderId).log("order moved")` with SLF4J 2's fluent API. An exception goes last, as the throwable argument, not into the text. — broker/src/main/java/org/apache/rocketmq/broker/transaction/TransactionMetricsFlushService.java:40
`error` at line 55 is handed a message assembled at the call — a string concatenated with a value, or `String.format` — through SLF4J or log4j 2, so the logger receives one finished string: the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the level is filtered out. Pass a constant pattern and the values beside it instead: `log.error("Order {} moved to {}", orderId, status)`, which keeps the pattern and its arguments apart on the event for a structured encoder (logstash-logback-encoder, log4j 2's JsonTemplateLayout, OpenTelemetry), or `log.atInfo().addKeyValue("order_id", orderId).log("order moved")` with SLF4J 2's fluent API. An exception goes last, as the throwable argument, not into the text. — broker/src/main/java/org/apache/rocketmq/broker/transaction/TransactionMetricsFlushService.java:55
`info` at line 58 is handed a message assembled at the call — a string concatenated with a value, or `String.format` — through SLF4J or log4j 2, so the logger receives one finished string: the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the level is filtered out. Pass a constant pattern and the values beside it instead: `log.info("Order {} moved to {}", orderId, status)`, which keeps the pattern and its arguments apart on the event for a structured encoder (logstash-logback-encoder, log4j 2's JsonTemplateLayout, OpenTelemetry), or `log.atInfo().addKeyValue("order_id", orderId).log("order moved")` with SLF4J 2's fluent API. An exception goes last, as the throwable argument, not into the text. — broker/src/main/java/org/apache/rocketmq/broker/transaction/TransactionMetricsFlushService.java:58
`warn` at line 168 is handed a message assembled at the call — a string concatenated with a value, or `String.format` — through SLF4J or log4j 2, so the logger receives one finished string: the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the level is filtered out. Pass a constant pattern and the values beside it instead: `log.warn("Order {} moved to {}", orderId, status)`, which keeps the pattern and its arguments apart on the event for a structured encoder (logstash-logback-encoder, log4j 2's JsonTemplateLayout, OpenTelemetry), or `log.atInfo().addKeyValue("order_id", orderId).log("order moved")` with SLF4J 2's fluent API. An exception goes last, as the throwable argument, not into the text. — broker/src/main/java/org/apache/rocketmq/broker/transaction/queue/TransactionalMessageServiceImpl.java:168
`info` at line 257 is handed a message assembled at the call — a string concatenated with a value, or `String.format` — through SLF4J or log4j 2, so the logger receives one finished string: the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the level is filtered out. Pass a constant pattern and the values beside it instead: `log.info("Order {} moved to {}", orderId, status)`, which keeps the pattern and its arguments apart on the event for a structured encoder (logstash-logback-encoder, log4j 2's JsonTemplateLayout, OpenTelemetry), or `log.atInfo().addKeyValue("order_id", orderId).log("order moved")` with SLF4J 2's fluent API. An exception goes last, as the throwable argument, not into the text. — broker/src/main/java/org/apache/rocketmq/broker/transaction/rocksdb/TransactionalMessageRocksDBService.java:257
`info` at line 268 is handed a message assembled at the call — a string concatenated with a value, or `String.format` — through SLF4J or log4j 2, so the logger receives one finished string: the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the level is filtered out. Pass a constant pattern and the values beside it instead: `log.info("Order {} moved to {}", orderId, status)`, which keeps the pattern and its arguments apart on the event for a structured encoder (logstash-logback-encoder, log4j 2's JsonTemplateLayout, OpenTelemetry), or `log.atInfo().addKeyValue("order_id", orderId).log("order moved")` with SLF4J 2's fluent API. An exception goes last, as the throwable argument, not into the text. — broker/src/main/java/org/apache/rocketmq/broker/transaction/rocksdb/TransactionalMessageRocksDBService.java:268
`warn` at line 79 is handed a message assembled at the call — a string concatenated with a value, or `String.format` — through SLF4J or log4j 2, so the logger receives one finished string: the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the level is filtered out. Pass a constant pattern and the values beside it instead: `log.warn("Order {} moved to {}", orderId, status)`, which keeps the pattern and its arguments apart on the event for a structured encoder (logstash-logback-encoder, log4j 2's JsonTemplateLayout, OpenTelemetry), or `log.atInfo().addKeyValue("order_id", orderId).log("order moved")` with SLF4J 2's fluent API. An exception goes last, as the throwable argument, not into the text. — broker/src/main/java/org/apache/rocketmq/broker/util/HookUtils.java:79
`warn` at line 109 is handed a message assembled at the call — a string concatenated with a value, or `String.format` — through SLF4J or log4j 2, so the logger receives one finished string: the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the level is filtered out. Pass a constant pattern and the values beside it instead: `log.warn("Order {} moved to {}", orderId, status)`, which keeps the pattern and its arguments apart on the event for a structured encoder (logstash-logback-encoder, log4j 2's JsonTemplateLayout, OpenTelemetry), or `log.atInfo().addKeyValue("order_id", orderId).log("order moved")` with SLF4J 2's fluent API. An exception goes last, as the throwable argument, not into the text. — client/src/main/java/org/apache/rocketmq/client/consumer/store/RemoteBrokerOffsetStore.java:109
`error` at line 141 is handed a message assembled at the call — a string concatenated with a value, or `String.format` — through SLF4J or log4j 2, so the logger receives one finished string: the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the level is filtered out. Pass a constant pattern and the values beside it instead: `log.error("Order {} moved to {}", orderId, status)`, which keeps the pattern and its arguments apart on the event for a structured encoder (logstash-logback-encoder, log4j 2's JsonTemplateLayout, OpenTelemetry), or `log.atInfo().addKeyValue("order_id", orderId).log("order moved")` with SLF4J 2's fluent API. An exception goes last, as the throwable argument, not into the text. — client/src/main/java/org/apache/rocketmq/client/consumer/store/RemoteBrokerOffsetStore.java:141
`error` at line 169 is handed a message assembled at the call — a string concatenated with a value, or `String.format` — through SLF4J or log4j 2, so the logger receives one finished string: the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the level is filtered out. Pass a constant pattern and the values beside it instead: `log.error("Order {} moved to {}", orderId, status)`, which keeps the pattern and its arguments apart on the event for a structured encoder (logstash-logback-encoder, log4j 2's JsonTemplateLayout, OpenTelemetry), or `log.atInfo().addKeyValue("order_id", orderId).log("order moved")` with SLF4J 2's fluent API. An exception goes last, as the throwable argument, not into the text. — client/src/main/java/org/apache/rocketmq/client/consumer/store/RemoteBrokerOffsetStore.java:169
`error` at line 195 is handed a message assembled at the call — a string concatenated with a value, or `String.format` — through SLF4J or log4j 2, so the logger receives one finished string: the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the level is filtered out. Pass a constant pattern and the values beside it instead: `log.error("Order {} moved to {}", orderId, status)`, which keeps the pattern and its arguments apart on the event for a structured encoder (logstash-logback-encoder, log4j 2's JsonTemplateLayout, OpenTelemetry), or `log.atInfo().addKeyValue("order_id", orderId).log("order moved")` with SLF4J 2's fluent API. An exception goes last, as the throwable argument, not into the text. — client/src/main/java/org/apache/rocketmq/client/consumer/store/LocalFileOffsetStore.java:195
`info` at line 366 is handed a message assembled at the call — a string concatenated with a value, or `String.format` — through SLF4J or log4j 2, so the logger receives one finished string: the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the level is filtered out. Pass a constant pattern and the values beside it instead: `log.info("Order {} moved to {}", orderId, status)`, which keeps the pattern and its arguments apart on the event for a structured encoder (logstash-logback-encoder, log4j 2's JsonTemplateLayout, OpenTelemetry), or `log.atInfo().addKeyValue("order_id", orderId).log("order moved")` with SLF4J 2's fluent API. An exception goes last, as the throwable argument, not into the text. — client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:366
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/276 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 — 25 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 — 48 check(s) not relevant to this codebase
These checks had nothing to measure here (no tests, no git history, the codebase is small, or the architecture style doesn't apply), so they're omitted above rather than scored low.
AC1 Text alternatives — No web markup found — accessibility is not applicable to this repository.
AC2 Forms & labels — No web markup found — accessibility is not applicable to this repository.
AC3 Page structure — No web markup found — accessibility is not applicable to this repository.
AC4 Keyboard semantics — No web markup found — accessibility is not applicable to this repository.
AC5 ARIA correctness — No web markup found — accessibility is not applicable to this repository.
AC6 Visual & motion safety — No web markup found — accessibility is not applicable to this repository.
AC7 A11y enforcement — No web markup found — accessibility is not applicable to this repository.
AX1 Captive dependencies — not analysed — these correctness checks read a source model that was not loaded for this repository, because the repository is written in a language this check does not yet model, or because its projects failed to load. This is a gap in the analyzer, not a finding about this repository
AX2 Stateful singletons — No container singleton was found, so there is no shared instance for concurrent requests to race on. No class in this Java code is a Spring, JSR-330 or CDI singleton bean. No function in this Python code is served by a threaded web framework (a Flask, Bottle or FastAPI route, a Django or Pyramid view), so no module is shared between request threads.
AX4 Dependency direction — not applicable to a CQRS architecture (the inward-dependency rule is for layered/clean styles)
AX7 Slice cohesion — not applicable — not a vertical-slice architecture
AX8 Test isolation — no test/production split to check
AX9 CQS / query purity — no CQRS query handlers detected — query purity is not applicable to this codebase
AXB1 Runtime evidence locked — no reproducible boot — This repository has nothing the runtime tiers could boot or serve — no markup, no UI framework or web-server dependency, no UI component source, no native UI project and no API definition — nothing here is a surface to boot — so runtime a11y/egress/header evidence has no subject here. Not applicable: this is neither a gap in the scan nor a finding about your code.
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.
D22 Internal API Consistency — The exposed public-API surface could not be collected — no C#/VB projects loaded.
D23 Boundary Type-Coupling — No bounded-context organisation was detected either — neither a context-shaped layout, nor 2+ sibling source directories each declaring an aggregate root, nor 2+ projects each declaring an entity of their own. Declaring this codebase's bounded contexts (≥2) would let cross-boundary type coupling be assessed. Declare them in `.codehealth/config.yaml` at the repository root (create it if absent), mapping each context name to the module-path or namespace prefixes that belong to it — e.g. `architecture:` → `contexts:` → `Billing: ["src/billing", "Acme.Billing"]`, `Catalog: ["src/catalog", "Acme.Catalog"]`.
D24 Comment Value — No inline comments to assess — comment value is not applicable here.
D25 ADR Conformance — no ADRs to check
D31 IaC & Container Security — No Infrastructure-as-Code or container manifests found (Dockerfile, Docker Compose, Terraform, Kubernetes/Helm, CloudFormation, ARM, Bicep, Ansible); nothing to scan.
D32 Data Compliance (PII/GDPR) — 1 file(s) were not parsed by semgrep — the PII/GDPR ruleset never ran over them
D37 Vulnerability-disclosure Policy — No vulnerability-disclosure policy file found (SECURITY.md/.markdown/.rst/.txt at root or under .github/.forgejo/.gitea/docs, .well-known/security.txt). A coordinated-disclosure policy may live off-repo, so this is not evidenced rather than failed.
D39 IL Efficiency — D39 measures the IL emitted by a .NET build; this repository has no .NET solution or project files, so the dimension does not apply.
D40 Network Egress Confinement — No Kubernetes/orchestration workloads found in the repository manifests; network egress policy is a cluster-native control that may live at the platform/firewall layer, so there is nothing to assess here.
D41 Kernel & Syscall Confinement — No Kubernetes/orchestration workloads found in the repository manifests; seccomp/AppArmor/SELinux confinement is a workload-level control, so there is nothing to assess here.
D42 Runtime Threat Enforcement — No Kubernetes/orchestration workloads found in the repository manifests; runtime threat-detection and admission-control policy are cluster-level controls, so there is nothing to assess here.
D7 Architectural Integrity — no checkable ADRs, and no project-reference graph for the cycle pass to read — so this dimension makes no claim about dependency cycles in either direction (where this repository's language has an import-cycle lens, cycles are reported there). Architectural integrity not assessed
D8 Code Coverage — Coverage not included — suite not readable by the collector
DM1 Domain Modelling — applicable but not scored (3 signals for this style, 3 needed — the count is met but a required primary signal is absent): 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 — no coverage report found on disk — produce a coverage report in a standard format (JaCoCo XML — `mvn jacoco:report`) and commit it — a hosted scan measures a clone of the repository, so a report that exists only in a working tree, a CI runner's or your own, never reaches it; the artefact is commonly gitignored, so `git add -f` that one file (or un-ignore its path) and commit it alongside the code it measures, or wire coverage collection into CI, to enable this cross-layer check
PF3 Async & latency hygiene — Not applicable: this repository declares no async functions, so there is no asynchronous code for a blocking call to stall.
S1 Web-Security Posture — Not assessed: these web-security controls are read from a source model (declarative annotations, request middleware, entity/column names, guard methods) that was not loaded for this repository — because the repository is written in a language this check does not yet model, or because its projects failed to load. Absence of an idiom this check recognises is NOT evidence that this repository lacks web-security controls: it may implement them entirely in its own ecosystem. This is a gap in the analyzer's language coverage, not a finding about this repository.
X2 Cancellation propagation — no C# was loaded; this repository's Java and Python were read, and no request in it can be cancelled by a caller — a Java request off Android takes no token: it is cancelled through the handle it returns (Future.cancel, Call.cancel, a Disposable), ambiently (io.grpc.Context) or by interrupting its thread, not through a parameter; a Python request takes no token: asyncio cancels the task and trio or anyio the scope that made it, from outside the call, and requests, httpx, aiohttp and gRPC take a timeout, not a cancellation
X32 Type resolved by simple name across every loaded assembly — This check is about how a .NET program searches the assemblies loaded into its process for a type, and this repository contains no .NET source, so there is nothing here for it to assess. Not a gap in the analyzer and not a finding about your code.
X6 Hand-rolled structured-format parsing — Advisory — this card reports evidence and never carries a score, so there is nothing missing here.
X9 Subsumed condition operand — Advisory — this card reports evidence and never carries a score, so there is nothing missing here.
Appendix A — Findings (grouped)
The findings behind the scores, grouped by severity, then by dimension and kind. The high-severity issues are enumerated in full below; items per group are capped at 25 with any overflow stated explicitly per group, never silently truncated. The complete machine-readable list of every finding (all severities) is the companion findings.md in this report's bundle.
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.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.
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.
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:1211— 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:1180— 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:968— 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: DefaultMQAdminExt tools/src/main/java/org/apache/rocketmq/tools/admin/DefaultMQAdminExt.java:83— TooManyMethods — 153 methods. The bar is 30 methods; this is 123 over it, 5.10× the bar. Most of these members implement admin.MQAdminExt (112 of 126 members), so moving them onto a smaller type would remove them from that contract rather than reduce it. To reduce it, split the contract instead: give each cohesive group of operations its own smaller interface and its own implementing type. Where the contract has to stay whole, move the work behind these members into collaborator types, so what is left here is a forward per member rather than a responsibility per member.
TooManyMethods: DefaultMQAdminExtImpl tools/src/main/java/org/apache/rocketmq/tools/admin/DefaultMQAdminExtImpl.java:130— TooManyMethods — 151 methods. The bar is 30 methods; this is 121 over it, 5.03× the bar. Most of these members implement admin.MQAdminExt (112 of 127 members), so moving them onto a smaller type would remove them from that contract rather than reduce it. To reduce it, split the contract instead: give each cohesive group of operations its own smaller interface and its own implementing type. Where the contract has to stay whole, move the work behind these members into collaborator types, so what is left here is a forward per member rather than a responsibility per member.
TooManyMethods: AbstractPluginMessageStore store/src/main/java/org/apache/rocketmq/store/plugin/AbstractPluginMessageStore.java: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.
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: DefaultMQAdminExtImpl tools/src/main/java/org/apache/rocketmq/tools/admin/DefaultMQAdminExtImpl.java:130— ClassTooLong — 1377 significant lines (blank, comment-only and punctuation-only lines excluded), 151 methods. The bar is 400 significant lines; this is 977 over it, 3.44× 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: DefaultMQAdminExt tools/src/main/java/org/apache/rocketmq/tools/admin/DefaultMQAdminExt.java:83— ClassTooLong — 648 significant lines (blank, comment-only and punctuation-only lines excluded), 153 methods. The bar is 400 significant lines; this is 248 over it, 1.62× 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/builder/DefaultAuthorizationContextBuilder.java:736— auth/src/main/java/org/apache/rocketmq/auth/authorization/builder/DefaultAuthorizationContextBuilder.java:736-742 | auth/src/main/java/org/apache/rocketmq/auth/authorization/builder/DefaultAuthorizationContextBuilder.java:774-780 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift 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 (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/BrokerController.java:2005— broker/src/main/java/org/apache/rocketmq/broker/BrokerController.java:2005-2011 | container/src/main/java/org/apache/rocketmq/container/InnerBrokerController.java:103-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 4 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 `broker/src/main/java/org/apache/rocketmq/broker/BrokerController.java:2005` it does not close everything it opens, so those exact lines 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/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/metrics/ConsumerLagCalculator.java:203— broker/src/main/java/org/apache/rocketmq/broker/metrics/ConsumerLagCalculator.java:203-209 | broker/src/main/java/org/apache/rocketmq/broker/metrics/ConsumerLagCalculator.java:213-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 (7 lines × 2) broker/src/main/java/org/apache/rocketmq/broker/out/BrokerOuterAPI.java:1357— broker/src/main/java/org/apache/rocketmq/broker/out/BrokerOuterAPI.java:1357-1363 | client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:3443-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. 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:1357` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (7 lines × 2) broker/src/main/java/org/apache/rocketmq/broker/processor/AdminBrokerProcessor.java: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) broker/src/main/java/org/apache/rocketmq/broker/transaction/AbstractTransactionalMessageCheckListener.java:61— broker/src/main/java/org/apache/rocketmq/broker/transaction/AbstractTransactionalMessageCheckListener.java:61-67 | broker/src/main/java/org/apache/rocketmq/broker/transaction/rocksdb/TransactionalMessageRocksDBService.java:234-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: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 (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 (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/metrics/BrokerMetricsManager.java:356— broker/src/main/java/org/apache/rocketmq/broker/metrics/BrokerMetricsManager.java:356-361 | broker/src/main/java/org/apache/rocketmq/broker/metrics/BrokerMetricsManager.java:403-408 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift 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:356` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (6 lines × 2) broker/src/main/java/org/apache/rocketmq/broker/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/AdminBrokerProcessor.java:1968— broker/src/main/java/org/apache/rocketmq/broker/processor/AdminBrokerProcessor.java:1968-1973 | proxy/src/main/java/org/apache/rocketmq/proxy/remoting/activity/ConsumerManagerActivity.java:100-105 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `broker/src/main/java/org/apache/rocketmq/broker/processor/AdminBrokerProcessor.java: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 (6 lines × 2) broker/src/main/java/org/apache/rocketmq/broker/processor/ChangeInvisibleTimeProcessor.java:324— broker/src/main/java/org/apache/rocketmq/broker/processor/ChangeInvisibleTimeProcessor.java:324-329 | broker/src/main/java/org/apache/rocketmq/broker/processor/PopMessageProcessor.java:939-944 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
Duplicated block (6 lines × 2) broker/src/main/java/org/apache/rocketmq/broker/processor/EndTransactionProcessor.java:350— broker/src/main/java/org/apache/rocketmq/broker/processor/EndTransactionProcessor.java:350-355 | broker/src/main/java/org/apache/rocketmq/broker/processor/SendMessageProcessor.java:439-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 (6 lines × 2) broker/src/main/java/org/apache/rocketmq/broker/processor/PeekMessageProcessor.java:139— broker/src/main/java/org/apache/rocketmq/broker/processor/PeekMessageProcessor.java:139-144 | broker/src/main/java/org/apache/rocketmq/broker/processor/PeekMessageProcessor.java:160-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 `broker/src/main/java/org/apache/rocketmq/broker/processor/PeekMessageProcessor.java:139` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (6 lines × 2) broker/src/main/java/org/apache/rocketmq/broker/processor/PopBufferMergeService.java:860— broker/src/main/java/org/apache/rocketmq/broker/processor/PopBufferMergeService.java:860-865 | broker/src/main/java/org/apache/rocketmq/broker/processor/PopBufferMergeService.java:874-879 — both copies are in the same file, so extract the 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/acl/common/AclSigner.java:50— client/src/main/java/org/apache/rocketmq/acl/common/AclSigner.java:50-55 | client/src/main/java/org/apache/rocketmq/acl/common/AclSigner.java:83-88 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift 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/acl/common/AclSigner.java:50` 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) 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/MQClientAPIImpl.java:1576— client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:1576-1581 | client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:1597-1602 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift 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:1576` it does not close everything it opens, so those exact lines 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) client/src/main/java/org/apache/rocketmq/client/impl/consumer/RebalanceImpl.java:433— client/src/main/java/org/apache/rocketmq/client/impl/consumer/RebalanceImpl.java:433-438 | client/src/main/java/org/apache/rocketmq/client/impl/consumer/RebalanceImpl.java:553-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:433` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (6 lines × 2) common/src/main/java/org/apache/rocketmq/common/message/MessageDecoder.java:198— common/src/main/java/org/apache/rocketmq/common/message/MessageDecoder.java:198-203 | common/src/main/java/org/apache/rocketmq/common/message/MessageDecoder.java:317-322 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (6 lines × 2) controller/src/main/java/org/apache/rocketmq/controller/impl/heartbeat/DefaultBrokerHeartbeatManager.java:186— controller/src/main/java/org/apache/rocketmq/controller/impl/heartbeat/DefaultBrokerHeartbeatManager.java:186-191 | controller/src/main/java/org/apache/rocketmq/controller/impl/heartbeat/RaftBrokerHeartBeatManager.java:266-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 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/heartbeat/DefaultBrokerHeartbeatManager.java:186` 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) controller/src/main/java/org/apache/rocketmq/controller/metrics/ControllerMetricsManager.java:305— controller/src/main/java/org/apache/rocketmq/controller/metrics/ControllerMetricsManager.java:305-310 | controller/src/main/java/org/apache/rocketmq/controller/metrics/ControllerMetricsManager.java:340-345 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `controller/src/main/java/org/apache/rocketmq/controller/metrics/ControllerMetricsManager.java:305` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
FileTooLong: impl/MQClientAPIImpl.java client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java— FileTooLong — 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: admin/DefaultMQAdminExtImpl.java tools/src/main/java/org/apache/rocketmq/tools/admin/DefaultMQAdminExtImpl.java— FileTooLong — 1488 significant lines (blank, comment-only and punctuation-only lines excluded), about 93% of them inside a single declaration: DefaultMQAdminExtImpl (130-2108). The bar is 500 significant lines; this is 988 over it, 2.98× 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: admin/DefaultMQAdminExt.java tools/src/main/java/org/apache/rocketmq/tools/admin/DefaultMQAdminExt.java— FileTooLong — 712 significant lines (blank, comment-only and punctuation-only lines excluded), about 91% of them inside a single declaration: DefaultMQAdminExt (83-1044). The bar is 500 significant lines; this is 212 over it, 1.42× 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 (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) broker/src/main/java/org/apache/rocketmq/broker/processor/EndTransactionProcessor.java:340— broker/src/main/java/org/apache/rocketmq/broker/processor/EndTransactionProcessor.java:340-348 | broker/src/main/java/org/apache/rocketmq/broker/processor/SendMessageProcessor.java:429-437 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `broker/src/main/java/org/apache/rocketmq/broker/processor/EndTransactionProcessor.java:340` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (9 lines × 2) broker/src/main/java/org/apache/rocketmq/broker/processor/PopBufferMergeService.java:699— broker/src/main/java/org/apache/rocketmq/broker/processor/PopBufferMergeService.java:699-707 | broker/src/main/java/org/apache/rocketmq/broker/processor/PopBufferMergeService.java:753-761 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift 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/PopBufferMergeService.java:699` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
Duplicated block (9 lines × 2) broker/src/main/java/org/apache/rocketmq/broker/processor/PopReviveService.java:410— broker/src/main/java/org/apache/rocketmq/broker/processor/PopReviveService.java:410-418 | broker/src/main/java/org/apache/rocketmq/broker/processor/PopReviveService.java:436-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:410` it does not close everything it opens, so those exact lines 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 (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) auth/src/main/java/org/apache/rocketmq/auth/migration/AuthMigrator.java:130— auth/src/main/java/org/apache/rocketmq/auth/migration/AuthMigrator.java:130-137 | auth/src/main/java/org/apache/rocketmq/auth/migration/AuthMigrator.java:148-155 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift 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/migration/AuthMigrator.java:130` 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/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:46— proxy/src/main/java/org/apache/rocketmq/proxy/service/relay/LocalProxyRelayService.java:46-53 | proxy/src/main/java/org/apache/rocketmq/proxy/service/relay/LocalProxyRelayService.java:70-77 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `proxy/src/main/java/org/apache/rocketmq/proxy/service/relay/LocalProxyRelayService.java:46` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (8 lines × 2) proxy/src/main/java/org/apache/rocketmq/proxy/service/relay/LocalProxyRelayService.java:56— proxy/src/main/java/org/apache/rocketmq/proxy/service/relay/LocalProxyRelayService.java:56-63 | proxy/src/main/java/org/apache/rocketmq/proxy/service/relay/LocalProxyRelayService.java:80-87 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `proxy/src/main/java/org/apache/rocketmq/proxy/service/relay/LocalProxyRelayService.java:56` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
Duplicated block (8 lines × 2) 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/ha/DefaultHAService.java:226— store/src/main/java/org/apache/rocketmq/store/ha/DefaultHAService.java:226-233 | store/src/main/java/org/apache/rocketmq/store/ha/autoswitch/AutoSwitchHAService.java:387-394 — 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 (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) tieredstore/src/main/java/org/apache/rocketmq/tieredstore/metrics/TieredStoreMetricsManager.java:178— tieredstore/src/main/java/org/apache/rocketmq/tieredstore/metrics/TieredStoreMetricsManager.java:178-185 | tieredstore/src/main/java/org/apache/rocketmq/tieredstore/metrics/TieredStoreMetricsManager.java:211-218 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift 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 (8 lines × 2) tools/src/main/java/org/apache/rocketmq/tools/admin/DefaultMQAdminExtImpl.java:989— tools/src/main/java/org/apache/rocketmq/tools/admin/DefaultMQAdminExtImpl.java:989-996 | tools/src/main/java/org/apache/rocketmq/tools/admin/DefaultMQAdminExtImpl.java:1754-1761 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift 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:989` 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) 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) auth/src/main/java/org/apache/rocketmq/auth/authorization/builder/DefaultAuthorizationContextBuilder.java:414— auth/src/main/java/org/apache/rocketmq/auth/authorization/builder/DefaultAuthorizationContextBuilder.java:414-423 | auth/src/main/java/org/apache/rocketmq/auth/authorization/builder/DefaultAuthorizationContextBuilder.java:431-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 (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 35 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `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/longpolling/PopLiteLongPollingService.java:169— broker/src/main/java/org/apache/rocketmq/broker/longpolling/PopLiteLongPollingService.java:169-178 | broker/src/main/java/org/apache/rocketmq/broker/longpolling/PopLongPollingService.java:275-284 — 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 35 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `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 (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 131 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 (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) broker/src/main/java/org/apache/rocketmq/broker/BrokerController.java:1999— broker/src/main/java/org/apache/rocketmq/broker/BrokerController.java:1999-2003 | container/src/main/java/org/apache/rocketmq/container/InnerBrokerController.java:97-101 — before extracting anything, compare `broker/src/main/java/org/apache/rocketmq/broker/BrokerController.java` and `container/src/main/java/org/apache/rocketmq/container/InnerBrokerController.java` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 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 `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 (5 lines × 2) broker/src/main/java/org/apache/rocketmq/broker/processor/AckMessageProcessor.java:136— broker/src/main/java/org/apache/rocketmq/broker/processor/AckMessageProcessor.java:136-140 | broker/src/main/java/org/apache/rocketmq/broker/processor/ChangeInvisibleTimeProcessor.java:115-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.
Duplicated block (5 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-586 | broker/src/main/java/org/apache/rocketmq/broker/processor/AdminBrokerProcessor.java:743-747 — both copies are in the same file, so extract the 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 (5 lines × 2) broker/src/main/java/org/apache/rocketmq/broker/processor/PopMessageProcessor.java:522— broker/src/main/java/org/apache/rocketmq/broker/processor/PopMessageProcessor.java:522-526 | broker/src/main/java/org/apache/rocketmq/broker/processor/PopMessageProcessor.java:545-549 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift 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:522` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (5 lines × 2) broker/src/main/java/org/apache/rocketmq/broker/processor/PopMessageProcessor.java:527— broker/src/main/java/org/apache/rocketmq/broker/processor/PopMessageProcessor.java:527-531 | broker/src/main/java/org/apache/rocketmq/broker/processor/PopMessageProcessor.java:550-554 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift 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:527` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (5 lines × 2) broker/src/main/java/org/apache/rocketmq/broker/processor/ReplyMessageProcessor.java:301— broker/src/main/java/org/apache/rocketmq/broker/processor/ReplyMessageProcessor.java:301-305 | broker/src/main/java/org/apache/rocketmq/broker/processor/SendMessageProcessor.java:489-493 — 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 before the matched lines, `broker/src/main/java/org/apache/rocketmq/broker/processor/SendMessageProcessor.java:485` calls `getBrokerStatsManager`, `incTopicPutLatency`, `getTopic` and `broker/src/main/java/org/apache/rocketmq/broker/processor/ReplyMessageProcessor.java:298` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (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) client/src/main/java/org/apache/rocketmq/client/impl/producer/DefaultMQProducerImpl.java:810— client/src/main/java/org/apache/rocketmq/client/impl/producer/DefaultMQProducerImpl.java:810-814 | client/src/main/java/org/apache/rocketmq/client/impl/producer/DefaultMQProducerImpl.java:847-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 (5 lines × 2) client/src/main/java/org/apache/rocketmq/client/trace/hook/EndTransactionTraceHookImpl.java:57— client/src/main/java/org/apache/rocketmq/client/trace/hook/EndTransactionTraceHookImpl.java:57-61 | client/src/main/java/org/apache/rocketmq/client/trace/hook/SendMessageTraceHookImpl.java:54-58 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Note first that the copies are not typed on the same thing: the declarations holding them bind `context` to `EndTransactionContext` in one and `SendMessageContext` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `client/src/main/java/org/apache/rocketmq/client/trace/hook/SendMessageTraceHookImpl.java:52` calls `setMqTraceContext` and `client/src/main/java/org/apache/rocketmq/client/trace/hook/EndTransactionTraceHookImpl.java:55` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (5 lines × 2) common/src/main/java/org/apache/rocketmq/common/message/MessageQueue.java:71— common/src/main/java/org/apache/rocketmq/common/message/MessageQueue.java:71-75 | common/src/main/java/org/apache/rocketmq/common/message/MessageQueueForC.java:64-68 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `common/src/main/java/org/apache/rocketmq/common/message/MessageQueue.java:71` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
Duplicated block (5 lines × 2) 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) proxy/src/main/java/org/apache/rocketmq/proxy/processor/ConsumerProcessor.java:495— proxy/src/main/java/org/apache/rocketmq/proxy/processor/ConsumerProcessor.java:495-499 | proxy/src/main/java/org/apache/rocketmq/proxy/processor/ConsumerProcessor.java:523-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:495` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (5 lines × 2) store/src/main/java/org/apache/rocketmq/store/CommitLog.java: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) 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) tools/src/main/java/org/apache/rocketmq/tools/admin/DefaultMQAdminExtImpl.java:1329— tools/src/main/java/org/apache/rocketmq/tools/admin/DefaultMQAdminExtImpl.java:1329-1333 | tools/src/main/java/org/apache/rocketmq/tools/admin/DefaultMQAdminExtImpl.java:1343-1347 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift 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:1329` 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) tools/src/main/java/org/apache/rocketmq/tools/command/lite/GetLiteGroupInfoSubCommand.java:137— tools/src/main/java/org/apache/rocketmq/tools/command/lite/GetLiteGroupInfoSubCommand.java:137-141 | tools/src/main/java/org/apache/rocketmq/tools/command/lite/GetLiteGroupInfoSubCommand.java:154-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 `tools/src/main/java/org/apache/rocketmq/tools/command/lite/GetLiteGroupInfoSubCommand.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.
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.
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: ConsumerProgressSubCommand.execute tools/src/main/java/org/apache/rocketmq/tools/command/consumer/ConsumerProgressSubCommand.java:102— MethodTooLong — execute runs 135 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 35 over it, 1.35× 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.
Swallowed exception (empty catch) broker/src/main/java/org/apache/rocketmq/broker/controller/ReplicasManager.java:186— An empty catch block silently discards the error — failures vanish with no log and no rethrow. Log it, handle it, or don't catch it.
Swallowed exception (empty catch) broker/src/main/java/org/apache/rocketmq/broker/dledger/DLedgerRoleChangeHandler.java:150— An empty catch block silently discards the error — failures vanish with no log and no rethrow. Log it, handle it, or don't catch it.
Swallowed exception (empty catch) broker/src/main/java/org/apache/rocketmq/broker/dledger/DLedgerRoleChangeHandler.java:173— An empty catch block silently discards the error — failures vanish with no log and no rethrow. Log it, handle it, or don't catch it.
Swallowed exception (empty catch) broker/src/main/java/org/apache/rocketmq/broker/latency/BrokerFastFailure.java:113— An empty catch block silently discards the error — failures vanish with no log and no rethrow. Log it, handle it, or don't catch it.
Swallowed exception (empty catch) broker/src/main/java/org/apache/rocketmq/broker/latency/BrokerFastFailure.java:151— An empty catch block silently discards the error — failures vanish with no log and no rethrow. Log it, handle it, or don't catch it.
Swallowed exception (empty catch) broker/src/main/java/org/apache/rocketmq/broker/longpolling/PopLongPollingService.java:164— An empty catch block silently discards the error — failures vanish with no log and no rethrow. Log it, handle it, or don't catch it.
Swallowed exception (empty catch) broker/src/main/java/org/apache/rocketmq/broker/longpolling/PopLiteLongPollingService.java:144— An empty catch block silently discards the error — failures vanish with no log and no rethrow. Log it, handle it, or don't catch it.
Swallowed exception (empty catch) broker/src/main/java/org/apache/rocketmq/broker/longpolling/PopLiteLongPollingService.java:255— An empty catch block silently discards the error — failures vanish with no log and no rethrow. Log it, handle it, or don't catch it.
Swallowed exception (empty catch) broker/src/main/java/org/apache/rocketmq/broker/processor/PullMessageProcessor.java:786— An empty catch block silently discards the error — failures vanish with no log and no rethrow. Log it, handle it, or don't catch it.
Swallowed exception (empty catch) broker/src/main/java/org/apache/rocketmq/broker/processor/PopReviveService.java:372— An empty catch block silently discards the error — failures vanish with no log and no rethrow. Log it, handle it, or don't catch it.
Swallowed exception (empty catch) broker/src/main/java/org/apache/rocketmq/broker/processor/PopLiteMessageProcessor.java:472— An empty catch block silently discards the error — failures vanish with no log and no rethrow. Log it, handle it, or don't catch it.
Swallowed exception (empty catch) broker/src/main/java/org/apache/rocketmq/broker/processor/AbstractSendMessageProcessor.java:345— An empty catch block silently discards the error — failures vanish with no log and no rethrow. Log it, handle it, or don't catch it.
Swallowed exception (empty catch) broker/src/main/java/org/apache/rocketmq/broker/processor/AbstractSendMessageProcessor.java:556— An empty catch block silently discards the error — failures vanish with no log and no rethrow. Log it, handle it, or don't catch it.
Swallowed exception (empty catch) broker/src/main/java/org/apache/rocketmq/broker/processor/AbstractSendMessageProcessor.java:585— An empty catch block silently discards the error — failures vanish with no log and no rethrow. Log it, handle it, or don't catch it.
Swallowed exception (empty catch) broker/src/main/java/org/apache/rocketmq/broker/topic/TopicQueueMappingManager.java:245— An empty catch block silently discards the error — failures vanish with no log and no rethrow. Log it, handle it, or don't catch it.
Swallowed exception (empty catch) broker/src/main/java/org/apache/rocketmq/broker/topic/TopicQueueMappingCleanService.java:84— An empty catch block silently discards the error — failures vanish with no log and no rethrow. Log it, handle it, or don't catch it.
Swallowed exception (empty catch) broker/src/main/java/org/apache/rocketmq/broker/transaction/queue/TransactionalMessageUtil.java: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.
Swallowed exception (empty catch) broker/src/main/java/org/apache/rocketmq/broker/transaction/queue/TransactionalMessageServiceImpl.java:320— An empty catch block silently discards the error — failures vanish with no log and no rethrow. Log it, handle it, or don't catch it.
Swallowed exception (empty catch) client/src/main/java/org/apache/rocketmq/client/consumer/DefaultMQPushConsumer.java:518— An empty catch block silently discards the error — failures vanish with no log and no rethrow. Log it, handle it, or don't catch it.
Swallowed exception (empty catch) client/src/main/java/org/apache/rocketmq/client/consumer/DefaultMQPullConsumer.java:444— An empty catch block silently discards the error — failures vanish with no log and no rethrow. Log it, handle it, or don't catch it.
Swallowed exception (empty catch) client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:648— An empty catch block silently discards the error — failures vanish with no log and no rethrow. Log it, handle it, or don't catch it.
Swallowed exception (empty catch) client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:665— An empty catch block silently discards the error — failures vanish with no log and no rethrow. Log it, handle it, or don't catch it.
Swallowed exception (empty catch) client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:740— An empty catch block silently discards the error — failures vanish with no log and no rethrow. Log it, handle it, or don't catch it.
Swallowed exception (empty catch) client/src/main/java/org/apache/rocketmq/client/impl/consumer/RebalanceImpl.java:534— An empty catch block silently discards the error — failures vanish with no log and no rethrow. Log it, handle it, or don't catch it.
Swallowed exception (empty catch) client/src/main/java/org/apache/rocketmq/client/impl/consumer/RebalanceImpl.java:543— An empty catch block silently discards the error — failures vanish with no log and no rethrow. Log it, handle it, or don't catch it.
Duplicated block (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:3107— broker/src/main/java/org/apache/rocketmq/broker/processor/AdminBrokerProcessor.java:3107-3117 | broker/src/main/java/org/apache/rocketmq/broker/transaction/queue/DefaultTransactionalMessageCheckListener.java:69-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:3107` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
Duplicated block (11 lines × 2) 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) tools/src/main/java/org/apache/rocketmq/tools/command/auth/GetUserSubCommand.java:56— tools/src/main/java/org/apache/rocketmq/tools/command/auth/GetUserSubCommand.java:56-66 | tools/src/main/java/org/apache/rocketmq/tools/command/auth/ListUserSubCommand.java:57-67 — 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 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. 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: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 (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) 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/lite/GetLiteClientInfoSubCommand.java:50— tools/src/main/java/org/apache/rocketmq/tools/command/lite/GetLiteClientInfoSubCommand.java:50-61 | tools/src/main/java/org/apache/rocketmq/tools/command/lite/GetLiteTopicInfoSubCommand.java:51-62 — 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/GetLiteTopicInfoSubCommand.java` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 53 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. 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/lite/GetLiteClientInfoSubCommand.java:46` calls `setRequired`, `addOption`, `Option` and `tools/src/main/java/org/apache/rocketmq/tools/command/lite/GetLiteTopicInfoSubCommand.java:50` 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) 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 (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 (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/offset/ConsumerOffsetManager.java:144— broker/src/main/java/org/apache/rocketmq/broker/offset/ConsumerOffsetManager.java:144-156 | broker/src/main/java/org/apache/rocketmq/broker/offset/ConsumerOffsetManager.java:162-174 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `broker/src/main/java/org/apache/rocketmq/broker/offset/ConsumerOffsetManager.java:144` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
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) store/src/main/java/org/apache/rocketmq/store/ha/DefaultHAConnection.java:66— store/src/main/java/org/apache/rocketmq/store/ha/DefaultHAConnection.java:66-78 | store/src/main/java/org/apache/rocketmq/store/ha/autoswitch/AutoSwitchHAConnection.java:111-123 — before extracting anything, compare `store/src/main/java/org/apache/rocketmq/store/ha/DefaultHAConnection.java` and `store/src/main/java/org/apache/rocketmq/store/ha/autoswitch/AutoSwitchHAConnection.java` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 36 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `store/src/main/java/org/apache/rocketmq/store/ha/DefaultHAConnection.java:66` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note first that the copies are not typed on the same thing: the declarations holding them bind `haService` to `DefaultHAService` in one and `AutoSwitchHAService` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
Duplicated block (13 lines × 2) tools/src/main/java/org/apache/rocketmq/tools/admin/DefaultMQAdminExtImpl.java:1418— tools/src/main/java/org/apache/rocketmq/tools/admin/DefaultMQAdminExtImpl.java:1418-1430 | tools/src/main/java/org/apache/rocketmq/tools/admin/DefaultMQAdminExtImpl.java:1509-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:1418` 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) tools/src/main/java/org/apache/rocketmq/tools/command/auth/CreateAclSubCommand.java:106— tools/src/main/java/org/apache/rocketmq/tools/command/auth/CreateAclSubCommand.java:106-118 | tools/src/main/java/org/apache/rocketmq/tools/command/auth/UpdateAclSubCommand.java:106-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 17 separate duplicated blocks between them, totalling at least 160 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:106` it does not close everything it opens, so those exact lines 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/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 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. 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.
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 (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 35 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `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 131 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/consumer/ConsumeMessageOrderlyService.java:325— client/src/main/java/org/apache/rocketmq/client/impl/consumer/ConsumeMessageOrderlyService.java:325-339 | client/src/main/java/org/apache/rocketmq/client/impl/consumer/ConsumeMessagePopOrderlyService.java:239-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 131 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:325` 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) 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/CommitLog.java:1036— store/src/main/java/org/apache/rocketmq/store/CommitLog.java:1036-1050 | store/src/main/java/org/apache/rocketmq/store/CommitLog.java:1197-1211 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift 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:1036` it does not close everything it opens, so those 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: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 (15 lines × 2) store/src/main/java/org/apache/rocketmq/store/CommitLog.java:1052— store/src/main/java/org/apache/rocketmq/store/CommitLog.java:1052-1066 | store/src/main/java/org/apache/rocketmq/store/CommitLog.java:1213-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. Read the line range as the matched WINDOW rather than a finished unit: at `store/src/main/java/org/apache/rocketmq/store/CommitLog.java:1052` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (15 lines × 2) tieredstore/src/main/java/org/apache/rocketmq/tieredstore/metrics/TieredStoreMetricsManager.java:186— tieredstore/src/main/java/org/apache/rocketmq/tieredstore/metrics/TieredStoreMetricsManager.java:186-200 | tieredstore/src/main/java/org/apache/rocketmq/tieredstore/metrics/TieredStoreMetricsManager.java:219-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.
Duplicated block (15 lines × 2) tools/src/main/java/org/apache/rocketmq/tools/command/controller/GetControllerConfigSubCommand.java:56— tools/src/main/java/org/apache/rocketmq/tools/command/controller/GetControllerConfigSubCommand.java:56-70 | tools/src/main/java/org/apache/rocketmq/tools/command/namesrv/GetNamesrvConfigCommand.java:53-67 — before extracting anything, compare `tools/src/main/java/org/apache/rocketmq/tools/command/controller/GetControllerConfigSubCommand.java` and `tools/src/main/java/org/apache/rocketmq/tools/command/namesrv/GetNamesrvConfigCommand.java` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 35 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `tools/src/main/java/org/apache/rocketmq/tools/command/controller/GetControllerConfigSubCommand.java:56` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (15 lines × 2) 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-211 | tools/src/main/java/org/apache/rocketmq/tools/command/metadata/RocksDBConfigToJsonCommand.java:300-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 `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 (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 (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 4 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 `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) 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.
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.
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: 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.
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.
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.
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 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/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/ha/GroupTransferService.java:123— // TODO: We must ensure every HAConnection represents a different slave — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
TodoComment store/src/main/java/org/apache/rocketmq/store/queue/ConsumeQueueStore.java: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/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/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 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 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.
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.
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:595— broker/src/main/java/org/apache/rocketmq/broker/processor/AdminBrokerProcessor.java:595-604 | broker/src/main/java/org/apache/rocketmq/broker/processor/AdminBrokerProcessor.java:674-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:595` 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–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) client/src/main/java/org/apache/rocketmq/client/consumer/store/LocalFileOffsetStore.java:219— client/src/main/java/org/apache/rocketmq/client/consumer/store/LocalFileOffsetStore.java:219-228 | client/src/main/java/org/apache/rocketmq/client/consumer/store/RemoteBrokerOffsetStore.java:185-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 `client/src/main/java/org/apache/rocketmq/client/consumer/store/LocalFileOffsetStore.java:219` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (9–10 lines × 2) remoting/src/main/java/org/apache/rocketmq/remoting/netty/NettyRemotingClient.java: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/processor/NotificationProcessor.java:105— broker/src/main/java/org/apache/rocketmq/broker/processor/NotificationProcessor.java:105-112 | broker/src/main/java/org/apache/rocketmq/broker/processor/PeekMessageProcessor.java:88-95 | broker/src/main/java/org/apache/rocketmq/broker/processor/PollingInfoProcessor.java:63-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: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 (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/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 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.
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 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/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/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.
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) 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.
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:162— store/src/main/java/org/apache/rocketmq/store/rocksdb/RocksDBOptionsFactory.java:162-170 | store/src/main/java/org/apache/rocketmq/store/rocksdb/RocksDBOptionsFactory.java:290-298 | store/src/main/java/org/apache/rocketmq/store/rocksdb/RocksDBOptionsFactory.java:341-349 — 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:162` 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.
Duplicated block (9 lines × 3) tools/src/main/java/org/apache/rocketmq/tools/command/lite/GetLiteClientInfoSubCommand.java:51— tools/src/main/java/org/apache/rocketmq/tools/command/lite/GetLiteClientInfoSubCommand.java:51-59 | tools/src/main/java/org/apache/rocketmq/tools/command/lite/GetLiteTopicInfoSubCommand.java:52-60 | tools/src/main/java/org/apache/rocketmq/tools/command/message/QueryMsgByUniqueKeySubCommand.java:173-181 — 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/GetLiteTopicInfoSubCommand.java` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 53 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (6 lines × 3) broker/src/main/java/org/apache/rocketmq/broker/BrokerStartup.java:313— broker/src/main/java/org/apache/rocketmq/broker/BrokerStartup.java:313-318 | tools/src/main/java/org/apache/rocketmq/tools/command/export/ExportMetadataCommand.java:64-70 | tools/src/main/java/org/apache/rocketmq/tools/command/offset/ResetOffsetByTimeCommand.java:60-66 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 3 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 3 times.
Duplicated block (6 lines × 3) 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 131 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) 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.
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.
Swallowed exception (caught, then discarded) auth/src/main/java/org/apache/rocketmq/auth/authorization/AuthorizationCompatibility.java:51— `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) client/src/main/java/org/apache/rocketmq/client/impl/producer/DefaultMQProducerImpl.java:167— `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.
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.
D4 · Code Duplication· Edited copy of a member (35 corresponding lines) · ×7
Edited copy of a member (35 corresponding lines) tools/src/main/java/org/apache/rocketmq/tools/command/message/ConsumeMessageCommand.java:77— tools/src/main/java/org/apache/rocketmq/tools/command/message/ConsumeMessageCommand.java:77-115 | tools/src/main/java/org/apache/rocketmq/tools/command/message/QueryMsgByIdSubCommand.java:195-229 — 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.
Edited copy of a member (35 corresponding lines) tools/src/main/java/org/apache/rocketmq/tools/command/message/ConsumeMessageCommand.java:77— tools/src/main/java/org/apache/rocketmq/tools/command/message/ConsumeMessageCommand.java:77-115 | tools/src/main/java/org/apache/rocketmq/tools/command/message/QueryMsgByKeySubCommand.java:48-82 — 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.
Edited copy of a member (35 corresponding lines) tools/src/main/java/org/apache/rocketmq/tools/command/message/PrintMessageByQueueCommand.java:115— tools/src/main/java/org/apache/rocketmq/tools/command/message/PrintMessageByQueueCommand.java:115-157 | tools/src/main/java/org/apache/rocketmq/tools/command/message/QueryMsgByIdSubCommand.java:195-229 — 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.
Edited copy of a member (35 corresponding lines) tools/src/main/java/org/apache/rocketmq/tools/command/message/PrintMessageByQueueCommand.java:115— tools/src/main/java/org/apache/rocketmq/tools/command/message/PrintMessageByQueueCommand.java:115-157 | tools/src/main/java/org/apache/rocketmq/tools/command/message/QueryMsgByKeySubCommand.java:48-82 — 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.
Edited copy of a member (35 corresponding lines) tools/src/main/java/org/apache/rocketmq/tools/command/message/QueryMsgByIdSubCommand.java:195— tools/src/main/java/org/apache/rocketmq/tools/command/message/QueryMsgByIdSubCommand.java:195-229 | tools/src/main/java/org/apache/rocketmq/tools/command/message/QueryMsgByKeySubCommand.java:48-82 — 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.
Edited copy of a member (35 corresponding lines) tools/src/main/java/org/apache/rocketmq/tools/command/message/PrintMessageSubCommand.java:70— tools/src/main/java/org/apache/rocketmq/tools/command/message/PrintMessageSubCommand.java:70-108 | tools/src/main/java/org/apache/rocketmq/tools/command/message/QueryMsgByIdSubCommand.java:195-229 — 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.
Edited copy of a member (35 corresponding lines) tools/src/main/java/org/apache/rocketmq/tools/command/message/PrintMessageSubCommand.java:70— tools/src/main/java/org/apache/rocketmq/tools/command/message/PrintMessageSubCommand.java:70-108 | tools/src/main/java/org/apache/rocketmq/tools/command/message/QueryMsgByKeySubCommand.java:48-82 — 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.
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) 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-102 | tools/src/main/java/org/apache/rocketmq/tools/command/auth/UpdateAclSubCommand.java:87-102 — 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 17 separate duplicated blocks between them, totalling at least 160 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 (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) 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) 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 (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) broker/src/main/java/org/apache/rocketmq/broker/processor/AdminBrokerProcessor.java:1025— broker/src/main/java/org/apache/rocketmq/broker/processor/AdminBrokerProcessor.java:1025-1041 | broker/src/main/java/org/apache/rocketmq/broker/processor/AdminBrokerProcessor.java:1055-1071 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift 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:1025` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (17 lines × 2) client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java: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) 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 (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 (12–13 lines × 2) auth/src/main/java/org/apache/rocketmq/auth/authentication/provider/LocalAuthenticationMetadataProvider.java:53— auth/src/main/java/org/apache/rocketmq/auth/authentication/provider/LocalAuthenticationMetadataProvider.java:53-65 | auth/src/main/java/org/apache/rocketmq/auth/authorization/provider/LocalAuthorizationMetadataProvider.java:58-69 — 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–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) broker/src/main/java/org/apache/rocketmq/broker/processor/QueryMessageProcessor.java:133— broker/src/main/java/org/apache/rocketmq/broker/processor/QueryMessageProcessor.java:133-145 | broker/src/main/java/org/apache/rocketmq/broker/processor/QueryMessageProcessor.java:195-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: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. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (12–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) 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 (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) 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 (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 (7 lines × 3) broker/src/main/java/org/apache/rocketmq/broker/metrics/BrokerMetricsManager.java:493— broker/src/main/java/org/apache/rocketmq/broker/metrics/BrokerMetricsManager.java:493-499 | broker/src/main/java/org/apache/rocketmq/broker/metrics/PopMetricsManager.java:79-85 | remoting/src/main/java/org/apache/rocketmq/remoting/metrics/RemotingMetricsManager.java:76-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:493` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
Duplicated block (7 lines × 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) 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.
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 (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) namesrv/src/main/java/org/apache/rocketmq/namesrv/routeinfo/RouteInfoManager.java:1052— namesrv/src/main/java/org/apache/rocketmq/namesrv/routeinfo/RouteInfoManager.java:1052-1056 | namesrv/src/main/java/org/apache/rocketmq/namesrv/routeinfo/RouteInfoManager.java:1073-1077 | namesrv/src/main/java/org/apache/rocketmq/namesrv/routeinfo/RouteInfoManager.java:1094-1098 — 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 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (5 lines × 3) store/src/main/java/org/apache/rocketmq/store/queue/BatchConsumeQueue.java: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.
Duplicated block (5 lines × 3) store/src/main/java/org/apache/rocketmq/store/rocksdb/MessageRocksDBStorage.java:279— store/src/main/java/org/apache/rocketmq/store/rocksdb/MessageRocksDBStorage.java:279-283 | store/src/main/java/org/apache/rocketmq/store/rocksdb/MessageRocksDBStorage.java:350-354 | store/src/main/java/org/apache/rocketmq/store/rocksdb/MessageRocksDBStorage.java:540-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.
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: Builder (LCOM4 7) broker/src/main/java/org/apache/rocketmq/broker/ConfigContext.java:74— Builder'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.
D4 · Code Duplication· Edited copy of a member (31 corresponding lines) · ×5
Edited copy of a member (31 corresponding lines) tools/src/main/java/org/apache/rocketmq/tools/command/message/ConsumeMessageCommand.java:77— tools/src/main/java/org/apache/rocketmq/tools/command/message/ConsumeMessageCommand.java:77-115 | tools/src/main/java/org/apache/rocketmq/tools/command/message/SendMessageCommand.java:48-78 — These two members are one piece of code written twice and then edited apart: 31 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (31 corresponding lines) tools/src/main/java/org/apache/rocketmq/tools/command/message/PrintMessageByQueueCommand.java:115— tools/src/main/java/org/apache/rocketmq/tools/command/message/PrintMessageByQueueCommand.java:115-157 | tools/src/main/java/org/apache/rocketmq/tools/command/message/SendMessageCommand.java:48-78 — These two members are one piece of code written twice and then edited apart: 31 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (31 corresponding lines) tools/src/main/java/org/apache/rocketmq/tools/command/message/PrintMessageSubCommand.java:70— tools/src/main/java/org/apache/rocketmq/tools/command/message/PrintMessageSubCommand.java:70-108 | tools/src/main/java/org/apache/rocketmq/tools/command/message/SendMessageCommand.java:48-78 — These two members are one piece of code written twice and then edited apart: 31 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (31 corresponding lines) tools/src/main/java/org/apache/rocketmq/tools/command/message/QueryMsgByIdSubCommand.java:195— tools/src/main/java/org/apache/rocketmq/tools/command/message/QueryMsgByIdSubCommand.java:195-229 | tools/src/main/java/org/apache/rocketmq/tools/command/message/SendMessageCommand.java:48-78 — These two members are one piece of code written twice and then edited apart: 31 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (31 corresponding lines) tools/src/main/java/org/apache/rocketmq/tools/command/message/QueryMsgByKeySubCommand.java:48— tools/src/main/java/org/apache/rocketmq/tools/command/message/QueryMsgByKeySubCommand.java:48-82 | tools/src/main/java/org/apache/rocketmq/tools/command/message/SendMessageCommand.java:48-78 — These two members are one piece of code written twice and then edited apart: 31 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
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 4 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 `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 (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/MQClientAPIImpl.java:1953— client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:1953-1962 | client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:1991-2000 | client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java:2009-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. 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) 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.
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 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.
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 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.
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 (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) remoting/src/main/java/org/apache/rocketmq/remoting/protocol/body/ConsumerRunningInfo.java:268— remoting/src/main/java/org/apache/rocketmq/remoting/protocol/body/ConsumerRunningInfo.java:268-284 | remoting/src/main/java/org/apache/rocketmq/remoting/protocol/body/ConsumerRunningInfo.java:290-305 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `remoting/src/main/java/org/apache/rocketmq/remoting/protocol/body/ConsumerRunningInfo.java:268` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
Duplicated block (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 (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 (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 (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 — before extracting anything, compare `tools/src/main/java/org/apache/rocketmq/tools/command/consumer/ConsumerStatusSubCommand.java` and `tools/src/main/java/org/apache/rocketmq/tools/command/controller/CleanControllerBrokerMetaSubCommand.java` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 34 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `controller/src/main/java/org/apache/rocketmq/controller/ControllerStartup.java: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 (8 lines × 4) tools/src/main/java/org/apache/rocketmq/tools/command/consumer/ConsumerSubCommand.java:56— tools/src/main/java/org/apache/rocketmq/tools/command/consumer/ConsumerSubCommand.java:56-64 | tools/src/main/java/org/apache/rocketmq/tools/command/lite/GetLiteClientInfoSubCommand.java:53-62 | tools/src/main/java/org/apache/rocketmq/tools/command/lite/GetLiteTopicInfoSubCommand.java:54-63 | tools/src/main/java/org/apache/rocketmq/tools/command/topic/TopicRouteSubCommand.java:51-58 — 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/GetLiteTopicInfoSubCommand.java` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 53 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `tools/src/main/java/org/apache/rocketmq/tools/command/consumer/ConsumerSubCommand.java:56` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on. ★ 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/GetLiteTopicInfoSubCommand.java:52` calls `addOption`, `Option` and `tools/src/main/java/org/apache/rocketmq/tools/command/consumer/ConsumerSubCommand.java:56` 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 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. 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) 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 × 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.
D4 · Code Duplication· Edited copy of a member (30 corresponding lines) · ×3
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) tools/src/main/java/org/apache/rocketmq/tools/command/message/ConsumeMessageCommand.java:77— tools/src/main/java/org/apache/rocketmq/tools/command/message/ConsumeMessageCommand.java:77-115 | tools/src/main/java/org/apache/rocketmq/tools/command/topic/UpdateTopicSubCommand.java:49-94 — These two members are one piece of code written twice and then edited apart: 30 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (30 corresponding lines) tools/src/main/java/org/apache/rocketmq/tools/command/message/PrintMessageSubCommand.java:70— tools/src/main/java/org/apache/rocketmq/tools/command/message/PrintMessageSubCommand.java:70-108 | tools/src/main/java/org/apache/rocketmq/tools/command/topic/UpdateTopicSubCommand.java:49-94 — These two members are one piece of code written twice and then edited apart: 30 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (18 corresponding lines) · ×3
Edited copy of a member (18 corresponding lines) example/src/main/java/org/apache/rocketmq/example/operation/Consumer.java:72— example/src/main/java/org/apache/rocketmq/example/operation/Consumer.java:72-110 | tools/src/main/java/org/apache/rocketmq/tools/command/auth/CreateAclSubCommand.java:48-81 — These two members are one piece of code written twice and then edited apart: 18 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (18 corresponding lines) example/src/main/java/org/apache/rocketmq/example/operation/Consumer.java:72— example/src/main/java/org/apache/rocketmq/example/operation/Consumer.java:72-110 | tools/src/main/java/org/apache/rocketmq/tools/command/topic/UpdateTopicSubCommand.java:49-94 — These two members are one piece of code written twice and then edited apart: 18 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (18 corresponding lines) example/src/main/java/org/apache/rocketmq/example/operation/Producer.java:66— example/src/main/java/org/apache/rocketmq/example/operation/Producer.java:66-108 | tools/src/main/java/org/apache/rocketmq/tools/command/consumer/SetConsumeModeSubCommand.java:46-72 — These two members are one piece of code written twice and then edited apart: 18 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Members sharing a duplicated core (7 members, 50+ identical tokens) · ×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.
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:269— store/src/main/java/org/apache/rocketmq/store/rocksdb/RocksDBOptionsFactory.java:269-298 | store/src/main/java/org/apache/rocketmq/store/rocksdb/RocksDBOptionsFactory.java:320-349 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift 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:269` 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 (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 (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) 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 (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:167-179 | store/src/main/java/org/apache/rocketmq/store/rocksdb/RocksDBOptionsFactory.java:295-307 — 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:167` 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) tools/src/main/java/org/apache/rocketmq/tools/command/controller/GetControllerConfigSubCommand.java:60— tools/src/main/java/org/apache/rocketmq/tools/command/controller/GetControllerConfigSubCommand.java:60-70 | tools/src/main/java/org/apache/rocketmq/tools/command/controller/UpdateControllerConfigSubCommand.java:74-84 | tools/src/main/java/org/apache/rocketmq/tools/command/namesrv/GetNamesrvConfigCommand.java:57-67 | tools/src/main/java/org/apache/rocketmq/tools/command/namesrv/UpdateNamesrvConfigCommand.java:69-79 — before extracting anything, compare `tools/src/main/java/org/apache/rocketmq/tools/command/controller/GetControllerConfigSubCommand.java` and `tools/src/main/java/org/apache/rocketmq/tools/command/namesrv/GetNamesrvConfigCommand.java` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 35 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (11 lines × 4) client/src/main/java/org/apache/rocketmq/client/impl/consumer/DefaultLitePullConsumerImpl.java: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 (9–11 lines × 2) broker/src/main/java/org/apache/rocketmq/broker/client/ConsumerManager.java:240— broker/src/main/java/org/apache/rocketmq/broker/client/ConsumerManager.java:240-250 | broker/src/main/java/org/apache/rocketmq/broker/client/ConsumerManager.java:291-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:240` 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–11 lines × 2) store/src/main/java/org/apache/rocketmq/store/ha/DefaultHAConnection.java:186— store/src/main/java/org/apache/rocketmq/store/ha/DefaultHAConnection.java:186-194 | store/src/main/java/org/apache/rocketmq/store/ha/autoswitch/AutoSwitchHAConnection.java:277-287 — before extracting anything, compare `store/src/main/java/org/apache/rocketmq/store/ha/DefaultHAConnection.java` and `store/src/main/java/org/apache/rocketmq/store/ha/autoswitch/AutoSwitchHAConnection.java` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 36 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `store/src/main/java/org/apache/rocketmq/store/ha/DefaultHAConnection.java:186` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (9–11 lines × 2) tools/src/main/java/org/apache/rocketmq/tools/command/namesrv/AddWritePermSubCommand.java:50— tools/src/main/java/org/apache/rocketmq/tools/command/namesrv/AddWritePermSubCommand.java:50-58 | tools/src/main/java/org/apache/rocketmq/tools/command/namesrv/WipeWritePermSubCommand.java:50-60 — before extracting anything, compare `tools/src/main/java/org/apache/rocketmq/tools/command/namesrv/AddWritePermSubCommand.java` and `tools/src/main/java/org/apache/rocketmq/tools/command/namesrv/WipeWritePermSubCommand.java` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 36 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `tools/src/main/java/org/apache/rocketmq/tools/command/namesrv/AddWritePermSubCommand.java:50` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (9–10 lines × 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:172-180 | store/src/main/java/org/apache/rocketmq/store/rocksdb/RocksDBOptionsFactory.java:248-257 | store/src/main/java/org/apache/rocketmq/store/rocksdb/RocksDBOptionsFactory.java:300-308 | store/src/main/java/org/apache/rocketmq/store/rocksdb/RocksDBOptionsFactory.java:351-359 — 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:172` 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:170` calls `setCompactionOptionsUniversal` and `store/src/main/java/org/apache/rocketmq/store/rocksdb/RocksDBOptionsFactory.java:246` 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:90-99 | 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 (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 (9 lines × 4) tools/src/main/java/org/apache/rocketmq/tools/command/consumer/ConsumerStatusSubCommand.java:61— tools/src/main/java/org/apache/rocketmq/tools/command/consumer/ConsumerStatusSubCommand.java:61-69 | tools/src/main/java/org/apache/rocketmq/tools/command/controller/CleanControllerBrokerMetaSubCommand.java:56-64 | tools/src/main/java/org/apache/rocketmq/tools/command/export/ExportMetadataCommand.java:62-70 | tools/src/main/java/org/apache/rocketmq/tools/command/offset/ResetOffsetByTimeCommand.java:58-66 — before extracting anything, compare `tools/src/main/java/org/apache/rocketmq/tools/command/consumer/ConsumerStatusSubCommand.java` and `tools/src/main/java/org/apache/rocketmq/tools/command/controller/CleanControllerBrokerMetaSubCommand.java` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 34 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (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:227-233 | store/src/main/java/org/apache/rocketmq/store/rocksdb/RocksDBOptionsFactory.java:269-275 | store/src/main/java/org/apache/rocketmq/store/rocksdb/RocksDBOptionsFactory.java:320-326 — 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:227` 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.
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–7 lines × 2) tools/src/main/java/org/apache/rocketmq/tools/command/auth/CreateUserSubCommand.java:81— tools/src/main/java/org/apache/rocketmq/tools/command/auth/CreateUserSubCommand.java:81-87 | tools/src/main/java/org/apache/rocketmq/tools/command/auth/ListAclSubCommand.java:81-86 — before extracting anything, compare `tools/src/main/java/org/apache/rocketmq/tools/command/auth/CreateUserSubCommand.java` and `tools/src/main/java/org/apache/rocketmq/tools/command/auth/ListAclSubCommand.java` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 34 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. 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/CreateUserSubCommand.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. ★ 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/CreateUserSubCommand.java:80` calls `trim`, `getOptionValue` and `tools/src/main/java/org/apache/rocketmq/tools/command/auth/ListAclSubCommand.java:80` 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.
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-07-25..2026-10-23, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-25 10:14:32 +08:00' --until='2026-10-23 10:14:32 +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.
Hotspot: store/src/main/java/org/apache/rocketmq/store/CommitLog.java store/src/main/java/org/apache/rocketmq/store/CommitLog.java:1990— store/src/main/java/org/apache/rocketmq/store/CommitLog.java changed 2 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 18 in DefaultAppendMessageCallback.doAppend at line 1990. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-07-25..2026-10-23, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-25 10:14:32 +08:00' --until='2026-10-23 10:14:32 +08:00' --full-history --no-merges -- store/src/main/java/org/apache/rocketmq/store/CommitLog.java`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
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· Edited copy of a member (33 corresponding lines) · ×2
Edited copy of a member (33 corresponding lines) tools/src/main/java/org/apache/rocketmq/tools/command/message/QueryMsgByIdSubCommand.java:195— tools/src/main/java/org/apache/rocketmq/tools/command/message/QueryMsgByIdSubCommand.java:195-229 | tools/src/main/java/org/apache/rocketmq/tools/command/topic/UpdateTopicSubCommand.java:49-94 — These two members are one piece of code written twice and then edited apart: 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) tools/src/main/java/org/apache/rocketmq/tools/command/message/QueryMsgByKeySubCommand.java:48— tools/src/main/java/org/apache/rocketmq/tools/command/message/QueryMsgByKeySubCommand.java:48-82 | tools/src/main/java/org/apache/rocketmq/tools/command/topic/UpdateTopicSubCommand.java:49-94 — These two members are one piece of code written twice and then edited apart: 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· 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.
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 (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) 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 (18–19 lines × 2) store/src/main/java/org/apache/rocketmq/store/MessageExtEncoder.java:63— store/src/main/java/org/apache/rocketmq/store/MessageExtEncoder.java:63-81 | store/src/main/java/org/apache/rocketmq/store/MessageExtEncoder.java:88-105 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (18–19 lines × 2) tools/src/main/java/org/apache/rocketmq/tools/command/cluster/ClusterListSubCommand.java:121— tools/src/main/java/org/apache/rocketmq/tools/command/cluster/ClusterListSubCommand.java:121-138 | tools/src/main/java/org/apache/rocketmq/tools/command/cluster/ClusterListSubCommand.java:188-206 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `tools/src/main/java/org/apache/rocketmq/tools/command/cluster/ClusterListSubCommand.java:121` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (17–18 lines × 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 (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:134-145 | store/src/main/java/org/apache/rocketmq/store/rocksdb/RocksDBOptionsFactory.java:220-231 | store/src/main/java/org/apache/rocketmq/store/rocksdb/RocksDBOptionsFactory.java:262-273 | store/src/main/java/org/apache/rocketmq/store/rocksdb/RocksDBOptionsFactory.java:313-324 — 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 (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) 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 (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 (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 (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 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.
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.
IC1 · Incompleteness & stubs· Empty method body · ×2
Empty method body — does nothing with its inputs common/src/main/java/org/apache/rocketmq/common/sysflag/SubscriptionSysFlag.java:45— `main` takes parameters but its body is empty — it accepts inputs and does nothing. Either implement it or remove it.
Empty method body — does nothing with its inputs tools/src/main/java/org/apache/rocketmq/tools/monitor/MonitorService.java:320— `reportFailedMsgs` takes parameters but its body is empty — it accepts inputs and does nothing. Either implement it or remove it.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
ConsumerProgressSubCommand.execute (cyclomatic 24) tools/src/main/java/org/apache/rocketmq/tools/command/consumer/ConsumerProgressSubCommand.java:102— ConsumerProgressSubCommand.execute has cyclomatic complexity 24 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
PolishExpr.participle (cyclomatic 24) common/src/main/java/org/apache/rocketmq/common/filter/impl/PolishExpr.java:89— PolishExpr.participle has cyclomatic complexity 24 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
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.
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.
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.
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.
DefaultMQPushConsumerImpl.pullMessage (cyclomatic 23) client/src/main/java/org/apache/rocketmq/client/impl/consumer/DefaultMQPushConsumerImpl.java:246— DefaultMQPushConsumerImpl.pullMessage has cyclomatic complexity 23 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
NotificationProcessor.processRequest (cyclomatic 23) broker/src/main/java/org/apache/rocketmq/broker/processor/NotificationProcessor.java: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.
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.
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.
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.
DefaultMQAdminExtImpl.examineConsumeStats (cyclomatic 21) tools/src/main/java/org/apache/rocketmq/tools/admin/DefaultMQAdminExtImpl.java:395— DefaultMQAdminExtImpl.examineConsumeStats 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.
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.
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.
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.
GetLiteGroupInfoSubCommand.execute (cyclomatic 20) tools/src/main/java/org/apache/rocketmq/tools/command/lite/GetLiteGroupInfoSubCommand.java:72— GetLiteGroupInfoSubCommand.execute has cyclomatic complexity 20 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
UpdateTopicPermSubCommand.execute (cyclomatic 20) tools/src/main/java/org/apache/rocketmq/tools/command/topic/UpdateTopicPermSubCommand.java:72— UpdateTopicPermSubCommand.execute has cyclomatic complexity 20 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
GroupTransferService.doWaitTransfer (cyclomatic 20) store/src/main/java/org/apache/rocketmq/store/ha/GroupTransferService.java:79— GroupTransferService.doWaitTransfer has cyclomatic complexity 20 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
CompactionLog.getMessage (cyclomatic 20) REDACTED:448— CompactionLog.getMessage has cyclomatic complexity 20 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
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.
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.
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.
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.
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.
DefaultMQAdminExtImpl.messageTrackDetail (cyclomatic 19) tools/src/main/java/org/apache/rocketmq/tools/admin/DefaultMQAdminExtImpl.java:1350— DefaultMQAdminExtImpl.messageTrackDetail has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
ConsumeMessageCommand.execute (cyclomatic 19) tools/src/main/java/org/apache/rocketmq/tools/command/message/ConsumeMessageCommand.java:118— ConsumeMessageCommand.execute has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
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.
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.
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.
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.
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.
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.
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.
ResetOffsetByTimeCommand.execute (cyclomatic 18) tools/src/main/java/org/apache/rocketmq/tools/command/offset/ResetOffsetByTimeCommand.java:88— ResetOffsetByTimeCommand.execute 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.
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.
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.
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.
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.
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.
ClusterListSubCommand.printClusterBaseInfo (cyclomatic 17) tools/src/main/java/org/apache/rocketmq/tools/command/cluster/ClusterListSubCommand.java:179— ClusterListSubCommand.printClusterBaseInfo has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
ClusterSendMsgRTCommand.execute (cyclomatic 17) tools/src/main/java/org/apache/rocketmq/tools/command/cluster/ClusterSendMsgRTCommand.java:84— ClusterSendMsgRTCommand.execute has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
UpdateSubGroupSubCommand.execute (cyclomatic 17) tools/src/main/java/org/apache/rocketmq/tools/command/consumer/UpdateSubGroupSubCommand.java:113— UpdateSubGroupSubCommand.execute has cyclomatic complexity 17 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
StatsAllSubCommand.printTopicDetail (cyclomatic 17) tools/src/main/java/org/apache/rocketmq/tools/command/stats/StatsAllSubCommand.java:45— StatsAllSubCommand.printTopicDetail has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
RemappingStaticTopicSubCommand.execute (cyclomatic 17) tools/src/main/java/org/apache/rocketmq/tools/command/topic/RemappingStaticTopicSubCommand.java:118— RemappingStaticTopicSubCommand.execute has cyclomatic complexity 17 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
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.
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.
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.
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.
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.
7.run (cyclomatic 16) tools/src/main/java/org/apache/rocketmq/tools/admin/DefaultMQAdminExtImpl.java:1449— 7.run has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
PrintMessageSubCommand.execute (cyclomatic 16) tools/src/main/java/org/apache/rocketmq/tools/command/message/PrintMessageSubCommand.java:111— PrintMessageSubCommand.execute has cyclomatic complexity 16 (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.
QueryMsgByIdSubCommand.execute (cyclomatic 16) tools/src/main/java/org/apache/rocketmq/tools/command/message/QueryMsgByIdSubCommand.java:232— QueryMsgByIdSubCommand.execute 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.
UpdateStaticTopicSubCommand.execute (cyclomatic 16) tools/src/main/java/org/apache/rocketmq/tools/command/topic/UpdateStaticTopicSubCommand.java:123— UpdateStaticTopicSubCommand.execute has cyclomatic complexity 16 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
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.
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.
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.
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.
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.
PolishExpr.reversePolish (cyclomatic 16) common/src/main/java/org/apache/rocketmq/common/filter/impl/PolishExpr.java:40— PolishExpr.reversePolish has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
ConsumeRequest.run (cyclomatic 16) client/src/main/java/org/apache/rocketmq/client/impl/consumer/ConsumeMessageConcurrentlyService.java: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.
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.
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.
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.
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.
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.
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.
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.
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.
ConsumerProgressSubCommand.execute (cognitive 65) tools/src/main/java/org/apache/rocketmq/tools/command/consumer/ConsumerProgressSubCommand.java:102— ConsumerProgressSubCommand.execute has cognitive complexity 65 (threshold 15). Drivers by points: if/else 16 (33 pts), error handling 5 (16 pts), ternaries 4 (11 pts), loops 2 (4 pts), boolean chains 1 (nesting depth added 37). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
MQClientInstance.updateTopicRouteInfoFromNameServer (cognitive 64) client/src/main/java/org/apache/rocketmq/client/impl/factory/MQClientInstance.java: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.
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.
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.
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.
ClusterListSubCommand.printClusterBaseInfo (cognitive 57) tools/src/main/java/org/apache/rocketmq/tools/command/cluster/ClusterListSubCommand.java:179— ClusterListSubCommand.printClusterBaseInfo has cognitive complexity 57 (threshold 15). Drivers by points: if/else 8 (37 pts), error handling 2 (10 pts), loops 3 (7 pts), boolean chains 3 (nesting depth added 41). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
DefaultMQAdminExtImpl.messageTrackDetail (cognitive 56) tools/src/main/java/org/apache/rocketmq/tools/admin/DefaultMQAdminExtImpl.java:1350— DefaultMQAdminExtImpl.messageTrackDetail has cognitive complexity 56 (threshold 15). Drivers by points: if/else 10 (35 pts), error handling 5 (13 pts), loops 2 (5 pts), match/switch 1 (2 pts), boolean chains 1 (nesting depth added 37). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
RemotingHelper.invokeSync (cognitive 55) remoting/src/main/java/org/apache/rocketmq/remoting/common/RemotingHelper.java: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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
UpdateTopicPermSubCommand.execute (cognitive 43) tools/src/main/java/org/apache/rocketmq/tools/command/topic/UpdateTopicPermSubCommand.java:72— UpdateTopicPermSubCommand.execute has cognitive complexity 43 (threshold 15). Drivers by points: if/else 13 (28 pts), loops 4 (10 pts), boolean chains 4, error handling 1 (nesting depth added 21). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
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.
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.
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.
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.
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.
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.
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.
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.
PolishExpr.participle (cognitive 39) common/src/main/java/org/apache/rocketmq/common/filter/impl/PolishExpr.java:89— PolishExpr.participle has cognitive complexity 39 (threshold 15). Drivers by points: if/else 14 (29 pts), boolean chains 9, loops 1 (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
DefaultMQPushConsumerImpl.checkConfig (cognitive 39) client/src/main/java/org/apache/rocketmq/client/impl/consumer/DefaultMQPushConsumerImpl.java: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.
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.
DefaultMQAdminExtImpl.examineConsumeStats (cognitive 38) tools/src/main/java/org/apache/rocketmq/tools/admin/DefaultMQAdminExtImpl.java:395— DefaultMQAdminExtImpl.examineConsumeStats has cognitive complexity 38 (threshold 15). Drivers by points: if/else 11 (22 pts), loops 5 (9 pts), error handling 2 (4 pts), boolean chains 3 (nesting depth added 17). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
StatsAllSubCommand.printTopicDetail (cognitive 38) tools/src/main/java/org/apache/rocketmq/tools/command/stats/StatsAllSubCommand.java:45— StatsAllSubCommand.printTopicDetail has cognitive complexity 38 (threshold 15). Drivers by points: if/else 7 (18 pts), error handling 3 (11 pts), loops 3 (6 pts), boolean chains 3 (nesting depth added 22). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
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.
ClusterSendMsgRTCommand.execute (cognitive 37) tools/src/main/java/org/apache/rocketmq/tools/command/cluster/ClusterSendMsgRTCommand.java:84— ClusterSendMsgRTCommand.execute has cognitive complexity 37 (threshold 15). Drivers by points: if/else 7 (16 pts), loops 4 (10 pts), error handling 2 (6 pts), ternaries 4, boolean chains 1 (nesting depth added 19). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ConsumeQueue.estimateMessageCount (cognitive 37) store/src/main/java/org/apache/rocketmq/store/ConsumeQueue.java: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.
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.
CopyUsersSubCommand.execute (cognitive 36) tools/src/main/java/org/apache/rocketmq/tools/command/auth/CopyUsersSubCommand.java:64— CopyUsersSubCommand.execute has cognitive complexity 36 (threshold 15). Drivers by points: if/else 10 (25 pts), loops 3 (9 pts), boolean chains 1, error handling 1 (nesting depth added 21). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
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.
MessageUtils.deleteProperty (cognitive 36) common/src/main/java/org/apache/rocketmq/common/utils/MessageUtils.java:54— MessageUtils.deleteProperty has cognitive complexity 36 (threshold 15). Drivers by points: if/else 7 (27 pts), loops 2 (7 pts), boolean chains 2 (nesting depth added 25). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
MQClientInstance.topicRouteData2TopicPublishInfo (cognitive 36) client/src/main/java/org/apache/rocketmq/client/impl/factory/MQClientInstance.java: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.
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.
ConsumerStatusSubCommand.execute (cognitive 35) tools/src/main/java/org/apache/rocketmq/tools/command/consumer/ConsumerStatusSubCommand.java:75— ConsumerStatusSubCommand.execute has cognitive complexity 35 (threshold 15). Drivers by points: if/else 9 (19 pts), loops 2 (6 pts), ternaries 2 (5 pts), error handling 2 (4 pts), boolean chains 1 (nesting depth added 19). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
BatchConsumeQueue.estimateMessageCount (cognitive 35) store/src/main/java/org/apache/rocketmq/store/queue/BatchConsumeQueue.java: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.
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.
7.run (cognitive 34) tools/src/main/java/org/apache/rocketmq/tools/admin/DefaultMQAdminExtImpl.java:1449— 7.run has cognitive complexity 34 (threshold 15). Drivers by points: if/else 8 (21 pts), error handling 5 (8 pts), loops 1 (3 pts), boolean chains 1, match/switch 1 (nesting depth added 18). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
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.
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.
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.
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.
ConsumerSubCommand.execute (cognitive 33) tools/src/main/java/org/apache/rocketmq/tools/command/consumer/ConsumerSubCommand.java:67— ConsumerSubCommand.execute has cognitive complexity 33 (threshold 15). Drivers by points: if/else 8 (18 pts), loops 2 (6 pts), error handling 2 (4 pts), ternaries 1 (4 pts), boolean chains 1 (nesting depth added 19). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
TimerMessageStore.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.
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.
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.
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.
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.
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.
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.
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.
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.
QueryMsgByIdSubCommand.execute (cognitive 30) tools/src/main/java/org/apache/rocketmq/tools/command/message/QueryMsgByIdSubCommand.java:232— QueryMsgByIdSubCommand.execute has cognitive complexity 30 (threshold 15). Drivers by points: if/else 10 (20 pts), loops 3 (7 pts), boolean chains 1, error handling 1, 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.
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.
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.
ProxyMetricsManager.start (cognitive 30) proxy/src/main/java/org/apache/rocketmq/proxy/metrics/ProxyMetricsManager.java:137— ProxyMetricsManager.start has cognitive complexity 30 (threshold 15). Drivers by points: if/else 13 (21 pts), loops 2 (5 pts), boolean chains 2, ternaries 1 (2 pts) (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ControllerMetricsManager.init (cognitive 30) controller/src/main/java/org/apache/rocketmq/controller/metrics/ControllerMetricsManager.java: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.
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.
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.
BrokerConsumeStatsSubCommand.execute (cognitive 29) tools/src/main/java/org/apache/rocketmq/tools/command/broker/BrokerConsumeStatsSubCommand.java:89— BrokerConsumeStatsSubCommand.execute has cognitive complexity 29 (threshold 15). Drivers by points: if/else 5 (13 pts), loops 4 (10 pts), error handling 2 (6 pts) (nesting depth added 18). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
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.
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.
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.
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.
ExportMetadataCommand.execute (cognitive 28) tools/src/main/java/org/apache/rocketmq/tools/command/export/ExportMetadataCommand.java:83— ExportMetadataCommand.execute has cognitive complexity 28 (threshold 15). Drivers by points: if/else 10 (18 pts), loops 3 (8 pts), error handling 1, ternaries 1 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
GetLiteGroupInfoSubCommand.execute (cognitive 28) tools/src/main/java/org/apache/rocketmq/tools/command/lite/GetLiteGroupInfoSubCommand.java:72— GetLiteGroupInfoSubCommand.execute has cognitive complexity 28 (threshold 15). Drivers by points: ternaries 6 (11 pts), if/else 7 (9 pts), error handling 2 (3 pts), loops 3, 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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
DefaultPromise.get (cognitive 26) openmessaging/src/main/java/io/openmessaging/rocketmq/promise/DefaultPromise.java:65— DefaultPromise.get has cognitive complexity 26 (threshold 15). Drivers by points: if/else 8 (17 pts), error handling 2 (6 pts), loops 1 (3 pts) (nesting depth added 15). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
RebalanceImpl.rebalanceByTopic (cognitive 26) client/src/main/java/org/apache/rocketmq/client/impl/consumer/RebalanceImpl.java: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.
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.
MQAdminStartup.main0 (cognitive 25) tools/src/main/java/org/apache/rocketmq/tools/command/MQAdminStartup.java:137— MQAdminStartup.main0 has cognitive complexity 25 (threshold 15). Drivers by points: if/else 10 (23 pts), error handling 1, match/switch 1 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
DefaultMQAdminExtImpl.consumedConcurrent (cognitive 23) tools/src/main/java/org/apache/rocketmq/tools/admin/DefaultMQAdminExtImpl.java:1560— DefaultMQAdminExtImpl.consumedConcurrent has cognitive complexity 23 (threshold 15). Drivers by points: if/else 6 (20 pts), loops 1 (2 pts), boolean chains 1 (nesting depth added 15). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
WriteSocketService.transferData (cognitive 23) store/src/main/java/org/apache/rocketmq/store/ha/DefaultHAConnection.java:408— WriteSocketService.transferData has cognitive complexity 23 (threshold 15). Drivers by points: if/else 11 (19 pts), loops 2 (3 pts), boolean chains 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
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.
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.
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.
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.
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.
MQAdminUtils.remappingStaticTopic (cognitive 22) tools/src/main/java/org/apache/rocketmq/tools/admin/MQAdminUtils.java:146— MQAdminUtils.remappingStaticTopic has cognitive complexity 22 (threshold 15). Drivers by points: if/else 5 (14 pts), loops 6 (7 pts), boolean chains 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ConsumeMessageCommand.execute (cognitive 22) tools/src/main/java/org/apache/rocketmq/tools/command/message/ConsumeMessageCommand.java:118— ConsumeMessageCommand.execute has cognitive complexity 22 (threshold 15). Drivers by points: if/else 14 (20 pts), error handling 1, match/switch 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
DumpCompactionLogCommand.execute (cognitive 22) tools/src/main/java/org/apache/rocketmq/tools/command/message/DumpCompactionLogCommand.java:59— DumpCompactionLogCommand.execute has cognitive complexity 22 (threshold 15). Drivers by points: if/else 8 (14 pts), error handling 2 (5 pts), loops 1 (2 pts), boolean chains 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
MonitorService.computeUndoneMsgs (cognitive 22) tools/src/main/java/org/apache/rocketmq/tools/monitor/MonitorService.java:269— MonitorService.computeUndoneMsgs has cognitive complexity 22 (threshold 15). Drivers by points: if/else 5 (14 pts), match/switch 1 (4 pts), error handling 1 (3 pts), loops 1 (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
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.
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.
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.
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.
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.
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.
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.
MQAdminUtils.convertPhysicalConsumeStats (cognitive 21) tools/src/main/java/org/apache/rocketmq/tools/admin/MQAdminUtils.java:298— MQAdminUtils.convertPhysicalConsumeStats has cognitive complexity 21 (threshold 15). Drivers by points: if/else 5 (14 pts), boolean chains 4, loops 2 (3 pts) (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
CopyAclsSubCommand.execute (cognitive 21) tools/src/main/java/org/apache/rocketmq/tools/command/auth/CopyAclsSubCommand.java:64— CopyAclsSubCommand.execute has cognitive complexity 21 (threshold 15). Drivers by points: if/else 7 (14 pts), loops 2 (5 pts), boolean chains 1, 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.
RemappingStaticTopicSubCommand.execute (cognitive 21) tools/src/main/java/org/apache/rocketmq/tools/command/topic/RemappingStaticTopicSubCommand.java:118— RemappingStaticTopicSubCommand.execute has cognitive complexity 21 (threshold 15). Drivers by points: if/else 10 (13 pts), loops 3 (5 pts), boolean chains 2, error handling 1 (nesting depth added 5). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
TopicListSubCommand.execute (cognitive 21) tools/src/main/java/org/apache/rocketmq/tools/command/topic/TopicListSubCommand.java:60— TopicListSubCommand.execute has cognitive complexity 21 (threshold 15). Drivers by points: if/else 4 (8 pts), loops 3 (7 pts), error handling 2 (4 pts), boolean chains 2 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
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.
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.
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.
AbstractOMSProducer.checkProducerException (cognitive 21) openmessaging/src/main/java/io/openmessaging/rocketmq/producer/AbstractOMSProducer.java:92— AbstractOMSProducer.checkProducerException has cognitive complexity 21 (threshold 15). Drivers by points: if/else 9 (20 pts), boolean chains 1 (nesting depth added 11). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
ConsumeMessageConcurrentlyService.submitConsumeRequest (cognitive 21) client/src/main/java/org/apache/rocketmq/client/impl/consumer/ConsumeMessageConcurrentlyService.java: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.
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.batchSendOpMessage (cognitive 21) broker/src/main/java/org/apache/rocketmq/broker/transaction/queue/TransactionalMessageServiceImpl.java:698— TransactionalMessageServiceImpl.batchSendOpMessage has cognitive complexity 21 (threshold 15). Drivers by points: if/else 7 (13 pts), boolean chains 3, loops 2 (3 pts), error handling 1, ternaries 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
TransactionalMessageServiceImpl.fillOpRemoveMap (cognitive 21) broker/src/main/java/org/apache/rocketmq/broker/transaction/queue/TransactionalMessageServiceImpl.java: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.
PrintMessageSubCommand.execute (cognitive 20) tools/src/main/java/org/apache/rocketmq/tools/command/message/PrintMessageSubCommand.java:111— PrintMessageSubCommand.execute has cognitive complexity 20 (threshold 15). Drivers by points: if/else 4 (6 pts), error handling 2 (4 pts), loops 2 (3 pts), match/switch 1 (3 pts), ternaries 3, boolean chains 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.
ResetOffsetByTimeCommand.execute (cognitive 20) tools/src/main/java/org/apache/rocketmq/tools/command/offset/ResetOffsetByTimeCommand.java:88— ResetOffsetByTimeCommand.execute has cognitive complexity 20 (threshold 15). Drivers by points: if/else 9 (11 pts), ternaries 3 (4 pts), error handling 3, 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.
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.
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.
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.
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.
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.
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.
UpdateSubGroupSubCommand.execute (cognitive 19) tools/src/main/java/org/apache/rocketmq/tools/command/consumer/UpdateSubGroupSubCommand.java:113— UpdateSubGroupSubCommand.execute has cognitive complexity 19 (threshold 15). Drivers by points: if/else 13, error handling 2 (4 pts), loops 1 (2 pts) (nesting depth added 3). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
UpdateStaticTopicSubCommand.execute (cognitive 19) tools/src/main/java/org/apache/rocketmq/tools/command/topic/UpdateStaticTopicSubCommand.java:123— UpdateStaticTopicSubCommand.execute has cognitive complexity 19 (threshold 15). Drivers by points: if/else 9 (11 pts), loops 2 (4 pts), boolean chains 3, error handling 1 (nesting depth added 4). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
UpdateTopicSubCommand.execute (cognitive 19) tools/src/main/java/org/apache/rocketmq/tools/command/topic/UpdateTopicSubCommand.java:97— UpdateTopicSubCommand.execute has cognitive complexity 19 (threshold 15). Drivers by points: if/else 11 (13 pts), loops 2 (5 pts), error handling 1 (nesting depth added 5). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
CommitLogInputStream.read (cognitive 19) tieredstore/src/main/java/org/apache/rocketmq/tieredstore/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.
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.
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.
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.
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.
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.
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.
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.
AbstractSendMessageProcessor.msgCheck (cognitive 19) broker/src/main/java/org/apache/rocketmq/broker/processor/AbstractSendMessageProcessor.java:464— AbstractSendMessageProcessor.msgCheck has cognitive complexity 19 (threshold 15). Drivers by points: if/else 11 (18 pts), boolean chains 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
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.
ClusterListSubCommand.printClusterMoreStats (cognitive 18) tools/src/main/java/org/apache/rocketmq/tools/command/cluster/ClusterListSubCommand.java:117— ClusterListSubCommand.printClusterMoreStats has cognitive complexity 18 (threshold 15). Drivers by points: loops 3 (7 pts), error handling 1 (5 pts), if/else 2 (5 pts), boolean chains 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
CommandUtil.fetchMasterAndSlaveDistinguish (cognitive 18) tools/src/main/java/org/apache/rocketmq/tools/command/CommandUtil.java:43— CommandUtil.fetchMasterAndSlaveDistinguish has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (13 pts), loops 2 (3 pts), boolean chains 2 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
DefaultMQAdminExtImpl.consumed (cognitive 16) tools/src/main/java/org/apache/rocketmq/tools/admin/DefaultMQAdminExtImpl.java:1533— DefaultMQAdminExtImpl.consumed has cognitive complexity 16 (threshold 15). Drivers by points: if/else 4 (14 pts), boolean chains 1, loops 1 (nesting depth added 10). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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:133-182 | store/src/main/java/org/apache/rocketmq/store/rocksdb/RocksDBOptionsFactory.java:219-259 | store/src/main/java/org/apache/rocketmq/store/rocksdb/RocksDBOptionsFactory.java:261-310 | store/src/main/java/org/apache/rocketmq/store/rocksdb/RocksDBOptionsFactory.java:312-361 — 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.
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 (64 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: 64 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 (45 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: 45 of their lines are already reported as duplicated blocks below, spread through both bodies rather than gathered into one. Read them as a single construct written twice. The repair is at the members' grain — factor the shared pipeline into one implementation the two call with their differences as parameters or as an injected step, or, where the difference is systematic (sync against async, one transport against another), generate one from the other. Extracting the individual blocks below is not the same fix: it leaves the two bodies in place and the next edit still has to be made twice.
Near-duplicate member pair (44 shared lines) 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 variants of one another: 44 of their lines are already reported as duplicated blocks below, spread through both bodies rather than gathered into one. Read them as a single construct written twice. The repair is at the members' grain — factor the shared pipeline into one implementation the two call with their differences as parameters or as an injected step, or, where the difference is systematic (sync against async, one transport against another), generate one from the other. Extracting the individual blocks below is not the same fix: it leaves the two bodies in place and the next edit still has to be made twice.
Near-duplicate member pair (40 shared 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 variants of one another: 40 of their lines are already reported as duplicated blocks below, spread through both bodies rather than gathered into one. Read them as a single construct written twice. The repair is at the members' grain — factor the shared pipeline into one implementation the two call with their differences as parameters or as an injected step, or, where the difference is systematic (sync against async, one transport against another), generate one from the other. Extracting the individual blocks below is not the same fix: it leaves the two bodies in place and the next edit still has to be made twice.
Near-duplicate member pair (39 shared lines) tools/src/main/java/org/apache/rocketmq/tools/command/topic/RemappingStaticTopicSubCommand.java:119— tools/src/main/java/org/apache/rocketmq/tools/command/topic/RemappingStaticTopicSubCommand.java:119-204 | tools/src/main/java/org/apache/rocketmq/tools/command/topic/UpdateStaticTopicSubCommand.java:124-208 — These two members are variants of one another: 39 of their lines are already reported as duplicated blocks below, spread through both bodies rather than gathered into one. Read them as a single construct written twice. The repair is at the members' grain — factor the shared pipeline into one implementation the two call with their differences as parameters or as an injected step, or, where the difference is systematic (sync against async, one transport against another), generate one from the other. Extracting the individual blocks below is not the same fix: it leaves the two bodies in place and the next edit still has to be made twice.
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 (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.
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.
Near-duplicate member pair (25 shared 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:1449-1524 — These two members are variants of one another: 25 of their lines are already reported as duplicated blocks below, spread through both bodies rather than gathered into one. Read them as a single construct written twice. The repair is at the members' grain — factor the shared pipeline into one implementation the two call with their differences as parameters or as an injected step, or, where the difference is systematic (sync against async, one transport against another), generate one from the other. Extracting the individual blocks below is not the same fix: it leaves the two bodies in place and the next edit still has to be made twice.
D4 · Code Duplication· Edited copy of a member (39 corresponding lines) · ×1
Edited copy of a member (39 corresponding lines) tools/src/main/java/org/apache/rocketmq/tools/command/message/ConsumeMessageCommand.java:77— tools/src/main/java/org/apache/rocketmq/tools/command/message/ConsumeMessageCommand.java:77-115 | tools/src/main/java/org/apache/rocketmq/tools/command/message/PrintMessageSubCommand.java:70-108 — 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 (29 corresponding lines) · ×1
Edited copy of a member (29 corresponding lines) tools/src/main/java/org/apache/rocketmq/tools/command/message/SendMessageCommand.java:48— tools/src/main/java/org/apache/rocketmq/tools/command/message/SendMessageCommand.java:48-78 | tools/src/main/java/org/apache/rocketmq/tools/command/topic/UpdateTopicSubCommand.java:49-94 — These two members are one piece of code written twice and then edited apart: 29 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (20 corresponding lines) · ×1
Edited copy of a member (20 corresponding lines) tools/src/main/java/org/apache/rocketmq/tools/command/broker/UpdateBrokerConfigSubCommand.java:44— tools/src/main/java/org/apache/rocketmq/tools/command/broker/UpdateBrokerConfigSubCommand.java:44-66 | tools/src/main/java/org/apache/rocketmq/tools/command/consumer/SetConsumeModeSubCommand.java:46-72 — These two members are one piece of code written twice and then edited apart: 20 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (19 corresponding lines) · ×1
Edited copy of a member (19 corresponding lines) example/src/main/java/org/apache/rocketmq/example/operation/Consumer.java:72— example/src/main/java/org/apache/rocketmq/example/operation/Consumer.java:72-110 | tools/src/main/java/org/apache/rocketmq/tools/command/consumer/SetConsumeModeSubCommand.java:46-72 — These two members are one piece of code written twice and then edited apart: 19 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· 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· 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-112 | 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-117 | 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.
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 (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 (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 131 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 (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 (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 (25–27 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-76 | store/src/main/java/org/apache/rocketmq/store/rocksdb/RocksDBOptionsFactory.java:107-131 — 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/config/ConfigHelper.java:50` 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 (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 (23–24 lines × 2) store/src/main/java/org/apache/rocketmq/store/CommitLog.java:419— store/src/main/java/org/apache/rocketmq/store/CommitLog.java:419-441 | store/src/main/java/org/apache/rocketmq/store/CommitLog.java:892-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:419` 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 (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 (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 (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 (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–16 lines × 2) broker/src/main/java/org/apache/rocketmq/broker/BrokerStartup.java:313— broker/src/main/java/org/apache/rocketmq/broker/BrokerStartup.java:313-325 | tools/src/main/java/org/apache/rocketmq/tools/command/export/ExportMetadataCommand.java:65-80 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `broker/src/main/java/org/apache/rocketmq/broker/BrokerStartup.java:313` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
Duplicated block (15–16 lines × 2) client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java: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:147— store/src/main/java/org/apache/rocketmq/store/rocksdb/RocksDBOptionsFactory.java:147-160 | store/src/main/java/org/apache/rocketmq/store/rocksdb/RocksDBOptionsFactory.java:275-288 | store/src/main/java/org/apache/rocketmq/store/rocksdb/RocksDBOptionsFactory.java:326-339 — 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:147` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (13–14 lines × 3) tools/src/main/java/org/apache/rocketmq/tools/command/broker/RemoveColdDataFlowCtrGroupConfigSubCommand.java:80— tools/src/main/java/org/apache/rocketmq/tools/command/broker/RemoveColdDataFlowCtrGroupConfigSubCommand.java:80-92 | tools/src/main/java/org/apache/rocketmq/tools/command/broker/UpdateBrokerConfigSubCommand.java:106-119 | tools/src/main/java/org/apache/rocketmq/tools/command/broker/UpdateColdDataFlowCtrGroupConfigSubCommand.java:90-102 — before extracting anything, compare `tools/src/main/java/org/apache/rocketmq/tools/command/broker/RemoveColdDataFlowCtrGroupConfigSubCommand.java` and `tools/src/main/java/org/apache/rocketmq/tools/command/broker/UpdateBrokerConfigSubCommand.java` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 51 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `tools/src/main/java/org/apache/rocketmq/tools/command/broker/RemoveColdDataFlowCtrGroupConfigSubCommand.java:80` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (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 (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 (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 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. 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 (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 (10–12 lines × 2) srvutil/src/main/java/org/apache/rocketmq/srvutil/ServerUtil.java:30— srvutil/src/main/java/org/apache/rocketmq/srvutil/ServerUtil.java:30-41 | tools/src/main/java/org/apache/rocketmq/tools/command/stats/StatsAllSubCommand.java:159-168 — 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 (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 (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:101-111 | 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:106-116 — 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 (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 (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 (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 (10 lines × 4) tools/src/main/java/org/apache/rocketmq/tools/command/auth/CreateAclSubCommand.java:72— tools/src/main/java/org/apache/rocketmq/tools/command/auth/CreateAclSubCommand.java:72-81 | tools/src/main/java/org/apache/rocketmq/tools/command/broker/CommitLogSetReadAheadSubCommand.java:56-65 | tools/src/main/java/org/apache/rocketmq/tools/command/broker/RemoveColdDataFlowCtrGroupConfigSubCommand.java:48-57 | tools/src/main/java/org/apache/rocketmq/tools/command/topic/UpdateOrderConfCommand.java:48-57 — before extracting anything, compare `tools/src/main/java/org/apache/rocketmq/tools/command/auth/CreateAclSubCommand.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 40 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/auth/CreateAclSubCommand.java:72` 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–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 × 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 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. 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 (7–10 lines × 2) tools/src/main/java/org/apache/rocketmq/tools/command/CommandUtil.java:92— tools/src/main/java/org/apache/rocketmq/tools/command/CommandUtil.java:92-101 | tools/src/main/java/org/apache/rocketmq/tools/command/CommandUtil.java:119-125 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `tools/src/main/java/org/apache/rocketmq/tools/command/CommandUtil.java:92` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (9 lines × 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 (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:103-112 | 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:108-117 | 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 9 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. 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 (9 lines × 8) 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-60 | tools/src/main/java/org/apache/rocketmq/tools/command/auth/CopyUsersSubCommand.java:52-60 | tools/src/main/java/org/apache/rocketmq/tools/command/auth/CreateUserSubCommand.java:61-69 | tools/src/main/java/org/apache/rocketmq/tools/command/auth/DeleteAclSubCommand.java:57-65 | tools/src/main/java/org/apache/rocketmq/tools/command/auth/UpdateAclSubCommand.java:72-80 | tools/src/main/java/org/apache/rocketmq/tools/command/consumer/DeleteSubscriptionGroupCommand.java:52-60 | tools/src/main/java/org/apache/rocketmq/tools/command/consumer/SetConsumeModeSubCommand.java:63-71 | tools/src/main/java/org/apache/rocketmq/tools/command/offset/GetConsumerStatusCommand.java:48-56 — 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 9 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. 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 `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/CreateUserSubCommand.java:57` calls `Option`, `setRequired`, `addOption` and `tools/src/main/java/org/apache/rocketmq/tools/command/auth/DeleteAclSubCommand.java:55` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (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 (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 (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 (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 × 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 × 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 9 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. 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 (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 (8 lines × 6) client/src/main/java/org/apache/rocketmq/client/impl/admin/MqClientAdminImpl.java:144— client/src/main/java/org/apache/rocketmq/client/impl/admin/MqClientAdminImpl.java:144-151 | client/src/main/java/org/apache/rocketmq/client/impl/admin/MqClientAdminImpl.java:162-169 | client/src/main/java/org/apache/rocketmq/client/impl/admin/MqClientAdminImpl.java:178-185 | client/src/main/java/org/apache/rocketmq/client/impl/admin/MqClientAdminImpl.java:194-201 | client/src/main/java/org/apache/rocketmq/client/impl/admin/MqClientAdminImpl.java:210-217 | client/src/main/java/org/apache/rocketmq/client/impl/admin/MqClientAdminImpl.java:226-233 — all 6 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `client/src/main/java/org/apache/rocketmq/client/impl/admin/MqClientAdminImpl.java:144` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on. Note first that the copies are not typed on the same thing: the declarations holding them bind `requestHeader` to `CreateTopicRequestHeader` in one and `DeleteTopicRequestHeader` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
Duplicated block (7–8 lines × 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 × 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 9 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. 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 (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 (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 (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 131 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 (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 (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 (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.
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.
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 (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.
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.
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 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.
Orphaned file remoting/src/main/java/org/apache/rocketmq/remoting/rpc/RpcClientImpl.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.
Interpolated log message defeats structured logging auth/src/main/java/org/apache/rocketmq/auth/migration/v1/PlainPermissionManager.java:102— `error` at line 102 is handed a message assembled at the call — a string concatenated with a value, or `String.format` — through SLF4J or log4j 2, so the logger receives one finished string: the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the level is filtered out. Pass a constant pattern and the values beside it instead: `log.error("Order {} moved to {}", orderId, status)`, which keeps the pattern and its arguments apart on the event for a structured encoder (logstash-logback-encoder, log4j 2's JsonTemplateLayout, OpenTelemetry), or `log.atInfo().addKeyValue("order_id", orderId).log("order moved")` with SLF4J 2's fluent API. An exception goes last, as the throwable argument, not into the text.
Interpolated log message defeats structured logging broker/src/main/java/org/apache/rocketmq/broker/BrokerPreOnlineService.java:63— `info` at line 63 is handed a message assembled at the call — a string concatenated with a value, or `String.format` — through SLF4J or log4j 2, so the logger receives one finished string: the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the level is filtered out. Pass a constant pattern and the values beside it instead: `log.info("Order {} moved to {}", orderId, status)`, which keeps the pattern and its arguments apart on the event for a structured encoder (logstash-logback-encoder, log4j 2's JsonTemplateLayout, OpenTelemetry), or `log.atInfo().addKeyValue("order_id", orderId).log("order moved")` with SLF4J 2's fluent API. An exception goes last, as the throwable argument, not into the text.
Interpolated log message defeats structured logging broker/src/main/java/org/apache/rocketmq/broker/BrokerPreOnlineService.java:82— `info` at line 82 is handed a message assembled at the call — a string concatenated with a value, or `String.format` — through SLF4J or log4j 2, so the logger receives one finished string: the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the level is filtered out. Pass a constant pattern and the values beside it instead: `log.info("Order {} moved to {}", orderId, status)`, which keeps the pattern and its arguments apart on the event for a structured encoder (logstash-logback-encoder, log4j 2's JsonTemplateLayout, OpenTelemetry), or `log.atInfo().addKeyValue("order_id", orderId).log("order moved")` with SLF4J 2's fluent API. An exception goes last, as the throwable argument, not into the text.
Interpolated log message defeats structured logging broker/src/main/java/org/apache/rocketmq/broker/coldctr/ColdDataPullRequestHoldService.java:76— `warn` at line 76 is handed a message assembled at the call — a string concatenated with a value, or `String.format` — through SLF4J or log4j 2, so the logger receives one finished string: the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the level is filtered out. Pass a constant pattern and the values beside it instead: `log.warn("Order {} moved to {}", orderId, status)`, which keeps the pattern and its arguments apart on the event for a structured encoder (logstash-logback-encoder, log4j 2's JsonTemplateLayout, OpenTelemetry), or `log.atInfo().addKeyValue("order_id", orderId).log("order moved")` with SLF4J 2's fluent API. An exception goes last, as the throwable argument, not into the text.
Interpolated log message defeats structured logging broker/src/main/java/org/apache/rocketmq/broker/coldctr/ColdDataCgCtrService.java:92— `warn` at line 92 is handed a message assembled at the call — a string concatenated with a value, or `String.format` — through SLF4J or log4j 2, so the logger receives one finished string: the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the level is filtered out. Pass a constant pattern and the values beside it instead: `log.warn("Order {} moved to {}", orderId, status)`, which keeps the pattern and its arguments apart on the event for a structured encoder (logstash-logback-encoder, log4j 2's JsonTemplateLayout, OpenTelemetry), or `log.atInfo().addKeyValue("order_id", orderId).log("order moved")` with SLF4J 2's fluent API. An exception goes last, as the throwable argument, not into the text.
Interpolated log message defeats structured logging broker/src/main/java/org/apache/rocketmq/broker/failover/EscapeBridge.java:167— `error` 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.error("Order {} moved to {}", orderId, status)`, which keeps the pattern and its arguments apart on the event for a structured encoder (logstash-logback-encoder, log4j 2's JsonTemplateLayout, OpenTelemetry), or `log.atInfo().addKeyValue("order_id", orderId).log("order moved")` with SLF4J 2's fluent API. An exception goes last, as the throwable argument, not into the text.
Interpolated log message defeats structured logging broker/src/main/java/org/apache/rocketmq/broker/failover/EscapeBridge.java:170— `error` at line 170 is handed a message assembled at the call — a string concatenated with a value, or `String.format` — through SLF4J or log4j 2, so the logger receives one finished string: the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the level is filtered out. Pass a constant pattern and the values beside it instead: `log.error("Order {} moved to {}", orderId, status)`, which keeps the pattern and its arguments apart on the event for a structured encoder (logstash-logback-encoder, log4j 2's JsonTemplateLayout, OpenTelemetry), or `log.atInfo().addKeyValue("order_id", orderId).log("order moved")` with SLF4J 2's fluent API. An exception goes last, as the throwable argument, not into the text.
Interpolated log message defeats structured logging broker/src/main/java/org/apache/rocketmq/broker/filter/ExpressionMessageFilter.java:108— `error` at line 108 is handed a message assembled at the call — a string concatenated with a value, or `String.format` — through SLF4J or log4j 2, so the logger receives one finished string: the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the level is filtered out. Pass a constant pattern and the values beside it instead: `log.error("Order {} moved to {}", orderId, status)`, which keeps the pattern and its arguments apart on the event for a structured encoder (logstash-logback-encoder, log4j 2's JsonTemplateLayout, OpenTelemetry), or `log.atInfo().addKeyValue("order_id", orderId).log("order moved")` with SLF4J 2's fluent API. An exception goes last, as the throwable argument, not into the text.
Interpolated log message defeats structured logging broker/src/main/java/org/apache/rocketmq/broker/filter/ExpressionMessageFilter.java:149— `error` at line 149 is handed a message assembled at the call — a string concatenated with a value, or `String.format` — through SLF4J or log4j 2, so the logger receives one finished string: the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the level is filtered out. Pass a constant pattern and the values beside it instead: `log.error("Order {} moved to {}", orderId, status)`, which keeps the pattern and its arguments apart on the event for a structured encoder (logstash-logback-encoder, log4j 2's JsonTemplateLayout, OpenTelemetry), or `log.atInfo().addKeyValue("order_id", orderId).log("order moved")` with SLF4J 2's fluent API. An exception goes last, as the throwable argument, not into the text.
Interpolated log message defeats structured logging broker/src/main/java/org/apache/rocketmq/broker/filter/ExpressionForRetryMessageFilter.java:86— `error` at line 86 is handed a message assembled at the call — a string concatenated with a value, or `String.format` — through SLF4J or log4j 2, so the logger receives one finished string: the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the level is filtered out. Pass a constant pattern and the values beside it instead: `log.error("Order {} moved to {}", orderId, status)`, which keeps the pattern and its arguments apart on the event for a structured encoder (logstash-logback-encoder, log4j 2's JsonTemplateLayout, OpenTelemetry), or `log.atInfo().addKeyValue("order_id", orderId).log("order moved")` with SLF4J 2's fluent API. An exception goes last, as the throwable argument, not into the text.
Interpolated log message defeats structured logging broker/src/main/java/org/apache/rocketmq/broker/filter/ConsumerFilterManager.java:267— `error` at line 267 is handed a message assembled at the call — a string concatenated with a value, or `String.format` — through SLF4J or log4j 2, so the logger receives one finished string: the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the level is filtered out. Pass a constant pattern and the values beside it instead: `log.error("Order {} moved to {}", orderId, status)`, which keeps the pattern and its arguments apart on the event for a structured encoder (logstash-logback-encoder, log4j 2's JsonTemplateLayout, OpenTelemetry), or `log.atInfo().addKeyValue("order_id", orderId).log("order moved")` with SLF4J 2's fluent API. An exception goes last, as the throwable argument, not into the text.
Interpolated log message defeats structured logging broker/src/main/java/org/apache/rocketmq/broker/latency/BrokerFastFailure.java:75— `error` at line 75 is handed a message assembled at the call — a string concatenated with a value, or `String.format` — through SLF4J or log4j 2, so the logger receives one finished string: the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the level is filtered out. Pass a constant pattern and the values beside it instead: `log.error("Order {} moved to {}", orderId, status)`, which keeps the pattern and its arguments apart on the event for a structured encoder (logstash-logback-encoder, log4j 2's JsonTemplateLayout, OpenTelemetry), or `log.atInfo().addKeyValue("order_id", orderId).log("order moved")` with SLF4J 2's fluent API. An exception goes last, as the throwable argument, not into the text.
Interpolated log message defeats structured logging broker/src/main/java/org/apache/rocketmq/broker/latency/BrokerFastFailure.java:142— `warn` at line 142 is handed a message assembled at the call — a string concatenated with a value, or `String.format` — through SLF4J or log4j 2, so the logger receives one finished string: the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the level is filtered out. Pass a constant pattern and the values beside it instead: `log.warn("Order {} moved to {}", orderId, status)`, which keeps the pattern and its arguments apart on the event for a structured encoder (logstash-logback-encoder, log4j 2's JsonTemplateLayout, OpenTelemetry), or `log.atInfo().addKeyValue("order_id", orderId).log("order moved")` with SLF4J 2's fluent API. An exception goes last, as the throwable argument, not into the text.
Interpolated log message defeats structured logging broker/src/main/java/org/apache/rocketmq/broker/longpolling/PullRequestHoldService.java:86— `warn` at line 86 is handed a message assembled at the call — a string concatenated with a value, or `String.format` — through SLF4J or log4j 2, so the logger receives one finished string: the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the level is filtered out. Pass a constant pattern and the values beside it instead: `log.warn("Order {} moved to {}", orderId, status)`, which keeps the pattern and its arguments apart on the event for a structured encoder (logstash-logback-encoder, log4j 2's JsonTemplateLayout, OpenTelemetry), or `log.atInfo().addKeyValue("order_id", orderId).log("order moved")` with SLF4J 2's fluent API. An exception goes last, as the throwable argument, not into the text.
Interpolated log message defeats structured logging broker/src/main/java/org/apache/rocketmq/broker/offset/ConsumerOffsetManager.java:406— `error` at line 406 is handed a message assembled at the call — a string concatenated with a value, or `String.format` — through SLF4J or log4j 2, so the logger receives one finished string: the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the level is filtered out. Pass a constant pattern and the values beside it instead: `log.error("Order {} moved to {}", orderId, status)`, which keeps the pattern and its arguments apart on the event for a structured encoder (logstash-logback-encoder, log4j 2's JsonTemplateLayout, OpenTelemetry), or `log.atInfo().addKeyValue("order_id", orderId).log("order moved")` with SLF4J 2's fluent API. An exception goes last, as the throwable argument, not into the text.
Interpolated log message defeats structured logging broker/src/main/java/org/apache/rocketmq/broker/out/BrokerOuterAPI.java:365— `error` at line 365 is handed a message assembled at the call — a string concatenated with a value, or `String.format` — through SLF4J or log4j 2, so the logger receives one finished string: the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the level is filtered out. Pass a constant pattern and the values beside it instead: `log.error("Order {} moved to {}", orderId, status)`, which keeps the pattern and its arguments apart on the event for a structured encoder (logstash-logback-encoder, log4j 2's JsonTemplateLayout, OpenTelemetry), or `log.atInfo().addKeyValue("order_id", orderId).log("order moved")` with SLF4J 2's fluent API. An exception goes last, as the throwable argument, not into the text.
Interpolated log message defeats structured logging broker/src/main/java/org/apache/rocketmq/broker/out/BrokerOuterAPI.java:395— `error` at line 395 is handed a message assembled at the call — a string concatenated with a value, or `String.format` — through SLF4J or log4j 2, so the logger receives one finished string: the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the level is filtered out. Pass a constant pattern and the values beside it instead: `log.error("Order {} moved to {}", orderId, status)`, which keeps the pattern and its arguments apart on the event for a structured encoder (logstash-logback-encoder, log4j 2's JsonTemplateLayout, OpenTelemetry), or `log.atInfo().addKeyValue("order_id", orderId).log("order moved")` with SLF4J 2's fluent API. An exception goes last, as the throwable argument, not into the text.
Interpolated log message defeats structured logging broker/src/main/java/org/apache/rocketmq/broker/out/BrokerOuterAPI.java:1163— `error` at line 1163 is handed a message assembled at the call — a string concatenated with a value, or `String.format` — through SLF4J or log4j 2, so the logger receives one finished string: the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the level is filtered out. Pass a constant pattern and the values beside it instead: `log.error("Order {} moved to {}", orderId, status)`, which keeps the pattern and its arguments apart on the event for a structured encoder (logstash-logback-encoder, log4j 2's JsonTemplateLayout, OpenTelemetry), or `log.atInfo().addKeyValue("order_id", orderId).log("order moved")` with SLF4J 2's fluent API. An exception goes last, as the throwable argument, not into the text.
Interpolated log message defeats structured logging broker/src/main/java/org/apache/rocketmq/broker/out/BrokerOuterAPI.java:1174— `error` at line 1174 is handed a message assembled at the call — a string concatenated with a value, or `String.format` — through SLF4J or log4j 2, so the logger receives one finished string: the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the level is filtered out. Pass a constant pattern and the values beside it instead: `log.error("Order {} moved to {}", orderId, status)`, which keeps the pattern and its arguments apart on the event for a structured encoder (logstash-logback-encoder, log4j 2's JsonTemplateLayout, OpenTelemetry), or `log.atInfo().addKeyValue("order_id", orderId).log("order moved")` with SLF4J 2's fluent API. An exception goes last, as the throwable argument, not into the text.
Interpolated log message defeats structured logging broker/src/main/java/org/apache/rocketmq/broker/processor/PopBufferMergeService.java:601— `error` at line 601 is handed a message assembled at the call — a string concatenated with a value, or `String.format` — through SLF4J or log4j 2, so the logger receives one finished string: the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the level is filtered out. Pass a constant pattern and the values beside it instead: `log.error("Order {} moved to {}", orderId, status)`, which keeps the pattern and its arguments apart on the event for a structured encoder (logstash-logback-encoder, log4j 2's JsonTemplateLayout, OpenTelemetry), or `log.atInfo().addKeyValue("order_id", orderId).log("order moved")` with SLF4J 2's fluent API. An exception goes last, as the throwable argument, not into the text.
Interpolated log message defeats structured logging broker/src/main/java/org/apache/rocketmq/broker/processor/DefaultPullMessageResultHandler.java:294— `warn` at line 294 is handed a message assembled at the call — a string concatenated with a value, or `String.format` — through SLF4J or log4j 2, so the logger receives one finished string: the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the level is filtered out. Pass a constant pattern and the values beside it instead: `log.warn("Order {} moved to {}", orderId, status)`, which keeps the pattern and its arguments apart on the event for a structured encoder (logstash-logback-encoder, log4j 2's JsonTemplateLayout, OpenTelemetry), or `log.atInfo().addKeyValue("order_id", orderId).log("order moved")` with SLF4J 2's fluent API. An exception goes last, as the throwable argument, not into the text.
Interpolated log message defeats structured logging broker/src/main/java/org/apache/rocketmq/broker/processor/AdminBrokerProcessor.java:449— `error` at line 449 is handed a message assembled at the call — a string concatenated with a value, or `String.format` — through SLF4J or log4j 2, so the logger receives one finished string: the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the level is filtered out. Pass a constant pattern and the values beside it instead: `log.error("Order {} moved to {}", orderId, status)`, which keeps the pattern and its arguments apart on the event for a structured encoder (logstash-logback-encoder, log4j 2's JsonTemplateLayout, OpenTelemetry), or `log.atInfo().addKeyValue("order_id", orderId).log("order moved")` with SLF4J 2's fluent API. An exception goes last, as the throwable argument, not into the text.
Interpolated log message defeats structured logging broker/src/main/java/org/apache/rocketmq/broker/processor/AdminBrokerProcessor.java:3140— `error` at line 3140 is handed a message assembled at the call — a string concatenated with a value, or `String.format` — through SLF4J or log4j 2, so the logger receives one finished string: the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the level is filtered out. Pass a constant pattern and the values beside it instead: `log.error("Order {} moved to {}", orderId, status)`, which keeps the pattern and its arguments apart on the event for a structured encoder (logstash-logback-encoder, log4j 2's JsonTemplateLayout, OpenTelemetry), or `log.atInfo().addKeyValue("order_id", orderId).log("order moved")` with SLF4J 2's fluent API. An exception goes last, as the throwable argument, not into the text.
Interpolated log message defeats structured logging broker/src/main/java/org/apache/rocketmq/broker/processor/AckMessageProcessor.java:392— `error` at line 392 is handed a message assembled at the call — a string concatenated with a value, or `String.format` — through SLF4J or log4j 2, so the logger receives one finished string: the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the level is filtered out. Pass a constant pattern and the values beside it instead: `log.error("Order {} moved to {}", orderId, status)`, which keeps the pattern and its arguments apart on the event for a structured encoder (logstash-logback-encoder, log4j 2's JsonTemplateLayout, OpenTelemetry), or `log.atInfo().addKeyValue("order_id", orderId).log("order moved")` with SLF4J 2's fluent API. An exception goes last, as the throwable argument, not into the text.
Interpolated log message defeats structured logging broker/src/main/java/org/apache/rocketmq/broker/subscription/SubscriptionGroupManager.java:382— `error` at line 382 is handed a message assembled at the call — a string concatenated with a value, or `String.format` — through SLF4J or log4j 2, so the logger receives one finished string: the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the level is filtered out. Pass a constant pattern and the values beside it instead: `log.error("Order {} moved to {}", orderId, status)`, which keeps the pattern and its arguments apart on the event for a structured encoder (logstash-logback-encoder, log4j 2's JsonTemplateLayout, OpenTelemetry), or `log.atInfo().addKeyValue("order_id", orderId).log("order moved")` with SLF4J 2's fluent API. An exception goes last, as the throwable argument, not into the text.
Duplicated predicate 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.
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.
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: 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: 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: Controller (16 abstract methods) controller/src/main/java/org/apache/rocketmq/controller/Controller.java:38— `Controller` declares 16 abstract methods: `alterSyncStateSet`, `applyBrokerId`, `cleanBrokerData`, `electMaster`, `getControllerMetadata`, `getNextBrokerId`, `getRemotingServer`, `getReplicaInfo`, `getSyncStateData`, `isLeaderState`, `registerBroker`, `registerBrokerLifecycleListener`, `shutdown`, `startScheduling`, `startup`, `stopScheduling`. Counted over its ABSTRACT methods, once per signature; `default`, `static` and `private` methods and constants are not counted, because no implementer is forced to write them. A wide interface forces every implementer and caller to depend on methods they don't use (the Interface-Segregation 'I' in SOLID). Split it into focused role-interfaces.
Fat interface: LitePullConsumer (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.
README/code drift README.md:29— README advertises Docker containerisation, but no Dockerfile/compose file exists — searched for: `dockerfile`, `docker-compose`, `compose.yaml`, `compose.yml`. Each was matched case- and separator-insensitively against file and directory NAMES anywhere in the tree, and against the CONTENTS of manifest and configuration files (package.json and other *.json, *.csproj, *.props, *.sln/*.slnx, *.yml, *.toml, *.config, tool configs such as eslint.config.js, Dockerfile); the README's own prose never counts, so a claim is never refuted by merely being made. Nothing outside that search was read — a footprint living only in a submodule, in a file type not listed here, or under a name none of those terms matches is not seen, and this row is then wrong.
README/code drift docs/proxy-admin-zh.md:13— docs/proxy-admin-zh.md names `apache/rocketmq/v2/admin.proto`, but no file or folder `apache/rocketmq/v2/admin.proto` exists. Checked without a model against the repository: its files and folders, the scripts and dependencies of every package.json, the projects, namespaces, package references and target frameworks of the .NET build, the SDK and Node pins, and the identifiers of every file that is not a document; the documents' own text never counts. A footprint generated at build time, read only by a platform, or living outside this repository is not seen, and this row is then wrong.
README/code drift docs/proxy-admin.md:19— docs/proxy-admin.md names `apache/rocketmq/v2/admin.proto`, but no file or folder `apache/rocketmq/v2/admin.proto` exists. Checked without a model against the repository: its files and folders, the scripts and dependencies of every package.json, the projects, namespaces, package references and target frameworks of the .NET build, the SDK and Node pins, and the identifiers of every file that is not a document; the documents' own text never counts. A footprint generated at build time, read only by a platform, or living outside this repository is not seen, and this row is then wrong.
README/code drift docs/cn/best_practice.md:373— docs/cn/best_practice.md links to `[](`, but `docs/cn/[](` does not exist. Checked without a model against the repository: its files and folders, the scripts and dependencies of every package.json, the projects, namespaces, package references and target frameworks of the .NET build, the SDK and Node pins, and the identifiers of every file that is not a document; the documents' own text never counts. A footprint generated at build time, read only by a platform, or living outside this repository is not seen, and this row is then wrong.
README/code drift docs/en/Configuration_Client.md:37— docs/en/Configuration_Client.md documents the environment variable `VIP_CHANNEL_ENABLED`, but no code, script or configuration file names it. Checked without a model against the repository: its files and folders, the scripts and dependencies of every package.json, the projects, namespaces, package references and target frameworks of the .NET build, the SDK and Node pins, and the identifiers of every file that is not a document; the documents' own text never counts. A footprint generated at build time, read only by a platform, or living outside this repository is not seen, and this row is then wrong.
README/code drift docs/en/Configuration_System.md:43— docs/en/Configuration_System.md names `os.sh`, but no file or folder `os.sh` exists. Checked without a model against the repository: its files and folders, the scripts and dependencies of every package.json, the projects, namespaces, package references and target frameworks of the .NET build, the SDK and Node pins, and the identifiers of every file that is not a document; the documents' own text never counts. A footprint generated at build time, read only by a platform, or living outside this repository is not seen, and this row is then wrong.
README/code drift docs/en/Native_RocksDB.md:144— docs/en/Native_RocksDB.md documents the environment variable `ROCKSDB_INCLUDE`, but no code, script or configuration file names it. Checked without a model against the repository: its files and folders, the scripts and dependencies of every package.json, the projects, namespaces, package references and target frameworks of the .NET build, the SDK and Node pins, and the identifiers of every file that is not a document; the documents' own text never counts. A footprint generated at build time, read only by a platform, or living outside this repository is not seen, and this row is then wrong.
Off-boarding risk: anonymized user #1 — If anonymized user #1 becomes unavailable, 10 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, tieredstore/src/main/java/org/apache/rocketmq/tieredstore/stream/CommitLogInputStream.java, store/src/main/java/org/apache/rocketmq/store/rocksdb/CqCompactionFilterJni.java, tieredstore/src/main/java/org/apache/rocketmq/tieredstore/MessageStoreExecutor.java (+2 more). Pair on, review, or document these before any departure.
Off-boarding risk: anonymized user #2 — If anonymized user #2 becomes unavailable, 8 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/BrokerConsumeStatsSubCommand.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 #3 — If anonymized user #3 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 #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.
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 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.
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.
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.
D16 · Bus Factor· Further sole-owners (lower concentration) · ×1
Further sole-owners (lower concentration) — 23 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 (63 single-owned of 842 analysed files in total, counted over production source files of roughly 2,400 bytes or more, excluding vendored, generated and example/demo 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 #6 (3 file(s)), 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)) (+17 more) — spread or document their files in the same way, at lower priority than the named off-boarding risks above. The files folded here: remoting/src/main/java/org/apache/rocketmq/remoting/Configuration.java, tools/src/main/java/org/apache/rocketmq/tools/command/auth/CopyUsersSubCommand.java, auth/src/main/java/org/apache/rocketmq/auth/authorization/AuthorizationCompatibility.java, 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 (+22 more).
Documentation: no project overview README.md— The first paragraph under 'Apache RocketMQ' describes what the project does but gives no overview of the repository as a whole (installation, usage) for readers who do not yet know which directory they are reading. Add an overview section at the top summarizing each README's purpose and where to find it.
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` (40591 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 — 475 of 864 significant files have no living knowledge, while the repository is still being changed at a low rate (79 commit(s) in the last 90 days) — so this is one repo-wide knowledge-decay state, not 475 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.
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.
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.
P10 · Library API & versioning· Large public API surface · ×1
Large public API surface — 1594/1925 types (83%) declared in the published library are public. For a library, every public type is a stability contract — keep implementation types off the surface and expose only the intended API.
Logging is not universal — Only 13/14 runnable modules use logging (modules with no entry point or server are excluded — they are libraries a runnable module hosts). Silent: `.`.
No changelog — No CHANGELOG/HISTORY/RELEASES file — what shipped when isn't easy to reconstruct for support or audit. (Versioning/tagging makes releases traceable, but a changelog records the what.)
Benchmarks don't track allocations namesrv/src/test/java/org/apache/rocketmq/namesrv/routeinfo/RegisterBrokerBenchmark.java— A JMH/Jetpack Benchmark suite exists but nothing turns on its allocation measurement — allocations (the main way hot code pressures a garbage collector or allocator) aren't being measured.
X5 · Nullable reference types· Java packages are not null-marked everywhere · ×1
Java packages are not null-marked everywhere — 0/276 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 01a16c6e-b3ca-7063-b2ff-cd6275861fbb · every finding is also locatable in findings.md, and the complete scoring record (with exit codes + durations) in sidecar.json.
Issues: 73 · Warnings: 1891 · Recommendations: 591 · Info: 50 — Appendix A · all findings · full markdown report.
Generated by Watchdog — deterministic code-health analysis. 24-10-2026 @ 05:42 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.