Again, the recursion warning doesn’t show up in the IDE but does show up in SonarQube.
However, a potentially related false positive does show up in both IDE and SonarQube: BankCountry(BankCountrySettings settings) is flagged by java:S1144 as unused
Thank you for your report. We fixed some problems with this rule in the presence of Lombok recently, the fix should be available in SQ 10.0 and is already deployed on SonarCloud.
Regarding your second example: could you share a self-contained reproducer and information about your build environment? We are looking into problems with this rule when there is some missing semantic information in the Java file (according to our Java parser), but did not manage to pinpoint an exact cause yet. Any additional information would be much appreciated.
Sure. Looks like the issue is caused by accepting a class that is the result of a Lombok builder.
import lombok.Builder;
public enum EnumWithSupposedlyUnusedConstructor {
A("a"),
B(ClassWithLombokBuilder.builder()
.a("b")
.build()
),
;
String a;
EnumWithSupposedlyUnusedConstructor(String a) {
this(ClassWithLombokBuilder.builder()
.a(a)
.build()
);
}
// This constructor is marked as unused with java:S1144
EnumWithSupposedlyUnusedConstructor(ClassWithLombokBuilder c) {
a = c.a;
}
@Builder
public static class ClassWithLombokBuilder {
String a;
}
}