Skip to content
Open
Changes from all commits
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
17 changes: 16 additions & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
import org.gradle.api.tasks.testing.logging.TestExceptionFormat
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
import org.jetbrains.kotlin.gradle.dsl.KotlinVersion
import org.jetbrains.kotlin.gradle.tasks.KotlinJvmCompile

plugins {
`kotlin-dsl`
Expand Down Expand Up @@ -37,7 +40,19 @@ gradlePlugin {
}
}

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.

coreLibrariesVersion = "2.0.0"
}

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

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.


testing {
suites {
Expand Down