Merge pull request #354 from square/eric.20170925.checkreturnvalue

Add CheckReturnValue for toJson's string result.
This commit is contained in:
Jake Wharton
2017-09-25 14:45:48 -04:00
committed by GitHub

View File

@@ -20,6 +20,7 @@ import java.lang.annotation.Annotation;
import java.lang.reflect.Type;
import java.math.BigDecimal;
import java.util.Set;
import javax.annotation.CheckReturnValue;
import javax.annotation.Nullable;
import okio.Buffer;
import okio.BufferedSink;
@@ -46,7 +47,7 @@ public abstract class JsonAdapter<T> {
toJson(writer, value);
}
public final String toJson(@Nullable T value) {
public final @CheckReturnValue String toJson(@Nullable T value) {
Buffer buffer = new Buffer();
try {
toJson(buffer, value);