Skip to content

Code Refactoring #14346

@Nakul-Shivaraj

Description

@Nakul-Shivaraj

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:

  1. org.jabref.logic.icore.ConferenceUtils
  2. org.jabref.logic.ai.util.CitationKeyCheck
  3. org.jabref.logic.importer.util.StaxParser
  4. org.jabref.logic.importer.util.JsonReader
  5. org.jabref.logic.importer.util.MathMLParser
  6. 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 .

Metadata

Metadata

Labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions