Add a field annotation when looking for FS_BAD_DATE_FORMAT_FLAG_COMBO#3868
Merged
gtoison merged 6 commits intospotbugs:masterfrom Jan 15, 2026
Merged
Add a field annotation when looking for FS_BAD_DATE_FORMAT_FLAG_COMBO#3868gtoison merged 6 commits intospotbugs:masterfrom
FS_BAD_DATE_FORMAT_FLAG_COMBO#3868gtoison merged 6 commits intospotbugs:masterfrom
Conversation
Keep track of the PC (and next PC) where DateFormatStringChecker detects bugs, when a field is initialized on the next PC add a field annotation to the bug instance.
ThrawnCA
approved these changes
Jan 12, 2026
JuditKnoll
reviewed
Jan 12, 2026
spotbugs-tests/src/test/java/edu/umd/cs/findbugs/detect/Issue3838Test.java
Outdated
Show resolved
Hide resolved
JuditKnoll
approved these changes
Jan 14, 2026
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.
When declaring and initialising a field at the same time the
FS_BAD_DATE_FORMAT_FLAG_COMBObug instances found are not associated with the field.This is because the problematic code is in the
<init>method, not on the field itself.This PR adds a class keeping track of the bug instances according to the PC (and next PC) where they were detected.
When the field is assigned we check if a bug instance was found on the previous PC.
In that case we add a field annotation.
Now that the bug has a field annotation, it is suppressed by field level annotation.