Kotlin JSR223 Scripting

With the recent 1.8.0 release of Kotlin,
I create a Kotlin JSR223 Scripting Engine from a Java application with:

kotlinEngine = new ScriptEngineManager().getEngineByExtension(“main.kts”);

The engine is created, i.e. it is not null.

However, when I try to evaluate statements I get the following error:

ERROR Unable to initialize repl compiler:
DEBUG Using JVM IR backend
WARNING Using new faster version of JAR FS: it should make your build faster, but the new implementation is experimental
ERROR @NotNull method org/jetbrains/kotlin/config/CompilerConfiguration.getNotNull must not return null:

What happens?

What works for me is

import javax.script.ScriptEngine;
import javax.script.ScriptException;
import kotlin.script.experimental.jsr223.KotlinJsr223DefaultScriptEngineFactory;

...

ScriptEngine kotlinEngine = new KotlinJsr223DefaultScriptEngineFactory().getScriptEngine();

The dependencies are org.jetbrains.kotlin:kotlin-scripting-jsr223 and org.jetbrains.kotlin:kotlin-compiler-embeddable.

Is it specific to 1.8.0? I’m at 1.7.22. I tried it with 1.8.0-RC and it still works.

Do you have a minimal example reproducing the issue?

Is the code above worked for Android project?