Repository navigation
THRIFT-4191: Drop constant presence flags from Java equals() - #4151
Open
slachiewicz wants to merge 1 commit into
Open
slachiewicz wants to merge 1 commit into
slachiewicz wants to merge 1 commit into
Conversation
Member
Code reviewFound 1 issue:
thrift/lib/java/src/test/java/org/apache/thrift/TestGeneratedEquals.java Lines 104 to 107 in 2e36924 🤖 Generated with Claude Code |
Client: java For fields that are neither optional nor nullable, the generated equals() declared this_present_x and that_present_x as constant true and guarded the comparison with them, which Coverity reports as DEADCODE. Such fields are now compared directly; optional and nullable fields keep the isset-based guard. Behavior is unchanged: ThriftTest.thrift and a mixed struct generate the same code except for the 45 collapsed blocks. TestGeneratedEquals covers equality semantics and fails on the old output. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
slachiewicz
force-pushed
the
THRIFT-4191
branch
from
November 13, 2026 17:26
2e36924 to
c056437
Compare
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Jira: THRIFT-4191
For fields that are neither optional nor nullable, the generated Java
equals()declaredthis_present_xandthat_present_xas constanttrueand guarded the comparison with them, which Coverity reports as dead code. Such fields are now compared directly; optional and nullable fields keep the isset-based guard.Verified: generated code for
ThriftTest.thriftand a mixed struct differs only in the 45 collapsed blocks; newTestGeneratedEqualsfails on the old output and passes on the new;spotlessCheckclean.