Hibernate's bytecode enhancement DLS_DEAD_LOCAL_STORE false positives#2865
Conversation
The methods added by Hibernate's bytecode enhancement trigger DLS_DEAD_LOCAL_STORE false positives
| @Test | ||
| void testIssue(SpotBugsRunner spotbugs) { | ||
| BugCollection bugCollection = spotbugs.performAnalysis( | ||
| Paths.get("../spotbugsTestCases/src/classSamples/classEnhanceByHibernate/HibernateEnhancedEntity.class")); |
There was a problem hiding this comment.
When running this test, several classes are missing:
The following classes needed for analysis were missing:
org.hibernate.engine.spi.ManagedEntity
org.hibernate.engine.spi.ExtendedSelfDirtinessTracker
org.hibernate.bytecode.enhance.internal.tracker.SimpleFieldTracker
org.hibernate.bytecode.enhance.internal.tracker.SimpleCollectionTracker
org.hibernate.engine.spi.EntityEntry
org.hibernate.bytecode.enhance.internal.tracker.DirtyTracker
org.hibernate.bytecode.enhance.spi.interceptor.LazyAttributeLoadingInterceptor
org.hibernate.bytecode.enhance.spi.CollectionTracker
org.hibernate.collection.spi.PersistentCollection
I'm not sure, how much these classes are really needed, and what exactly causes when there are missing classes. The PR solves the referenced issue, so maybe it's not a big deal in this case.
There was a problem hiding this comment.
The classes references are from the bytecode added by Hibernate's enhancer.
I looked into adding Hibernate as a dependency and also adding the enhancer plugin to the build but that seems to be overkill, so I just compiled a class and copied it into the samples folder.
| return; | ||
| } | ||
|
|
||
| if (method.getName().startsWith("$$_hibernate_")) { |
There was a problem hiding this comment.
Might be worth ignoring other $$ methods?
There was a problem hiding this comment.
I thought about it by I think the underlying issue might very well be a bug in Hibernate's bytecode enhancer, to at least it seems to be producing suboptimal bytecode here.
In case other false positives are reported it will be easy to ignore more methods
|
Is it OK if I merge this PR? |
I don't see any reason not to merge it. |
|
Go for it
Sent from my Verizon, Samsung Galaxy smartphone
Get Outlook for Android<https://aka.ms/AAb9ysg>
…________________________________
From: Judit Knoll ***@***.***>
Sent: Wednesday, February 28, 2024 6:22:04 AM
To: spotbugs/spotbugs ***@***.***>
Cc: Jeremy Landis ***@***.***>; Mention ***@***.***>
Subject: Re: [spotbugs/spotbugs] Hibernate's bytecode enhancement DLS_DEAD_LOCAL_STORE false positives (PR #2865)
Is it OK if I merge this PR? There are a few outstanding PRs and its getting time consuming to merge the conflicts in the changelog Let me know if you think I could/should/shouldn't/musn't/can't merge my own PR once approved :)
I don't see any reason not to merge it.
Usually @hazendaz<https://github.com/hazendaz> or @iloveeclipse<https://github.com/iloveeclipse> merge the PRs, so if they could express their opinion it would be really useful.
—
Reply to this email directly, view it on GitHub<#2865 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/AAHODI2W6RGUAJQ5EWST3ELYV4HNZAVCNFSM6AAAAABDCXQW3SVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSNRYG43TEOJQGQ>.
You are receiving this because you were mentioned.Message ID: ***@***.***>
|
The methods added by Hibernate's bytecode enhancement trigger DLS_DEAD_LOCAL_STORE false positives
Fixes #2864