From 0e02cbb33ec43b301b6835a99db020a2df3c6f51 Mon Sep 17 00:00:00 2001 From: Jesse Wilson Date: Fri, 14 Oct 2011 03:20:05 +0000 Subject: [PATCH] Nulls are here to stay. Sigh. --- gson/src/main/java/com/google/gson/Gson.java | 6 ++-- .../gson/internal/bind/ArrayTypeAdapter.java | 2 +- .../bind/CollectionTypeAdapterFactory.java | 2 +- .../internal/bind/MapTypeAdapterFactory.java | 2 +- .../bind/ReflectiveTypeAdapterFactory.java | 2 +- .../StringToValueMapTypeAdapterFactory.java | 2 +- .../gson/internal/bind/TypeAdapters.java | 34 +++++++++---------- 7 files changed, 25 insertions(+), 25 deletions(-) diff --git a/gson/src/main/java/com/google/gson/Gson.java b/gson/src/main/java/com/google/gson/Gson.java index 7aa38b34..267161d9 100644 --- a/gson/src/main/java/com/google/gson/Gson.java +++ b/gson/src/main/java/com/google/gson/Gson.java @@ -282,7 +282,7 @@ public final class Gson { return new TypeAdapter() { @Override public Double read(JsonReader reader) throws IOException { if (reader.peek() == JsonToken.NULL) { - reader.nextNull(); // TODO: does this belong here? + reader.nextNull(); return null; } return reader.nextDouble(); @@ -306,7 +306,7 @@ public final class Gson { return new TypeAdapter() { @Override public Float read(JsonReader reader) throws IOException { if (reader.peek() == JsonToken.NULL) { - reader.nextNull(); // TODO: does this belong here? + reader.nextNull(); return null; } return (float) reader.nextDouble(); @@ -338,7 +338,7 @@ public final class Gson { return new TypeAdapter() { @Override public Number read(JsonReader reader) throws IOException { if (reader.peek() == JsonToken.NULL) { - reader.nextNull(); // TODO: does this belong here? + reader.nextNull(); return null; } return reader.nextLong(); diff --git a/gson/src/main/java/com/google/gson/internal/bind/ArrayTypeAdapter.java b/gson/src/main/java/com/google/gson/internal/bind/ArrayTypeAdapter.java index a53ed2c3..7bf8b2c0 100644 --- a/gson/src/main/java/com/google/gson/internal/bind/ArrayTypeAdapter.java +++ b/gson/src/main/java/com/google/gson/internal/bind/ArrayTypeAdapter.java @@ -61,7 +61,7 @@ public final class ArrayTypeAdapter extends TypeAdapter { public Object read(JsonReader reader) throws IOException { if (reader.peek() == JsonToken.NULL) { - reader.nextNull(); // TODO: does this belong here? + reader.nextNull(); return null; } diff --git a/gson/src/main/java/com/google/gson/internal/bind/CollectionTypeAdapterFactory.java b/gson/src/main/java/com/google/gson/internal/bind/CollectionTypeAdapterFactory.java index 84871cf6..665dd8a2 100644 --- a/gson/src/main/java/com/google/gson/internal/bind/CollectionTypeAdapterFactory.java +++ b/gson/src/main/java/com/google/gson/internal/bind/CollectionTypeAdapterFactory.java @@ -68,7 +68,7 @@ public final class CollectionTypeAdapterFactory implements TypeAdapter.Factory { public Collection read(JsonReader reader) throws IOException { if (reader.peek() == JsonToken.NULL) { - reader.nextNull(); // TODO: does this belong here? + reader.nextNull(); return null; } diff --git a/gson/src/main/java/com/google/gson/internal/bind/MapTypeAdapterFactory.java b/gson/src/main/java/com/google/gson/internal/bind/MapTypeAdapterFactory.java index 29be2925..74ecb20c 100644 --- a/gson/src/main/java/com/google/gson/internal/bind/MapTypeAdapterFactory.java +++ b/gson/src/main/java/com/google/gson/internal/bind/MapTypeAdapterFactory.java @@ -147,7 +147,7 @@ public final class MapTypeAdapterFactory implements TypeAdapter.Factory { public Map read(JsonReader reader) throws IOException { JsonToken peek = reader.peek(); if (peek == JsonToken.NULL) { - reader.nextNull(); // TODO: does this belong here? + reader.nextNull(); return null; } diff --git a/gson/src/main/java/com/google/gson/internal/bind/ReflectiveTypeAdapterFactory.java b/gson/src/main/java/com/google/gson/internal/bind/ReflectiveTypeAdapterFactory.java index eaa4d98a..51d5aba9 100644 --- a/gson/src/main/java/com/google/gson/internal/bind/ReflectiveTypeAdapterFactory.java +++ b/gson/src/main/java/com/google/gson/internal/bind/ReflectiveTypeAdapterFactory.java @@ -150,7 +150,7 @@ public class ReflectiveTypeAdapterFactory implements TypeAdapter.Factory { @Override public T read(JsonReader reader) throws IOException { if (reader.peek() == JsonToken.NULL) { - reader.nextNull(); // TODO: does this belong here? + reader.nextNull(); return null; } diff --git a/gson/src/main/java/com/google/gson/internal/bind/StringToValueMapTypeAdapterFactory.java b/gson/src/main/java/com/google/gson/internal/bind/StringToValueMapTypeAdapterFactory.java index 02c4c143..f138c256 100644 --- a/gson/src/main/java/com/google/gson/internal/bind/StringToValueMapTypeAdapterFactory.java +++ b/gson/src/main/java/com/google/gson/internal/bind/StringToValueMapTypeAdapterFactory.java @@ -74,7 +74,7 @@ public final class StringToValueMapTypeAdapterFactory implements TypeAdapter.Fac public Map read(JsonReader reader) throws IOException { if (reader.peek() == JsonToken.NULL) { - reader.nextNull(); // TODO: does this belong here? + reader.nextNull(); return null; } diff --git a/gson/src/main/java/com/google/gson/internal/bind/TypeAdapters.java b/gson/src/main/java/com/google/gson/internal/bind/TypeAdapters.java index 50ce20fa..6ab72985 100644 --- a/gson/src/main/java/com/google/gson/internal/bind/TypeAdapters.java +++ b/gson/src/main/java/com/google/gson/internal/bind/TypeAdapters.java @@ -112,7 +112,7 @@ public final class TypeAdapters { @Override public Boolean read(JsonReader reader) throws IOException { if (reader.peek() == JsonToken.NULL) { - reader.nextNull(); // TODO: does this belong here? + reader.nextNull(); return null; } return reader.nextBoolean(); @@ -134,7 +134,7 @@ public final class TypeAdapters { @Override public Number read(JsonReader reader) throws IOException { if (reader.peek() == JsonToken.NULL) { - reader.nextNull(); // TODO: does this belong here? + reader.nextNull(); return null; } try { @@ -157,7 +157,7 @@ public final class TypeAdapters { @Override public Number read(JsonReader reader) throws IOException { if (reader.peek() == JsonToken.NULL) { - reader.nextNull(); // TODO: does this belong here? + reader.nextNull(); return null; } try { @@ -179,7 +179,7 @@ public final class TypeAdapters { @Override public Number read(JsonReader reader) throws IOException { if (reader.peek() == JsonToken.NULL) { - reader.nextNull(); // TODO: does this belong here? + reader.nextNull(); return null; } try { @@ -201,7 +201,7 @@ public final class TypeAdapters { @Override public Number read(JsonReader reader) throws IOException { if (reader.peek() == JsonToken.NULL) { - reader.nextNull(); // TODO: does this belong here? + reader.nextNull(); return null; } try { @@ -223,7 +223,7 @@ public final class TypeAdapters { @Override public Number read(JsonReader reader) throws IOException { if (reader.peek() == JsonToken.NULL) { - reader.nextNull(); // TODO: does this belong here? + reader.nextNull(); return null; } return (float) reader.nextDouble(); @@ -241,7 +241,7 @@ public final class TypeAdapters { @Override public Number read(JsonReader reader) throws IOException { if (reader.peek() == JsonToken.NULL) { - reader.nextNull(); // TODO: does this belong here? + reader.nextNull(); return null; } return reader.nextDouble(); @@ -261,7 +261,7 @@ public final class TypeAdapters { JsonToken jsonToken = reader.peek(); switch (jsonToken) { case NULL: - reader.nextNull(); // TODO: does this belong here? + reader.nextNull(); return null; case NUMBER: return new LazilyParsedNumber(reader.nextString()); @@ -281,7 +281,7 @@ public final class TypeAdapters { @Override public Character read(JsonReader reader) throws IOException { if (reader.peek() == JsonToken.NULL) { - reader.nextNull(); // TODO: does this belong here? + reader.nextNull(); return null; } return reader.nextString().charAt(0); @@ -300,7 +300,7 @@ public final class TypeAdapters { public String read(JsonReader reader) throws IOException { JsonToken peek = reader.peek(); if (peek == JsonToken.NULL) { - reader.nextNull(); // TODO: does this belong here? + reader.nextNull(); return null; } /* coerce booleans to strings for backwards compatibility */ @@ -321,7 +321,7 @@ public final class TypeAdapters { @Override public StringBuilder read(JsonReader reader) throws IOException { if (reader.peek() == JsonToken.NULL) { - reader.nextNull(); // TODO: does this belong here? + reader.nextNull(); return null; } return new StringBuilder(reader.nextString()); @@ -339,7 +339,7 @@ public final class TypeAdapters { @Override public StringBuffer read(JsonReader reader) throws IOException { if (reader.peek() == JsonToken.NULL) { - reader.nextNull(); // TODO: does this belong here? + reader.nextNull(); return null; } return new StringBuffer(reader.nextString()); @@ -357,7 +357,7 @@ public final class TypeAdapters { @Override public URL read(JsonReader reader) throws IOException { if (reader.peek() == JsonToken.NULL) { - reader.nextNull(); // TODO: does this belong here? + reader.nextNull(); return null; } String nextString = reader.nextString(); @@ -375,7 +375,7 @@ public final class TypeAdapters { @Override public URI read(JsonReader reader) throws IOException { if (reader.peek() == JsonToken.NULL) { - reader.nextNull(); // TODO: does this belong here? + reader.nextNull(); return null; } try { @@ -397,7 +397,7 @@ public final class TypeAdapters { @Override public InetAddress read(JsonReader reader) throws IOException { if (reader.peek() == JsonToken.NULL) { - reader.nextNull(); // TODO: does this belong here? + reader.nextNull(); return null; } return InetAddress.getByName(reader.nextString()); @@ -415,7 +415,7 @@ public final class TypeAdapters { @Override public UUID read(JsonReader reader) throws IOException { if (reader.peek() == JsonToken.NULL) { - reader.nextNull(); // TODO: does this belong here? + reader.nextNull(); return null; } return java.util.UUID.fromString(reader.nextString()); @@ -521,7 +521,7 @@ public final class TypeAdapters { @Override public Locale read(JsonReader reader) throws IOException { if (reader.peek() == JsonToken.NULL) { - reader.nextNull(); // TODO: does this belong here? + reader.nextNull(); return null; } String locale = reader.nextString();