clolov commented on code in PR #18783:
URL: https://github.com/apache/kafka/pull/18783#discussion_r1939564760
##########
server-common/src/main/java/org/apache/kafka/server/common/TopicIdPartition.java:
##########
@@ -18,45 +18,15 @@
import org.apache.kafka.common.Uuid;
-import java.util.Objects;
-
/**
* Represents a partition using its unique topic Id and partition number.
+ * @param topicId Universally unique Id representing this topic partition.
+ * @param partitionId The partition Id.
*/
-public final class TopicIdPartition {
- private final Uuid topicId;
- private final int partitionId;
-
- public TopicIdPartition(Uuid topicId, int partitionId) {
- this.topicId = topicId;
- this.partitionId = partitionId;
- }
-
- /**
- * @return Universally unique Id representing this topic partition.
- */
- public Uuid topicId() {
- return topicId;
- }
-
- /**
- * @return The partition Id.
- */
- public int partitionId() {
- return partitionId;
- }
-
- @Override
- public boolean equals(Object o) {
- if (!(o instanceof TopicIdPartition other)) return false;
- return other.topicId.equals(topicId) && other.partitionId ==
partitionId;
- }
-
- @Override
- public int hashCode() {
- return Objects.hash(topicId, partitionId);
- }
-
+public record TopicIdPartition(
+ Uuid topicId,
+ int partitionId
+) {
@Override
public String toString() {
return topicId + ":" + partitionId;
Review Comment:
Maybe I am missing something obvious, but why can't you just change the
output of the test to adhere to the new format and use the new format?
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]