Skip to content

Require JDK 17 to run NullAway#1394

Merged
msridhar merged 5 commits intomasterfrom
require-jdk-17
Dec 23, 2025
Merged

Require JDK 17 to run NullAway#1394
msridhar merged 5 commits intomasterfrom
require-jdk-17

Conversation

@msridhar
Copy link
Copy Markdown
Collaborator

@msridhar msridhar commented Dec 23, 2025

See #1170

We leave the annotations artifact at targeting JDK 11, since some clients may include that artifact in their runtime classpath. Also, our next release will be 0.13.0 due to this change.

To do in follow ups:

Summary by CodeRabbit

  • Chores
    • Updated minimum Java requirement from Java 11 to Java 17.
    • Bumped project version to 0.13.0-SNAPSHOT.
    • Adjusted build and test tool configuration to reduce spurious warnings and improve compatibility across development environments.

✏️ Tip: You can customize this high-level summary in your review settings.

@codecov
Copy link
Copy Markdown

codecov Bot commented Dec 23, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 88.19%. Comparing base (5ace1bf) to head (e6a89a3).
⚠️ Report is 1 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff            @@
##             master    #1394   +/-   ##
=========================================
  Coverage     88.19%   88.19%           
  Complexity     2616     2616           
=========================================
  Files            95       95           
  Lines          8675     8675           
  Branches       1743     1743           
=========================================
  Hits           7651     7651           
  Misses          510      510           
  Partials        514      514           

☔ View full report in Codecov by Sentry.
📢 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.

@msridhar msridhar marked this pull request as ready for review December 23, 2025 17:49
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Dec 23, 2025

Walkthrough

This pull request raises Java compilation targets across the build from Java 11 to Java 17 in multiple build.gradle files and test tasks, updates the project version to 0.13.0-SNAPSHOT, and disables three error-prone checks in the main build configuration. The annotations module retains Java 11 compatibility for annotations on the runtime classpath. No public API signatures were changed.

Possibly related PRs

  • NullAway#1315: Modifies Gradle build configuration for Java toolchain/target version handling, touching the same compile/source settings.
  • NullAway#1271: Updates build and test Java versions across the repo, including test task launcher versions.
  • NullAway#1301: Adjusts Gradle build/test configurations to change supported Java major versions used for compilation and tests.

Suggested reviewers

  • lazaroclapp
  • yuxincs

Pre-merge checks and finishing touches

✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title 'Require JDK 17 to run NullAway' directly and clearly summarizes the main change in the PR, which updates the minimum Java runtime version requirement from JDK 11 to JDK 17.
Linked Issues check ✅ Passed The PR successfully implements the primary requirement from issue #1170: making JDK 17 the minimum runtime for NullAway. All build files were updated to enforce Java 17 compatibility.
Out of Scope Changes check ✅ Passed All changes align with the stated objective of updating Java version requirements. Version bump to 0.13.0 and annotations remaining at Java 11 are both explicitly mentioned in PR objectives as intentional decisions.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch require-jdk-17

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 and usage tips.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 5ace1bf and 5d3bfa3.

📒 Files selected for processing (7)
  • annotations/build.gradle
  • build.gradle
  • gradle.properties
  • guava-recent-unit-tests/build.gradle
  • jar-infer/test-android-lib-jarinfer/build.gradle
  • nullaway/build.gradle
  • sample-app/build.gradle
🧰 Additional context used
🧠 Learnings (4)
📓 Common learnings
Learnt from: msridhar
Repo: uber/NullAway PR: 1245
File: guava-recent-unit-tests/src/test/java/com/uber/nullaway/guava/NullAwayGuavaParametricNullnessTests.java:101-102
Timestamp: 2025-08-14T18:50:06.159Z
Learning: In NullAway JSpecify tests, when JDK version requirements exist due to bytecode annotation reading capabilities, prefer failing tests over skipping them on unsupported versions to ensure CI catches regressions and enforces proper JDK version usage for developers.
Learnt from: msridhar
Repo: uber/NullAway PR: 1248
File: nullaway/src/main/java/com/uber/nullaway/generics/GenericsChecks.java:847-857
Timestamp: 2025-08-28T04:54:20.953Z
Learning: In NullAway's GenericsChecks.java, NewClassTree support for explicit type argument substitution requires more extensive changes beyond just modifying the conditional in compareGenericTypeParameterNullabilityForCall. The maintainers prefer to handle NewClassTree support in a separate follow-up rather than expanding the scope of PRs focused on specific issues like super constructor calls.
📚 Learning: 2025-08-14T18:50:06.159Z
Learnt from: msridhar
Repo: uber/NullAway PR: 1245
File: guava-recent-unit-tests/src/test/java/com/uber/nullaway/guava/NullAwayGuavaParametricNullnessTests.java:101-102
Timestamp: 2025-08-14T18:50:06.159Z
Learning: In NullAway JSpecify tests, when JDK version requirements exist due to bytecode annotation reading capabilities, prefer failing tests over skipping them on unsupported versions to ensure CI catches regressions and enforces proper JDK version usage for developers.

