Skip to content

Small tweaks to fix Error Prone warnings. - #2227

Merged
eamonnmcmanus merged 2 commits into
google:masterfrom
eamonnmcmanus:errorprone
Oct 24, 2022
Merged

Small tweaks to fix Error Prone warnings.#2227
eamonnmcmanus merged 2 commits into
google:masterfrom
eamonnmcmanus:errorprone

Conversation

@eamonnmcmanus

Copy link
Copy Markdown
Member

No description provided.

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
switch (peeked) {
case NAME:
nextName(true);
String unused = nextName(true);

@Marcono1234 Marcono1234 Oct 25, 2022

Copy link
Copy Markdown
Contributor

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
Copy Markdown
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.

3 participants