Skip to content

Commit

Permalink
adjusted factory finding code to take into account non-present factories
Browse files Browse the repository at this point in the history
  • Loading branch information
inder123 committed Nov 10, 2014
1 parent 7f8f490 commit f2591b6
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions gson/src/main/java/com/google/gson/Gson.java
Original file line number Diff line number Diff line change
Expand Up @@ -420,6 +420,10 @@ public <T> TypeAdapter<T> getAdapter(TypeToken<T> type) {
*/
public <T> TypeAdapter<T> getDelegateAdapter(TypeAdapterFactory skipPast, TypeToken<T> type) {
boolean skipPastFound = false;
// Skip past if and only if the specified factory is present in the factories.
// This is useful because the factories created through JsonAdapter annotations are not
// registered in this list.
if (!factories.contains(skipPast)) skipPastFound = true;

for (TypeAdapterFactory factory : factories) {
if (!skipPastFound) {
Expand Down

0 comments on commit f2591b6

Please sign in to comment.