Applied to files:

  • gradle.properties
  • build.gradle
  • nullaway/build.gradle
  • guava-recent-unit-tests/build.gradle
📚 Learning: 2025-10-09T19:59:16.543Z
Learnt from: msridhar
Repo: uber/NullAway PR: 1243
File: jdk-annotations/astubx-generator/build.gradle:22-22
Timestamp: 2025-10-09T19:59:16.543Z
Learning: When disabling testJdk17 tasks for modules requiring JDK 21, use `onlyIf { false }` to skip the task:
```gradle
tasks.named("testJdk17").configure {
    onlyIf { false }
}
```
Do not use `doFirst { throw new GradleException(...) }` as it will cause CI failures when the task is executed.

Applied to files:

  • build.gradle
  • nullaway/build.gradle
  • guava-recent-unit-tests/build.gradle
  • jar-infer/test-android-lib-jarinfer/build.gradle
📚 Learning: 2025-11-25T22:43:06.446Z
Learnt from: CR
Repo: uber/NullAway PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-11-25T22:43:06.446Z
Learning: Run only the tests for the main NullAway module using `./gradlew :nullaway:test` unless specifically asked to run tests in a different module

Applied to files:

  • nullaway/build.gradle
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (5)
  • GitHub Check: Build caffeine with snapshot
  • GitHub Check: Build and test on macos-latest
  • GitHub Check: Build and test on windows-latest
  • GitHub Check: Build spring-framework with snapshot
  • GitHub Check: Build and test on ubuntu-latest
🔇 Additional comments (6)
guava-recent-unit-tests/build.gradle (1)

50-50: LGTM! Test launcher correctly updated to Java 17.

This change aligns with the PR objective to require JDK 17 as the minimum runtime for NullAway.

gradle.properties (1)

15-15: LGTM! Version bump appropriate for breaking change.

The bump to 0.13.0 correctly reflects that requiring JDK 17 is a breaking change that warrants a minor version increment.

nullaway/build.gradle (1)

115-115: LGTM! Test launcher correctly updated to Java 17.

This change is consistent with the PR objective and aligns with the same update in guava-recent-unit-tests.

build.gradle (2)

89-93: Verify issue #1398 documents the rationale for disabling these checks.

The disabled checks (PatternMatchingInstanceof, StatementSwitchToExpressionSwitch, MisformattedTestData) appear related to Java 17+ features. The PR description mentions follow-up issues #1396-#1399, which is good practice.

Please confirm that issue #1398 exists and documents why these checks are disabled and when they might be re-enabled.


123-124: LGTM! Core change to require Java 17 compilation target.

This is the primary change that enforces JDK 17 as the minimum runtime across the project (except for the annotations module, which correctly preserves Java 11 compatibility).

annotations/build.gradle (1)

26-30: LGTM! Critical backward compatibility preserved for annotations.

This correctly implements the PR objective to keep the annotations artifact at Java 11 compatibility. The comment clearly explains the rationale: clients may include annotations on their runtime classpath, so maintaining Java 11 compatibility avoids breaking those clients even though NullAway itself now requires JDK 17.

Comment thread jar-infer/test-android-lib-jarinfer/build.gradle Outdated
Comment thread sample-app/build.gradle Outdated
@msridhar msridhar enabled auto-merge (squash) December 23, 2025 18:23
@msridhar msridhar requested a review from yuxincs December 23, 2025 18:23
@msridhar msridhar merged commit 3fdd52b into master Dec 23, 2025
10 of 11 checks passed
@msridhar msridhar deleted the require-jdk-17 branch December 23, 2025 20:47
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