Version used: 6.7.3 (build 38370)
This seems to be a false-positive. Sonar wants a private constructor even though the private nested class Foo.Bar
cannot be instantiated from anywhere outside the parent Foo
class.
public class Foo {
private static final class Bar { // squid:1118 - Add a private constructor to hide the implicit public one.
// Uncomment constructor to resolve warning in Sonar, but then Intellij will warn with "Redundant no-arg constructor"
// private Bar() {
// // Should not be instantiated
// }
public static String bar1() {
return "bar1";
}
}
}