diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 7ee5da7b8f..8e8f580e41 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -25,7 +25,7 @@ jobs: strategy: fail-fast: false matrix: - java_version: [11, 17, 23] + java_version: [17, 23] steps: - name: Environment @@ -133,7 +133,7 @@ jobs: strategy: fail-fast: false matrix: - java_version: [11, 23] + java_version: [17, 23] test_mode: ["test_integration", "test_docs", "test_aws", "test_azure", "test_google", "test_wave"] steps: - name: Checkout diff --git a/build.gradle b/build.gradle index a0740611ce..b9758294fd 100644 --- a/build.gradle +++ b/build.gradle @@ -73,12 +73,12 @@ allprojects { } compileJava { - options.release.set(11) + options.release.set(17) } tasks.withType(GroovyCompile) { - sourceCompatibility = '11' - targetCompatibility = '11' + sourceCompatibility = '17' + targetCompatibility = '17' } idea { @@ -147,7 +147,6 @@ allprojects { // Required to run tests on Java 9 and higher in compatibility mode tasks.withType(Test) { jvmArgs ([ - '-Dorg.spockframework.mock.ignoreByteBuddy=true', '--enable-preview', '--add-opens=java.base/java.lang=ALL-UNNAMED', '--add-opens=java.base/java.io=ALL-UNNAMED', diff --git a/docs/install.md b/docs/install.md index 75dc3bb513..efee6f883d 100644 --- a/docs/install.md +++ b/docs/install.md @@ -6,12 +6,16 @@ ## Requirements -Nextflow can be used on any POSIX-compatible system (Linux, macOS, etc), and on Windows through [WSL](https://en.wikipedia.org/wiki/Windows_Subsystem_for_Linux). It requires Bash 3.2 (or later) and [Java 11 (or later, up to 23)](http://www.oracle.com/technetwork/java/javase/downloads/index.html). You can see which version you have using the following command: +Nextflow can be used on any POSIX-compatible system (Linux, macOS, etc), and on Windows through [WSL](https://en.wikipedia.org/wiki/Windows_Subsystem_for_Linux). It requires Bash 3.2 (or later) and [Java 17 (or later, up to 23)](http://www.oracle.com/technetwork/java/javase/downloads/index.html) to be installed. You can see which version you have using the following command: ```bash java -version ``` +:::{versionchanged} 24.11.0-edge +Support for Java versions prior to 17 was dropped. +::: + If you don't have a compatible version of Java installed in your computer, it is recommended that you install it through [SDKMAN!](https://sdkman.io/), and that you use the latest LTS version of Temurin. See [this website](https://whichjdk.com/) for more information. To install Java with SDKMAN: diff --git a/launch.sh b/launch.sh index 28af024b3d..846eaf9eb6 100755 --- a/launch.sh +++ b/launch.sh @@ -66,13 +66,13 @@ fi JAVA_VER=$(echo "$JAVA_VER" | awk '/version/ {gsub(/"/, "", $3); print $3}') major=${BASH_REMATCH[1]} minor=${BASH_REMATCH[2]} -version_check="^(1.8|9|10|11|12|13|14|15|16|17|18|19|20|21|22|23)" +version_check="^(17|18|19|20|21|23)" if [[ ! $JAVA_VER =~ $version_check ]]; then - echo "Error: cannot find Java or it's a wrong version -- please make sure that Java 8 or higher is installed" + echo "Error: cannot find Java or it's a wrong version -- please make sure that Java 17 or higher is installed" exit 1 fi JVM_ARGS+=" -Dfile.encoding=UTF-8 -XX:+TieredCompilation -XX:TieredStopAtLevel=1" -[[ $JAVA_VER =~ ^(9|10|11|12|13|14|15|16|17|18|19|20|21|22|23) ]] && JVM_ARGS+=" --add-opens=java.base/java.lang=ALL-UNNAMED --add-opens=java.base/java.io=ALL-UNNAMED --add-opens=java.base/java.nio=ALL-UNNAMED --add-opens=java.base/java.net=ALL-UNNAMED --add-opens=java.base/java.nio.file.spi=ALL-UNNAMED --add-opens=java.base/java.util=ALL-UNNAMED --add-opens=java.base/java.util.concurrent.locks=ALL-UNNAMED --add-opens=java.base/java.util.concurrent.atomic=ALL-UNNAMED --add-opens=java.base/sun.nio.ch=ALL-UNNAMED --add-opens=java.base/sun.nio.fs=ALL-UNNAMED --add-opens=java.base/sun.net.www.protocol.http=ALL-UNNAMED --add-opens=java.base/sun.net.www.protocol.https=ALL-UNNAMED --add-opens=java.base/sun.net.www.protocol.ftp=ALL-UNNAMED --add-opens=java.base/sun.net.www.protocol.file=ALL-UNNAMED --add-opens=java.base/jdk.internal.misc=ALL-UNNAMED --add-opens=java.base/jdk.internal.vm=ALL-UNNAMED --add-opens=java.base/java.util.regex=ALL-UNNAMED" +JVM_ARGS+=" --add-opens=java.base/java.lang=ALL-UNNAMED --add-opens=java.base/java.io=ALL-UNNAMED --add-opens=java.base/java.nio=ALL-UNNAMED --add-opens=java.base/java.net=ALL-UNNAMED --add-opens=java.base/java.nio.file.spi=ALL-UNNAMED --add-opens=java.base/java.util=ALL-UNNAMED --add-opens=java.base/java.util.concurrent.locks=ALL-UNNAMED --add-opens=java.base/java.util.concurrent.atomic=ALL-UNNAMED --add-opens=java.base/sun.nio.ch=ALL-UNNAMED --add-opens=java.base/sun.nio.fs=ALL-UNNAMED --add-opens=java.base/sun.net.www.protocol.http=ALL-UNNAMED --add-opens=java.base/sun.net.www.protocol.https=ALL-UNNAMED --add-opens=java.base/sun.net.www.protocol.ftp=ALL-UNNAMED --add-opens=java.base/sun.net.www.protocol.file=ALL-UNNAMED --add-opens=java.base/jdk.internal.misc=ALL-UNNAMED --add-opens=java.base/jdk.internal.vm=ALL-UNNAMED --add-opens=java.base/java.util.regex=ALL-UNNAMED" [[ $NXF_ENABLE_VIRTUAL_THREADS == 'true' ]] && [[ "$JAVA_VER" =~ ^(19|20) ]] && JVM_ARGS+=" --enable-preview" [[ "$JAVA_VER" =~ ^(21) ]] && [[ ! "$NXF_ENABLE_VIRTUAL_THREADS" ]] && NXF_ENABLE_VIRTUAL_THREADS=true diff --git a/modules/nextflow/build.gradle b/modules/nextflow/build.gradle index d7e40cf9de..8a2c770e03 100644 --- a/modules/nextflow/build.gradle +++ b/modules/nextflow/build.gradle @@ -54,10 +54,10 @@ dependencies { // test configuration testFixturesApi ("org.apache.groovy:groovy-test:4.0.23") { exclude group: 'org.apache.groovy' } - testFixturesApi ("cglib:cglib-nodep:3.3.0") - testFixturesApi ("org.objenesis:objenesis:3.2") - testFixturesApi ("org.spockframework:spock-core:2.3-groovy-4.0") { exclude group: 'org.apache.groovy'; exclude group: 'net.bytebuddy' } - testFixturesApi ('org.spockframework:spock-junit4:2.3-groovy-4.0') { exclude group: 'org.apache.groovy'; exclude group: 'net.bytebuddy' } + testFixturesApi ("org.objenesis:objenesis:3.4") + testFixturesApi ("net.bytebuddy:byte-buddy:1.14.17") + testFixturesApi ("org.spockframework:spock-core:2.3-groovy-4.0") { exclude group: 'org.apache.groovy' } + testFixturesApi ('org.spockframework:spock-junit4:2.3-groovy-4.0') { exclude group: 'org.apache.groovy' } testFixturesApi 'com.google.jimfs:jimfs:1.2' } diff --git a/modules/nextflow/src/main/groovy/nextflow/scm/RepositoryProvider.groovy b/modules/nextflow/src/main/groovy/nextflow/scm/RepositoryProvider.groovy index 96a959c569..75a6d2798e 100644 --- a/modules/nextflow/src/main/groovy/nextflow/scm/RepositoryProvider.groovy +++ b/modules/nextflow/src/main/groovy/nextflow/scm/RepositoryProvider.groovy @@ -241,8 +241,15 @@ abstract class RepositoryProvider { } } - @Memoized protected List invokeAndResponseWithPaging(String request, Closure parse) { + // this is needed because apparently bytebuddy used by testing framework is not able + // to handle properly this method signature using both generics and `@Memoized` annotation. + // therefore the `@Memoized` has been moved to the inner method invocation + return invokeAndResponseWithPaging0(request, parse) + } + + @Memoized + protected List invokeAndResponseWithPaging0(String request, Closure parse) { int page = 0 final result = new ArrayList() while( true ) { diff --git a/nextflow b/nextflow index dc07de798c..5dbb589bdf 100755 --- a/nextflow +++ b/nextflow @@ -313,7 +313,7 @@ if [ ! -x "$JAVA_CMD" ] ; then JAVA_CMD="$JAVA_HOME/bin/java" fi elif [ -x /usr/libexec/java_home ]; then - JAVA_CMD="$(/usr/libexec/java_home -v 11+ 2>/dev/null)/bin/java" || JAVA_CMD=java + JAVA_CMD="$(/usr/libexec/java_home -v 17+ 2>/dev/null)/bin/java" || JAVA_CMD=java else JAVA_CMD="$(which java)" || JAVA_CMD=java fi @@ -344,14 +344,8 @@ else fi major=${BASH_REMATCH[1]} minor=${BASH_REMATCH[2]} - # legacy version - Java 7/8 only - if [ $major -eq 0 ] && [ $minor -lt 26 ]; then - version_check="^(1.7|1.8)" - version_message="Java 7 or 8" - else - version_check="^(1.8|9|10|11|12|13|14|15|16|17|18|19|20|21|22|23)" - version_message="Java 8 or later (up to 22)" - fi + version_check="^(17|18|19|20|21|22|23)" + version_message="Java 17 or later (up to 23)" if [[ ! $JAVA_VER =~ $version_check ]]; then echo_red "ERROR: Cannot find Java or it's a wrong version -- please make sure that $version_message is installed" if [[ "$NXF_JAVA_HOME" ]]; then @@ -361,9 +355,6 @@ else fi exit 1 fi - if [[ ! $JAVA_VER =~ ^(11|12|13|14|15|16|17|18|19|20|21|22|23) ]]; then - echo_yellow "NOTE: Nextflow is not tested with Java $JAVA_VER -- It's recommended the use of version 11 up to 23\n" - fi mkdir -p "$(dirname "$JAVA_KEY")" [[ -f $JAVA_VER ]] && echo $JAVA_VER > "$JAVA_KEY" fi @@ -461,33 +452,29 @@ else [[ "$NXF_JVM_ARGS" ]] && launcher+=($NXF_JVM_ARGS) [[ "$remote_debug" ]] && launcher+=(-agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=$NXF_REMOTE_DEBUG_PORT) - if [[ "$JAVA_VER" =~ ^(9|10|11|12|13|14|15|16|17|18|19|20|21|22|23) ]]; then - launcher+=(--add-opens=java.base/java.lang=ALL-UNNAMED) - launcher+=(--add-opens=java.base/java.io=ALL-UNNAMED) - launcher+=(--add-opens=java.base/java.nio=ALL-UNNAMED) - launcher+=(--add-opens=java.base/java.net=ALL-UNNAMED) - launcher+=(--add-opens=java.base/java.util=ALL-UNNAMED) - launcher+=(--add-opens=java.base/java.util.concurrent.locks=ALL-UNNAMED) - launcher+=(--add-opens=java.base/java.util.concurrent.atomic=ALL-UNNAMED) - launcher+=(--add-opens=java.base/java.nio.file.spi=ALL-UNNAMED) - launcher+=(--add-opens=java.base/sun.nio.ch=ALL-UNNAMED) - launcher+=(--add-opens=java.base/sun.nio.fs=ALL-UNNAMED) - launcher+=(--add-opens=java.base/sun.net.www.protocol.http=ALL-UNNAMED) - launcher+=(--add-opens=java.base/sun.net.www.protocol.https=ALL-UNNAMED) - launcher+=(--add-opens=java.base/sun.net.www.protocol.ftp=ALL-UNNAMED) - launcher+=(--add-opens=java.base/sun.net.www.protocol.file=ALL-UNNAMED) - launcher+=(--add-opens=java.base/jdk.internal.misc=ALL-UNNAMED) - launcher+=(--add-opens=java.base/jdk.internal.vm=ALL-UNNAMED) - launcher+=(--add-opens=java.base/java.util.regex=ALL-UNNAMED) - if [[ "$NXF_ENABLE_VIRTUAL_THREADS" == 'true' ]]; then - if [[ "$JAVA_VER" =~ ^(19|20) ]]; then launcher+=(--enable-preview) - elif [[ ! "$JAVA_VER" =~ ^(21|22|23) ]]; then die "Virtual threads require Java 19 or later - current version $JAVA_VER" - fi + launcher+=(--add-opens=java.base/java.lang=ALL-UNNAMED) + launcher+=(--add-opens=java.base/java.io=ALL-UNNAMED) + launcher+=(--add-opens=java.base/java.nio=ALL-UNNAMED) + launcher+=(--add-opens=java.base/java.net=ALL-UNNAMED) + launcher+=(--add-opens=java.base/java.util=ALL-UNNAMED) + launcher+=(--add-opens=java.base/java.util.concurrent.locks=ALL-UNNAMED) + launcher+=(--add-opens=java.base/java.util.concurrent.atomic=ALL-UNNAMED) + launcher+=(--add-opens=java.base/java.nio.file.spi=ALL-UNNAMED) + launcher+=(--add-opens=java.base/sun.nio.ch=ALL-UNNAMED) + launcher+=(--add-opens=java.base/sun.nio.fs=ALL-UNNAMED) + launcher+=(--add-opens=java.base/sun.net.www.protocol.http=ALL-UNNAMED) + launcher+=(--add-opens=java.base/sun.net.www.protocol.https=ALL-UNNAMED) + launcher+=(--add-opens=java.base/sun.net.www.protocol.ftp=ALL-UNNAMED) + launcher+=(--add-opens=java.base/sun.net.www.protocol.file=ALL-UNNAMED) + launcher+=(--add-opens=java.base/jdk.internal.misc=ALL-UNNAMED) + launcher+=(--add-opens=java.base/jdk.internal.vm=ALL-UNNAMED) + launcher+=(--add-opens=java.base/java.util.regex=ALL-UNNAMED) + if [[ "$NXF_ENABLE_VIRTUAL_THREADS" == 'true' ]]; then + if [[ "$JAVA_VER" =~ ^(19|20) ]]; then launcher+=(--enable-preview) + elif [[ ! "$JAVA_VER" =~ ^(21|22|23) ]]; then die "Virtual threads require Java 19 or later - current version $JAVA_VER" fi - launcher+=("${cmd_tail[@]}") - else - launcher+=("${cmd_tail[@]}") fi + launcher+=("${cmd_tail[@]}") # create the launch file only when using the legacy launcher (capsule) if [[ $NXF_LEGACY_LAUNCHER ]]; then diff --git a/plugins/nf-azure/src/main/nextflow/cloud/azure/nio/AzFileSystem.groovy b/plugins/nf-azure/src/main/nextflow/cloud/azure/nio/AzFileSystem.groovy index e890dbb559..41a1b62d4a 100644 --- a/plugins/nf-azure/src/main/nextflow/cloud/azure/nio/AzFileSystem.groovy +++ b/plugins/nf-azure/src/main/nextflow/cloud/azure/nio/AzFileSystem.groovy @@ -527,8 +527,15 @@ class AzFileSystem extends FileSystem { * @param cond A predicate that determines when a retry should be triggered * @return The {@link dev.failsafe.RetryPolicy} instance */ - @Memoized protected RetryPolicy retryPolicy(Predicate cond) { + // this is needed because apparently bytebuddy used by testing framework is not able + // to handle properly this method signature using both generics and `@Memoized` annotation. + // therefore the `@Memoized` has been moved to the inner method invocation + return (RetryPolicy) retryPolicy0(cond) + } + + @Memoized + protected RetryPolicy retryPolicy0(Predicate cond) { final cfg = AzConfig.getConfig().retryConfig() final listener = new EventListener() { @Override @@ -536,7 +543,7 @@ class AzFileSystem extends FileSystem { log.debug("Azure I/O exception - attempt: ${event.attemptCount}; cause: ${event.lastFailure?.message}") } } - return RetryPolicy.builder() + return RetryPolicy.builder() .handleIf(cond) .withBackoff(cfg.delay.toMillis(), cfg.maxDelay.toMillis(), ChronoUnit.MILLIS) .withMaxAttempts(cfg.maxAttempts)