Given the following snipped
@AllArgsConstructor
@Data
public class LogAttributes implements Iterable<LogAttribute> {
@Getter(AccessLevel.NONE)
@NonNull
private final Collection<LogAttribute> items;
public LogAttributes(final LogAttribute... items) {
this(Arrays.asList(items));
}
...
I get “Add a way to break out of this recursive method.” blocker bug javabugs:S2190 for this(Arrays.asList(items));
In IntelliJ, the sonar plugin does not complain.
See delombok
public LogAttributes(final LogAttribute... items) {
this(Arrays.asList(items));
}
public LogAttributes(@NonNull Collection<LogAttribute> items) {
this.items = items;
}
which shows that one constructor is calling the other constructor.
Apart of that, lombok annotation seem to be respected correctly by Sonar.
If you may ask, yes, I have sonar.java.libraries=.gradle/caches/modules-2/files-2.1/**/*.jar
configured.
Any ideas how to deal with that?
Java 17, Gradle 8
SonarQube 9.9.4
Scanner CLI 5
IntelliJ SonarLint 10.6.1.78652
Colin
(Colin)
May 28, 2024, 6:00am
2
Hey there!
I’ve moved your post to the section on reporting false-positives.
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…
Can you please include the version of SonarLint for IntellIJ you’re using, and what specific rule ID is concerned here?
Thanks, I updated the initial post
Hey,
Thank you for your report. We’ve had issues with this rule producing false positives related to Lombok in the past and we shipped the fix in SQ 10.0. Seeing that you are using SQ 9.9 LTA, could you check with the latest SQ version and see if the issue has been resolved?
Hey Gyula, I dont have access to SQ 10.0 and I suppose our IT department will only update to LTA versions. Is backporting from 10 to 9.9 an option?
Hey @MahatmaFatalError ,
Unfortunately, we do not backport fixes for false positives, so you’ll have to wait until the next LTA version is released. In the meantime, you can either mark the issues as false positives in the SonarQube UI or disable the rule.
Gyula