Skip to content

Fix remaining Error Prone javadoc-shape findings, suppress MissingSummary, escalate cleared checks to ERROR - #3606

Merged
dbwiddis merged 3 commits into
oshi:masterfrom
dbwiddis:fix-error-prone-javadoc-shape-tail
Aug 13, 2026
Merged

dbwiddis merged 3 commits into
oshi:masterfrom
dbwiddis:fix-error-prone-javadoc-shape-tail

Conversation

@dbwiddis

@dbwiddis dbwiddis commented Aug 13, 2026 •

Copy link
Copy Markdown
Member

Summary

Closes out the Error Prone WARNING backlog left after #3594-3605:

  • EscapedEntity (6): HTML entities inside {@code}/{@literal} render literally in Javadoc output; use the bare </>/& characters instead.
  • NotJavadoc (4): four oshi-demo main() methods carried a stale duplicate /** block left behind from an older doc pass, sandwiched around @SuppressForbidden. Removed the stale block, keeping (and where useful, merging in) the more accurate one.
  • AlmostJavadoc (3): three private helper methods had genuine @return-bearing doc comments opened with /* instead of /**.
  • InvalidInlineTag (1): a stray @param patterns} that should have been {@code patterns}.
  • InlineFormatString (1): a single-use format-string constant, inlined into its one call site.

Then, since the whole backlog is at zero:

  • Suppress MissingSummary globally - it demands a summary fragment distinct from the @return block, which Checkstyle's javadoc checks don't require and the project doesn't want to enforce separately.
  • Escalate every other check with findings in this triage arc to ERROR severity, so a regression fails the build via the same javac mechanism already blocking on Error Prone's built-in ERROR-severity checks - narrower than -Werror, which would also fail on javac warning categories (deprecation, unchecked, etc.) nothing here has ever triaged.

Test plan

  • ./mvnw clean compile -Perror-prone: 0 warnings, 0 errors, across all 8 modules
  • ./mvnw clean spotless:apply sortpom:sort checkstyle:check install forbiddenapis:check javadoc:javadoc: BUILD SUCCESS

Summary by CodeRabbit

  • Documentation

    • Clarified and standardized documentation across operating system, hardware, utility, and system integration features.
    • Improved descriptions for demonstration application entry points and optional command-line arguments.
    • Documented behavior when registry data is unavailable.
  • Chores

    • Strengthened build-time static analysis checks to identify documentation and code-quality issues earlier.
    • Improved internal test code readability without changing behavior.

Closes out every WARNING-severity finding except MissingSummary
(explicitly deprioritized, see next commit): EscapedEntity (HTML
entities inside {@code}/{@literal} render literally, so use the bare
characters instead), NotJavadoc (four oshi-demo main() methods had a
stale duplicate /** block left over from an older doc pass, sandwiched
around @SuppressForbidden), AlmostJavadoc (three private helper
methods had genuine @return-bearing doc comments opened with /* rather
than /**), InvalidInlineTag (a stray "@PARAM patterns}" instead of
"{@code patterns}"), and InlineFormatString (a single-use format
string constant, inlined into its one call site).
MissingSummary demands a summary fragment distinct from the @return
block; Checkstyle's javadoc checks don't require that phrasing, and
the project doesn't want a separate Error Prone rule for it either.

Separately, every other WARNING-severity check with findings across
the #3594-3605 triage and the previous commit is now at zero. Escalate
each of them individually to ERROR so a regression fails the build,
using the same javac mechanism that already blocks on Error Prone's
own ERROR-severity checks - narrower than -Werror, which would also
fail on every other javac warning category this project has never
triaged.
@coderabbitai

coderabbitai Bot commented Aug 13, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: adaa18b0-04f8-4670-b6d8-e6390784d940

📥 Commits

Reviewing files that changed from the base of the PR and between 7ec992d and 9fca10b.

📒 Files selected for processing (1)
  • oshi-common/src/test/java/oshi/util/GlobalConfigTest.java
📜 Recent review details
⏰ Context from checks skipped due to timeout. (4)
  • GitHub Check: Test JDK 25, OpenIndiana (+ JNA==FFM)
  • GitHub Check: Test JDK 25, OpenBSD (+ JNA==FFM)
  • GitHub Check: Codacy Static Code Analysis
  • GitHub Check: Analyze (java)
🧰 Additional context used
📓 Path-based instructions (4)
**/*.{java,properties}

📄 CodeRabbit inference engine (AGENTS.md)

Before writing any parsing helper, check whether ParseUtil already has one.

Files:

  • oshi-common/src/test/java/oshi/util/GlobalConfigTest.java
oshi-common/**/*.java

📄 CodeRabbit inference engine (AGENTS.md)

