Skip to content

Change utility and factory class constructors from private to protected#12

Merged
marevol merged 3 commits intomasterfrom
fix/utility-constructor-visibility
Jul 31, 2025
Merged

Change utility and factory class constructors from private to protected#12
marevol merged 3 commits intomasterfrom
fix/utility-constructor-visibility

Conversation

@marevol
Copy link
Contributor

@marevol marevol commented Jul 31, 2025

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.

@marevol marevol requested a review from Copilot July 31, 2025 08:11
@marevol marevol self-assigned this Jul 31, 2025
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 private to protected in 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.)

Comment on lines 29 to 31
public class StreamUtil {
private StreamUtil() {
protected StreamUtil() {
// nothing
Copy link

Copilot AI Jul 31, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copilot uses AI. Check for mistakes.
Comment on lines +28 to 29
protected CommonPoolUtil() {
// nothing
Copy link

Copilot AI Jul 31, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Suggested change
protected CommonPoolUtil() {
// nothing
private CommonPoolUtil() {
// Prevent instantiation

Copilot uses AI. Check for mistakes.
@marevol marevol merged commit 73b5443 into master Jul 31, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant