chia7712 commented on code in PR #18783:
URL: https://github.com/apache/kafka/pull/18783#discussion_r1940699726


##########
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:
   > In org.apache.kafka.server there is package-info.java, I think it is 
public api, thus we should not modify the toString method
   
   not really, the `pakcage-info.java` doesn't simply indicate "public" APIs. 
for example, this 
[package-info.java](https://github.com/apache/kafka/blob/ad031b99d312cdfe452965c841e22c1ab391956e/clients/src/main/java/org/apache/kafka/common/cache/package-info.java#L19)
 is used to announce this package is NOT public APIs.
   
   Although it's not a public API, I prefer to maintain the existing format due 
to its long-standing presence.
   
   
   



-- 
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]

Reply via email to