-
Notifications
You must be signed in to change notification settings - Fork 4.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add @CanIgnoreReturnValue
as appropriate to Gson methods.
#2369
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,6 +16,7 @@ | |
|
||
package com.google.gson; | ||
|
||
import com.google.errorprone.annotations.CanIgnoreReturnValue; | ||
import com.google.gson.internal.Streams; | ||
import com.google.gson.stream.JsonWriter; | ||
import java.io.IOException; | ||
|
@@ -143,6 +144,7 @@ public JsonPrimitive getAsJsonPrimitive() { | |
* @throws IllegalStateException if this element is of another type. | ||
* @since 1.2 | ||
*/ | ||
@CanIgnoreReturnValue | ||
public JsonNull getAsJsonNull() { | ||
Comment on lines
+147
to
148
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Maybe there should be a comment explaining this? E.g. @CanIgnoreReturnValue // For when this method is used only to verify that the value is JsonNull There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That's fair. I had to do the |
||
if (isJsonNull()) { | ||
return (JsonNull) this; | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,6 +15,7 @@ | |
*/ | ||
package com.google.gson; | ||
|
||
import com.google.errorprone.annotations.CanIgnoreReturnValue; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Unused? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Indeed. |
||
import com.google.gson.internal.Streams; | ||
import com.google.gson.stream.JsonReader; | ||
import com.google.gson.stream.JsonToken; | ||
|
@@ -33,7 +34,7 @@ | |
* <p>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: | ||
* | ||
* | ||
* <pre> | ||
* JsonStreamParser parser = new JsonStreamParser("['first'] {'second':10} 'third'"); | ||
* JsonElement element; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Might be good to add a comment here explaining this?