HHH-18500 If superclass is null, class should not be enhanced, simply return empty collection

This commit is contained in:
Čedomir Igaly 2024-08-18 11:18:06 +02:00 committed by Christian Beikov
parent b25dc774ea
commit df16ea9694
1 changed files with 4 additions and 1 deletions

View File

@ -145,7 +145,10 @@ final class PersistentAttributeTransformer implements AsmVisitorWrapper.ForDecla
}
TypeDefinition managedCtSuperclass = managedCtClass.getSuperClass();
if ( enhancementContext.isEntityClass( managedCtSuperclass.asErasure() ) ) {
// If managedCtSuperclass is null, managedCtClass can be either interface or module-info.
// Interfaces are already filtered-out, and module-info does not have any fields to enhance
// so we can safely return empty list.
if ( managedCtSuperclass == null || enhancementContext.isEntityClass( managedCtSuperclass.asErasure() ) ) {
return Collections.emptyList();
}
else if ( !enhancementContext.isMappedSuperclassClass( managedCtSuperclass.asErasure() ) ) {