Skip to content

Enforce the jSpecify annotations: NullAway from WARN to ERROR - #3636

Merged
dbwiddis merged 1 commit into
oshi:masterfrom
dbwiddis:jspecify-error
Aug 15, 2026
Merged

dbwiddis merged 1 commit into
oshi:masterfrom
dbwiddis:jspecify-error

Conversation

@dbwiddis

@dbwiddis dbwiddis commented Aug 15, 2026 •

Copy link
Copy Markdown
Member

The last step of the jSpecify arc. Resolves #3593.

NullAway has run at WARN since #3618 so the backlog it exposed could be drained without blocking
the build. That backlog is now zero across oshi-common, oshi-core and oshi-core-ffm, so the
check moves to ERROR: a signature that contradicts its annotations now fails the build rather than
adding to a list.

Verified by building the whole reactor under -Perror-prone with the flip in place — zero findings,
BUILD SUCCESS. That is the entire functional change; the other two files are documentation that had
drifted.

The FAQ was describing an earlier state, and in one place an untrue one

  • It said only oshi.hardware and oshi.software.os were @NullMarked. The whole project is marked
    now, by two different mechanisms for two different audiences: the API packages carry @NullMarked
    in their package-info.java, which every consumer sees including on a Java 8 or classpath build,
    while the implementation packages are marked on their module descriptors, which only a module-path
    consumer sees — they are internal either way. The native mapping packages under oshi.jna and
    oshi.ffm.platform are explicitly @NullUnmarked, because they mirror C structs and libraries
    where nullability is the operating system's to state and not OSHI's.
  • It claimed "a violation fails continuous integration". That was aspirational while the check ran at
    WARN — a violation was logged and ignored. This PR is what makes the sentence true, so it now
    says ERROR severity explicitly.

The two pom comments describing this as "groundwork for jSpecify annotations ... once those land"
have been updated for the same reason.

CHANGELOG

Re-summarized as one entry for the whole arc, in three parts: what was adopted, what the sweep fixed,
and the user-facing behavior changes as a list. One pull request link per line, for readability of the
raw markdown.

Worth a look: the entry introduces a nested list, which this CHANGELOG has not used before. It is the
readable way to present eight distinct behavior changes, but say the word if you would rather have
them inline.

Full gate on macOS: spotless:apply spotless:check checkstyle:check install forbiddenapis:check javadoc:javadoc plus -Perror-prone clean install. All modules green, 1565 tests, 0 failures.

Summary by CodeRabbit

  • Documentation

    • Expanded nullability guidance across API packages, implementation modules, and native mappings.
    • Clarified that nullability violations are treated as build failures.
    • Updated documentation describing Error Prone integration.
    • Added details on incomplete platform outputs and platform-specific string and unknown-value return behavior.
  • Chores

    • Updated the 7.5.0 changelog with the latest pull requests and release details.
    • Enabled stricter nullability checking during Error Prone builds.

@coderabbitai

coderabbitai Bot commented Aug 15, 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: 2f5c5b9f-c39b-40e0-b8ad-deba2a6a4ea6

📥 Commits

Reviewing files that changed from the base of the PR and between 02bcc0c and b18ba24.

📒 Files selected for processing (1)
  • FAQ.md
🚧 Files skipped from review as they are similar to previous changes (1)
  • FAQ.md
📜 Recent review details
⏰ Context from checks skipped due to timeout. (12)
  • GitHub Check: Test JDK 25, FreeBSD (+ JNA==FFM)
  • GitHub Check: Test JDK 25, OpenIndiana (+ JNA==FFM)
  • GitHub Check: Test JDK 25, OpenBSD (+ JNA==FFM)
  • GitHub Check: Codacy Static Code Analysis
  • GitHub Check: Test JDK 25, macos-latest (+ JNA==FFM)
  • GitHub Check: Lint (ForbiddenAPIs, Javadoc, SLF4J)
  • GitHub Check: Test JDK 25, ubuntu-latest (+ JNA==FFM)
  • GitHub Check: Test JDK 26, ubuntu-latest
  • GitHub Check: Test JDK 25, windows-latest (+ JNA==FFM)
  • GitHub Check: Lint (Spotless, Checkstyle)
  • GitHub Check: Error Prone
  • GitHub Check: Analyze (java)

