Closed pditommaso closed 4 months ago
It works with no problem using as simple project https://github.com/pditommaso/groovy-java21-poc
Wonder if it could be an error with the Grengine script parser
java.lang.NoClassDefFoundError: java/util/SequencedCollection
at nextflow.script.WorkflowDef.collectInputs(WorkflowDef.groovy:127)
at nextflow.script.WorkflowDef.run0(WorkflowDef.groovy:199)
at nextflow.script.WorkflowDef.run(WorkflowDef.groovy:188)
at nextflow.script.BindableDef.invoke_a(BindableDef.groovy:51)
at org.codehaus.groovy.vmplugin.v8.IndyInterface.fromCache(IndyInterface.java:321)
at nextflow.script.BaseScript.run0(BaseScript.groovy:198)
at org.codehaus.groovy.vmplugin.v8.IndyInterface.fromCache(IndyInterface.java:321)
at nextflow.script.BaseScript.run(BaseScript.groovy:209)
at nextflow.script.ScriptParser.runScript(ScriptParser.groovy:236)
at nextflow.script.ScriptRunner.run(ScriptRunner.groovy:243)
at nextflow.script.ScriptRunner.execute(ScriptRunner.groovy:138)
at nextflow.cli.CmdRun.run(CmdRun.groovy:372)
at nextflow.cli.Launcher.run(Launcher.groovy:503)
at nextflow.cli.Launcher.main(Launcher.groovy:657)
Caused by: java.lang.ClassNotFoundException: java.util.SequencedCollection
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:641)
at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:188)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521)
I've tried setting the script compiler target bytecode version, but still no joy https://github.com/nextflow-io/nextflow/pull/5030/commits/8bcdf49a700b74f5b738e179be48a40e21620269
Unable to replicate the problem with the POC.
It turns out ScriptParser
classes uses Groovy shell, as well
Ok, the problem is the @Delegate
annotation for List
Currently Nextflow runs on Java 11 and later up to Java 22 (included).
However the build process is still using Java 19 as defined by the following entry in the Gradle build
https://github.com/nextflow-io/nextflow/blob/de13de80b7f7eaf92e16893fb7b7fd30d539a005/build.gradle#L71-L71
The goal of this issue is to upgrade build toolchaing to Java 21 which enables the use of modern JVM features such as virtual threads.
However, when using any Java version >= 21 the following *runtime* error is reported:
This looks caused by the new
SequencedCollection
interface introduced in Java 21 that's retroffied in the collection API.Ideally the target compatibility setting should prevent this, but it looks it's ignored.
The following link reports a similar error in Clojure:
https://aphyr.com/posts/369-classnotfoundexception-java-util-sequencedcollection