Thomas Mogwitz (
https://hibernate.atlassian.net/secure/ViewProfile.jspa?accountId=6319ba4...
) *commented* on HHH-15602 (
https://hibernate.atlassian.net/browse/HHH-15602?atlOrigin=eyJpIjoiOGZiZj...
)
Re: ByteBuddy enhancement generates faulty code with many-to-many associations (
https://hibernate.atlassian.net/browse/HHH-15602?atlOrigin=eyJpIjoiOGZiZj...
)
I’m not trying anything in particular. I’m using Hibernate bytecode enhancement with
<enableAssociationManagement>true</enableAssociationManagement>.
And I’m using SpotBugs to keep the code clean. SpotBugs’s specialty is that it scans class
files (ie the bytecode) instead of the sources. So as I said, SpotBugs reported an error
in the code generated by Hibernate. (see bug description)
As you probably know this code is generated from templates residing in
org.hibernate.bytecode.enhance.internal.bytebuddy.CodeTemplates. If you take a closer look
at the code, you can see the line this faulty generated code stems from, and you can see
that it makes no sense (see bug description - line 21 - marked with a comment)
Since we have a clean code policy I tried to fix this by having a modified copy of
CodeTemplate.class in one of our jars, which in turn is used as a dependency to
hibernate-enhance-maven-plugin, so the modified CodeTemplate.class is in the class path
before the original class from Hibernate. But this hack is not beautiful and needs to
reviewed every time the Hibernate version changes, so I’d like you to fix this bug.
I don’t see why you need a reproducer, just look at the code.
(
https://hibernate.atlassian.net/browse/HHH-15602#add-comment?atlOrigin=ey...
) Add Comment (
https://hibernate.atlassian.net/browse/HHH-15602#add-comment?atlOrigin=ey...
)
Get Jira notifications on your phone! Download the Jira Cloud app for Android (
https://play.google.com/store/apps/details?id=com.atlassian.android.jira....
) or iOS (
https://itunes.apple.com/app/apple-store/id1006972087?pt=696495&ct=Em...
) This message was sent by Atlassian Jira (v1001.0.0-SNAPSHOT#100221- sha1:5609d8c )