HHH-12199 - Ignore static fields when resolving property types via reflection.
This commit is contained in:
parent
b44001c644
commit
1d94549394
|
@ -396,13 +396,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