klitos
(Klitos Kyriacou)
1
Please provide
- Operating system: Ubuntu
- SonarLint plugin version: 7.3.0.59206
- Programming language you’re coding in: Java
- Is connected mode used: No
And a thorough description of the problem / question:
The following code produces a false positive:
public static void main(String[] args) {
if (args.length > 3) {
foo(true);
}
foo(false);
}
SonarLint reports issue java:S1126
“Replace this if-then-else statement by a single method invocation”.
This should not be issued because this is not an if-then-else statement and cannot be replaced by a single method invocation.
1 Like
ganncamp
(G Ann Campbell)
2
Hi,
Welcome to the community!
Could you upgrade to the latest SonarLint version (7.4.0.60471) and see if this is still replicable, please?
Thx!
Ann
klitos
(Klitos Kyriacou)
3
Hi Ann,
Yes, I’ve just upgraded to the latest version (7.4.0.60471) and the issue still exists.
Regards,
Klitos
ganncamp
(G Ann Campbell)
8
Hi Klitos,
Thanks for testing. I’ll flag this for the developers.
Ann
chrislain
(Chrislain Razafimahefa)
11
Hello @klitos ,
There is indeed an issue. Thank you for reporting!
I have created a ticket about it.
Best,
Chrislain
1 Like