Skip to content

Private constructors for static-only classes - #10

Merged
diegourban merged 1 commit into
masterfrom
private-constructors
Nov 6, 2026
Merged

diegourban merged 1 commit into
masterfrom
private-constructors

Conversation

@diegourban

Copy link
Copy Markdown
Owner

Follow-up to #9, making the other static-only classes match Sequences.

  • ArrayUtils, BinarySearch, Combinatorics, Geometry, Measurement, Numbers, NumberTheory, Statistics and StringUtils only have static methods (checked with javap), so each gets a private constructor. They can no longer be instantiated by mistake.
  • The eight shouldCreateInstance tests existed only to cover the implicit public constructor, so they're removed. JaCoCo leaves private empty constructors out of coverage, so nothing is hidden or excluded.
  • Reader and SampleBuilder keep their shouldCreateInstance tests, since those create real objects.

Nothing outside those eight tests instantiated these classes.

Test plan

  • ./mvnw verify: 574 tests (582 − 8), coverage floors met (line 97.3%, branch 91.0%)
  • CI, Codecov and Codacy green

🤖 Generated with Claude Code

ArrayUtils, BinarySearch, Combinatorics, Geometry, Measurement,
Numbers, NumberTheory, Statistics and StringUtils only have static
methods, so they get a private constructor like Sequences. The eight
shouldCreateInstance tests that only existed to cover the implicit
public constructor are removed; JaCoCo leaves private empty
constructors out of coverage.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@codacy-production

Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

🟢 Metrics 0 complexity · 0 duplication

Metric Results
Complexity 0
Duplication 0

View in Codacy

AI Reviewer: first review requested successfully. AI can make mistakes. Always validate suggestions.

Run reviewer

TIP This summary will be updated as you push new changes.

@codacy-production codacy-production Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull Request Overview

✅ No blocking issues noticed

No blocking findings were identified. Functional tests are present, but constructor visibility and unaffected instantiable classes lack explicit automated coverage.

About this PR

  • Add automated tests covering constructor visibility for the utility classes and confirming that the intended object-oriented classes remain instantiable.

Test suggestions

  • Verify utility classes do not expose public constructors
  • Run existing functional tests for each utility class
  • Verify Reader and SampleBuilder remain instantiable
Prompt proposal for missing tests
Consider implementing these tests if applicable:
1. Verify utility classes do not expose public constructors
2. Verify Reader and SampleBuilder remain instantiable

Make this review better

TIP Add a ticket key to the branch or title so the reviewer can check the PR against it. Or tell us which ticket tracker you use here.
TIP Add Codacy review.md instructions or an AGENTS.md so the reviewer knows your conventions.

TIP How was this review? Give us feedback

@codecov-commenter

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 94.17%. Comparing base (0237e3d) to head (3389830).

Additional details and impacted files
@@             Coverage Diff              @@
##             master      #10      +/-   ##
============================================
+ Coverage     94.09%   94.17%   +0.08%     
+ Complexity      264      256       -8     
============================================
  Files            24       24              
  Lines           593      584       -9     
  Branches         94       94              
============================================
- Hits            558      550       -8     
+ Misses           17       16       -1     
  Partials         18       18              

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@diegourban
diegourban merged commit ff88d77 into master Nov 6, 2026
2 checks 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.

2 participants