Don't call setAccessible(true) on fields we won't be setting or getting.
Fixes bug 191.
This commit is contained in:
parent
8d5de3136c
commit
740d03ef0e
@ -108,13 +108,13 @@ public final class ReflectiveTypeAdapterFactory implements TypeAdapterFactory {
|
||||
Type declaredType = type.getType();
|
||||
while (raw != Object.class) {
|
||||
Field[] fields = raw.getDeclaredFields();
|
||||
AccessibleObject.setAccessible(fields, true);
|
||||
for (Field field : fields) {
|
||||
boolean serialize = excludeField(field, true);
|
||||
boolean deserialize = excludeField(field, false);
|
||||
if (!serialize && !deserialize) {
|
||||
continue;
|
||||
}
|
||||
field.setAccessible(true);
|
||||
Type fieldType = $Gson$Types.resolve(type.getType(), raw, field.getGenericType());
|
||||
BoundField boundField = createBoundField(context, field, getFieldName(field),
|
||||
TypeToken.get(fieldType), serialize, deserialize);
|
||||
|
Loading…
Reference in New Issue
Block a user