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, null,
context.getBootstrapContext().getReflectionManager() context.getBootstrapContext().getReflectionManager()
); );
final Value originalValue = prop.getValue(); if ( declaredProperty.isTypeResolved() ) {
if ( originalValue instanceof SimpleValue ) {
// Avoid copying when the property doesn't depend on a type variable // Avoid copying when the property doesn't depend on a type variable
if ( inferredData.getTypeName().equals( getTypeName( prop ) ) ) { propertyConsumer.accept( prop );
propertyConsumer.accept( prop ); return;
return;
}
} }
// If the property depends on a type variable, we have to copy it and the Value // If the property depends on a type variable, we have to copy it and the Value
final Property actualProperty = prop.copy(); final Property actualProperty = prop.copy();
@ -348,6 +345,7 @@ public class ClassPropertyHolder extends AbstractPropertyHolder {
// collection.setOwner( null ); // collection.setOwner( null );
collection.setRole( type.getName() + "." + prop.getName() ); 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 // 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( context.getMetadataCollector().addSecondPass(
new SecondPass() { new SecondPass() {
@Override @Override