-
-
Notifications
You must be signed in to change notification settings - Fork 3.7k
Enhance plugin - Option to add @SuppressFBWarnings annotation #5668
-
Lombok has an option to add @SuppressFBWarnings to generated code via lombok.extern.findbugs.addSuppressFBWarnings
It would be really helpful if the hibernate gradle/maven enhance plugins would provide a similar option.
We're currently struggling with warnings related to hibernate generated code in our entities, in SpotBugs.
NP | Non-null field $_hibernate_attributeInterceptor is not initialized by new <entity>
NP | Non-null field $_hibernate_entityEntryHolder is not initialized by new <entity>
NP | Non-null field $_hibernate_nextManagedEntity is not initialized by new <entity>
NP | Non-null field $_hibernate_previousManagedEntity is not initialized by new <entity>
NP | Non-null field $_hibernate_tracker is not initialized by new <entity>
Beta Was this translation helpful? Give feedback.
All reactions
Replies: 2 comments 5 replies
-
Sure, sounds reasonable :) Will you try a patch?
Beta Was this translation helpful? Give feedback.
All reactions
-
Great, I'm not to familiar with code base, but I took a first stab at it.
main...NicklasWallgren:hibernate-orm:option-to-add-suppress-fb-warnings
Am I on the right track? 🙂
Beta Was this translation helpful? Give feedback.
All reactions
-
I think so, yes!
Beta Was this translation helpful? Give feedback.
All reactions
-
Great, thanks.
I opened a PR, #5790
Beta Was this translation helpful? Give feedback.
All reactions
-
It would also be nice to add the jakarta.annotation.Generated annotation, so that tools like Jacoco can exclude hibernate-generated fields and methods from coverage reports.
Beta Was this translation helpful? Give feedback.
All reactions
-
@Sanne How should we processed with this issue, should I update the PR?
Beta Was this translation helpful? Give feedback.
All reactions
-
We discussed this as a team and the consensus was that we are not really keen on the idea of adding support for particular annotations one-by-one. We believe this is a use case that can be generalized.
Let's discuss approaches for that here or on Zulip
Beta Was this translation helpful? Give feedback.