Moving AccessibleObject.setAccessible to where the fields are obtained by reflection.
This commit is contained in:
parent
0adf7f5e17
commit
4a58dc3e2a
@ -63,7 +63,6 @@ final class ReflectingFieldNavigator {
|
||||
private void navigateClassFields(Object obj, Type objType,
|
||||
Class<?> classInInheritanceHierarchyForObj, Visitor visitor) {
|
||||
Field[] fields = getFields(classInInheritanceHierarchyForObj);
|
||||
AccessibleObject.setAccessible(fields, true);
|
||||
for (Field f : fields) {
|
||||
FieldAttributes fieldAttributes = new FieldAttributes(classInInheritanceHierarchyForObj, f);
|
||||
if (exclusionStrategy.shouldSkipField(fieldAttributes)
|
||||
@ -87,6 +86,7 @@ final class ReflectingFieldNavigator {
|
||||
Field[] fields = fieldsCache.get(clazz);
|
||||
if (fields == null) {
|
||||
fields = clazz.getDeclaredFields();
|
||||
AccessibleObject.setAccessible(fields, true);
|
||||
fieldsCache.put(clazz, fields);
|
||||
}
|
||||
return fields;
|
||||
|
Loading…
Reference in New Issue
Block a user