dandoy
(Kevin Dandoy)
January 9, 2025, 3:52pm
1
Operating system: Windows
SonarQube for Eclipse plugin version: 10.11
Programming language you’re coding in: Java
Is connected mode used: No
The following code generates the warning. I think it should NOT since by definition the class is ‘final’ and the warning is not issued on final classes as appropraite.
new Thread("name")
{
{
setDaemon(true);
start();
}
}
@Override public void run() { }
Colin
(Colin)
January 9, 2025, 7:56pm
2
Hey @dandoy !
Thanks for the report. Can you provide a more complete code sample that reproduces the issue? Preferably a single file that includes the class definition.
Hey SonarSource Community!
False-positives happen , as do false-negatives, and we’re eager to fix them. We are thrilled when our users report problems, so we can make our products better.
What is a false-positive (FP)?
A false-positive is when an issue is raised unexpectedly on code that should not trigger an issue, or where the suggested action doesn’t make any sense for the code.
What is a false-negative (FN)?
A false-negative is when an issue should be raised on a piece of code, but isn’t.
…
dandoy
(Kevin Dandoy)
January 9, 2025, 8:16pm
3
package kevin;
public class FPTest {
public static void main(String[] args)
{
new Thread("name")
{
{
setDaemon(true);
start();
}
@Override public void run() { return;}
};
}
}
Hello @dandoy , thanks for reporting this issue.
I’m checking it myself, and I don’t get the rule S2693 triggered for that code, but I get S1171.
I’m using IntelliJ, SonarQube plugin 10.13
Could you please recheck and send a screenshot ?
dandoy
(Kevin Dandoy)
January 10, 2025, 10:53am
7
My Company currently blocking sending/uploading screen capture. Here is the text from Sonar in my Eclipse IDE.
Description Resource Path Location Type
Move this “start” call to another method. FPTest.java /zKevin/src/kevin line 10 SonarLint Report Issue
By the way S1171 (we disabled) is also a FP when in an anonymous class since it cannot have a constructor.
Now I found that S2693 comes disabled by default. Now I get the same issue as you.
I’m investigating and I will come back with my findings.
Thanks for your patience.
dandoy
(Kevin Dandoy)
January 10, 2025, 7:51pm
9
Might as well get S1171 fixed also since it is generating a FP as you have shown, It should not give a positive on an anonymous class.
Sorry for the delay @dandoy , we’ve been in an offsite the whole last week.
I will keep you posted.