False positive: Records should be used instead of ordinary classes when representing immutable data structure (S6206)
SonarLint plugin for IntelliJ 6.4.3.42541 connected to SonarCloud.io project
A Java class cannot extend a record, as records are final classes. Sonar still reports that the superclass should be converted to a record.
minimal example:
public class A {
private final int i;
public A(final int i) {
this.i = i;
}
public int getI() {
return i;
}
}
public class B extends A {
public B(final int j) {
super(j);
}
}
SonarLint reports a major Code Smell about converting class A to a record, which would be valid if class B did not extend A.