Several utility classes in the codebase contain only static methods but lack both the final modifier and a private constructor to prevent instantiation and subclassing. This violates Java best practices for utility classes and could lead to misuse.
Add the final modifier to each utility class declaration and include a private constructor that throws UnsupportedOperationException to explicitly prevent instantiation. This follows the standard pattern recommended in "Effective Java" by Joshua Bloch.
Affected classes:
org.jabref.logic.icore.ConferenceUtils
org.jabref.logic.ai.util.CitationKeyCheck
org.jabref.logic.importer.util.StaxParser
org.jabref.logic.importer.util.JsonReader
org.jabref.logic.importer.util.MathMLParser
org.jabref.logic.git.merge.planning.util.ConflictRules
This refactoring has no behavioral changes and improves code quality by making the intent of these utility classes explicit. Each class will be addressed in a separate pull request for easier review.
This was discussed and approved on Gitter by @koppor .
Several utility classes in the codebase contain only static methods but lack both the
finalmodifier and a private constructor to prevent instantiation and subclassing. This violates Java best practices for utility classes and could lead to misuse.Add the
finalmodifier to each utility class declaration and include a private constructor that throwsUnsupportedOperationExceptionto explicitly prevent instantiation. This follows the standard pattern recommended in "Effective Java" by Joshua Bloch.Affected classes:
org.jabref.logic.icore.ConferenceUtilsorg.jabref.logic.ai.util.CitationKeyCheckorg.jabref.logic.importer.util.StaxParserorg.jabref.logic.importer.util.JsonReaderorg.jabref.logic.importer.util.MathMLParserorg.jabref.logic.git.merge.planning.util.ConflictRulesThis refactoring has no behavioral changes and improves code quality by making the intent of these utility classes explicit. Each class will be addressed in a separate pull request for easier review.
This was discussed and approved on Gitter by @koppor .