Add support for Kotlin JSR223 scripts#2898
Conversation
* Add required Kotlin dependencies into the `spring-integration-scripting` module * Introduce `KotlinScriptExecutor` to interact with the `KotlinJsr223JvmLocalScriptEngineFactory` directly since there is no `META-INF/services/javax.script.ScriptEngineFactory` file in the Kotlin * Also set an `idea.use.native.fs.for.win` system property to `false` in this class to disable check for native support on Windows. (Might be removed in future Kotlin versions) * Move `ScriptParser.getLanguageFromFileExtension()` logic into the `ScriptExecutorFactory.deriveLanguageFromFileExtension()` since the same one must be applied in the `DslScriptExecutingMessageProcessor`, too. * Modify tests to reflect Kotlin support * Fix some test scripts to their official extensions
garyrussell
left a comment
There was a problem hiding this comment.
Just one small issue.
| * @since 2.1 | ||
| */ | ||
| public abstract class ScriptExecutorFactory { | ||
| public final class ScriptExecutorFactory { |
| return engine.getFactory().getLanguageName(); | ||
| } | ||
|
|
||
| private ScriptExecutorFactory() { |
There was a problem hiding this comment.
Needs a private CTOR
Doesn't this work?
There was a problem hiding this comment.
But it needs super() to prevent Sonar from complaining.
There was a problem hiding this comment.
OK. Will add. Can we tweak Sonar do not complain on the matter?
There is definitely a super() in the target byte code, so it's complaining is pointless.
Or do I miss something else ?
There was a problem hiding this comment.
Adding super is a no-op - the compiler generates one anyway.
I don't think we want to disable empty block detection.
* Polishing according Sonar objections
Are you going to merge this? Or have you let it to me to squash and rebase? Thanks |
|
I was waiting for our friend Travis - merging now. |
spring-integration-scriptingmodule
KotlinScriptExecutorto interact with theKotlinJsr223JvmLocalScriptEngineFactorydirectly since there is noMETA-INF/services/javax.script.ScriptEngineFactoryfile in the Kotlinidea.use.native.fs.for.winsystem property tofalseinthis class to disable check for native support on Windows.
(Might be removed in future Kotlin versions)
ScriptParser.getLanguageFromFileExtension()logic into theScriptExecutorFactory.deriveLanguageFromFileExtension()since the sameone must be applied in the
DslScriptExecutingMessageProcessor, too.