fix: target Kotlin 2.0, so the plugin is compatible with Gradle 8.3+#21
fix: target Kotlin 2.0, so the plugin is compatible with Gradle 8.3+#21vlsi wants to merge 1 commit into
Conversation
📝 WalkthroughWalkthroughThe 🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
📝 Coding Plan
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 Tip CodeRabbit can generate a title for your PR based on the changes.Add |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@build.gradle.kts`:
- Around line 48-55: The build config redundantly sets JVM target twice: inside
tasks.withType<KotlinJvmCompile>().configureEach you set
compilerOptions.jvmTarget and add "-Xjdk-release=17" while a jvmToolchain(17) is
already configured; to clean this up, remove the explicit
compilerOptions.jvmTarget and the "-Xjdk-release=17" entry (or keep them if you
intentionally want defensive explicitness), leaving
tasks.withType<KotlinJvmCompile>() and compilerOptions with only apiVersion and
languageVersion (KotlinVersion.KOTLIN_2_0) while relying on jvmToolchain(17) to
set the JVM target.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro
Run ID: bc9f72dd-a271-42a7-bdd4-23dcbf41a18c
📒 Files selected for processing (1)
build.gradle.kts
| tasks.withType<KotlinJvmCompile>().configureEach { | ||
| compilerOptions { | ||
| jvmTarget = JvmTarget.JVM_17 | ||
| freeCompilerArgs.add("-Xjdk-release=17") | ||
| apiVersion = KotlinVersion.KOTLIN_2_0 | ||
| languageVersion = KotlinVersion.KOTLIN_2_0 | ||
| } | ||
| } |
There was a problem hiding this comment.
🧹 Nitpick | 🔵 Trivial
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
# Description: Check the Kotlin Gradle Plugin version used in this project
# Check for Kotlin plugin version in version catalog
fd --type f "libs.versions.toml" --exec cat {}
# Also check if any explicit Kotlin version is set in build files
rg -n "kotlin.*version" --type kotlin --type groovyRepository: typetools/checker-framework-gradle-plugin
Length of output: 543
🏁 Script executed:
cat build.gradle.ktsRepository: typetools/checker-framework-gradle-plugin
Length of output: 3443
Configuration correctly targets Kotlin 2.0; minor JVM target redundancy exists.
The apiVersion and languageVersion settings correctly target Kotlin 2.0. The jvmTarget and -Xjdk-release=17 configuration is slightly redundant when jvmToolchain(17) (line 44) is already configured, as the toolchain infers the JVM target. However, this explicit configuration is defensive and acceptable if you prefer to ensure consistent behavior.
♻️ Optional: Remove redundant JVM target configuration
If you prefer a leaner configuration, you can rely on jvmToolchain(17) to set the JVM target:
tasks.withType<KotlinJvmCompile>().configureEach {
compilerOptions {
- jvmTarget = JvmTarget.JVM_17
- freeCompilerArgs.add("-Xjdk-release=17")
apiVersion = KotlinVersion.KOTLIN_2_0
languageVersion = KotlinVersion.KOTLIN_2_0
}
}The current explicit configuration is also valid if you want to ensure no ambiguity.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@build.gradle.kts` around lines 48 - 55, The build config redundantly sets JVM
target twice: inside tasks.withType<KotlinJvmCompile>().configureEach you set
compilerOptions.jvmTarget and add "-Xjdk-release=17" while a jvmToolchain(17) is
already configured; to clean this up, remove the explicit
compilerOptions.jvmTarget and the "-Xjdk-release=17" entry (or keep them if you
intentionally want defensive explicitness), leaving
tasks.withType<KotlinJvmCompile>() and compilerOptions with only apiVersion and
languageVersion (KotlinVersion.KOTLIN_2_0) while relying on jvmToolchain(17) to
set the JVM target.
|
|
||
| kotlin { jvmToolchain(17) } | ||
| kotlin { | ||
| jvmToolchain(17) |
There was a problem hiding this comment.
Note: Ideally, the build should use the latest JDK (e.g. Java 25) and target older bytecode/release. I did not modify the toolchain so far as it is not directly connected with the key change.
See https://docs.gradle.org/current/userguide/compatibility.html
Fixes #20