Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ test {
}

// Tasks for testing on other JDK versions; see https://jakewharton.com/build-on-latest-java-test-through-lowest-java/
[21].each { majorVersion ->
[21,26].each { majorVersion ->
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot Apr 13, 2026

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Read-only verification: check toolchain resolver + CI JDK 26 setup.
set -euo pipefail

echo "== settings.gradle* files =="
fd -i 'settings.gradle*' -x sed -n '1,220p' {}

echo
echo "== Toolchain-related config in Gradle files/properties =="
rg -n -C3 --iglob '*.gradle' --iglob '*.gradle.kts' --iglob 'gradle.properties' \
  'foojay|toolchainManagement|javaRepositories|javaToolchains|org\.gradle\.java\.installations|auto-download'

echo
echo "== CI workflow Java setup (looking for 26) =="
rg -n -C3 --iglob '*.yml' --iglob '*.yaml' \
  'actions/setup-java|java-version|distribution|temurin|zulu|26'

Repository: uber/NullAway

Length of output: 5555


🏁 Script executed:

# Check if any modules disable testJdk26 using onlyIf
rg -n 'testJdk26' --iglob '*.gradle' --iglob '*.gradle.kts' -A 3

Repository: uber/NullAway

Length of output: 39


🌐 Web query:

Foojay resolver Gradle plugin version 1.0.0 Java 26 support toolchain

💡 Result:

The Foojay resolver Gradle plugin version 1.0.0, released on May 19, 2025, supports Java toolchains via the Foojay Disco API. Java 26 reached general availability on March 17, 2026. The plugin resolves toolchains using the major Java version specified in the toolchain, querying the Disco API for matching distributions. No sources indicate limitations preventing Java 26 support; the plugin dynamically fetches available JDKs from the API, which tracks all OpenJDK builds including recent releases like Java 26. The plugin requires Gradle 7.6+ and Java 17+ to run. Usage example in settings.gradle.kts: plugins { id("org.gradle.toolchains.foojay-resolver-convention") version "1.0.0" } java { toolchain { languageVersion.set(JavaLanguageVersion.of(26)) } }

Citations:


🏁 Script executed:

# Search for onlyIf { false } pattern on test tasks to understand skip pattern
rg -n 'onlyIf\s*\{\s*false\s*\}' --iglob '*.gradle' --iglob '*.gradle.kts' -B 2

Repository: uber/NullAway

Length of output: 1468


🏁 Script executed:

# Check if any modules have JDK version constraints that would exclude JDK 26
rg -n 'sourceCompatibility|targetCompatibility|languageVersion' --iglob '*.gradle' --iglob '*.gradle.kts' | grep -E '(21|22|23|24|25)' | head -20

Repository: uber/NullAway

Length of output: 1973


🏁 Script executed:

# Check jdk-recent-unit-tests full build.gradle to understand its testing strategy
cat -n jdk-recent-unit-tests/build.gradle | head -80

Repository: uber/NullAway

Length of output: 2802


🏁 Script executed:

# Search for any conditional logic or patterns that might auto-skip newer JDK tests
rg -n 'testJdk' buildSrc/src/main/groovy/nullaway.java-test-conventions.gradle -A 5 -B 2

Repository: uber/NullAway

Length of output: 829


Add explicit testJdk26 disable to modules with fixed JDK targets, like jdk-recent-unit-tests.

Foojay resolver 1.0.0 properly provisions Java 26 toolchains via the Disco API; the shared convention's addition of testJdk26 won't cause CI hard-failures. However, jdk-recent-unit-tests explicitly targets JDK 25 and disables testJdk17 and testJdk21 to enforce this (per its comment "we only run on the recent JDK version specified above"). This module now inherits testJdk26 from the shared convention but does not disable it, breaking its module-specific JDK targeting. Add onlyIf { false } to testJdk26 in affected modules using fixed JDK versions.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@buildSrc/src/main/groovy/nullaway.java-test-conventions.gradle` at line 81,
The shared convention is enabling testJdk26 via the loop that registers JDK test
tasks (e.g., the block iterating [21,26].each { majorVersion -> ... } that
creates testJdk26), which causes modules that explicitly target a fixed JDK
(such as jdk-recent-unit-tests) to inherit it; update those module build scripts
that enforce a single recent JDK target to disable the inherited testJdk26 by
adding onlyIf { false } to the testJdk26 task registration (i.e., locate the
testJdk26 TaskProvider or task configuration in the module and append onlyIf {
false } so the task is skipped).

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

We should run jdk-recent-unit-tests on JDK 25 and newer. I'll clarify the comment to indicate this

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.

@msridhar, thanks for the clarification! That makes sense — jdk-recent-unit-tests is intended to run on JDK 25 and newer, so inheriting testJdk26 from the shared convention is exactly the right behavior. My concern was incorrect. Appreciate you updating the comment to make this intent clear.


✏️ Learnings added
Learnt from: msridhar
Repo: uber/NullAway PR: 1526
File: buildSrc/src/main/groovy/nullaway.java-test-conventions.gradle:0-0
Timestamp: 2026-04-13T19:39:37.891Z
Learning: In the NullAway repo, the `jdk-recent-unit-tests` module is intentionally run on JDK 25 AND all newer JDK versions (e.g., JDK 26). It should NOT disable newer JDK test tasks like `testJdk26` inherited from the shared `nullaway.java-test-conventions.gradle` convention. The module's purpose is to test on the latest/recent JDKs (25+), not exclusively on JDK 25.

Note: Learnings are effective only in the context of similar code segments. To apply general coding guidelines, please configure review instructions. You can manage existing learnings in the app.


🧠 Learnings used
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: 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.

Learnt from: CR
Repo: uber/NullAway PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-04-08T19:11:30.754Z
Learning: Run tests for the main NullAway module using `./gradlew :nullaway:test`; use `--tests` flag to run specific test classes or methods

def jdkTest = tasks.register("testJdk$majorVersion", Test) {
javaLauncher = javaToolchains.launcherFor {
languageVersion = JavaLanguageVersion.of(majorVersion)
Expand Down
2 changes: 1 addition & 1 deletion gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
asm = "9.3"
check-framework = "4.0.0"
support = "27.1.1"
wala = "1.6.12"
wala = "1.7.0"
Comment thread
msridhar marked this conversation as resolved.
commons-cli = "1.4"
auto-service = "1.1.1"
google-java-format = "1.34.1"
Expand Down
8 changes: 3 additions & 5 deletions jdk-recent-unit-tests/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,9 @@ tasks.withType(Test).configureEach { test ->
// Used by com.uber.nullaway.jdk17.NullAwayModuleInfoTests
"-Dtest.module.path=${configurations.testModulePath.asPath}"
]
// The test module jar is consumed via the synthetic module path above, so every
// JDK-specific Test task needs it built before execution.
dependsOn ':test-java-module:jar'
}

// Disable tasks for specific JDK versions; we only run on the recent JDK version specified above
Expand All @@ -60,8 +63,3 @@ tasks.getByName('testJdk17').configure {
tasks.getByName('testJdk21').configure {
onlyIf { false }
}

tasks.getByName('test').configure {
// we need this since we don't have an implementation / api dependence on test-java-module
dependsOn ':test-java-module:jar'
}
Loading