org.sonar.l10n.java.rules.squid.S2974.html Maven / Gradle / Ivy
Classes with only private
constructors should be marked final
to prevent any mistaken extension attempts.
Noncompliant Code Example
public class PrivateConstructorClass { // Noncompliant
private PrivateConstructorClass() {
// ...
}
public static int magic(){
return 42;
}
}
Compliant Solution
public final class PrivateConstructorClass { // Compliant
private PrivateConstructorClass() {
// ...
}
public static int magic(){
return 42;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy