HHH-17916 Check type is resolved before building generic property

This commit is contained in:
Marco Belladelli 2024-04-04 15:46:57 +02:00
parent f220abd1ca
commit d8e0ecfbf8
1 changed files with 4 additions and 6 deletions

View File

@ -326,13 +326,10 @@ public class ClassPropertyHolder extends AbstractPropertyHolder {
null,
context.getBootstrapContext().getReflectionManager()
);
final Value originalValue = prop.getValue();
if ( originalValue instanceof SimpleValue ) {
if ( declaredProperty.isTypeResolved() ) {
// Avoid copying when the property doesn't depend on a type variable
if ( inferredData.getTypeName().equals( getTypeName( prop ) ) ) {
propertyConsumer.accept( prop );
return;
}
propertyConsumer.accept( prop );
return;
}
// If the property depends on a type variable, we have to copy it and the Value
final Property actualProperty = prop.copy();
@ -348,6 +345,7 @@ public class ClassPropertyHolder extends AbstractPropertyHolder {
// collection.setOwner( null );
collection.setRole( type.getName() + "." + prop.getName() );
// To copy the element and key values, we need to defer setting the type name until the CollectionBinder ran
final Value originalValue = prop.getValue();
context.getMetadataCollector().addSecondPass(
new SecondPass() {
@Override