Change utility and factory class constructors from private to protected#12
Change utility and factory class constructors from private to protected#12
Conversation
There was a problem hiding this comment.
Pull Request Overview
This pull request systematically changes the visibility of no-argument constructors in utility classes from private to protected across the codebase. The goal is to maintain the guarantee that these classes cannot be instantiated directly while enabling subclassing for testing purposes or client code extensions.
- Updates constructors from
privatetoprotectedin all utility and factory classes - Preserves the "Do not instantiate" javadoc comments indicating the original intent
- Affects abstract utility classes across multiple packages (convert, io, lang, beans, etc.)
| public class StreamUtil { | ||
| private StreamUtil() { | ||
| protected StreamUtil() { | ||
| // nothing |
There was a problem hiding this comment.
StreamUtil is not declared as abstract but follows the utility class pattern. Consider making it abstract to be consistent with other utility classes in this codebase, or ensure it cannot be instantiated by keeping the constructor private.
| protected CommonPoolUtil() { | ||
| // nothing |
There was a problem hiding this comment.
CommonPoolUtil is not declared as abstract but follows the utility class pattern. Consider making it abstract to be consistent with other utility classes in this codebase, or ensure it cannot be instantiated by keeping the constructor private.
| protected CommonPoolUtil() { | |
| // nothing | |
| private CommonPoolUtil() { | |
| // Prevent instantiation |
This pull request updates the visibility of no-argument constructors in various abstract and utility classes from private to protected. Since these classes are not intended to be instantiated directly, the change maintains that guarantee while allowing subclassing in client code or for testing purposes.