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
parent 5af1856c4b
commit 92f83ea188
1 changed files with 4 additions and 1 deletions

View File

@ -148,7 +148,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() ) ) {