apoorvmittal10 commented on code in PR #19581: URL: https://github.com/apache/kafka/pull/19581#discussion_r2076108970
########## clients/src/main/java/org/apache/kafka/common/record/MemoryRecords.java: ########## @@ -312,7 +312,7 @@ public ByteBuffer buffer() { * @return A sliced buffer on this message set limited based on the given position and size */ @Override - public MemoryRecords slice(int position, int size) { + public Records slice(int position, int size) { Review Comment: Thanks for the suggestion @junrao . @AndrewJSchofield did also referenced same [approach](https://github.com/apache/kafka/blob/2df14b1190601955c01d4d74318093087601faa0/clients/src/main/java/org/apache/kafka/clients/admin/AbstractOptions.java#L25) in our discussion, but the issue I told him was that now where ever `Records` will be used then we have to specify the `type` else compilation will fail because of `warning: [rawtypes] usage` or we need to suppress warnings at all the places. Second option is currently in the PR, change the code to with minimal casting. Third was the original, where I returned specific types from implementing classes. And Records just have Records as return type on slice API. Fourth can be which I didn't implement is to not define `slice` API in `Records.java` and where slice API is needed and type is of `Records` then cast to the specific Records implementation type and use the `slice` API. -- 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