HHH-17034 Bytecode enhancement leads to broken constructor for a generic embedded field in a twice removed MappedSuperclass

This commit is contained in:
Andrea Boriero 2023-08-07 16:32:04 +02:00 committed by Andrea Boriero
parent b32e0cdaf8
commit 3992ac354d
1 changed files with 4 additions and 4 deletions

View File

@ -608,20 +608,20 @@ class CodeTemplates {
static class GetterMapping implements Advice.OffsetMapping {
private final TypeDescription.Generic returnType;
private final String name;
private final FieldDescription persistentField;
GetterMapping(FieldDescription persistentField) {
this( persistentField, persistentField.getType() );
}
GetterMapping(FieldDescription persistentField, TypeDescription.Generic returnType) {
this.name = persistentField.getName();
this.persistentField = persistentField;
this.returnType = returnType;
}
@Override public Target resolve(TypeDescription instrumentedType, MethodDescription instrumentedMethod, Assigner assigner, Advice.ArgumentHandler argumentHandler, Sort sort) {
MethodDescription.Token signature = new MethodDescription.Token( EnhancerConstants.PERSISTENT_FIELD_READER_PREFIX + name , Opcodes.ACC_PUBLIC, returnType );
MethodDescription method = new MethodDescription.Latent( instrumentedType.getSuperClass().asErasure(), signature );
MethodDescription.Token signature = new MethodDescription.Token( EnhancerConstants.PERSISTENT_FIELD_READER_PREFIX + persistentField.getName() , Opcodes.ACC_PUBLIC, returnType );
MethodDescription method = new MethodDescription.Latent( persistentField.getDeclaringType().asErasure(), signature );
return new Target.AbstractReadOnlyAdapter() {
@Override