Skip to content

Commit df16ea9

Browse files
cigalybeikov
authored andcommitted
HHH-18500 If superclass is null, class should not be enhanced, simply return empty collection
1 parent b25dc77 commit df16ea9

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

hibernate-core/src/main/java/org/hibernate/bytecode/enhance/internal/bytebuddy/PersistentAttributeTransformer.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,10 @@ private static Collection<AnnotatedFieldDescription> collectInheritPersistentFie
145145
}
146146
TypeDefinition managedCtSuperclass = managedCtClass.getSuperClass();
147147

148-
if ( enhancementContext.isEntityClass( managedCtSuperclass.asErasure() ) ) {
148+
// If managedCtSuperclass is null, managedCtClass can be either interface or module-info.
149+
// Interfaces are already filtered-out, and module-info does not have any fields to enhance
150+
// so we can safely return empty list.
151+
if ( managedCtSuperclass == null || enhancementContext.isEntityClass( managedCtSuperclass.asErasure() ) ) {
149152
return Collections.emptyList();
150153
}
151154
else if ( !enhancementContext.isMappedSuperclassClass( managedCtSuperclass.asErasure() ) ) {

0 commit comments

Comments
 (0)