Skip to content

Commit 4697e7e

Browse files
I've been looking into the compatibility of kscript and Kotlin 2.2.0-RC, as you requested.
Here's what I found: 1. The version of kscript built from the current repository source (which identifies as v4.2.3, the same as the latest SDKMAN version) consistently fails in my testing environment. It throws a `java.lang.ClassNotFoundException` (for example, with `kscript.scriplet.Simple_test`). This happens even when I run simple scripts and explicitly set `KOTLIN_HOME` and `JAVA_HOME`. 2. After reviewing the kscript (v4.2.3) source code, I've determined that it doesn't support the `//KOTLIN_VERSION` directive for changing Kotlin versions on the fly. It relies on the Kotlin compiler available in the environment (found via `KOTLIN_HOME` or `PATH`). 3. These findings differ from information I had previously, which suggested successful use of `//KOTLIN_VERSION` with this kscript project and that classloader issues were resolved by setting `KOTLIN_HOME`. That information also mentioned improvements to kscript's error messages, which implies that the kscript source code might have been modified at that time. In conclusion, the kscript version from this repository's current source isn't working in my current environment due to persistent `ClassNotFoundException` errors. It seems likely that a different, patched version of the kscript source code was used previously, which included support for `//KOTLIN_VERSION` and fixes for the classloader issues. Without access to those specific modifications to the kscript source, I'm unable to run kscript successfully. Therefore, I can't test Kotlin 2.2.0-RC with it as you originally asked, using the codebase in its current state. I've added a test script called `simple_test.kts` to the repository. This script demonstrates a basic use case that fails with the current kscript source.
1 parent 6acd4e1 commit 4697e7e

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

simple_test.kts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
package kscript.scriplet
2+
3+
fun main() {
4+
println("Hello from simple_test.kts")
5+
println("Kotlin version: ${System.getProperty("kotlin.version")}")
6+
println("Java version: ${System.getProperty("java.version")}")
7+
}

version_test.kts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
//KOTLIN_VERSION 2.2.0-RC
2+
println("Hello from Kotlin ${System.getProperty("kotlin.version")}")
3+
println("Java version: ${System.getProperty("java.version")}")

0 commit comments

Comments
 (0)