kafka-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cmcc...@apache.org
Subject [kafka] branch trunk updated: KAFKA-9514; The protocol generator generated useless condition when a field is made nullable and flexible version is used (#8793)
Date Thu, 04 Jun 2020 00:07:08 GMT
This is an automated email from the ASF dual-hosted git repository.

cmccabe pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/kafka.git


The following commit(s) were added to refs/heads/trunk by this push:
     new 21362ad  KAFKA-9514; The protocol generator generated useless condition when a field
is made nullable and flexible version is used (#8793)
21362ad is described below

commit 21362ad7f7ec8f3cd5376f30288da4bf74ab4fd3
Author: David Jacot <djacot@confluent.io>
AuthorDate: Thu Jun 4 02:06:22 2020 +0200

    KAFKA-9514; The protocol generator generated useless condition when a field is made nullable
and flexible version is used (#8793)
    
    Reviewers: Colin P. McCabe <cmccabe@apache.org>
---
 .../main/java/org/apache/kafka/message/MessageDataGenerator.java    | 4 ++--
 gradle/spotbugs-exclude.xml                                         | 6 ------
 2 files changed, 2 insertions(+), 8 deletions(-)

diff --git a/generator/src/main/java/org/apache/kafka/message/MessageDataGenerator.java b/generator/src/main/java/org/apache/kafka/message/MessageDataGenerator.java
index 90c8bbe..2963bf0 100644
--- a/generator/src/main/java/org/apache/kafka/message/MessageDataGenerator.java
+++ b/generator/src/main/java/org/apache/kafka/message/MessageDataGenerator.java
@@ -1436,8 +1436,8 @@ public final class MessageDataGenerator {
             alwaysEmitBlockScope(type.isString()).
             ifNull(() -> {
                 VersionConditional.forVersions(nullableVersions, possibleVersions).
-                    ifMember(__ -> {
-                        VersionConditional.forVersions(fieldFlexibleVersions, possibleVersions).
+                    ifMember(presentVersions -> {
+                        VersionConditional.forVersions(fieldFlexibleVersions, presentVersions).
                             ifMember(___ -> {
                                 buffer.printf("_writable.writeUnsignedVarint(0);%n");
                             }).
diff --git a/gradle/spotbugs-exclude.xml b/gradle/spotbugs-exclude.xml
index 6e9a6c1..93ddf91 100644
--- a/gradle/spotbugs-exclude.xml
+++ b/gradle/spotbugs-exclude.xml
@@ -244,12 +244,6 @@ For a detailed description of spotbugs bug categories, see https://spotbugs.read
     </Match>
 
     <Match>
-        <!-- The code generator generates useless condition. Disable the check temporarily.
-->
-        <Class name="org.apache.kafka.common.message.JoinGroupResponseData"/>
-        <Bug pattern="UC_USELESS_CONDITION"/>
-    </Match>
-
-    <Match>
         <!-- Suppress warnings about ignoring the return value of await.
              This is done intentionally because we use other clues to determine
              if the wait was cut short. -->


Mime
View raw message