Skip to content

Commit 47e17c9

Browse files
authored
Merge branch 'junit-team:main' into file_source_reuse
2 parents ac5529c + 4bbe57d commit 47e17c9

File tree

157 files changed

+507
-455
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

157 files changed

+507
-455
lines changed

.github/actions/run-gradle/action.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ runs:
1515
id: setup-gradle-jdk
1616
with:
1717
distribution: temurin
18-
java-version: 21
18+
java-version: 24
1919
check-latest: true
2020
- uses: gradle/actions/setup-gradle@8379f6a1328ee0e06e2bb424dadb7b159856a326 # v4.4.0
2121
with:

.github/workflows/cross-version.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,6 @@ jobs:
2222
fail-fast: false
2323
matrix:
2424
jdk:
25-
- version: 24
26-
type: ga
2725
- version: 25
2826
type: ea
2927
name: "OpenJDK ${{ matrix.jdk.version }} (${{ matrix.jdk.release || matrix.jdk.type }})"

.github/workflows/gradle-dependency-submission.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ jobs:
2222
uses: actions/setup-java@c5195efecf7bdfc987ee8bae7a71cb8b11521c00 # v4.7.1
2323
with:
2424
distribution: temurin
25-
java-version: 21
25+
java-version: 24
2626
check-latest: true
2727
- name: Generate and submit dependency graph
2828
uses: gradle/actions/dependency-submission@8379f6a1328ee0e06e2bb424dadb7b159856a326 # v4.4.0

.github/workflows/main.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ jobs:
2929
with:
3030
distribution: graalvm-community
3131
version: 'latest'
32-
java-version: '21'
32+
java-version: '24'
3333
github-token: ${{ secrets.GITHUB_TOKEN }}
3434
- name: Build
3535
uses: ./.github/actions/main-build

.github/workflows/release.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ jobs:
8787
- name: Set up JDK
8888
uses: actions/setup-java@c5195efecf7bdfc987ee8bae7a71cb8b11521c00 # v4.7.1
8989
with:
90-
java-version: 21
90+
java-version: 24
9191
distribution: temurin
9292
- uses: sbt/setup-sbt@69a46ab4acd4316aa16e68d91a9249a98d7e78d5 # v1.1.8
9393
- name: Update JUnit dependencies in samples
@@ -245,7 +245,7 @@ jobs:
245245
- name: Set up JDK
246246
uses: actions/setup-java@c5195efecf7bdfc987ee8bae7a71cb8b11521c00 # v4.7.1
247247
with:
248-
java-version: 21
248+
java-version: 24
249249
distribution: temurin
250250
- uses: sbt/setup-sbt@69a46ab4acd4316aa16e68d91a9249a98d7e78d5 # v1.1.8
251251
- name: Update JUnit dependencies in samples

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ task outputs from previous CI builds.
7070

7171
## Building from Source
7272

73-
You need [JDK 21] to build JUnit. [Gradle toolchains] are used to detect and
73+
You need [JDK 24] to build JUnit. [Gradle toolchains] are used to detect and
7474
potentially download additional JDKs for compilation and test execution.
7575

7676
All modules can be _built_ and _tested_ with the [Gradle Wrapper] using the following command:
@@ -100,7 +100,7 @@ of the JUnit Platform, JUnit Jupiter, and JUnit Vintage.
100100
[Gradle Wrapper]: https://docs.gradle.org/current/userguide/gradle_wrapper.html#sec:using_wrapper
101101
[JaCoCo]: https://www.eclemma.org/jacoco/
102102
[Javadoc]: https://junit.org/junit5/docs/current/api/
103-
[JDK 21]: https://javaalmanac.io/jdk/21/
103+
[JDK 24]: https://javaalmanac.io/jdk/24/
104104
[Release Notes]: https://junit.org/junit5/docs/current/release-notes/
105105
[Samples]: https://github.com/junit-team/junit5-samples
106106
[StackOverflow]: https://stackoverflow.com/questions/tagged/junit5

documentation/src/docs/asciidoc/release-notes/release-notes-5.13.1.adoc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,8 @@ on GitHub.
4242
in their enclosing class. This undesired change in behavior has now been reverted so
4343
that tests in `@Nested` test classes are always executed _after_ tests in enclosing test
4444
classes again.
45+
* Fix support for `AnnotationBasedArgumentsProvider` implementations that override the
46+
deprecated `provideArguments(ExtensionContext, Annotation)` method.
4547

4648
[[release-notes-5.13.1-junit-jupiter-deprecations-and-breaking-changes]]
4749
==== Deprecations and Breaking Changes

