Skip to content

Commit 0140f95

Browse files
Target Java 17 as minimal Java version (#5045)
Signed-off-by: Paolo Di Tommaso <[email protected]> Signed-off-by: Ben Sherman <[email protected]> Co-authored-by: Ben Sherman <[email protected]>
1 parent 69d07db commit 0140f95

File tree

8 files changed

+58
-54
lines changed

8 files changed

+58
-54
lines changed

.github/workflows/build.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ jobs:
2525
strategy:
2626
fail-fast: false
2727
matrix:
28-
java_version: [11, 17, 23]
28+
java_version: [17, 23]
2929

3030
steps:
3131
- name: Environment
@@ -133,7 +133,7 @@ jobs:
133133
strategy:
134134
fail-fast: false
135135
matrix:
136-
java_version: [11, 23]
136+
java_version: [17, 23]
137137
test_mode: ["test_integration", "test_docs", "test_aws", "test_azure", "test_google", "test_wave"]
138138
steps:
139139
- name: Checkout

build.gradle

+3-4
Original file line numberDiff line numberDiff line change
@@ -73,12 +73,12 @@ allprojects {
7373
}
7474

7575
compileJava {
76-
options.release.set(11)
76+
options.release.set(17)
7777
}
7878

7979
tasks.withType(GroovyCompile) {
80-
sourceCompatibility = '11'
81-
targetCompatibility = '11'
80+
sourceCompatibility = '17'
81+
targetCompatibility = '17'
8282
}
8383

8484
idea {
@@ -147,7 +147,6 @@ allprojects {
147147
// Required to run tests on Java 9 and higher in compatibility mode
148148
tasks.withType(Test) {
149149
jvmArgs ([
150-
'-Dorg.spockframework.mock.ignoreByteBuddy=true',
151150
'--enable-preview',
152151
'--add-opens=java.base/java.lang=ALL-UNNAMED',
153152
'--add-opens=java.base/java.io=ALL-UNNAMED',

docs/install.md

+5-1
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,16 @@
66

77
## Requirements
88

9-
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:
9+
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:
1010

1111
```bash
1212
java -version
1313
```
1414

15+
:::{versionchanged} 24.11.0-edge
16+
Support for Java versions prior to 17 was dropped.
17+
:::
18+
1519
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.
1620

1721
To install Java with SDKMAN:

launch.sh

+3-3
Original file line numberDiff line numberDiff line change
@@ -66,13 +66,13 @@ fi
6666
JAVA_VER=$(echo "$JAVA_VER" | awk '/version/ {gsub(/"/, "", $3); print $3}')
6767
major=${BASH_REMATCH[1]}
6868
minor=${BASH_REMATCH[2]}
69-
version_check="^(1.8|9|10|11|12|13|14|15|16|17|18|19|20|21|22|23)"
69+
version_check="^(17|18|19|20|21|23)"
7070
if [[ ! $JAVA_VER =~ $version_check ]]; then
71-
echo "Error: cannot find Java or it's a wrong version -- please make sure that Java 8 or higher is installed"
71+
echo "Error: cannot find Java or it's a wrong version -- please make sure that Java 17 or higher is installed"
7272
exit 1
7373
fi
7474
JVM_ARGS+=" -Dfile.encoding=UTF-8 -XX:+TieredCompilation -XX:TieredStopAtLevel=1"
75-
[[ $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"
75+
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"
7676
[[ $NXF_ENABLE_VIRTUAL_THREADS == 'true' ]] && [[ "$JAVA_VER" =~ ^(19|20) ]] && JVM_ARGS+=" --enable-preview"
7777
[[ "$JAVA_VER" =~ ^(21) ]] && [[ ! "$NXF_ENABLE_VIRTUAL_THREADS" ]] && NXF_ENABLE_VIRTUAL_THREADS=true
7878

modules/nextflow/build.gradle

+4-4
Original file line numberDiff line numberDiff line change
@@ -54,10 +54,10 @@ dependencies {
5454

5555
// test configuration
5656
testFixturesApi ("org.apache.groovy:groovy-test:4.0.23") { exclude group: 'org.apache.groovy' }
57-
testFixturesApi ("cglib:cglib-nodep:3.3.0")
58-
testFixturesApi ("org.objenesis:objenesis:3.2")
59-
testFixturesApi ("org.spockframework:spock-core:2.3-groovy-4.0") { exclude group: 'org.apache.groovy'; exclude group: 'net.bytebuddy' }
60-
testFixturesApi ('org.spockframework:spock-junit4:2.3-groovy-4.0') { exclude group: 'org.apache.groovy'; exclude group: 'net.bytebuddy' }
57+
testFixturesApi ("org.objenesis:objenesis:3.4")
58+
testFixturesApi ("net.bytebuddy:byte-buddy:1.14.17")
59+
testFixturesApi ("org.spockframework:spock-core:2.3-groovy-4.0") { exclude group: 'org.apache.groovy' }
60+
testFixturesApi ('org.spockframework:spock-junit4:2.3-groovy-4.0') { exclude group: 'org.apache.groovy' }
6161
testFixturesApi 'com.google.jimfs:jimfs:1.2'
6262

6363
}

modules/nextflow/src/main/groovy/nextflow/scm/RepositoryProvider.groovy

+8-1
Original file line numberDiff line numberDiff line change
@@ -241,8 +241,15 @@ abstract class RepositoryProvider {
241241
}
242242
}
243243

244-
@Memoized
245244
protected <T> List<T> invokeAndResponseWithPaging(String request, Closure<T> parse) {
245+
// this is needed because apparently bytebuddy used by testing framework is not able
246+
// to handle properly this method signature using both generics and `@Memoized` annotation.
247+
// therefore the `@Memoized` has been moved to the inner method invocation
248+
return invokeAndResponseWithPaging0(request, parse)
249+
}
250+
251+
@Memoized
252+
protected List invokeAndResponseWithPaging0(String request, Closure parse) {
246253
int page = 0
247254
final result = new ArrayList()
248255
while( true ) {

nextflow

+24-37
Original file line numberDiff line numberDiff line change
@@ -313,7 +313,7 @@ if [ ! -x "$JAVA_CMD" ] ; then
313313
JAVA_CMD="$JAVA_HOME/bin/java"
314314
fi
315315
elif [ -x /usr/libexec/java_home ]; then
316-
JAVA_CMD="$(/usr/libexec/java_home -v 11+ 2>/dev/null)/bin/java" || JAVA_CMD=java
316+
JAVA_CMD="$(/usr/libexec/java_home -v 17+ 2>/dev/null)/bin/java" || JAVA_CMD=java
317317
else
318318
JAVA_CMD="$(which java)" || JAVA_CMD=java
319319
fi
@@ -344,14 +344,8 @@ else
344344
fi
345345
major=${BASH_REMATCH[1]}
346346
minor=${BASH_REMATCH[2]}
347-
# legacy version - Java 7/8 only
348-
if [ $major -eq 0 ] && [ $minor -lt 26 ]; then
349-
version_check="^(1.7|1.8)"
350-
version_message="Java 7 or 8"
351-
else
352-
version_check="^(1.8|9|10|11|12|13|14|15|16|17|18|19|20|21|22|23)"
353-
version_message="Java 8 or later (up to 22)"
354-
fi
347+
version_check="^(17|18|19|20|21|22|23)"
348+
version_message="Java 17 or later (up to 23)"
355349
if [[ ! $JAVA_VER =~ $version_check ]]; then
356350
echo_red "ERROR: Cannot find Java or it's a wrong version -- please make sure that $version_message is installed"
357351
if [[ "$NXF_JAVA_HOME" ]]; then
@@ -361,9 +355,6 @@ else
361355
fi
362356
exit 1
363357
fi
364-
if [[ ! $JAVA_VER =~ ^(11|12|13|14|15|16|17|18|19|20|21|22|23) ]]; then
365-
echo_yellow "NOTE: Nextflow is not tested with Java $JAVA_VER -- It's recommended the use of version 11 up to 23\n"
366-
fi
367358
mkdir -p "$(dirname "$JAVA_KEY")"
368359
[[ -f $JAVA_VER ]] && echo $JAVA_VER > "$JAVA_KEY"
369360
fi
@@ -461,33 +452,29 @@ else
461452
[[ "$NXF_JVM_ARGS" ]] && launcher+=($NXF_JVM_ARGS)
462453
[[ "$remote_debug" ]] && launcher+=(-agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=$NXF_REMOTE_DEBUG_PORT)
463454

464-
if [[ "$JAVA_VER" =~ ^(9|10|11|12|13|14|15|16|17|18|19|20|21|22|23) ]]; then
465-
launcher+=(--add-opens=java.base/java.lang=ALL-UNNAMED)
466-
launcher+=(--add-opens=java.base/java.io=ALL-UNNAMED)
467-
launcher+=(--add-opens=java.base/java.nio=ALL-UNNAMED)
468-
launcher+=(--add-opens=java.base/java.net=ALL-UNNAMED)
469-
launcher+=(--add-opens=java.base/java.util=ALL-UNNAMED)
470-
launcher+=(--add-opens=java.base/java.util.concurrent.locks=ALL-UNNAMED)
471-
launcher+=(--add-opens=java.base/java.util.concurrent.atomic=ALL-UNNAMED)
472-
launcher+=(--add-opens=java.base/java.nio.file.spi=ALL-UNNAMED)
473-
launcher+=(--add-opens=java.base/sun.nio.ch=ALL-UNNAMED)
474-
launcher+=(--add-opens=java.base/sun.nio.fs=ALL-UNNAMED)
475-
launcher+=(--add-opens=java.base/sun.net.www.protocol.http=ALL-UNNAMED)
476-
launcher+=(--add-opens=java.base/sun.net.www.protocol.https=ALL-UNNAMED)
477-
launcher+=(--add-opens=java.base/sun.net.www.protocol.ftp=ALL-UNNAMED)
478-
launcher+=(--add-opens=java.base/sun.net.www.protocol.file=ALL-UNNAMED)
479-
launcher+=(--add-opens=java.base/jdk.internal.misc=ALL-UNNAMED)
480-
launcher+=(--add-opens=java.base/jdk.internal.vm=ALL-UNNAMED)
481-
launcher+=(--add-opens=java.base/java.util.regex=ALL-UNNAMED)
482-
if [[ "$NXF_ENABLE_VIRTUAL_THREADS" == 'true' ]]; then
483-
if [[ "$JAVA_VER" =~ ^(19|20) ]]; then launcher+=(--enable-preview)
484-
elif [[ ! "$JAVA_VER" =~ ^(21|22|23) ]]; then die "Virtual threads require Java 19 or later - current version $JAVA_VER"
485-
fi
455+
launcher+=(--add-opens=java.base/java.lang=ALL-UNNAMED)
456+
launcher+=(--add-opens=java.base/java.io=ALL-UNNAMED)
457+
launcher+=(--add-opens=java.base/java.nio=ALL-UNNAMED)
458+
launcher+=(--add-opens=java.base/java.net=ALL-UNNAMED)
459+
launcher+=(--add-opens=java.base/java.util=ALL-UNNAMED)
460+
launcher+=(--add-opens=java.base/java.util.concurrent.locks=ALL-UNNAMED)
461+
launcher+=(--add-opens=java.base/java.util.concurrent.atomic=ALL-UNNAMED)
462+
launcher+=(--add-opens=java.base/java.nio.file.spi=ALL-UNNAMED)
463+
launcher+=(--add-opens=java.base/sun.nio.ch=ALL-UNNAMED)
464+
launcher+=(--add-opens=java.base/sun.nio.fs=ALL-UNNAMED)
465+
launcher+=(--add-opens=java.base/sun.net.www.protocol.http=ALL-UNNAMED)
466+
launcher+=(--add-opens=java.base/sun.net.www.protocol.https=ALL-UNNAMED)
467+
launcher+=(--add-opens=java.base/sun.net.www.protocol.ftp=ALL-UNNAMED)
468+
launcher+=(--add-opens=java.base/sun.net.www.protocol.file=ALL-UNNAMED)
469+
launcher+=(--add-opens=java.base/jdk.internal.misc=ALL-UNNAMED)
470+
launcher+=(--add-opens=java.base/jdk.internal.vm=ALL-UNNAMED)
471+
launcher+=(--add-opens=java.base/java.util.regex=ALL-UNNAMED)
472+
if [[ "$NXF_ENABLE_VIRTUAL_THREADS" == 'true' ]]; then
473+
if [[ "$JAVA_VER" =~ ^(19|20) ]]; then launcher+=(--enable-preview)
474+
elif [[ ! "$JAVA_VER" =~ ^(21|22|23) ]]; then die "Virtual threads require Java 19 or later - current version $JAVA_VER"
486475
fi
487-
launcher+=("${cmd_tail[@]}")
488-
else
489-
launcher+=("${cmd_tail[@]}")
490476
fi
477+
launcher+=("${cmd_tail[@]}")
491478

492479
# create the launch file only when using the legacy launcher (capsule)
493480
if [[ $NXF_LEGACY_LAUNCHER ]]; then

plugins/nf-azure/src/main/nextflow/cloud/azure/nio/AzFileSystem.groovy

+9-2
Original file line numberDiff line numberDiff line change
@@ -527,16 +527,23 @@ class AzFileSystem extends FileSystem {
527527
* @param cond A predicate that determines when a retry should be triggered
528528
* @return The {@link dev.failsafe.RetryPolicy} instance
529529
*/
530-
@Memoized
531530
protected <T> RetryPolicy<T> retryPolicy(Predicate<? extends Throwable> cond) {
531+
// this is needed because apparently bytebuddy used by testing framework is not able
532+
// to handle properly this method signature using both generics and `@Memoized` annotation.
533+
// therefore the `@Memoized` has been moved to the inner method invocation
534+
return (RetryPolicy<T>) retryPolicy0(cond)
535+
}
536+
537+
@Memoized
538+
protected RetryPolicy retryPolicy0(Predicate<? extends Throwable> cond) {
532539
final cfg = AzConfig.getConfig().retryConfig()
533540
final listener = new EventListener<ExecutionAttemptedEvent>() {
534541
@Override
535542
void accept(ExecutionAttemptedEvent event) throws Throwable {
536543
log.debug("Azure I/O exception - attempt: ${event.attemptCount}; cause: ${event.lastFailure?.message}")
537544
}
538545
}
539-
return RetryPolicy.<T>builder()
546+
return RetryPolicy.builder()
540547
.handleIf(cond)
541548
.withBackoff(cfg.delay.toMillis(), cfg.maxDelay.toMillis(), ChronoUnit.MILLIS)
542549
.withMaxAttempts(cfg.maxAttempts)

0 commit comments

Comments
 (0)