You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jira@kafka.apache.org by "divijvaidya (via GitHub)" <gi...@apache.org> on 2023/09/22 16:00:12 UTC

[GitHub] [kafka] divijvaidya commented on a diff in pull request #14427: KAFKA-15485: Fix "this-escape" compiler warnings introduced by JDK 21 (1/N)

divijvaidya commented on code in PR #14427:
URL: https://github.com/apache/kafka/pull/14427#discussion_r1334524883


##########
storage/src/main/java/org/apache/kafka/storage/internals/log/TimeIndex.java:
##########
@@ -60,6 +60,7 @@ public TimeIndex(File file, long baseOffset, int maxIndexSize) throws IOExceptio
         this(file, baseOffset, maxIndexSize, true);
     }
 
+    @SuppressWarnings("this-escape")

Review Comment:
   I think this might be due to super class methods such as maxEntries(). We can make them final. AbstractIndex is not a public class [1]
   
   (same for other index files)
   
   [1] https://kafka.apache.org/36/javadoc/allclasses-index.html



##########
storage/src/main/java/org/apache/kafka/server/log/remote/metadata/storage/serialization/RemoteLogMetadataSerde.java:
##########
@@ -50,6 +50,7 @@ public class RemoteLogMetadataSerde {
     private final Map<Short, RemoteLogMetadataTransform> keyToTransform;
     private final BytesApiMessageSerde bytesApiMessageSerde;
 
+    @SuppressWarnings("this-escape")

Review Comment:
   the warning occurs probably because we call `newApiMessage` which is protected and might be overridden in a sub-class? If that is the case, could we make it final?



##########
storage/src/main/java/org/apache/kafka/storage/internals/log/LogConfig.java:
##########
@@ -343,7 +343,7 @@ public LogConfig(Map<?, ?> props) {
         this(props, Collections.emptySet());
     }
 
-    @SuppressWarnings("deprecation")
+    @SuppressWarnings({"deprecation", "this-escape"})

Review Comment:
   self note: this warning occurs due to methods such as getBoolean() from AbstractConfig, which is a public class and we can't add `final` to those methods.



##########
storage/src/main/java/org/apache/kafka/storage/internals/epoch/LeaderEpochFileCache.java:
##########
@@ -56,6 +56,7 @@ public class LeaderEpochFileCache {
      * @param topicPartition the associated topic partition
      * @param checkpoint     the checkpoint file
      */
+    @SuppressWarnings("this-escape")
     public LeaderEpochFileCache(TopicPartition topicPartition, LeaderEpochCheckpoint checkpoint) {

Review Comment:
   This is probably due to calling `this.assign()` which is a private method. The code works because it is the last line in the ctor but it's a legitimate warning. Should we create a ticket for fixing this correctly (and removing the warning)?



-- 
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-unsubscribe@kafka.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org