documentation/src/docs/asciidoc/release-notes/release-notes-6.0.0-M1.adoc

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,11 @@ repository on GitHub.
7676
property has been removed. JUnit now always adheres to standard Java semantics regarding
7777
whether a given field or method is visible or overridden according to the rules of the
7878
Java language.
79+
* The type bounds of the following methods have been changed to be more flexible and allow
80+
nullable and non-nullable types:
81+
- `ConfigurationParameters.get(String, Function)`
82+
- `NamespacedHierarchicalStore.getOrComputeIfAbsent(N, K, Function)`
83+
- `NamespacedHierarchicalStore.getOrComputeIfAbsent(N, K, Function, Class)`
7984

8085
[[release-notes-6.0.0-M1-junit-platform-new-features-and-improvements]]
8186
==== New Features and Improvements
@@ -112,6 +117,11 @@ repository on GitHub.
112117
`callsInPlace(executable, AT_MOST_ONCE)` which might result in compilation errors.
113118
* The `junit-jupiter-migrationsupport` artifact and its contained classes are now
114119
deprecated and will be removed in the next major version.
120+
* The type bounds of the following methods have been changed to be more flexible and allow
121+
nullable and non-nullable types:
122+
- `ExtensionContext.getConfigurationParameter(String, Function)`
123+
- `ExtensionContext.getOrComputeIfAbsent(K, Function)`
124+
- `ExtensionContext.getOrComputeIfAbsent(K, Function, Class)`
115125

116126
[[release-notes-6.0.0-M1-junit-jupiter-new-features-and-improvements]]
117127
==== New Features and Improvements

documentation/src/javadoc/junit-stylesheet.css

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,9 @@
3030
/* Text colors for links */
3131
--link-color: #dc524a;
3232
--link-color-active: #b62b23;
33+
/* Table of contents */
34+
--toc-background-color: var(--section-background-color);
35+
--toc-link-color: #000;
3336
/* Snippet colors */
3437
--snippet-background-color: #ebecee;
3538
--snippet-text-color: var(--block-text-color);
@@ -39,10 +42,6 @@
3942
--table-border-color: #999;
4043
/* Highlight color for active search tag target */
4144
--search-tag-highlight-color: #ffff00;
42-
/* Adjustments for icon and active background colors of copy-to-clipboard buttons */
43-
--copy-button-background-color-active: rgba(168, 168, 168, 0.3);
44-
/* Colors for invalid tag notifications */
45-
--invalid-tag-background-color: #ffe6e6;
4645
}
4746