oshi-common/**/*.java: oshi-common may not reference com.sun.jna.**, java.lang.foreign.**, or any
System.load/loadLibrary. It must stay pure JDK.

Files:

  • oshi-common/src/test/java/oshi/util/GlobalConfigTest.java
**/*Test.java

📄 CodeRabbit inference engine (AGENTS.md)

**/*Test.java: Test files are named *Test.java.
Tests must pass there and on real hardware.

  • Assert on invariants (non-null, correct type, ordering, a plausible range), not on specific values.

Files:

  • oshi-common/src/test/java/oshi/util/GlobalConfigTest.java
**/*.java

📄 CodeRabbit inference engine (AGENTS.md)

**/*.java: Every public and protected type and method needs javadoc.
Do not use fully-qualified class names in
code or in javadoc — including inside {@link ...}. Import the type and link the simple name.
New files get a current-year-only
header (Copyright 2026 The OSHI Project Contributors / SPDX-License-Identifier: MIT), even when
copied from an older file; spotless maintains end years on existing files.
Never add a line range to
config/checkstyle-suppressions.xml — a range breaks the moment anything above it shifts, including a
single added import, and the failure looks unrelated to the change that caused it.
new classes are
expected to declare one, and matching the annotation of the class you are modeling yours on is the
right default.
Values that are constant (CPU model,
serial number) or expensive-but-slow-changing are wrapped in
oshi.util.Memoizer.memoize(supplier, ...)

Files:

  • oshi-common/src/test/java/oshi/util/GlobalConfigTest.java
🧠 Learnings (2)
📓 Common learnings
Learnt from: dbwiddis
Repo: oshi/oshi PR: 3432
File: oshi-common/src/main/java/oshi/util/ExceptionUtil.java:26-56
Timestamp: 2026-07-06T19:26:05.716Z
Learning: In oshi/oshi, `oshi-common/src/main/java/oshi/util/ExceptionUtil.java`'s private `logAtLevel(Logger, Level, String, Throwable)` helper (and the similar pattern in `oshi-core-ffm/src/main/java/oshi/ffm/ForeignFunctions.java` and `oshi-core/src/main/java/oshi/util/platform/windows/PerfDataUtil.java`) intentionally calls SLF4J 1.x-compatible methods like `log.error(msg, t.getMessage(), t)` with a single `{}` placeholder in `msg` and the `Throwable t` as the trailing argument. This is not a bug: SLF4J's implicit-cause handling (since 1.6.0) detects a trailing `Throwable` argument and attaches it as the log event's cause with full stack trace, equivalent to the SLF4J 2.x-only `.atLevel(level).setCause(t).log(...)` fluent API that this PR deliberately avoids for SLF4J 1.x runtime compatibility. Do not flag these calls as losing the throwable cause/stack trace.
Learnt from: dbwiddis
Repo: oshi/oshi PR: 3530
File: oshi-common/src/main/java/oshi/util/ExceptionUtil.java:43-48
Timestamp: 2026-07-26T23:06:49.011Z
Learning: In the oshi/oshi repository, `oshi.util.ExceptionUtil` is intentionally outside the binary-compatibility surface: japicmp enforces compatibility only for types annotated `oshi.annotation.PublicApi`, and `ExceptionUtil` is not annotated. Therefore, do not flag in-place public method descriptor changes in `ExceptionUtil` merely because precompiled third-party callers could receive `NoSuchMethodError`; source compatibility and lockstep module releases are the applicable expectations. If this guarantee is desired later, annotating `ExceptionUtil` with `PublicApi` is the policy mechanism rather than adding numerous forwarding overloads.
📚 Learning: 2026-08-03T00:46:14.953Z
Learnt from: dbwiddis
Repo: oshi/oshi PR: 3566
File: oshi-common/src/main/java/oshi/software/common/os/unix/openbsd/OpenBsdNetworkParams.java:18-22
Timestamp: 2026-08-03T00:46:14.953Z
Learning: In the OSHI Java codebase, do not require duplicate Javadoc on public methods annotated with Override when the inherited Javadoc from the parent declaration adequately documents the method. The general public-member Javadoc requirement should not flag these overrides solely because they lack redundant documentation.

Applied to files:

  • oshi-common/src/test/java/oshi/util/GlobalConfigTest.java
🔇 Additional comments (1)
oshi-common/src/test/java/oshi/util/GlobalConfigTest.java (1)

221-221: LGTM!

Also applies to: 225-225


📝 Walkthrough

Walkthrough

The PR strengthens selected Error Prone checks in Maven and cleans up Javadocs, comments, and test helper code across OSHI modules. Runtime behavior and public declarations remain unchanged.

Changes

Error Prone enforcement and documentation cleanup