📝 Walkthrough

Walkthrough

The Error Prone profile now runs NullAway at ERROR severity. The FAQ and changelog describe jSpecify coverage, annotation scope, native mapping exceptions, and related platform-output changes.

Changes

NullAway enforcement and documentation

Layer / File(s) Summary
NullAway enforcement configuration
pom.xml
The Error Prone profile identifies NullAway as the jSpecify enforcement tool and changes its check severity from WARN to ERROR.
Nullability policy and release documentation
FAQ.md, CHANGELOG.md
The documentation describes annotation coverage, module visibility, native mapping exceptions, build-blocking violations, and the 7.5.0 changes.

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

Merge Risk: ⚪ Minimal · up to b18ba

The PR enables build failures for nullability violations and updates related documentation; the supplied full-build verification passed, so no actionable merge-blocking risk remains beyond normal checks and review.

Possibly related PRs

  • oshi/oshi#3594: Adds the Error Prone integration configured here for NullAway.
  • oshi/oshi#3614: Introduces the NullAway and jSpecify enforcement documented here.
  • oshi/oshi#3621: Adds nullable annotations validated by these checks.

Poem

A rabbit checks the build tonight,
NullAway makes the errors bright.
JSpecify marks each careful page,
The changelog hops from stage to stage.
“ERROR guards the code,” says Bun,
Then bounds away when checks are done.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly identifies the main change: enforcing jSpecify nullability by changing NullAway from WARN to ERROR.
Linked Issues check ✅ Passed The changes complete the linked issue's enforcement objective by making NullAway findings build errors after jSpecify annotation coverage reached zero.
Out of Scope Changes check ✅ Passed The changelog, FAQ, and POM comment updates directly document the jSpecify adoption and NullAway enforcement changes.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ 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 15, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 79.94%. Comparing base (84c737c) to head (b18ba24).

Additional details and impacted files
@@            Coverage Diff             @@
##             master    #3636    +/-   ##
==========================================
  Coverage     79.94%   79.94%            
- Complexity     3869     4231   +362     
==========================================
  Files           697      697            
  Lines         24292    24292            
  Branches       4012     4012            
==========================================
+ Hits          19420    19421     +1     
- Misses         2727     2729     +2     
+ Partials       2145     2142     -3     
Flag Coverage Δ
freebsd 33.50% <ø> (+0.01%) ⬆️
linux 37.69% <ø> (+<0.01%) ⬆️
macos 38.52% <ø> (-0.04%) ⬇️
openbsd 32.69% <ø> (-0.02%) ⬇️
solaris 34.23% <ø> (+0.03%) ⬆️
windows 45.31% <ø> (+0.02%) ⬆️

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.

NullAway has run at WARN since #3618 so the backlog it exposed could be drained
without blocking the build. That backlog is now zero across oshi-common,
oshi-core and oshi-core-ffm, so the check moves to ERROR and a signature that
contradicts its annotations fails the build rather than adding to a list.

Verified by building the whole reactor under -Perror-prone with the flip in
place: zero findings, BUILD SUCCESS.

Updates the two pom comments that still described this as groundwork for
annotations that had not landed, and the FAQ, which claimed only oshi.hardware
and oshi.software.os were marked and that a violation fails CI - the first was
out of date and the second was not true while the check ran at WARN.

Re-summarizes the CHANGELOG for the whole arc as one entry: what was adopted,
then what the sweep fixed, then the user-facing behavior changes as a list. One
pull request link per line, for readability of the raw markdown.
@dbwiddis
dbwiddis merged commit 6128729 into oshi:master Aug 15, 2026
18 checks passed
@dbwiddis
dbwiddis deleted the jspecify-error branch August 15, 2026 18:34
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.

PROPOSAL: Adopt jSpecify nullability annotations

1 participant