HHH-12199 - Ignore static fields when resolving property types via reflection.

This commit is contained in:
Chris Cranford 2018-04-27 16:08:36 -04:00
parent b44001c644
commit 1d94549394
1 changed files with 9 additions and 1 deletions

View File

@ -396,13 +396,21 @@ public final class ReflectHelper {
}
try {
return clazz.getDeclaredField( propertyName );
Field field = clazz.getDeclaredField( propertyName );
if ( !isStaticField( field ) ) {
return field;
}
return locateField( clazz.getSuperclass(), propertyName );
}
catch ( NoSuchFieldException nsfe ) {
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) {
Class checkClass = containerClass;
Method getter = null;