Use the new CF plugin in the examples.#7474
Use the new CF plugin in the examples.#7474smillst wants to merge 2 commits intotypetools:masterfrom
Conversation
📝 WalkthroughWalkthroughThis PR updates Gradle build configuration in documentation examples. It bumps multiple plugins: the Error Prone plugin from 4.1.0 to 5.0.0, Lombok plugin from 8.10 to 9.2.0, and Checker Framework plugin from 0.6.49 to 1.0.0 across the example projects. The Error Prone core dependency is updated from 2.38.0 to 2.46.0. Explicit plugin applications and dependency declarations are replaced with simplified Checker Framework configuration blocks using local versioning. An empty settings.gradle file is added to the Lombok example directory. Possibly related PRs
Suggested reviewers
🚥 Pre-merge checks | ✅ 1✅ Passed checks (1 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
docs/examples/errorprone/build.gradle (1)
13-21:⚠️ Potential issue | 🔴 CriticalFix Error Prone version for Java 17/21 compatibility and correct the plugin declaration.
The else-branch cannot use
error_prone_core:2.46.0because it requires JDK 21+, not Java 17. The plugin version5.0.0does not exist in published repositories (latest is4.3.0).Either:
- Add a separate branch for Java 17 with a compatible Error Prone version (e.g.,
2.31.0), and use2.46.0only for Java 21+, or- Use a Java 17-compatible version for the else-branch (e.g.,
2.31.0).Additionally, correct the plugin declaration from
version("5.0.0")to an actual published version (e.g.,version("4.3.0")).If using
error_prone_core:2.46.0on JDK 21, add-XDaddTypeAnnotationsToSymbol=trueto the javac options.
🤖 Fix all issues with AI agents
In `@docs/examples/lombok/build.gradle`:
- Around line 11-13: Remove or update the stale commented block `lombok {
version = "1.18.30" }`: either delete that commented code since Lombok is now
configured in the `plugins {}` block, or replace it with a short clarifying
comment explaining how to override the Lombok version (e.g., indicate that
changing the version in `plugins { id "io.freefair.lombok" version "x.y.z" }` is
the correct approach). Ensure the file no longer contains the obsolete commented
`lombok` block so the example is not confusing.
- Around line 19-23: The checkerFramework block uses a nonstandard setting
version = "local" which only works when running the example from the repository
root using the repo's Gradle wrapper and included builds; update the example to
add an inline comment next to version = "local" (referencing the
checkerFramework configuration and the version = "local" line) that explains it
relies on the repo's included builds and must be run with the repo Gradle
wrapper, or alternatively expand the docs to show how to replace "local" with a
normal version string for running the example independently.
| //lombok { | ||
| // version = "1.18.30" | ||
| //} |
There was a problem hiding this comment.
🧹 Nitpick | 🔵 Trivial
Remove or update the stale commented Lombok block.
The commented lombok { version = "1.18.30" } looks obsolete now that the plugin version is set in plugins {}; consider removing it or clarifying how to override the Lombok version in this example.
♻️ Suggested cleanup
-//lombok {
-// version = "1.18.30"
-//}📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| //lombok { | |
| // version = "1.18.30" | |
| //} |
🤖 Prompt for AI Agents
In `@docs/examples/lombok/build.gradle` around lines 11 - 13, Remove or update the
stale commented block `lombok { version = "1.18.30" }`: either delete that
commented code since Lombok is now configured in the `plugins {}` block, or
replace it with a short clarifying comment explaining how to override the Lombok
version (e.g., indicate that changing the version in `plugins { id
"io.freefair.lombok" version "x.y.z" }` is the correct approach). Ensure the
file no longer contains the obsolete commented `lombok` block so the example is
not confusing.
| checkerFramework { | ||
| version = "local" | ||
| checkers = [ | ||
| "org.checkerframework.checker.nullness.NullnessChecker", | ||
| ] |
There was a problem hiding this comment.
🧩 Analysis chain
🏁 Script executed:
# First, let's find the build.gradle file and read it
find . -path "*/examples/lombok/build.gradle" -type fRepository: typetools/checker-framework
Length of output: 106
🏁 Script executed:
# Let's also check the directory structure around this file
ls -la docs/examples/lombok/ 2>/dev/null || find . -path "*/examples/lombok" -type dRepository: typetools/checker-framework
Length of output: 414
🏁 Script executed:
# Search for any composite build or included build configuration
rg "includeBuild|composite" --type gradle --max-count 20Repository: typetools/checker-framework
Length of output: 53
🏁 Script executed:
# Search for documentation about the checkerFramework version configuration
rg "version.*local" --type gradle -B 2 -A 2Repository: typetools/checker-framework
Length of output: 665
🌐 Web query:
Checker Framework Gradle plugin version "local" configuration documentation
💡 Result:
The Checker Framework Gradle plugin (id("org.checkerframework")) does not document any version = "local" (or similar) extension setting. Instead, its documentation describes two “local” options:
- Use a locally published Checker Framework (via
mavenLocal())
- Publish CF to your local Maven repo, then add
mavenLocal()and depend on the desired CF version via thecheckerFramework(...)/compileOnly(...)coordinates. (github.com)
- Use a locally built (unpublished) Checker Framework build (
-PcfLocal)
- Run Gradle with
-PcfLocal, setCHECKERFRAMEWORKto your CF checkout/build directory, and the plugin will use the JARs from that location (as shown in the README snippet). (github.com)
If what you meant by "local" is using a locally built copy of the plugin itself, the README documents publishing the plugin to mavenLocal() and adding mavenLocal() under pluginManagement { repositories { ... } } in settings.gradle. (github.com)
Citations:
- 1: https://github.com/kelloggm/checkerframework-gradle-plugin?utm_source=openai
- 2: https://github.com/kelloggm/checkerframework-gradle-plugin?utm_source=openai
- 3: https://github.com/kelloggm/checkerframework-gradle-plugin?utm_source=openai
🏁 Script executed:
# Read the build.gradle file with line numbers
cat -n docs/examples/lombok/build.gradleRepository: typetools/checker-framework
Length of output: 743
🏁 Script executed:
# Read the settings.gradle file
cat -n docs/examples/lombok/settings.gradleRepository: typetools/checker-framework
Length of output: 78
🏁 Script executed:
# Check for README or documentation files in the examples directory
ls -la docs/examples/lombok/Repository: typetools/checker-framework
Length of output: 414
🏁 Script executed:
# Check the root settings.gradle for composite build setup
cat -n settings.gradle | head -50Repository: typetools/checker-framework
Length of output: 596
🏁 Script executed:
# Look for any documentation about the examples or local version setup
find docs/examples -name "README*" -o -name "*.md" | head -10Repository: typetools/checker-framework
Length of output: 249
🏁 Script executed:
# Read the Makefile to understand how this example is meant to be run
cat -n docs/examples/lombok/MakefileRepository: typetools/checker-framework
Length of output: 1214
🏁 Script executed:
# Check if there's a README in the root docs/examples directory
ls -la docs/examples/Repository: typetools/checker-framework
Length of output: 1122
🏁 Script executed:
# Search for any documentation about examples or "local" version in the repo
rg "local.*build|composite.*build" --type md --max-count 20Repository: typetools/checker-framework
Length of output: 53
🏁 Script executed:
# Look for documentation in build files about version = "local"
rg "version.*=.*local" -B 5 -A 2 --type gradleRepository: typetools/checker-framework
Length of output: 949
🏁 Script executed:
# Search for the checkerframework gradle plugin implementation in the repo
find . -name "*gradle*plugin*" -o -name "checkerframework*.gradle" | head -20Repository: typetools/checker-framework
Length of output: 53
🏁 Script executed:
# Look for the plugin definition or version handling
rg "class.*CheckerFramework|extension\|version" --type kotlin --type java | grep -i checker | head -20Repository: typetools/checker-framework
Length of output: 3503
🏁 Script executed:
# Check build folder or plugin source
find . -path "*/plugin*" -name "*.kt" -o -name "*.java" | grep -i checker | head -10Repository: typetools/checker-framework
Length of output: 1074
🌐 Web query:
checkerframework-gradle-plugin "version = local" implementation
💡 Result:
checkerframework-gradle-plugin does not support version = "local" as a special value. To use a locally built plugin you have two standard Gradle options:
Option A (recommended): composite build (no version in plugins {})
- Clone/build the plugin locally.
- In your consumer project’s
settings.gradle(.kts):
pluginManagement {
includeBuild("../checkerframework-gradle-plugin")
repositories {
gradlePluginPortal()
}
}- In your consumer project’s
build.gradle(.kts):
plugins {
id("org.checkerframework")
}Gradle resolves the plugin from the included build, so you must not specify a version here. [2], [3]
Option B: publish to mavenLocal() (use a real version string)
- In the plugin repo:
./gradlew publishToMavenLocal- In the consumer project’s
settings.gradle(.kts):
pluginManagement {
repositories {
mavenLocal()
gradlePluginPortal()
}
}- Apply with an actual published version (whatever the plugin build published), e.g.:
plugins {
id("org.checkerframework") version "0.6.61"
}(0.6.61 is the current portal version; your local publish may be a different version.) [1], [2]
If you meant implementation(...) (for convention plugins / build-logic)
Use the plugin marker artifact (again, with a real version):
dependencies {
implementation("org.checkerframework:org.checkerframework.gradle.plugin:0.6.61")
}[1]
🏁 Script executed:
# Search for checkerframework plugin source or implementation that handles version property
rg "version" docs/examples/lombok/build.gradle -B 2 -A 2Repository: typetools/checker-framework
Length of output: 391
🏁 Script executed:
# Look for documentation or comments in build files about how version "local" works
rg "local|version" docs/ --type gradle -B 3 -A 1 | grep -A 5 -B 5 "local"Repository: typetools/checker-framework
Length of output: 828
🏁 Script executed:
# Check if there's a gradle plugin build in the repo
find . -path "*gradle*plugin*" -name "build.gradle*" 2>/dev/null | head -5Repository: typetools/checker-framework
Length of output: 53
🌐 Web query:
checkerframework-gradle-plugin extension configuration version property documentation
💡 Result:
The org.checkerframework Gradle plugin (kelloggm/checkerframework-gradle-plugin) does not document an extension property like checkerFramework { version = "…" } / checkerFrameworkVersion for selecting the Checker Framework version. Instead, you set the Checker Framework version by declaring explicit dependencies (which override the plugin’s default CF version). [1]
Example (Gradle Kotlin DSL equivalent in Groovy is analogous):
dependencies {
compileOnly("org.checkerframework:checker-qual:3.4.0")
testCompileOnly("org.checkerframework:checker-qual:3.4.0")
checkerFramework("org.checkerframework:checker:3.4.0")
}This is the approach shown in the plugin’s README under “Specifying a Checker Framework version”. [1]
(Separately, the plugin’s own version is set in the plugins {} block, e.g. id("org.checkerframework") version "0.6.61". [2])
Sources: [1] [2]
Add documentation explaining version = "local" in the Checker Framework configuration.
The checkerFramework { version = "local" } setting relies on the Checker Framework's included builds in the root project and only works when the example is executed from within the repository using the repo's Gradle wrapper. This configuration is not standard in the Checker Framework Gradle plugin documentation and will confuse users attempting to run the example independently.
Add an inline comment (e.g., // Uses the Checker Framework built in the repo's included builds) or update documentation to clarify this requirement.
🤖 Prompt for AI Agents
In `@docs/examples/lombok/build.gradle` around lines 19 - 23, The checkerFramework
block uses a nonstandard setting version = "local" which only works when running
the example from the repository root using the repo's Gradle wrapper and
included builds; update the example to add an inline comment next to version =
"local" (referencing the checkerFramework configuration and the version =
"local" line) that explains it relies on the repo's included builds and must be
run with the repo Gradle wrapper, or alternatively expand the docs to show how
to replace "local" with a normal version string for running the example
independently.
No description provided.