Layer / File(s) Summary
Error Prone enforcement configuration
pom.xml
The error-prone profile retains selected disabled checks and escalates numerous checks to ERROR.
Javadoc and comment cleanup
oshi-common/..., oshi-core-ffm/..., oshi-core/..., oshi-demo/...
Javadocs use corrected markup, clearer wording, literal native syntax, and concise entry-point descriptions. One local format-string variable is also inlined without changing behavior.
Test helper message cleanup
oshi-common/src/test/java/oshi/util/GlobalConfigTest.java
The test helper removes message template constants and passes unchanged format strings directly to formatting methods.

Estimated code review effort: 2 (Simple) | ~10 minutes

Mergeability Score: ⚪ Minimal · up to 9fca1

This PR makes localized documentation and Error Prone configuration cleanup changes, with the reported validation checks passing; no actionable merge-blocking risk remains beyond normal checks and review.

Possibly related PRs

  • oshi/oshi#3594: Further configures the same Error Prone Maven profile.
  • oshi/oshi#3595: Changes Error Prone severity configuration in the same build profile.
  • oshi/oshi#3116: Updates Javadocs and Maven/Javadoc build configuration.

Poem

A rabbit checks each doc tonight,
Ampersands display right.
Error checks stand firm and clear,
While unchanged code hops near.
— 🐇

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 77.78% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the main changes: fixing remaining Javadoc findings, suppressing MissingSummary, and escalating cleared Error Prone checks.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@codecov

codecov Bot commented Aug 13, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 0% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 79.84%. Comparing base (3759911) to head (9fca10b).

Files with missing lines Patch % Lines
...dware/platform/unix/freebsd/FreeBsdSensorsJNA.java 0.00% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##             master    #3606      +/-   ##
============================================
- Coverage     79.87%   79.84%   -0.03%     
- Complexity     3868     3991     +123     
============================================
  Files           710      710              
  Lines         24243    24242       -1     
  Branches       4057     4057              
============================================
- Hits          19363    19355       -8     
- Misses         2714     2720       +6     
- Partials       2166     2167       +1     
Flag Coverage Δ
freebsd 33.48% <0.00%> (-0.01%) ⬇️
linux 37.61% <0.00%> (+<0.01%) ⬆️
macos 38.42% <0.00%> (-0.04%) ⬇️
openbsd 32.66% <0.00%> (-0.02%) ⬇️
solaris 34.17% <0.00%> (+<0.01%) ⬆️
windows 45.35% <0.00%> (+0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

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

Missed in the prior commit: I'd only verified 'mvn compile', which
skips test sources. The escalation to ERROR surfaced these on CI.
Inline both single-use message-template constants, same fix as
FreeBsdSensorsJNA's InlineFormatString earlier in this PR.
@dbwiddis
dbwiddis merged commit 3a532a3 into oshi:master Aug 13, 2026
19 checks passed
@dbwiddis
dbwiddis deleted the fix-error-prone-javadoc-shape-tail branch August 13, 2026 16:41
@dbwiddis dbwiddis mentioned this pull request Aug 13, 2026
3 tasks done
dbwiddis added a commit that referenced this pull request Aug 13, 2026
-Xlint:all findings (raw type, missing-explicit-ctor), both from a
one-off diagnostic sweep, not a build-enforced check:
- FileStorePanel: suppress rawtypes alongside the existing unchecked
  suppression on the same generic-array-creation idiom.
- SystemInfoTest (FFM): add an explicit package-private constructor
  so the exported oshi.ffm package doesn't expose a default public
  one.

Also widen oshi-core-ffm's org.slf4j requirement to transitive:
ForeignFunctions' public callInArena*OrDefault methods take a Logger
parameter directly, unlike other modules where Logger is only a
private field, so this one actually needs it.

Sonar findings from the latest master analysis:
- S108: comment the intentionally-empty default arm in
  LogicalProcessorInformationFFM, matching the JNA twin's existing
  "Ignore Group info" comment.
- S1905: drop the genuinely-redundant int-to-long cast in
  KstatUtilFFM (the JNA twin already omits it). The three long-to-
  double casts Sonar also flagged in FileStorePanel/MemoryPanel are
  NOT redundant - they're required by Error Prone's LongDoubleConversion
  check (ERROR severity as of #3606), which exists specifically to
  catch long-to-double precision loss. Suppressed those three with
  NOSONAR instead of removing them.

Left alone: S9149 (22 findings) - MSFTStorageFFM/JNA and similar
classes redeclare identical static methods from their oshi-common
base class purely so each backend module can reference a locally-
named class. Real callers exist for all of them; fixing this means
deleting ~9 shim class-pairs and repointing callers at the shared
base classes directly across both twins - a separate, larger PR.
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