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

A false negative about the rule ES_COMPARING_STRINGS_WITH_EQ #1764

Closed
Zustin opened this issue Oct 22, 2021 · 1 comment · Fixed by #1769
Closed

A false negative about the rule ES_COMPARING_STRINGS_WITH_EQ #1764

Zustin opened this issue Oct 22, 2021 · 1 comment · Fixed by #1769
Assignees
Labels

Comments

@Zustin
Copy link
Contributor

Zustin commented Oct 22, 2021

SpotBugs Version: 4.4.2
Rule: ES_COMPARING_STRINGS_WITH_EQ

Hi! I find a false negative about this rule. SpotBugs should have reported a warning at line 4.

Minimal Code Sample

public boolean func() {
    String s1 = "str1";
    final String s2 = "str2";
    return s1 == s2; // should report a warning here
}

Expected outcome:
SpotBugs should report a violation at line 4, but doesn't. This is a false-negative.

Running SpotBugs through: [CLI]

KengoTODA added a commit that referenced this issue Oct 23, 2021
@KengoTODA KengoTODA self-assigned this Oct 23, 2021
@KengoTODA KengoTODA added the bug label Oct 23, 2021
@KengoTODA
Copy link
Member

Thanks for your report, I could reproduce this false negative. I am going to fix it as #1769.

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

Successfully merging a pull request may close this issue.

2 participants