[HHH-16122] Fix determining the type of a property during type variable resolving for mapped superclasses

This commit is contained in:
Christian Beikov 2023-02-07 13:43:41 +01:00
parent a7448bb15a
commit 2271e18ba5
2 changed files with 7 additions and 2 deletions

View File

@ -269,7 +269,7 @@ public class ClassPropertyHolder extends AbstractPropertyHolder {
final Value originalValue = prop.getValue();
if ( originalValue instanceof SimpleValue ) {
// Avoid copying when the property doesn't depend on a type variable
if ( inferredData.getTypeName().equals( getTypeName( originalValue ) ) ) {
if ( inferredData.getTypeName().equals( getTypeName( prop ) ) ) {
superclass.addDeclaredProperty( prop );
return;
}
@ -329,6 +329,11 @@ public class ClassPropertyHolder extends AbstractPropertyHolder {
}
}
static String getTypeName(Property property) {
final String typeName = getTypeName( property.getValue() );
return typeName != null ? typeName : property.getReturnedClassName();
}
static String getTypeName(Value value) {
if ( value instanceof Component ) {
final Component component = (Component) value;

View File

@ -365,7 +365,7 @@ public class PropertyBinder {
final Value originalValue = prop.getValue();
if ( originalValue instanceof SimpleValue ) {
// Avoid copying when the property doesn't depend on a type variable
if ( inferredData.getTypeName().equals( ClassPropertyHolder.getTypeName( originalValue ) ) ) {
if ( inferredData.getTypeName().equals( ClassPropertyHolder.getTypeName( prop ) ) ) {
superclass.setDeclaredIdentifierProperty( prop );
return;
}