Using getElement() instead of get() to get proper synchronization.

This commit is contained in:
Inderjeet Singh 2011-04-04 23:00:19 +00:00
parent 542a17c3bc
commit 50b4e3f4b9

View File

@ -15,16 +15,16 @@
*/
package com.google.gson;
import com.google.gson.ObjectNavigator.Visitor;
import com.google.gson.internal.$Types;
import com.google.gson.internal.$Preconditions;
import java.lang.reflect.AccessibleObject;
import java.lang.reflect.Field;
import java.lang.reflect.Type;
import java.util.ArrayList;
import java.util.List;
import com.google.gson.ObjectNavigator.Visitor;
import com.google.gson.internal.$Preconditions;
import com.google.gson.internal.$Types;
/**
* Visits each of the fields of the specified class using reflection
*
@ -34,7 +34,7 @@ import java.util.List;
*/
final class ReflectingFieldNavigator {
private static final LruCache<Type, List<FieldAttributes>> fieldsCache =
private static final Cache<Type, List<FieldAttributes>> fieldsCache =
new LruCache<Type, List<FieldAttributes>>(500);
private final ExclusionStrategy exclusionStrategy;
@ -73,7 +73,7 @@ final class ReflectingFieldNavigator {
}
private List<FieldAttributes> getAllFields(Type type, Type declaredType) {
List<FieldAttributes> fields = fieldsCache.get(type);
List<FieldAttributes> fields = fieldsCache.getElement(type);
if (fields == null) {
fields = new ArrayList<FieldAttributes>();
for (Class<?> curr : getInheritanceHierarchy(type)) {