org.openrewrite.staticanalysis.FinalClass works on wrong assumptions. A non-final class with no public constructor can have nested static sub classes, and in that case it cannot be made final.
What is the smallest, simplest way to reproduce the problem?
public class Reproducer {
private Reproducer(final String name) {
//...
}
public static final class Sub extends Reproducer {
public Sub() {
super("subclass");
}
}
}
What did you expect to see?
no change
What did you see instead?
final added to the top level class
Maybe. Have to look for how to get the information that there are nested sub classes.