Skip to content

fix: target Kotlin 2.0, so the plugin is compatible with Gradle 8.3+#21

Open
vlsi wants to merge 1 commit into
typetools:mainfrom
vlsi:kotlin2
Open

fix: target Kotlin 2.0, so the plugin is compatible with Gradle 8.3+#21
vlsi wants to merge 1 commit into
typetools:mainfrom
vlsi:kotlin2

Conversation

@vlsi

@vlsi vlsi commented Mar 20, 2026

Copy link
Copy Markdown

@coderabbitai

coderabbitai Bot commented Mar 20, 2026

Copy link
Copy Markdown
📝 Walkthrough

Walkthrough

The build.gradle.kts file is updated to configure Kotlin compiler settings. The changes set the core libraries version to 2.0.0, configure all KotlinJvmCompile tasks with an explicit JVM target of 17, add the -Xjdk-release=17 flag to compiler arguments, and set both the API and language versions to Kotlin 2.0. These modifications ensure consistent compiler behavior across Kotlin compilation tasks.

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Linked Issues check ✅ Passed The pull request correctly targets Kotlin 2.0 by setting coreLibrariesVersion, apiVersion, and languageVersion as required in issue #20 to ensure Gradle 8.3+ compatibility.
Out of Scope Changes check ✅ Passed All changes are scoped to Kotlin compiler configuration in build.gradle.kts with no unrelated modifications introduced.
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.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
📝 Coding Plan
  • Generate coding plan for human review comments

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.

Tip

CodeRabbit can generate a title for your PR based on the changes.

Add @coderabbitai placeholder anywhere in the title of your PR and CodeRabbit will replace it with a title based on the changes in the PR. You can change the placeholder by changing the reviews.auto_title_placeholder setting.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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

📥 Commits

Reviewing files that changed from the base of the PR and between 6815333 and d51167b.

📒 Files selected for processing (1)
  • build.gradle.kts

Comment thread build.gradle.kts
Comment on lines +48 to +55
tasks.withType<KotlinJvmCompile>().configureEach {
compilerOptions {
jvmTarget = JvmTarget.JVM_17
freeCompilerArgs.add("-Xjdk-release=17")
apiVersion = KotlinVersion.KOTLIN_2_0
languageVersion = KotlinVersion.KOTLIN_2_0
}
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🧹 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 groovy

Repository: typetools/checker-framework-gradle-plugin

Length of output: 543


🏁 Script executed:

cat build.gradle.kts

Repository: 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.

Comment thread build.gradle.kts

kotlin { jvmToolchain(17) }
kotlin {
jvmToolchain(17)

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

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.

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.

Target older Kotlin stdlib to support Gradle 8.14

1 participant