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>
This commit is contained in:
David Jacot 2020-06-04 02:06:22 +02:00 committed by GitHub
parent 3af3ab9bf9
commit 21362ad7f7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 8 deletions

View File

@ -1436,8 +1436,8 @@ public final class MessageDataGenerator {
alwaysEmitBlockScope(type.isString()). alwaysEmitBlockScope(type.isString()).
ifNull(() -> { ifNull(() -> {
VersionConditional.forVersions(nullableVersions, possibleVersions). VersionConditional.forVersions(nullableVersions, possibleVersions).
ifMember(__ -> { ifMember(presentVersions -> {
VersionConditional.forVersions(fieldFlexibleVersions, possibleVersions). VersionConditional.forVersions(fieldFlexibleVersions, presentVersions).
ifMember(___ -> { ifMember(___ -> {
buffer.printf("_writable.writeUnsignedVarint(0);%n"); buffer.printf("_writable.writeUnsignedVarint(0);%n");
}). }).

View File

@ -243,12 +243,6 @@ For a detailed description of spotbugs bug categories, see https://spotbugs.read
<Bug pattern="MS_MUTABLE_ARRAY"/> <Bug pattern="MS_MUTABLE_ARRAY"/>
</Match> </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> <Match>
<!-- Suppress warnings about ignoring the return value of await. <!-- Suppress warnings about ignoring the return value of await.
This is done intentionally because we use other clues to determine This is done intentionally because we use other clues to determine