Repository navigation
Wire Error Prone into the build as groundwork for jSpecify - #3594
Conversation
NullAway, the Error Prone check that will enforce jSpecify nullability annotations once they land, requires Error Prone as its host platform. This adds Error Prone behind an opt-in, non-blocking error-prone profile/CI job so pre-existing findings can be triaged ahead of next week's jSpecify/NullAway PR, and splits the lint job into parallel jobs so static analysis doesn't run as one long sequential chain.
📝 WalkthroughWalkthroughThe Maven build now supports opt-in Error Prone analysis with required JDK compiler access. Benchmark annotation processors append to inherited paths. Pull-request validation separates formatting, verification, and non-blocking Error Prone jobs. ChangesBuild validation
Estimated code review effort: 3 (Moderate) | ~20 minutes Possibly related PRs
Suggested reviewers: Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #3594 +/- ##
============================================
- Coverage 79.93% 79.87% -0.07%
- Complexity 3870 4230 +360
============================================
Files 710 710
Lines 24242 24242
Branches 4052 4052
============================================
- Hits 19379 19364 -15
- Misses 2711 2729 +18
+ Partials 2152 2149 -3
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@pom.xml`:
- Around line 1219-1222: Add the ten JPMS access flags from .mvn/jvm.config to
the compilerArgs in the profile containing -XDcompilePolicy=simple, prefixing
each flag with -J so they are forwarded to the forked compiler while preserving
the existing arguments.
🪄 Autofix
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro Plus
Run ID: db93de13-332f-4962-b09d-f89d80064e48
📒 Files selected for processing (4)
.github/workflows/pr.yaml.mvn/jvm.configoshi-benchmark/pom.xmlpom.xml
📜 Review details
⏰ Context from checks skipped due to timeout. (12)
- GitHub Check: Test JDK 25, OpenBSD (+ JNA==FFM)
- GitHub Check: Test JDK 25, OpenIndiana (+ JNA==FFM)
- GitHub Check: Test JDK 25, FreeBSD (+ JNA==FFM)
- GitHub Check: Codacy Static Code Analysis
- GitHub Check: Test JDK 25, ubuntu-latest (+ JNA==FFM)
- GitHub Check: Test JDK 25, macos-latest (+ JNA==FFM)
- GitHub Check: Test JDK 26, ubuntu-latest
- GitHub Check: Lint (ForbiddenAPIs, Javadoc, SLF4J)
- GitHub Check: Test JDK 25, windows-latest (+ JNA==FFM)
- GitHub Check: Lint (Spotless, Checkstyle)
- GitHub Check: Error Prone (informational)
- GitHub Check: Analyze (java)
🧰 Additional context used
📓 Path-based instructions (2)
**/*.{java,xml}
📄 CodeRabbit inference engine (AGENTS.md)
Do not add line-range Checkstyle suppressions. Prefer declaration-level
@SuppressWarnings, scoped Checkstyle comments, or file/package suppressions without line ranges; use Sonar@SuppressWarnings("java:Sxxxx")where possible and keep statement-level suppression comments short and justified.
Files:
pom.xmloshi-benchmark/pom.xml
**/pom.xml
📄 CodeRabbit inference engine (AGENTS.md)
Do not add dependencies without discussion or manually bump dependency versions; Renovate manages dependency updates.
Files:
pom.xmloshi-benchmark/pom.xml
🧠 Learnings (10)
📓 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.
📚 Learning: 2026-08-05T23:44:09.936Z
Learnt from: CR
Repo: oshi/oshi PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-08-05T23:44:09.936Z
Learning: Applies to **/src/main/java/module-info.java : Keep external imports consistent with `config/import-control.xml` and the module's `module-info.java`; adding an external dependency may also require updating the module POM.
Applied to files:
.mvn/jvm.configpom.xml
📚 Learning: 2026-08-05T23:44:09.936Z
Learnt from: CR
Repo: oshi/oshi PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-08-05T23:44:09.936Z
Learning: Applies to **/src/test/java/module-info.test : When adding a test package not already used, add the corresponding `--add-opens` entry to that module's `module-info.test`; use the correct module name for the module under test.
Applied to files:
.mvn/jvm.config
📚 Learning: 2026-03-29T20:01:06.452Z
Learnt from: dbwiddis
Repo: oshi/oshi PR: 3014
File: oshi-core-java11/src/main/java/module-info.java:10-17
Timestamp: 2026-03-29T20:01:06.452Z
Learning: In the oshi project, `oshi-core-java25/src/main/java/module-info.java` intentionally does NOT export `oshi.util.platform.unix.freebsd`, `oshi.util.platform.unix.openbsd`, or `oshi.util.platform.unix.solaris`, because the FFM (Foreign Function & Memory) implementation only supports Windows, macOS, and Linux. This differs from `oshi-core-java11/src/main/java/module-info.java` which exports all Unix platform packages. The asymmetry is by design.
Applied to files:
.mvn/jvm.config
📚 Learning: 2026-08-05T23:44:09.936Z
Learnt from: CR
Repo: oshi/oshi PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-08-05T23:44:09.936Z
Learning: Applies to **/*.{java,md} : When changing a JNA or FFM implementation, apply the equivalent behavior change to its counterpart, or document why the implementations intentionally differ; prefer hoisting non-native-specific logic into `oshi-common`.
Applied to files:
oshi-benchmark/pom.xml
📚 Learning: 2026-07-26T23:06:49.011Z
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.
Applied to files:
oshi-benchmark/pom.xml
📚 Learning: 2026-08-05T23:44:09.936Z
Learnt from: CR
Repo: oshi/oshi PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-08-05T23:44:09.936Z
Learning: Applies to oshi-common/src/main/java/**/*.java : Keep `oshi-common` pure Java 8: do not reference JNA, FFM, `System.load`, or `System.loadLibrary`; shared parsing, conversion, filtering, caching, and sentinel/range logic belongs here.
Applied to files:
oshi-benchmark/pom.xml
📚 Learning: 2026-08-05T23:44:09.936Z
Learnt from: CR
Repo: oshi/oshi PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-08-05T23:44:09.936Z
Learning: Applies to oshi-common/src/main/java/**/*.java : Do not import `com.sun.jna`, `java.lang.foreign`, or use `System.load`/`System.loadLibrary` in `oshi-common`.
Applied to files:
oshi-benchmark/pom.xml
📚 Learning: 2026-07-21T20:38:16.728Z
Learnt from: dbwiddis
Repo: oshi/oshi PR: 3509
File: oshi-demo/pom.xml:72-80
Timestamp: 2026-07-21T20:38:16.728Z
Learning: For the OSHI Maven/Jacoco CI workflows, coverage aggregation/report upload steps should run only when the test job succeeds (e.g., guard with conditions like `if: success()`). Do not add logic to generate/upload or preserve aggregate coverage artifacts after test failures, and avoid fragile/over-engineered handling of exit status unless there is an explicit separate project requirement.
Applied to files:
.github/workflows/pr.yaml
📚 Learning: 2026-05-31T05:53:04.246Z
Learnt from: dbwiddis
Repo: oshi/oshi PR: 3311
File: .github/workflows/site.yaml:21-21
Timestamp: 2026-05-31T05:53:04.246Z
Learning: When a GitHub Actions workflow verifies that a pinned commit SHA matches a version tag, dereference annotated tags before comparing to a commit SHA. The API `GET /repos/{owner}/{repo}/git/refs/tags/{tag}` returns the tag *object* SHA for annotated tags (not the underlying commit SHA), so comparing it directly to a commit SHA will cause false mismatches. Instead: (1) fetch the tag object SHA via `GET /repos/{owner}/{repo}/git/refs/tags/{tag}`; (2) resolve that tag object to the underlying commit by calling `GET /repos/{owner}/{repo}/git/tags/{tag_object_sha}`; (3) compare the pinned commit SHA to the resolved commit at `.object.sha`.
Applied to files:
.github/workflows/pr.yaml
🔇 Additional comments (8)
.github/workflows/pr.yaml (3)
59-85: LGTM!
87-115: LGTM!
117-140: LGTM!pom.xml (3)
111-114: LGTM!
1223-1227: 🎯 Functional CorrectnessVerify the generated-source exclusion for test compilation.
The pattern matches
target/generated-sourcesonly. The Maven Compiler Plugin usestarget/generated-test-sources/test-annotationsfor test-generated sources. If test annotation processors run, Error Prone will still inspect their generated code. (maven.apache.org)If all generated sources must be excluded, use
generated-(test-)?sources.Possible pattern
-<arg>-Xplugin:ErrorProne -XepExcludedPaths:.*/target/generated-sources/.* +<arg>-Xplugin:ErrorProne -XepExcludedPaths:.*/target/generated-(test-)?sources/.*Source: MCP tools
1229-1235: 🗄️ Data Integrity & IntegrationNo annotation-processing change is needed. The configured paths cover Error Prone and JMH. Maven Compiler Plugin 3.15.0 defaults
<proc>tofull, so the effective compiler arguments already include-proc:full.> Likely an incorrect or invalid review comment..mvn/jvm.config (1)
1-10: 🩺 Stability & AvailabilityVerify the supported Maven JDK range before making these options global.
.mvn/jvm.configapplies these options before Maven evaluates profiles. The root POM still activates a[1.8,16)profile.--add-exportsand--add-opensbelong to the JDK 9 module system and are unavailable to a JDK 8 launcher. If JDK 8 remains a supported Maven runtime, normal builds fail before-Perror-proneis selected. (openjdk.org)Scope these options to the Error Prone invocation, or explicitly raise and document the minimum JDK for every Maven build. Verify both paths with the supported JDK matrix.
Source: MCP tools
oshi-benchmark/pom.xml (1)
126-129: LGTM!
…mary, escalate cleared checks to ERROR (#3606) * Fix remaining Error Prone javadoc-shape findings 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). * Suppress MissingSummary, escalate cleared checks to ERROR severity 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. * Fix InlineFormatString in GlobalConfigTest 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.
Summary
Groundwork for the jSpecify nullability-annotations proposal, without adding any
@Nullable/@NonNullmarkers yet. NullAway — the Error Prone check that will eventually enforce jSpecify annotations — requires Error Prone as its host platform, so this PR wires Error Prone into the build now so any pre-existing findings can be triaged ahead of the follow-on jSpecify/NullAway PR.error-proneMaven profile (repo-wide, one block in the rootpom.xml) that activates-Xplugin:ErrorProneviaerror_prone_core:2.50.0. Not active on a normal build..mvn/jvm.configwith the--add-exports/--add-opensJPMS flags Error Prone's in-process javac plugin needs (JEP 396).-XepExcludedPaths) so findings in JMH's auto-generated benchmark harness (not code we own) don't show up.InlineMeSuggester/DoNotCallSuggester— they suggest Google-specific@InlineMe/@DoNotCallannotations this project doesn't use.oshi-benchmark/pom.xml: its ownannotationProcessorPaths(for JMH's processor) was silently replacing rather than merging with the profile'serror_prone_corepath; fixed withcombine.children="append".lintjob intolint-format(Spotless/Checkstyle) andlint-verify(ForbiddenAPIs/SLF4J), since it was growing long, and swapsjavadoc:javadocfor the stricter release-profile javadoc check (-Prelease install -Dgpg.skip=true) thatRELEASING.mdnotes catches unresolved{@link}s the normal gate tolerates — this project has been bitten by javadoc errors that only surfaced atrelease:performtime.error-proneCI job, informational only (continue-on-error: true) — nothing here blocks the PR check yet, including the small number of real ERROR-severity findings the tool already surfaced (BanJNDI,MemorySegmentReferenceEquality,ReturnValueIgnored). No fixing in this PR; that's follow-on work.No CHANGELOG entry — pure CI/build tooling, no user-visible change.
Next steps (follow-on PRs, not this one)
continue-on-error: true, so ERROR-severity findings block (javac's own default) while WARNING-severity findings stay non-blocking for ongoing triage.org.jspecify:jspecify+com.uber.nullaway:nullaway, start marking packages@NullMarkedbeginning withoshi-common's shared interfaces/abstract classes, then push outward tooshi-core/oshi-core-ffmkeeping twins in sync.StringSplitter,MissingSummary,EnumOrdinal,MixedMutabilityReturnType), by module or by check.Test plan
./mvnw clean install -DskipTests(no profile) — unaffected, confirms Error Prone stays fully opt-in./mvnw clean install -DskipTests -Perror-prone -fn(whole reactor) — plugin activates on every module, findings are real code (not generated sources), no false "plug-in not found" errors./mvnw -Prelease install -DskipTests -Dgpg.skip=true— succeeds without a signing key, produces*-javadoc.jar/*-sources.jarfor every module./mvnw clean spotless:apply sortpom:sort checkstyle:check install forbiddenapis:check javadoc:javadoc— full gate passes, no reformatting needed.github/workflows/pr.yamlparses as valid YAMLSummary by CodeRabbit
Quality Improvements
Build Improvements