Skip to content

Complete Javadoc on the library API, enforced by doclint - #14

Merged
diegourban merged 3 commits into
masterfrom
javadoc
Nov 6, 2026
Merged

diegourban merged 3 commits into
masterfrom
javadoc

Conversation

@diegourban

Copy link
Copy Markdown
Owner

Clean-code PR C of 4 (formatting ✅ → final ✅ → Javadoc → approved findings).

What changed

  • Complete Javadoc on every public and protected member of the library (23 files). Before this there were 101 doclint findings: 73 members with no comment, empty @param/@return descriptions, and malformed HTML.
  • Docs describe actual behaviour, including quirks and limits. For example:
    • Statistics.median sorts the caller's array in place;
    • fibonacci only works for n ≤ 46;
    • the Binet variants are approximate beyond their tested ranges;
    • LinkedList.get throws IllegalArgumentException for a missing position;
    • each sort states its time and space complexity.
  • The only code added: explicit, documented, empty no-arg constructors where a class relied on the implicit one, which doclint can't document. They're in LinkedList, Queue, Stack, Vector, InsertionSort, MergeSort, QuickSort and SelectionSort.
    • Verified mechanically: with comments and whitespace removed, every file is identical to before, apart from those 8 constructors.
  • Enforcement: the library compiles (default-compile) with -Xdoclint:all/protected -Werror, so a public or protected member without complete Javadoc fails ./mvnw verify. Test and problem sources aren't affected. Before the docs landed, a clean build failed on the 101 findings.

Possible bugs noticed while documenting (not changed here)

These were documented as the code behaves today; whether to fix them is a separate decision. Examples: LinkedList.add(0, e) on a non-empty list throws; Vector.remove has no bounds check; Element has no hashCode; Numbers.toArray casts before % 10; Geometry uses π = 3.14.

Test plan

  • ./mvnw clean verify: doclint, 591 tests, Spotless, PMD and coverage floors pass
  • CI, Codacy, Codecov green

🤖 Generated with Claude Code

diegourban and others added 3 commits November 6, 2026 17:01
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
default-compile now runs with -Xdoclint:all/protected -Werror, so any
public or protected library member without complete Javadoc fails the
build. Test and problem sources are not affected.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@codecov-commenter

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 99.65%. Comparing base (98bba13) to head (f9223da).

Additional details and impacted files
@@            Coverage Diff            @@
##             master      #14   +/-   ##
=========================================
  Coverage     99.65%   99.65%           
  Complexity      279      279           
=========================================
  Files            24       24           
  Lines           576      576           
  Branches         94       94           
=========================================
  Hits            574      574           
  Partials          2        2           

☔ 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.

@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.

@diegourban
diegourban merged commit 73da738 into master Nov 6, 2026
2 checks passed

@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

⚠️ Resolve issues before merging

The current build configuration does not enforce the intended documentation checks: -Xdoclint is configured as a compiler argument even though it belongs to the Javadoc tool, so the verification build may fail on an unsupported option or fail to validate the API documentation. This acceptance criterion remains unaddressed and should be corrected before merging.

No automated verification scenarios are included, and there is no independent evidence in the diff that all public/protected members are documented or that runtime behavior remains unchanged.

Test suggestions

  • Run a clean Maven verification build and confirm doclint rejects missing or malformed public/protected documentation.
  • Verify the eight explicitly added no-argument constructors are available and preserve the previous default construction behavior.
  • Exercise documented edge-case behavior for collections, numeric utilities, geometry, I/O, and sorting APIs.
  • Confirm the documentation-only changes do not alter existing library behavior.
Prompt proposal for missing tests
Consider implementing these tests if applicable:
1. Run a clean Maven verification build and confirm doclint rejects missing or malformed public/protected documentation.
2. Verify the eight explicitly added no-argument constructors are available and preserve the previous default construction behavior.
3. Exercise documented edge-case behavior for collections, numeric utilities, geometry, I/O, and sorting APIs.
4. Confirm the documentation-only changes do not alter existing library behavior.
Low confidence findings
  • Add automated verification for the documented API behavior and constructor changes, and include a build or generated-Javadoc check that independently demonstrates complete public/protected API documentation.

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

Comment thread pom.xml
Comment on lines +159 to +160
<arg>-Xdoclint:all/protected</arg>
<arg>-Werror</arg>

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🔴 HIGH RISK

-Xdoclint is a Javadoc-tool option, not a javac option, so configuring it under the compiler plugin cannot reliably enforce API documentation and may make compilation fail with an unsupported flag. Move doclint and warning-as-error enforcement to the Maven Javadoc plugin, configured for the protected API, and keep only compiler-supported arguments under the compiler plugin.

TIP React 👍 if this review is right, or reply with what's wrong and how it could be better to help improve the reviewer.

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