False positive recursive method with lombok

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

Hey there!

I’ve moved your post to the section on reporting false-positives.

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