HHH-18151 Fix lazy loading with generics and inheritance

This commit is contained in:
Matej Pucihar 2024-05-24 18:21:35 +02:00 committed by Marco Belladelli
parent e0217c1d2d
commit d53f21a4b4
No known key found for this signature in database
GPG Key ID: DBD6E257ABE9EA3D
2 changed files with 4 additions and 4 deletions

View File

@ -350,7 +350,7 @@ final class BiDirectionalAssociationHandler implements Implementation {
Opcodes.INVOKEVIRTUAL,
entity.getInternalName(),
EnhancerConstants.PERSISTENT_FIELD_READER_PREFIX + field.getName(),
Type.getMethodDescriptor( Type.getType( field.getDescriptor() ) ),
Type.getMethodDescriptor( Type.getType( field.asDefined().getDescriptor() ) ),
false
);
}

View File

@ -261,7 +261,7 @@ final class PersistentAttributeTransformer implements AsmVisitorWrapper.ForDecla
builder = builder
.defineMethod(
EnhancerConstants.PERSISTENT_FIELD_READER_PREFIX + enhancedField.getName(),
enhancedField.getType().asErasure(),
enhancedField.asDefined().getType().asErasure(),
Visibility.PUBLIC
)
.intercept( fieldReader( enhancedField ) );
@ -373,10 +373,10 @@ final class PersistentAttributeTransformer implements AsmVisitorWrapper.ForDecla
Opcodes.INVOKESPECIAL,
managedCtClass.getSuperClass().asErasure().getInternalName(),
EnhancerConstants.PERSISTENT_FIELD_READER_PREFIX + persistentField.getName(),
Type.getMethodDescriptor( Type.getType( persistentField.getType().asErasure().getDescriptor() ) ),
Type.getMethodDescriptor( Type.getType( persistentField.asDefined().getType().asErasure().getDescriptor() ) ),
false
);
methodVisitor.visitInsn( Type.getType( persistentField.getType().asErasure().getDescriptor() ).getOpcode( Opcodes.IRETURN ) );
methodVisitor.visitInsn( Type.getType( persistentField.asDefined().getType().asErasure().getDescriptor() ).getOpcode( Opcodes.IRETURN ) );
return new Size( persistentField.getType().getStackSize().getSize(), instrumentedMethod.getStackSize() );
}
}