Skip to content

kotlin script template tests are broken on Java 19 #29249

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
bclozel opened this issue Oct 4, 2022 · 2 comments
Closed

kotlin script template tests are broken on Java 19 #29249

bclozel opened this issue Oct 4, 2022 · 2 comments
Assignees
Labels
theme: kotlin An issue related to Kotlin support type: task A general task
Milestone

Comments

@bclozel
Copy link
Member

bclozel commented Oct 4, 2022

When running org.springframework.web.reactive.result.view.script.KotlinScriptTemplateTests on Java 19, we're getting the following failure:

Failed to evaluate script [org/springframework/web/reactive/result/view/script/kotlin/render.kts]
java.lang.IllegalStateException: Failed to evaluate script [org/springframework/web/reactive/result/view/script/kotlin/render.kts]
	at org.springframework.web.reactive.result.view.script.ScriptTemplateView.loadScripts(ScriptTemplateView.java:302)
	at org.springframework.web.reactive.result.view.script.ScriptTemplateView.createEngineFromName(ScriptTemplateView.java:276)
	at org.springframework.web.reactive.result.view.script.ScriptTemplateView.setApplicationContext(ScriptTemplateView.java:241)
	at org.springframework.web.reactive.result.view.script.KotlinScriptTemplateTests.createViewWithUrl(KotlinScriptTemplateTests.java:91)
	at org.springframework.web.reactive.result.view.script.KotlinScriptTemplateTests.render(KotlinScriptTemplateTests.java:78)
	at org.springframework.web.reactive.result.view.script.KotlinScriptTemplateTests.renderTemplateWithFrenchLocale(KotlinScriptTemplateTests.java:48)
	at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:104)
	at java.base/java.lang.reflect.Method.invoke(Method.java:578)
	at org.junit.platform.commons.util.ReflectionUtils.invokeMethod(ReflectionUtils.java:727)
	at org.junit.jupiter.engine.execution.MethodInvocation.proceed(MethodInvocation.java:60)
	at 
...
org.gradle.process.internal.worker.child.SystemApplicationClassLoaderWorker.call(SystemApplicationClassLoaderWorker.java:71)
	at worker.org.gradle.process.internal.worker.GradleWorkerMain.run(GradleWorkerMain.java:69)
	at worker.org.gradle.process.internal.worker.GradleWorkerMain.main(GradleWorkerMain.java:74)
Caused by: javax.script.ScriptException: ERROR Cannot inline bytecode built with JVM target 17 into bytecode that is being built with JVM target 1.8. Please specify proper '-jvm-target' option (ScriptingHost574059d5_Line_0.kts:11:58)
	at org.jetbrains.kotlin.cli.common.repl.KotlinJsr223JvmScriptEngineBase.asJsr223EvalResult(KotlinJsr223JvmScriptEngineBase.kt:104)
	at org.jetbrains.kotlin.cli.common.repl.KotlinJsr223JvmScriptEngineBase.compileAndEval(KotlinJsr223JvmScriptEngineBase.kt:63)
	at kotlin.script.experimental.jvmhost.jsr223.KotlinJsr223ScriptEngineImpl.compileAndEval(KotlinJsr223ScriptEngineImpl.kt:95)
	at org.jetbrains.kotlin.cli.common.repl.KotlinJsr223JvmScriptEngineBase.eval(KotlinJsr223JvmScriptEngineBase.kt:33)
	at java.scripting/javax.script.AbstractScriptEngine.eval(AbstractScriptEngine.java:247)
	at org.springframework.web.reactive.result.view.script.ScriptTemplateView.loadScripts(ScriptTemplateView.java:299)
	... 87 more

This can be reproduced by running ./gradlew :spring-webflux:check -PtestToolchain=19.
The same tests don't fail with Java 18, so this might be that Java 19 support is not there yet and it falls back to Java 1.8. Our toolchain configuration can be found here.

@bclozel bclozel added status: waiting-for-triage An issue we've not yet triaged or decided on type: bug A general bug theme: kotlin An issue related to Kotlin support labels Oct 4, 2022
@bclozel bclozel added this to the 6.0.x milestone Oct 4, 2022
@bclozel bclozel added type: task A general task and removed type: bug A general bug status: waiting-for-triage An issue we've not yet triaged or decided on labels Oct 4, 2022
@bclozel
Copy link
Member Author

bclozel commented Oct 5, 2022

We need to revert 7dd6afc when this is solved.

@sdeleuze sdeleuze modified the milestones: 6.0.x, 6.1.0-M1 Jan 19, 2023
@sdeleuze sdeleuze self-assigned this Jan 19, 2023
@sdeleuze
Copy link
Contributor

I think Kotlin 1.8 brings Java 19 support so I move this issue to 6.1 along to #29754.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
theme: kotlin An issue related to Kotlin support type: task A general task
Projects
None yet
Development

No branches or pull requests

2 participants