HHH-14499 Explicitly listing mapped classes which are @MappedSuperClass might break narrowing down of generics
This commit is contained in:
parent
394d6ab2d4
commit
9f22dafe17
|
@ -252,7 +252,7 @@ public class AnnotationMetadataSourceProcessorImpl implements MetadataSourceProc
|
||||||
}
|
}
|
||||||
|
|
||||||
private List<XClass> orderAndFillHierarchy(List<XClass> original) {
|
private List<XClass> orderAndFillHierarchy(List<XClass> original) {
|
||||||
List<XClass> copy = new ArrayList<XClass>( original );
|
List<XClass> copy = new ArrayList<>( original.size() );
|
||||||
insertMappedSuperclasses( original, copy );
|
insertMappedSuperclasses( original, copy );
|
||||||
|
|
||||||
// order the hierarchy
|
// order the hierarchy
|
||||||
|
@ -266,16 +266,28 @@ public class AnnotationMetadataSourceProcessorImpl implements MetadataSourceProc
|
||||||
}
|
}
|
||||||
|
|
||||||
private void insertMappedSuperclasses(List<XClass> original, List<XClass> copy) {
|
private void insertMappedSuperclasses(List<XClass> original, List<XClass> copy) {
|
||||||
|
final boolean debug = log.isDebugEnabled();
|
||||||
for ( XClass clazz : original ) {
|
for ( XClass clazz : original ) {
|
||||||
XClass superClass = clazz.getSuperclass();
|
if ( clazz.isAnnotationPresent( javax.persistence.MappedSuperclass.class ) ) {
|
||||||
while ( superClass != null
|
if ( debug ) {
|
||||||
&& !reflectionManager.equals( superClass, Object.class )
|
log.debugf(
|
||||||
&& !copy.contains( superClass ) ) {
|
"Skipping explicit MappedSuperclass %s, the class will be discovered analyzing the implementing class",
|
||||||
if ( superClass.isAnnotationPresent( Entity.class )
|
clazz
|
||||||
|| superClass.isAnnotationPresent( javax.persistence.MappedSuperclass.class ) ) {
|
);
|
||||||
copy.add( superClass );
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
copy.add( clazz );
|
||||||
|
XClass superClass = clazz.getSuperclass();
|
||||||
|
while ( superClass != null
|
||||||
|
&& !reflectionManager.equals( superClass, Object.class )
|
||||||
|
&& !copy.contains( superClass ) ) {
|
||||||
|
if ( superClass.isAnnotationPresent( Entity.class )
|
||||||
|
|| superClass.isAnnotationPresent( javax.persistence.MappedSuperclass.class ) ) {
|
||||||
|
copy.add( superClass );
|
||||||
|
}
|
||||||
|
superClass = superClass.getSuperclass();
|
||||||
}
|
}
|
||||||
superClass = superClass.getSuperclass();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue