HHH-12199 - Ignore static fields when resolving property types via reflection.
(cherry picked from commit 1d94549
)
This commit is contained in:
parent
ceb45b109e
commit
dd450145c0
|
@ -386,13 +386,21 @@ public final class ReflectHelper {
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
return clazz.getDeclaredField( propertyName );
|
Field field = clazz.getDeclaredField( propertyName );
|
||||||
|
if ( !isStaticField( field ) ) {
|
||||||
|
return field;
|
||||||
|
}
|
||||||
|
return locateField( clazz.getSuperclass(), propertyName );
|
||||||
}
|
}
|
||||||
catch ( NoSuchFieldException nsfe ) {
|
catch ( NoSuchFieldException nsfe ) {
|
||||||
return locateField( clazz.getSuperclass(), propertyName );
|
return locateField( clazz.getSuperclass(), propertyName );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static boolean isStaticField(Field field) {
|
||||||
|
return field != null && ( field.getModifiers() & Modifier.STATIC ) == Modifier.STATIC;
|
||||||
|
}
|
||||||
|
|
||||||
public static Method findGetterMethod(Class containerClass, String propertyName) {
|
public static Method findGetterMethod(Class containerClass, String propertyName) {
|
||||||
Class checkClass = containerClass;
|
Class checkClass = containerClass;
|
||||||
Method getter = null;
|
Method getter = null;
|
||||||
|
|
Loading…
Reference in New Issue