We're updating the issue view to help you get more done. 

Bytecode enhancement: MappedSuperclass with enabledDirtyTracking fails to enhance fields

Description

Hi there,
while using the bytecode enhancement task with enabledDirtyTracking, the script returns several compile errors, such as

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.hibernate.orm.tooling:hibernate-enhance-maven-plugin:5.3.0.Final:enhance (default) on project test-case-template-hibernate-orm5: Unable to enhance class: Mail.class at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:212) at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153) at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145) at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:116) at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:80) at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51) at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128) at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:307) at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:193) at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:106) at org.apache.maven.cli.MavenCli.execute(MavenCli.java:863) at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:288) at org.apache.maven.cli.MavenCli.main(MavenCli.java:199) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289) at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229) at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415) at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356) at org.codehaus.classworlds.Launcher.main(Launcher.java:47) Caused by: org.apache.maven.plugin.MojoExecutionException: Unable to enhance class: Mail.class at org.hibernate.orm.tooling.maven.MavenEnhancePlugin.doEnhancement(MavenEnhancePlugin.java:226) at org.hibernate.orm.tooling.maven.MavenEnhancePlugin.execute(MavenEnhancePlugin.java:151) at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134) at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:207) ... 21 more Caused by: org.hibernate.bytecode.enhance.spi.EnhancementException: Failed to enhance class com.genericsenhancement.Mail at org.hibernate.bytecode.enhance.internal.bytebuddy.EnhancerImpl.enhance(EnhancerImpl.java:117) at org.hibernate.orm.tooling.maven.MavenEnhancePlugin.doEnhancement(MavenEnhancePlugin.java:221) ... 24 more Caused by: java.lang.IllegalStateException: Cannot access private java.util.Set com.genericsenhancement.AbstractMail.to from class com.genericsenhancement.Mail at net.bytebuddy.asm.Advice$OffsetMapping$ForField$Resolved.resolve(Advice.java:2221) at net.bytebuddy.asm.Advice$OffsetMapping$ForField.resolve(Advice.java:2000) at net.bytebuddy.asm.Advice$Dispatcher$Inlining$Resolved$ForMethodExit.apply(Advice.java:6444) at net.bytebuddy.asm.Advice$Dispatcher$Inlining$Resolved$AdviceMethodInliner.visitMethod(Advice.java:6022) at net.bytebuddy.jar.asm.ClassReader.readMethod(ClassReader.java:1059) at net.bytebuddy.jar.asm.ClassReader.accept(ClassReader.java:628) at net.bytebuddy.jar.asm.ClassReader.accept(ClassReader.java:352) at net.bytebuddy.asm.Advice$Dispatcher$Inlining$Resolved$AdviceMethodInliner.doApply(Advice.java:6016) at net.bytebuddy.asm.Advice$Dispatcher$Inlining$Resolved$ForMethodExit$AdviceMethodInliner.apply(Advice.java:6533) at net.bytebuddy.asm.Advice$AdviceVisitor$WithExitAdvice.onUserEnd(Advice.java:8102) at net.bytebuddy.asm.Advice$AdviceVisitor.visitMaxs(Advice.java:7872) at net.bytebuddy.asm.Advice$Appender$EmulatingMethodVisitor.resolve(Advice.java:8412) at net.bytebuddy.asm.Advice$Appender.apply(Advice.java:8364) at net.bytebuddy.dynamic.scaffold.TypeWriter$MethodPool$Record$ForDefinedMethod$WithBody.applyCode(TypeWriter.java:620) at net.bytebuddy.dynamic.scaffold.TypeWriter$MethodPool$Record$ForDefinedMethod$WithBody.applyBody(TypeWriter.java:609) at net.bytebuddy.dynamic.scaffold.TypeWriter$MethodPool$Record$ForDefinedMethod.apply(TypeWriter.java:526) at net.bytebuddy.dynamic.scaffold.TypeWriter$Default$ForInlining$RedefinitionClassVisitor.visitEnd(TypeWriter.java:3865) at net.bytebuddy.jar.asm.ClassReader.accept(ClassReader.java:632) at net.bytebuddy.jar.asm.ClassReader.accept(ClassReader.java:352) at net.bytebuddy.dynamic.scaffold.TypeWriter$Default$ForInlining.create(TypeWriter.java:2941) at net.bytebuddy.dynamic.scaffold.TypeWriter$Default.make(TypeWriter.java:1633) at net.bytebuddy.dynamic.scaffold.inline.RedefinitionDynamicTypeBuilder.make(RedefinitionDynamicTypeBuilder.java:171) at net.bytebuddy.dynamic.scaffold.inline.AbstractInliningDynamicTypeBuilder.make(AbstractInliningDynamicTypeBuilder.java:92) at net.bytebuddy.dynamic.DynamicType$Builder$AbstractBase.make(DynamicType.java:2639) at net.bytebuddy.dynamic.DynamicType$Builder$AbstractBase$Delegator.make(DynamicType.java:2741) at org.hibernate.bytecode.enhance.internal.bytebuddy.EnhancerImpl.enhance(EnhancerImpl.java:113) ... 25 more

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 @MappedSuperclass @Cache(usage = CacheConcurrencyStrategy.NONE) public class AbstractMail { @Access(AccessType.PROPERTY) private Set<String> to = new LinkedHashSet<>(); @Id @GeneratedValue public int id; @ElementCollection public Set<String> getTo() { return to; } private void setTo(Set<String> to) { this.to = to; } } @Entity public class Mail extends AbstractMail { }

https://github.com/nikowitt/hibernate-test-case-templates/tree/HHH-12421

Environment

None

Status

Assignee

Gail Badner

Reporter

Niko Wittenbeck

Fix versions

None

Labels

None

backPortable

None

Suitable for new contributors

None

Requires Release Note

None

Pull Request

None

backportDecision

None

Components

Affects versions

5.2.15
5.3.0.Final

Priority

Major