hibernate-orm
hibernate-orm copied to clipboard
HHH-15846 Option to add @SuppressFBWarnings annotation on generated code
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>
Discussion on GitHub Enhance plugin - Option to add @SuppressFBWarnings annotation · Discussion #5668 · hibernate/hibernate-orm
Thanks for your pull request!
This pull request appears to follow the contribution rules.
› This message was automatically generated.
@gavinking Are you able to review this PR, or any of the other contributors? 🙂 Thanks
@gavinking Are you able to review this PR, or any of the other contributors? 🙂 Thanks
Hi, I don't know what @SuppressFBWarnings is, nor why you want this, and neither the JIRA issue nor the discussion explain it...
@gavinking Are you able to review this PR, or any of the other contributors? 🙂 Thanks
Hi, I don't know what
@SuppressFBWarningsis, nor why you want this, and neither the JIRA issue nor the discussion explain it...
Ah sorry, I got you mixed up with @Sanne.
The annotation is used to suppress any warnings found by FindBugs or SpotBugs.
@NicklasWallgren Can you rebase this on main? And I will take a look.
Also, the discussion mentioned @Generated but I do not see that handled here. Is that a different PR or just not added?
@NicklasWallgren Could you explain how an annotation you are adding into Hibernate here in this PR somehow affects those other libraries? How do FindBugs, etc know to look for this annotation?
Could we not just leverage java.lang.SuppressWarnings for this?