Upgrade to Kotlin 1.8.20

* Fix Scripting module to rely on the `kotlin-scripting-jsr223` instead
* Deprecate `KotlinScriptExecutor` in favor of `DefaultScriptExecutor` with `kotlin` as lang
This commit is contained in:
Artem Bilan
2024-02-16 19:07:10 -05:00
parent c6e62172c1
commit e21de19f67
5 changed files with 15 additions and 42 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2019 the original author or authors.
* Copyright 2019-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -18,29 +18,24 @@ package org.springframework.integration.scripting.jsr223;
import javax.script.Bindings;
import javax.script.ScriptEngine;
import org.jetbrains.kotlin.script.jsr223.KotlinJsr223JvmLocalScriptEngineFactory;
import javax.script.ScriptEngineManager;
/**
* An {@link AbstractScriptExecutor} for the Kotlin scripts support.
* Uses {@link KotlinJsr223JvmLocalScriptEngineFactory} directly since there is
* no {@code META-INF/services/javax.script.ScriptEngineFactory} file in CLASSPATH.
* Also sets an {@code idea.use.native.fs.for.win} system property to {@code false}
* to disable a native engine discovery for Windows: bay be resolved in the future Kotlin versions.
*
* @author Artem Bilan
*
* @since 5.2
*
* @deprecated since 6.1.6 in favor of {@link DefaultScriptExecutor} with {@code kotlin}
* as an argument.
*/
@Deprecated(since = "6.1.6", forRemoval = true)
public class KotlinScriptExecutor extends AbstractScriptExecutor {
static {
System.setProperty("idea.use.native.fs.for.win", "false");
}
public KotlinScriptExecutor() {
super(new KotlinJsr223JvmLocalScriptEngineFactory().getScriptEngine());
super(new ScriptEngineManager().getEngineByName("kotlin"));
}
@Override

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2022 the original author or authors.
* Copyright 2002-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -40,9 +40,6 @@ public final class ScriptExecutorFactory {
else if (language.equalsIgnoreCase("ruby") || language.equalsIgnoreCase("jruby")) {
return new RubyScriptExecutor();
}
else if (language.equalsIgnoreCase("kotlin")) {
return new KotlinScriptExecutor();
}
else if (language.equalsIgnoreCase("js") || language.equalsIgnoreCase("javascript")) {
return new PolyglotScriptExecutor("js");
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2022 the original author or authors.
* Copyright 2002-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -48,7 +48,7 @@ public class DeriveLanguageFromExtensionTests {
RubyScriptExecutor.class,
DefaultScriptExecutor.class,
PythonScriptExecutor.class,
KotlinScriptExecutor.class
DefaultScriptExecutor.class
};
Map<String, ScriptExecutingMessageProcessor> scriptProcessors =