Gavin Ray
01/23/2023, 2:49 PMval JDK_21_PATH = "/home/user/.sdkman/candidates/java/21.ea.6-open"
tasks.withType<org.jetbrains.kotlin.gradle.tasks.UsesKotlinJavaToolchain>().configureEach {
kotlinJavaToolchain.jdk.use(JDK_21_PATH, JavaVersion.VERSION_21)
}
Execution failed for task ':app:compileKotlin'.
> Error while evaluating property 'compilerOptions.jvmTarget' of task ':app:compileKotlin'.
> Failed to calculate the value of property 'jvmTarget'.
> Unknown Kotlin JVM target: 21
Foreign Function & Memory API
since it's significantly changed since JDK19 LTStapchicoma
01/23/2023, 2:54 PMJavaVersion.VERSION_21
was added in Gradle 7.6Gavin Ray
01/23/2023, 3:39 PMdistributionUrl=https\://services.gradle.org/distributions/gradle-8.0-rc-1-bin.zip
tapchicoma
01/23/2023, 3:41 PMJavaTarget.VERSION_19
as task input but still point to JDK 21 locationGavin Ray
01/23/2023, 3:42 PMtapchicoma
01/23/2023, 3:42 PMGavin Ray
01/23/2023, 3:42 PMval JDK_21_PATH = "/home/user/.sdkman/candidates/java/21.ea.6-open"
tasks.withType<org.jetbrains.kotlin.gradle.tasks.UsesKotlinJavaToolchain>().configureEach {
kotlinJavaToolchain.jdk.use(JDK_21_PATH, JavaVersion.VERSION_19)
}
tapchicoma
01/23/2023, 3:45 PMGavin Ray
01/23/2023, 3:45 PM[user@MSI bustub-kotlin]$ ./gradlew compileKotlin
> Task :app:compileKotlin FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:compileKotlin'.
> Error while evaluating property 'compilerOptions.jvmTarget' of task ':app:compileKotlin'.
> Failed to calculate the value of property 'jvmTarget'.
> Unknown Kotlin JVM target: 21
Caused by: java.lang.IllegalArgumentException: Unknown Kotlin JVM target: 21
at org.jetbrains.kotlin.gradle.dsl.JvmTarget$Companion.fromTarget(JvmTarget.kt:26)
at org.jetbrains.kotlin.gradle.tasks.DefaultKotlinJavaToolchain$wireJvmTargetToToolchain$1$1.invoke(DefaultKotlinJavaToolchain.kt:78)
at org.jetbrains.kotlin.gradle.tasks.DefaultKotlinJavaToolchain$wireJvmTargetToToolchain$1$1.invoke(DefaultKotlinJavaToolchain.kt:70)
at org.jetbrains.kotlin.gradle.tasks.DefaultKotlinJavaToolchain$sam$org_gradle_api_Transformer$0.transform(DefaultKotlinJavaToolchain.kt)
tapchicoma
01/23/2023, 3:48 PMJavaVersion.VERSION_19
for Jvm TargetGavin Ray
01/23/2023, 3:51 PMsdk install java 21.ea.6-open
and replace the path constant)tapchicoma
01/23/2023, 4:12 PMExecution failed for task ':app:compileKotlin'.
> 'compileJava' task (current target is 11) and 'compileKotlin' task (current target is 19) jvm target compatibility should be set to the same Java version.
Consider using JVM toolchain: <https://kotl.in/gradle/jvm/toolchain>
but it is possible to disable via kotlin.jvm.target.validation.mode=ignore
Gavin Ray
01/23/2023, 4:24 PMjava {
toolchain{
languageVersion.set(JavaLanguageVersion.of(21))
}
}
tapchicoma
01/23/2023, 4:29 PMGavin Ray
01/23/2023, 4:30 PMtapchicoma
01/23/2023, 4:30 PMApp.kt:12:26 Unresolved reference: MemorySession
Gavin Ray
01/23/2023, 4:30 PM