From b1edb7048687c2822b4fa006ddeb5e2cc2a038f9 Mon Sep 17 00:00:00 2001 From: Marcono1234 Date: Sat, 19 Sep 2020 13:30:50 +0200 Subject: [PATCH] Improve incorrect JsonStreamParser doc --- .../java/com/google/gson/JsonStreamParser.java | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/gson/src/main/java/com/google/gson/JsonStreamParser.java b/gson/src/main/java/com/google/gson/JsonStreamParser.java index 1c0c9b9d6d..37075503cd 100644 --- a/gson/src/main/java/com/google/gson/JsonStreamParser.java +++ b/gson/src/main/java/com/google/gson/JsonStreamParser.java @@ -29,8 +29,9 @@ /** * A streaming parser that allows reading of multiple {@link JsonElement}s from the specified reader - * asynchronously. - * + * asynchronously. The JSON data is parsed in lenient mode, see also + * {@link JsonReader#setLenient(boolean)}. + * *

This class is conditionally thread-safe (see Item 70, Effective Java second edition). To * properly use this class across multiple threads, you will need to add some external * synchronization. For example: @@ -72,10 +73,12 @@ public JsonStreamParser(Reader reader) { } /** - * Returns the next available {@link JsonElement} on the reader. Null if none available. - * - * @return the next available {@link JsonElement} on the reader. Null if none available. - * @throws JsonParseException if the incoming stream is malformed JSON. + * Returns the next available {@link JsonElement} on the reader. Throws a + * {@link NoSuchElementException} if no element is available. + * + * @return the next available {@code JsonElement} on the reader. + * @throws JsonSyntaxException if the incoming stream is malformed JSON. + * @throws NoSuchElementException if no {@code JsonElement} is available. * @since 1.4 */ public JsonElement next() throws JsonParseException { @@ -97,6 +100,7 @@ public JsonElement next() throws JsonParseException { /** * Returns true if a {@link JsonElement} is available on the input for consumption * @return true if a {@link JsonElement} is available on the input, false otherwise + * @throws JsonSyntaxException if the incoming stream is malformed JSON. * @since 1.4 */ public boolean hasNext() {