smjn commented on code in PR #19443: URL: https://github.com/apache/kafka/pull/19443#discussion_r2041964318
########## share-coordinator/src/main/java/org/apache/kafka/coordinator/share/ShareGroupOffset.java: ########## @@ -245,4 +246,15 @@ public String toString() { ", stateBatches=" + stateBatches + '}'; } + + public Builder builderSupplier() { + return new Builder() + .setSnapshotEpoch(snapshotEpoch) + .setStateEpoch(stateEpoch) + .setLeaderEpoch(leaderEpoch) + .setStartOffset(startOffset) + .setStateBatches(new ArrayList<>(stateBatches)) Review Comment: The idea was to prevent the caller from modifying the ShareGroupOffset pointed to by the `this`, while still being able to append additional batches to the resultant object. If we don't duplicate. The new SGO and the one pointed to by this will point to same internal statebatches list. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: jira-unsubscr...@kafka.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org