Skip to content

Update Caffeine JMH benchmark to 3.3.0 - #1887

Merged
msridhar merged 2 commits into
apache:masterfrom
abdeltaehass:issue-1629-caffeine-3.3.0
Sep 22, 2026
Merged

msridhar merged 2 commits into
apache:masterfrom
abdeltaehass:issue-1629-caffeine-3.3.0

Conversation

@abdeltaehass

@abdeltaehass abdeltaehass commented Sep 22, 2026 •

Copy link
Copy Markdown
Contributor

Caffeine 3.3.0 compiles cleanly with NullAway master, so this moves the Caffeine JMH benchmark to it and re-enables BenchmarkCompilationTest.testCaffeine, which has been ignored since #1623.

Besides the version bump:

  • WindowClimber.java is new in 3.3.0 and is referenced from BoundedLocalCache, so it is added to the benchmark's source list. It is the only source file added since 3.2.3.
  • The benchmark now passes -XepOpt:NullAway:JSpecifyExperimental=true, which is what Caffeine's own build uses. 3.3.0 declares @Nullable Object[] toArray() on the key and value views in UnboundedLocalCache, and without the JSpecify JDK models NullAway reports these as invalid overrides of AbstractCollection.toArray(). Enabling JSpecifyJDKModels alone is not enough: it leads to errors in compute and handle lambdas, which the wildcard handling in JSpecifyExperimental resolves.

Because of the new flag, benchmark timings from before and after this change are not directly comparable.

Fixes #1629

Disclosure: I used AI tooling for the grunt and mechanical work here — boilerplate, test scaffolding, and running the test matrix. The approach and direction were mine, and I reviewed the result before submitting.

Summary by CodeRabbit

  • Tests

    • Re-enabled benchmark compilation validation for Caffeine.
    • Added coverage for compiling an additional Caffeine source component.
  • Chores

    • Updated the Caffeine benchmark dependency to version 3.3.0.
    • Enabled experimental JSpecify support during benchmark compilation.

Caffeine 3.3.0 compiles cleanly with NullAway master, so this moves the Caffeine JMH benchmark to it and re-enables `BenchmarkCompilationTest.testCaffeine`, which has been ignored since apache#1623.

Besides the version bump:

- `WindowClimber.java` is new in 3.3.0 and is referenced from `BoundedLocalCache`, so it is added to the benchmark's source list. It is the only source file added since 3.2.3.
- The benchmark now passes `-XepOpt:NullAway:JSpecifyExperimental=true`, which is what Caffeine's own build uses. 3.3.0 declares `@Nullable Object[] toArray()` on the key and value views in `UnboundedLocalCache`, and without the JSpecify JDK models NullAway reports these as invalid overrides of `AbstractCollection.toArray()`. Enabling `JSpecifyJDKModels` alone is not enough: it leads to errors in `compute` and `handle` lambdas, which the wildcard handling in `JSpecifyExperimental` resolves.

Because of the new flag, benchmark timings from before and after this change are not directly comparable.

Fixes apache#1629
@coderabbitai

coderabbitai Bot commented Sep 22, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository: uber/NullAway/.coderabbit.yaml

Review profile: ASSERTIVE

Plan: Advanced

Run ID: cfc85218-68b1-4703-ae99-1a82b8c668cf

📥 Commits

Reviewing files that changed from the base of the PR and between ed6f4bf and 6403fd1.

📒 Files selected for processing (3)
  • jmh/build.gradle
  • jmh/src/main/java/com/uber/nullaway/jmh/CaffeineCompiler.java
  • jmh/src/test/java/com/uber/nullaway/jmh/BenchmarkCompilationTest.java
💤 Files with no reviewable changes (1)
  • jmh/src/test/java/com/uber/nullaway/jmh/BenchmarkCompilationTest.java

Included review availability: Your plan provides up to 8 included reviews per hour; 7 remain after this review.


Walkthrough

The JMH build now uses Caffeine 3.3.0 for source and binary dependencies. Its classpath exclusion filter matches that version. CaffeineCompiler now compiles WindowClimber.java and enables NullAway:JSpecifyExperimental. The Caffeine compilation test is no longer ignored, and its unused JUnit import was removed.

Priority: ➖ Normal

Change: Bug fix · Severity of issue fixed: Medium

Merge Risk: ⚪ Minimal · up to 03480

The benchmark now compiles against Caffeine 3.3.0 with the required source and annotations support, and its compilation test is enabled. No actionable merge-blocking risk is evidenced.

🚥 Pre-merge checks | ✅ 6 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 1 functions across 1 files. (1 skipped: 1 … Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (6 passed)
Check name Status Explanation
Description check ✅ Passed The description accurately explains the Caffeine 3.3.0 upgrade, the source-file addition, the NullAway configuration change, test re-enablement, and linked issue.
Linked Issues check ✅ Passed The description references and addresses issue #1629, which matches the stated objective of restoring Caffeine benchmark compilation.
Out of Scope Changes check ✅ Passed All changes support the stated objective of updating the Caffeine benchmark and re-enabling its compilation test. No unrelated changes are present.
Title check ✅ Passed The title clearly and concisely identifies the primary change: updating the Caffeine JMH benchmark to version 3.3.0.
Linked Issues check ✅ Passed The changes satisfy #1629. jmh/build.gradle updates the Caffeine benchmark dependencies and filter from 3.2.3 to 3.3.0. CaffeineCompiler adds WindowClimber.java and enables `NullAway:JSpecifyExp…
Out of Scope Changes check ✅ Passed The changes stay within #1629. The dependency update, compiler configuration, added Caffeine source, and test re-enablement directly support the benchmark compilation objective. No unrelated productio…
Full details: Docstring Coverage

Explanation

Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 1 functions across 1 files. (1 skipped: 1 unsupported.)

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create a new PR

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.

@msridhar msridhar left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks!

@msridhar
msridhar enabled auto-merge (squash) September 22, 2026 02:06
@msridhar
msridhar merged commit f9963ae into apache:master Sep 22, 2026
16 checks passed
@codecov

codecov Bot commented Sep 22, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 87.68%. Comparing base (ed6f4bf) to head (03480b5).
⚠️ Report is 1 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff            @@
##             master    #1887   +/-   ##
=========================================
  Coverage     87.68%   87.68%           
  Complexity     3458     3458           
=========================================
  Files           110      110           
  Lines         11509    11509           
  Branches       2366     2366           
=========================================
  Hits          10092    10092           
  Misses          652      652           
  Partials        765      765           

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

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.

Update Caffeine JMH benchmark once it builds again with NullAway

2 participants