From 50b4e3f4b9fda3494c07221547eac505deb6f7eb Mon Sep 17 00:00:00 2001 From: Inderjeet Singh Date: Mon, 4 Apr 2011 23:00:19 +0000 Subject: [PATCH] Using getElement() instead of get() to get proper synchronization. --- .../com/google/gson/ReflectingFieldNavigator.java | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/gson/src/main/java/com/google/gson/ReflectingFieldNavigator.java b/gson/src/main/java/com/google/gson/ReflectingFieldNavigator.java index 55e71698..6d48c7a1 100644 --- a/gson/src/main/java/com/google/gson/ReflectingFieldNavigator.java +++ b/gson/src/main/java/com/google/gson/ReflectingFieldNavigator.java @@ -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> fieldsCache = + private static final Cache> fieldsCache = new LruCache>(500); private final ExclusionStrategy exclusionStrategy; @@ -73,7 +73,7 @@ final class ReflectingFieldNavigator { } private List getAllFields(Type type, Type declaredType) { - List fields = fieldsCache.get(type); + List fields = fieldsCache.getElement(type); if (fields == null) { fields = new ArrayList(); for (Class curr : getInheritanceHierarchy(type)) {