
org.sonar.l10n.squidjava.rules.squid.UnusedPrivateMethod.html Maven / Gradle / Ivy
Private methods that are never executed are dead code. Dead code
means unnecessary, inoperative code that should be removed. This helps
in maintenance by decreasing the maintained code size, making it easier
to understand the program and preventing bugs from being introduced.
In the following two cases, private methods are not considered as
dead code by SonarQube :
- Private empty constructors that are intentionally used to
prevent any direct instantiation of a class.
- Private methods : readObject(...), writeObject(...),
writeReplace(...), readResolve(...) which can contractually be used
when implementing the Serializable interface.
© 2015 - 2025 Weber Informatics LLC | Privacy Policy