From df16ea9694fa556d778e371d9dd0ba8bdae496b3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C4=8Cedomir=20Igaly?= Date: Sun, 18 Aug 2024 11:18:06 +0200 Subject: [PATCH] HHH-18500 If superclass is null, class should not be enhanced, simply return empty collection --- .../internal/bytebuddy/PersistentAttributeTransformer.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/hibernate-core/src/main/java/org/hibernate/bytecode/enhance/internal/bytebuddy/PersistentAttributeTransformer.java b/hibernate-core/src/main/java/org/hibernate/bytecode/enhance/internal/bytebuddy/PersistentAttributeTransformer.java index 42b2b464d8..7109f4fc03 100644 --- a/hibernate-core/src/main/java/org/hibernate/bytecode/enhance/internal/bytebuddy/PersistentAttributeTransformer.java +++ b/hibernate-core/src/main/java/org/hibernate/bytecode/enhance/internal/bytebuddy/PersistentAttributeTransformer.java @@ -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() ) ) {