Skip to content

Extended annotation filtering#3364

Merged
hazendaz merged 2 commits intospotbugs:masterfrom
fenuks:annotation_filtering
Apr 15, 2025
Merged

Extended annotation filtering#3364
hazendaz merged 2 commits intospotbugs:masterfrom
fenuks:annotation_filtering

Conversation

@fenuks
Copy link
Copy Markdown
Contributor

@fenuks fenuks commented Mar 21, 2025

Pull request #2395 added option to filter out bugs based on annotation on class. This patch generalizes the feature to include annotations applied to methods and fields as well. It is particularly useful for generated code; e.g. lombok can be configured to apply @lombok.Generated to methods it generates.

Generalized annotation filtering can be used to fix issue #3350 with change to the lombok.config file:

+ lombok.addLombokGeneratedAnnotation = true
- lombok.extern.findbugs.addSuppressFBWarnings = true

and <Annotation name="lombok.Generated" /> addition to the spotbugsExclude.xml.

Make sure these boxes are checked before submitting your PR -- thank you!

  • Added an entry into CHANGELOG.md if you have changed SpotBugs code

@fenuks fenuks force-pushed the annotation_filtering branch 2 times, most recently from a4e79b2 to 371dd17 Compare March 25, 2025 15:11
@fenuks
Copy link
Copy Markdown
Contributor Author

fenuks commented Mar 28, 2025

@JuditKnoll Can you please take another look at the updated patch?

@fenuks fenuks force-pushed the annotation_filtering branch from 371dd17 to fb36014 Compare March 31, 2025 14:40
Pull request spotbugs#2395 added option
to filter out bugs based on annotation on class. This patch generalizes
the feature to include annotations applied to methods and fields as well.
It is particularly useful for generated code; e.g. lombok can be
configured to apply `@lombok.Generated` to methods it generates.

Generalized annotation filtering can be used to fix issue
spotbugs#3350 with change to the
`lombok.config` file:

```diff
+ lombok.addLombokGeneratedAnnotation = true
- lombok.extern.findbugs.addSuppressFBWarnings = true
```

and `<Annotation name="lombok.Generated" />` addition to the
`spotbugsExclude.xml`.
@fenuks fenuks force-pushed the annotation_filtering branch from fb36014 to ad20f67 Compare April 1, 2025 10:27
@fenuks
Copy link
Copy Markdown
Contributor Author

fenuks commented Apr 3, 2025

Is there anything left to be done before it can be merged?

@hazendaz
Copy link
Copy Markdown
Member

Is there anything left to be done before it can be merged?

I fixed merged conflict on change log, rebuilding now. If all builds ok will merge. I'm thinking we probably release this coming weekend.

@hazendaz hazendaz merged commit 3bd4394 into spotbugs:master Apr 15, 2025
15 checks passed
@fenuks
Copy link
Copy Markdown
Contributor Author

fenuks commented Apr 15, 2025

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants