Skip to content

Use Error Prone 2.46.0#7437

Closed
mernst wants to merge 1 commit intotypetools:masterfrom
mernst:errorprone-2460
Closed

Use Error Prone 2.46.0#7437
mernst wants to merge 1 commit intotypetools:masterfrom
mernst:errorprone-2460

Conversation

@mernst
Copy link
Copy Markdown
Member

@mernst mernst commented Jan 9, 2026

No description provided.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Jan 9, 2026

📝 Walkthrough

Walkthrough

This pull request updates the Error Prone annotations library dependency from version 2.45.0 to 2.46.0 in the Gradle version catalog. Additionally, it adds a Java 21-specific compiler argument -XDaddTypeAnnotationsToSymbol=true to the build configuration during the afterEvaluate phase. The build.gradle file also includes a capitalization fix in a comment describing Error Prone usage.

Possibly related PRs

  • Require Java 21 to run Error Prone #7345: Modifies build.gradle to configure Error Prone behavior specifically for Java 21 compilation, sharing the same focus on Java 21-specific Error Prone configuration.

Suggested reviewers

  • smillst
🚥 Pre-merge checks | ✅ 1
✅ Passed checks (1 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


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

🤖 Fix all issues with AI agents
In @build.gradle:
- Around line 591-593: Add an inline comment above the JavaVersion.current() ==
JavaVersion.VERSION_21 check explaining that Error Prone 2.46.0 requires the
"-XDaddTypeAnnotationsToSymbol=true" javac flag on JDK 21 to enable the javac
fix for JDK-8225377; reference the Error Prone v2.46.0 release and note that the
equality check (== JavaVersion.VERSION_21) is intentional because this flag is
only needed for JDK 21.

In @gradle/libs.versions.toml:
- Line 31: The libs.versions.toml update only bumped error-prone-annotations to
2.46.0 but left error-prone-core at 2.45.0, causing a version/ABI mismatch;
update the error-prone-core entry (symbol: error-prone-core) in
gradle/libs.versions.toml to use com.google.errorprone:error_prone_core:2.46.0
so it matches error-prone-annotations:2.46.0.
📜 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 aaf33ab and 0e49830.

📒 Files selected for processing (2)
  • build.gradle
  • gradle/libs.versions.toml
🧰 Additional context used
🧠 Learnings (1)
📓 Common learnings
Learnt from: mernst
Repo: typetools/checker-framework PR: 7354
File: annotation-file-utilities/tests/LocalMultipleManyMethodsShifted.java:14-14
Timestamp: 2025-11-02T02:18:00.536Z
Learning: In the Checker Framework repository, when doing refactoring PRs (such as preferring isEmpty() over size() comparisons), test files should not be changed. Tests should remain stable to preserve their exact patterns for annotation processing and bytecode verification purposes.
🔇 Additional comments (1)
build.gradle (1)

205-205: LGTM: Comment capitalization improvement.

The capitalization fix to "Error Prone" improves consistency with the proper product name.

Comment thread build.gradle
Comment on lines +591 to +593
if (JavaVersion.current() == JavaVersion.VERSION_21) {
options.compilerArgs << "-XDaddTypeAnnotationsToSymbol=true"
}
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.

⚠️ Potential issue | 🟡 Minor

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Search for the specific flag and any related documentation
rg -n "addTypeAnnotationsToSymbol" -A 5 -B 5

# Search for broader context about Error Prone 2.46.0 in build.gradle
rg -n "errorprone" -i -A 2 -B 2 build.gradle

# Search for any TODO/FIXME related to Error Prone or Java 21/22
rg -n "TODO|FIXME" build.gradle | head -20

# Check if there are version checks for Java 22
rg -n "VERSION_22|VERSION_2[2-9]|JavaVersion.current()" build.gradle

Repository: typetools/checker-framework

Length of output: 3813


🌐 Web query:

Error Prone 2.46.0 release notes Java 21 compatibility flag

💡 Result:

Error Prone 2.46.0 requires running javac with the flag:
-XDaddTypeAnnotationsToSymbol=true
when invoking Error Prone on JDK 21 (enables the javac fix for JDK-8225377). [1][2]

Sources:
[1] Error Prone 2.46.0 release notes. [2] Release notes summary (shows the same requirement).


Add an inline comment explaining the Error Prone 2.46.0 requirement for this flag.

This flag is correctly scoped to Java 21 per Error Prone 2.46.0 release notes, which requires -XDaddTypeAnnotationsToSymbol=true to enable the javac fix for JDK-8225377 on JDK 21. The exact version match (==) is appropriate since this is a JDK 21-specific requirement and not needed for Java 22+.

For clarity, consider adding a comment in build.gradle referencing the Error Prone 2.46.0 requirement (similar to the existing comment at line 588), for example:

Suggested comment addition
if (JavaVersion.current() == JavaVersion.VERSION_21) {
  // https://github.com/google/error-prone/releases/tag/v2.46.0
  // Error Prone 2.46.0 requires this flag for JDK 21 to enable javac fix for JDK-8225377
  options.compilerArgs << "-XDaddTypeAnnotationsToSymbol=true"
}
🤖 Prompt for AI Agents
In @build.gradle around lines 591 - 593, Add an inline comment above the
JavaVersion.current() == JavaVersion.VERSION_21 check explaining that Error
Prone 2.46.0 requires the "-XDaddTypeAnnotationsToSymbol=true" javac flag on JDK
21 to enable the javac fix for JDK-8225377; reference the Error Prone v2.46.0
release and note that the equality check (== JavaVersion.VERSION_21) is
intentional because this flag is only needed for JDK 21.

Comment thread gradle/libs.versions.toml
require-javadoc = "org.plumelib:require-javadoc:2.0.0"

error-prone-annotations = "com.google.errorprone:error_prone_annotations:2.45.0"
error-prone-annotations = "com.google.errorprone:error_prone_annotations:2.46.0"
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.

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Check current Error Prone library versions in gradle/libs.versions.toml
cat gradle/libs.versions.toml | grep -i "error.prone" -A 0 -B 0

Repository: typetools/checker-framework

Length of output: 221


🏁 Script executed:

#!/bin/bash
# Search for error-prone references across gradle files to understand usage
find . -name "*.gradle" -o -name "*.gradle.kts" -o -name "*.toml" | head -20

Repository: typetools/checker-framework

Length of output: 608


🌐 Web query:

Error Prone 2.46.0 release artifacts compatibility error_prone_core error_prone_annotations

💡 Result:

Short answer: this is caused by a version/ABI mismatch — error_prone_core 2.46.0 expects the matching error_prone_annotations (and related annotation/type-annotation artifacts) from the same 2.46.0 release and includes JDK-21-specific behavior (requires a javac flag). Fix by using the matching 2.46.0 artifacts and, if compiling on JDK 21, add the required javac flag.

What to do

  • Ensure your build depends on the same Error Prone release for core and annotations (com.google.errorprone:error_prone_core:2.46.0 and com.google.errorprone:error_prone_annotations:2.46.0). [1][2]
  • If you use JDK 21, add -XDaddTypeAnnotationsToSymbol=true to javac when invoking Error Prone (release note requirement). [1][3]
  • Clean your build tool cache (Gradle/Maven) after changing versions to avoid mixed artifacts.
  • If you use a Gradle/ErrorProne plugin, pin the plugin/dependency versions instead of ranges (avoid 2.+ or latest.release). [4]

References

  • Error Prone 2.46.0 release notes (JDK-21 flag and changes). [1]
  • Example dependency bumps updating error_prone_core → 2.46.0. [2]
  • Example dependency bumps updating error_prone_annotations → 2.46.0. [3]
  • Gradle errorprone plugin guidance (how to declare the error_prone dependency). [4]

If you want, paste your build.gradle / pom.xml and the exact error message and I’ll show the precise changes.


🏁 Script executed:

#!/bin/bash
# Check which gradle files reference error-prone-core or error-prone-annotations
rg "error.prone.core|error.prone.annotations" --type gradle -l

Repository: typetools/checker-framework

Length of output: 121


🏁 Script executed:

#!/bin/bash
# Get more details on how error-prone is used in the build configuration
rg "errorprone" gradle/libs.versions.toml -A 2 -B 2

Repository: typetools/checker-framework

Length of output: 829


Update error-prone-core to 2.46.0 to match error-prone-annotations.

The PR title indicates "Use Error Prone 2.46.0", but only error-prone-annotations was updated to 2.46.0 while error-prone-core remains at 2.45.0. According to Error Prone's release requirements, error-prone-core 2.46.0 expects matching error-prone-annotations:2.46.0 to avoid version/ABI mismatches. This partial update can cause compatibility issues.

Update line 25 to error-prone-core = "com.google.errorprone:error_prone_core:2.46.0" to match the annotated version update.

🤖 Prompt for AI Agents
In @gradle/libs.versions.toml at line 31, The libs.versions.toml update only
bumped error-prone-annotations to 2.46.0 but left error-prone-core at 2.45.0,
causing a version/ABI mismatch; update the error-prone-core entry (symbol:
error-prone-core) in gradle/libs.versions.toml to use
com.google.errorprone:error_prone_core:2.46.0 so it matches
error-prone-annotations:2.46.0.

@mernst mernst closed this Jan 9, 2026
@mernst mernst deleted the errorprone-2460 branch January 9, 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.

1 participant