4847
.title {

documentation/src/test/java/example/FirstCustomEngine.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,9 @@ public TestDescriptor discover(EngineDiscoveryRequest discoveryRequest, UniqueId
4848
return new EngineDescriptor(uniqueId, "First Custom Test Engine");
4949
}
5050

51+
//end::user_guide[]
52+
@SuppressWarnings("NullAway")
53+
//tag::user_guide[]
5154
@Override
5255
public void execute(ExecutionRequest request) {
5356
request.getEngineExecutionListener()

documentation/src/test/java/example/ParameterizedLifecycleDemo.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ static void beforeInvocation(TextFile textFile, @TempDir Path tempDir) throws Ex
5555
}
5656

5757
//end::user_guide[]
58-
@SuppressWarnings({ "DataFlowIssue", "NullAway" })
58+
@SuppressWarnings("DataFlowIssue")
5959
//tag::user_guide[]
6060
@AfterParameterizedClassInvocation
6161
static void afterInvocation(TextFile textFile) throws Exception {
@@ -66,7 +66,7 @@ static void afterInvocation(TextFile textFile) throws Exception {
6666
}
6767

6868
//end::user_guide[]
69-
@SuppressWarnings({ "DataFlowIssue", "NullAway" })
69+
@SuppressWarnings("DataFlowIssue")
7070
//tag::user_guide[]
7171
@Test
7272
void test() {

documentation/src/test/java/example/SecondCustomEngine.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,9 @@ public TestDescriptor discover(EngineDiscoveryRequest discoveryRequest, UniqueId
4848
return new EngineDescriptor(uniqueId, "Second Custom Test Engine");
4949
}
5050

51+
//end::user_guide[]
52+
@SuppressWarnings("NullAway")
53+
//tag::user_guide[]
5154
@Override
5255
public void execute(ExecutionRequest request) {
5356
request.getEngineExecutionListener()

documentation/src/test/java/example/interceptor/SwingEdtInterceptor.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,9 @@
2323
// tag::user_guide[]
2424
public class SwingEdtInterceptor implements InvocationInterceptor {
2525

26+
//end::user_guide[]
27+
@SuppressWarnings("NullAway")
28+
//tag::user_guide[]
2629
@Override
2730
public void interceptTestMethod(Invocation<Void> invocation,
2831
ReflectiveInvocationContext<Method> invocationContext,

gradle/base/code-generator-model/build.gradle.kts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
1+
import org.jetbrains.kotlin.gradle.dsl.JvmTarget.JVM_17
22

33
plugins {
44
`kotlin-dsl`
@@ -10,5 +10,8 @@ java {
1010
}
1111

1212
kotlin {
13-
compilerOptions.jvmTarget = JvmTarget.JVM_17
13+
compilerOptions {
14+
jvmTarget = JVM_17
15+
freeCompilerArgs.add("-Xjdk-release=17")
16+
}
1417
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,16 @@
1+
import org.jetbrains.kotlin.gradle.dsl.JvmTarget.JVM_21
2+
13
plugins {
24
`kotlin-dsl`
35
}
6+
7+
tasks.compileJava {
8+
options.release = 21
9+
}
10+
11+
kotlin {
12+
compilerOptions {
13+
jvmTarget = JVM_21
14+
freeCompilerArgs.add("-Xjdk-release=21")
15+
}
16+
}

gradle/gradle-daemon-jvm.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
#This file is generated by updateDaemonJvm
2-
toolchainVersion=21
2+
toolchainVersion=24

gradle/libs.versions.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ junit4 = { module = "junit:junit", version = { require = "[4.12,)", prefer = "4.
5353
kotlinx-coroutines = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-core", version = "1.10.2" }
5454
log4j-core = { module = "org.apache.logging.log4j:log4j-core", version.ref = "log4j" }
5555
log4j-jul = { module = "org.apache.logging.log4j:log4j-jul", version.ref = "log4j" }
56-
maven = { module = "org.apache.maven:apache-maven", version = "3.9.9" }
56+
maven = { module = "org.apache.maven:apache-maven", version = "3.9.10" }
5757
mavenSurefirePlugin = { module = "org.apache.maven.plugins:maven-surefire-plugin", version.ref = "surefire" }
5858
memoryfilesystem = { module = "com.github.marschall:memoryfilesystem", version = "2.8.1" }
5959
mockito-bom = { module = "org.mockito:mockito-bom", version = "5.18.0" }
@@ -96,7 +96,7 @@ asciidoctorConvert = { id = "org.asciidoctor.jvm.convert", version.ref = "asciid
9696
asciidoctorPdf = { id = "org.asciidoctor.jvm.pdf", version.ref = "asciidoctor-plugins" }
9797
bnd = { id = "biz.aQute.bnd", version.ref = "bnd" }
9898
buildParameters = { id = "org.gradlex.build-parameters", version = "1.4.4" }
99-
commonCustomUserData = { id = "com.gradle.common-custom-user-data-gradle-plugin", version = "2.2.1" }
99+
commonCustomUserData = { id = "com.gradle.common-custom-user-data-gradle-plugin", version = "2.3" }
100100
develocity = { id = "com.gradle.develocity", version = "4.0.2" }
101101
errorProne = { id = "net.ltgt.errorprone", version = "4.2.0" }
102102
extraJavaModuleInfo = { id = "org.gradlex.extra-java-module-info", version = "1.12" }

gradle/plugins/build-parameters/build.gradle.kts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@ plugins {
44

55
group = "junitbuild"
66

7+
tasks.compileJava {
8+
options.release = 21
9+
}
10+
711
buildParameters {
812
pluginId("junitbuild.build-parameters")
913
bool("ci") {

gradle/plugins/code-generator/build.gradle.kts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import org.jetbrains.kotlin.gradle.dsl.JvmTarget.JVM_21
2+
13
plugins {
24
`kotlin-dsl`
35
}
@@ -10,3 +12,14 @@ dependencies {
1012
implementation(libs.jackson.module.kotlin)
1113
implementation(libs.jte)
1214
}
15+
16+
tasks.compileJava {
17+
options.release = 21
18+
}
19+
20+
kotlin {
21+
compilerOptions {
22+
jvmTarget = JVM_21
23+
freeCompilerArgs.add("-Xjdk-release=21")
24+
}
25+
}

gradle/plugins/common/build.gradle.kts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import junitbuild.extensions.markerCoordinates
2+
import org.jetbrains.kotlin.gradle.dsl.JvmTarget.JVM_21
23

34
plugins {
45
`kotlin-dsl`
@@ -19,3 +20,14 @@ dependencies {
1920
implementation(libs.plugins.shadow.markerCoordinates)
2021
implementation(libs.plugins.spotless.markerCoordinates)
2122
}
23+
24+
tasks.compileJava {
25+
options.release = 21
26+
}
27+
28+
kotlin {
29+
compilerOptions {
30+
jvmTarget = JVM_21
31+
freeCompilerArgs.add("-Xjdk-release=21")
32+
}
33+
}

gradle/plugins/common/src/main/kotlin/junitbuild.java-nullability-conventions.gradle.kts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,12 @@ tasks.withType<JavaCompile>().configureEach {
2121
options.errorprone {
2222
disableAllChecks = true
2323
nullaway {
24-
enable()
24+
if (java.toolchain.implementation.orNull == JvmImplementation.J9) {
25+
disable()
26+
} else {
27+
enable()
28+
}
29+
isJSpecifyMode = true
2530
}
2631
}
2732
}

gradle/plugins/common/src/main/kotlin/junitbuild.java-toolchain-conventions.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ plugins {
55
}
66

77
project.pluginManager.withPlugin("java") {
8-
val defaultLanguageVersion = JavaLanguageVersion.of(21)
8+
val defaultLanguageVersion = JavaLanguageVersion.of(24)
99
val javaLanguageVersion = buildParameters.javaToolchain.version.map { JavaLanguageVersion.of(it) }.getOrElse(defaultLanguageVersion)
1010
val jvmImplementation = buildParameters.javaToolchain.implementation.map {
1111
when(it) {

gradle/plugins/common/src/main/kotlin/junitbuild.kotlin-library-conventions.gradle.kts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
12
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
23
import org.jetbrains.kotlin.gradle.dsl.KotlinVersion.KOTLIN_2_1
34
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
@@ -20,7 +21,8 @@ tasks.withType<KotlinCompile>().configureEach {
2021
languageVersion = apiVersion
2122
allWarningsAsErrors.convention(true)
2223
javaParameters = true
23-
freeCompilerArgs.addAll("-opt-in=kotlin.RequiresOptIn")
24+
freeCompilerArgs.add("-opt-in=kotlin.RequiresOptIn")
25+
freeCompilerArgs.add(jvmTarget.map { "-Xjdk-release=${JavaVersion.toVersion(it.target).majorVersion}" })
2426
}
2527
}
2628

gradle/plugins/common/src/main/kotlin/junitbuild.testing-conventions.gradle.kts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,8 @@ tasks.withType<Test>().configureEach {
110110
systemProperty("log4j2.julLoggerAdapter", "org.apache.logging.log4j.jul.CoreLoggerAdapter")
111111
// Avoid overhead (see https://logging.apache.org/log4j/2.x/manual/jmx.html#enabling-jmx)
112112
systemProperty("log4j2.disableJmx", "true")
113+
// https://github.com/raphw/byte-buddy/issues/1803
114+
systemProperty("net.bytebuddy.safe", true)
113115
// Required until ASM officially supports the JDK 14
114116
systemProperty("net.bytebuddy.experimental", true)
115117
if (buildParameters.testing.enableJFR) {

gradle/plugins/publishing/build.gradle.kts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import junitbuild.extensions.markerCoordinates
2+
import org.jetbrains.kotlin.gradle.dsl.JvmTarget.JVM_21
23

34
plugins {
45
`kotlin-dsl`
@@ -23,3 +24,14 @@ configurations.configureEach {
2324
}
2425
}
2526
}
27+
28+
tasks.compileJava {
29+
options.release = 21
30+
}
31+
32+
kotlin {
33+
compilerOptions {
34+
jvmTarget = JVM_21
35+
freeCompilerArgs.add("-Xjdk-release=21")
36+
}
37+
}

junit-jupiter-api/src/main/java/org/junit/jupiter/api/AssertTimeout.java

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,17 +36,15 @@ static void assertTimeout(Duration timeout, Executable executable) {
3636
assertTimeout(timeout, executable, (String) null);
3737
}
3838

39-
@SuppressWarnings("NullAway")
4039
static void assertTimeout(Duration timeout, Executable executable, @Nullable String message) {
41-
assertTimeout(timeout, () -> {
40+
AssertTimeout.<@Nullable Object> assertTimeout(timeout, () -> {
4241
executable.execute();
4342
return null;
4443
}, message);
4544
}
4645

47-
@SuppressWarnings("NullAway")
4846
static void assertTimeout(Duration timeout, Executable executable, Supplier<@Nullable String> messageSupplier) {
49-
assertTimeout(timeout, () -> {
47+
AssertTimeout.<@Nullable Object> assertTimeout(timeout, () -> {
5048
executable.execute();
5149
return null;
5250
}, messageSupplier);

junit-jupiter-api/src/main/java/org/junit/jupiter/api/AssertionFailureBuilder.java

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -32,22 +32,17 @@
3232
@API(status = STABLE, since = "5.9")
3333
public class AssertionFailureBuilder {
3434

35-
@Nullable
36-
private Object message;
35+
private @Nullable Object message;
3736

38-
@Nullable
39-
private Throwable cause;
37+
private @Nullable Throwable cause;
4038

4139
private boolean mismatch;
4240

43-
@Nullable
44-
private Object expected;
41+
private @Nullable Object expected;
4542

46-
@Nullable
47-
private Object actual;
43+
private @Nullable Object actual;
4844

49-
@Nullable
50-
private String reason;
45+
private @Nullable String reason;
5146

5247
private boolean includeValuesInMessage = true;
5348

0 commit comments

Comments
 (0)