Skip to content
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

Small tweaks to fix Error Prone warnings. #2227

Merged
merged 2 commits into from
Oct 24, 2022

Conversation

eamonnmcmanus
Copy link
Member

No description provided.

@@ -277,7 +277,7 @@
JsonToken peeked = peek();
switch (peeked) {
case NAME:
nextName(true);
String unused = nextName(true);

Check notice

Code scanning / CodeQL

Unread local variable

Variable 'String unused' is never read.
@eamonnmcmanus eamonnmcmanus merged commit 9578583 into google:master Oct 24, 2022
@eamonnmcmanus eamonnmcmanus deleted the errorprone branch October 24, 2022 17:28
@@ -277,7 +277,7 @@ JsonElement nextJsonElement() throws IOException {
JsonToken peeked = peek();
switch (peeked) {
case NAME:
nextName(true);
String unused = nextName(true);
Copy link
Collaborator

@Marcono1234 Marcono1234 Oct 25, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we add @SuppressWarnings("unused") to avoid (Eclipse) IDE warnings?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you send a PR for that, I will merge it. :-)
Error Prone doesn't warn about an unused variable if its name begins with unused.
Eventually I might want to add Error Prone's @CanIgnoreReturnValue to methods like this nextName, and then we wouldn't need to have this assignment. But that would mean introducing a dependency on Error Prone's annotations artifact.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants