From b9e81f93c1e32eb5568f306db317ea907813596e Mon Sep 17 00:00:00 2001 From: Joel Leitch Date: Mon, 1 Dec 2008 01:40:11 +0000 Subject: [PATCH] Fixed warnings and updated some JavaDoc. --- gson/src/main/java/com/google/gson/JsonNull.java | 11 +++++++++-- .../gson/functional/NullObjectAndFieldTest.java | 2 +- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/gson/src/main/java/com/google/gson/JsonNull.java b/gson/src/main/java/com/google/gson/JsonNull.java index 80293abb..e2e6a924 100755 --- a/gson/src/main/java/com/google/gson/JsonNull.java +++ b/gson/src/main/java/com/google/gson/JsonNull.java @@ -28,7 +28,7 @@ public final class JsonNull extends JsonElement { private static final JsonNull INSTANCE = new JsonNull(true); /** - * @deprecated use the creation method, {@link #createJsonNull()}, instead. + * @deprecated Instead, use the creation method, {@link #createJsonNull()}. */ @Deprecated public JsonNull() { @@ -59,7 +59,14 @@ public final class JsonNull extends JsonElement { public boolean equals(Object other) { return other instanceof JsonNull; } - + + /** + * Creation method used to return an instance of a {@link JsonNull}. To reduce the memory + * footprint, a single object has been created for this class; therefore the same instance is + * being returned for each invocation of this method. + * + * @return a instance of a {@link JsonNull} + */ public static JsonNull createJsonNull() { return INSTANCE; } diff --git a/gson/src/test/java/com/google/gson/functional/NullObjectAndFieldTest.java b/gson/src/test/java/com/google/gson/functional/NullObjectAndFieldTest.java index 945abeb5..c1981073 100755 --- a/gson/src/test/java/com/google/gson/functional/NullObjectAndFieldTest.java +++ b/gson/src/test/java/com/google/gson/functional/NullObjectAndFieldTest.java @@ -139,7 +139,7 @@ public class NullObjectAndFieldTest extends TestCase { public JsonElement serialize(ClassWithObjects src, Type typeOfSrc, JsonSerializationContext context) { JsonObject obj = new JsonObject(); - obj.add("bag", new JsonNull()); + obj.add("bag", JsonNull.createJsonNull()); return obj; } }