public class Foo {
private final UUID uuid;
public Foo(Bar bar) {
this(bar.getUuid());
}
public Foo(UUID uuid) {
this.uuid = uuid;
}
private static class Bar {
UUID getUuid() {
return UUID.randomUUID();
}
}
}
I’m unable to create a reproducible snippet (or upload exact code), but I get the same false positive for EProcessor(CustomObject init) constructor with code similar to this:
public abstract class CustomObject implements Serializable {
int key;
public CustomObject() {}
public CustomObject(int key) {this.key = key;}
public int getKey() {return key;}
}
public class CustomDocument extends CustomObject {
public CustomDocument() { super(); }
public CustomDocument(int key) {super(key);}
}
public abstract class AbstractProcessor {
public AbstractProcessor(int key){}
}
public class EProcessor extends AbstractProcessor {
public EProcessor(CustomObject init) {
this((CustomDocument) init);
}
public EProcessor(CustomDocument init) {
super(init.getKey());
}
}
I also tried to analyze the project on the SonarQube 9.9 LTS, and still could not reproduce the issue. Could you please share what build system you are using and how to modify the example project so that the FP appears?
Sorry I was not clear. What I meant was that if you could configure the project correctly, e.g. make the gradle files point to public repositories, etc… it would be much easier for us to provide feedback.