Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/actions/run-gradle/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ runs:
id: setup-gradle-jdk
with:
distribution: temurin
java-version: 21
java-version: 24
check-latest: true
- uses: gradle/actions/setup-gradle@8379f6a1328ee0e06e2bb424dadb7b159856a326 # v4.4.0
with:
Expand Down
2 changes: 0 additions & 2 deletions .github/workflows/cross-version.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@ jobs:
fail-fast: false
matrix:
jdk:
- version: 24
type: ga
- version: 25
type: ea
name: "OpenJDK ${{ matrix.jdk.version }} (${{ matrix.jdk.release || matrix.jdk.type }})"
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/gradle-dependency-submission.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
uses: actions/setup-java@c5195efecf7bdfc987ee8bae7a71cb8b11521c00 # v4.7.1
with:
distribution: temurin
java-version: 21
java-version: 24
check-latest: true
- name: Generate and submit dependency graph
uses: gradle/actions/dependency-submission@8379f6a1328ee0e06e2bb424dadb7b159856a326 # v4.4.0
2 changes: 1 addition & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:
with:
distribution: graalvm-community
version: 'latest'
java-version: '21'
java-version: '24'
github-token: ${{ secrets.GITHUB_TOKEN }}
- name: Build
uses: ./.github/actions/main-build
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ jobs:
- name: Set up JDK
uses: actions/setup-java@c5195efecf7bdfc987ee8bae7a71cb8b11521c00 # v4.7.1
with:
java-version: 21
java-version: 24
distribution: temurin
- uses: sbt/setup-sbt@69a46ab4acd4316aa16e68d91a9249a98d7e78d5 # v1.1.8
- name: Update JUnit dependencies in samples
Expand Down Expand Up @@ -245,7 +245,7 @@ jobs:
- name: Set up JDK
uses: actions/setup-java@c5195efecf7bdfc987ee8bae7a71cb8b11521c00 # v4.7.1
with:
java-version: 21
java-version: 24
distribution: temurin
- uses: sbt/setup-sbt@69a46ab4acd4316aa16e68d91a9249a98d7e78d5 # v1.1.8
- name: Update JUnit dependencies in samples
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ task outputs from previous CI builds.

## Building from Source

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

All modules can be _built_ and _tested_ with the [Gradle Wrapper] using the following command:
Expand Down Expand Up @@ -100,7 +100,7 @@ of the JUnit Platform, JUnit Jupiter, and JUnit Vintage.
[Gradle Wrapper]: https://docs.gradle.org/current/userguide/gradle_wrapper.html#sec:using_wrapper
[JaCoCo]: https://www.eclemma.org/jacoco/
[Javadoc]: https://junit.org/junit5/docs/current/api/
[JDK 21]: https://javaalmanac.io/jdk/21/
[JDK 24]: https://javaalmanac.io/jdk/24/
[Release Notes]: https://junit.org/junit5/docs/current/release-notes/
[Samples]: https://github.com/junit-team/junit5-samples
[StackOverflow]: https://stackoverflow.com/questions/tagged/junit5
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,11 @@ repository on GitHub.
property has been removed. JUnit now always adheres to standard Java semantics regarding
whether a given field or method is visible or overridden according to the rules of the
Java language.
* The type bounds of the following methods have been changed to be more flexible and allow
nullable and non-nullable types:
- `ConfigurationParameters.get(String, Function)`
- `NamespacedHierarchicalStore.getOrComputeIfAbsent(N, K, Function)`
- `NamespacedHierarchicalStore.getOrComputeIfAbsent(N, K, Function, Class)`

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

[[release-notes-6.0.0-M1-junit-jupiter-new-features-and-improvements]]
==== New Features and Improvements
Expand Down
7 changes: 3 additions & 4 deletions documentation/src/javadoc/junit-stylesheet.css
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@
/* Text colors for links */
--link-color: #dc524a;
--link-color-active: #b62b23;
/* Table of contents */
--toc-background-color: var(--section-background-color);
--toc-link-color: #000;
/* Snippet colors */
--snippet-background-color: #ebecee;
--snippet-text-color: var(--block-text-color);
Expand All @@ -39,10 +42,6 @@
--table-border-color: #999;
/* Highlight color for active search tag target */
--search-tag-highlight-color: #ffff00;
/* Adjustments for icon and active background colors of copy-to-clipboard buttons */
--copy-button-background-color-active: rgba(168, 168, 168, 0.3);
/* Colors for invalid tag notifications */
--invalid-tag-background-color: #ffe6e6;
}

.title {
Expand Down
3 changes: 3 additions & 0 deletions documentation/src/test/java/example/FirstCustomEngine.java
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,9 @@ public TestDescriptor discover(EngineDiscoveryRequest discoveryRequest, UniqueId
return new EngineDescriptor(uniqueId, "First Custom Test Engine");
}

//end::user_guide[]
@SuppressWarnings("NullAway")
//tag::user_guide[]
@Override
public void execute(ExecutionRequest request) {
request.getEngineExecutionListener()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ static void beforeInvocation(TextFile textFile, @TempDir Path tempDir) throws Ex
}

//end::user_guide[]
@SuppressWarnings({ "DataFlowIssue", "NullAway" })
@SuppressWarnings("DataFlowIssue")
//tag::user_guide[]
@AfterParameterizedClassInvocation
static void afterInvocation(TextFile textFile) throws Exception {
Expand All @@ -66,7 +66,7 @@ static void afterInvocation(TextFile textFile) throws Exception {
}

//end::user_guide[]
@SuppressWarnings({ "DataFlowIssue", "NullAway" })
@SuppressWarnings("DataFlowIssue")
//tag::user_guide[]
@Test
void test() {
Expand Down
3 changes: 3 additions & 0 deletions documentation/src/test/java/example/SecondCustomEngine.java
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,9 @@ public TestDescriptor discover(EngineDiscoveryRequest discoveryRequest, UniqueId
return new EngineDescriptor(uniqueId, "Second Custom Test Engine");
}

//end::user_guide[]
@SuppressWarnings("NullAway")
//tag::user_guide[]
@Override
public void execute(ExecutionRequest request) {
request.getEngineExecutionListener()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@
// tag::user_guide[]
public class SwingEdtInterceptor implements InvocationInterceptor {

//end::user_guide[]
@SuppressWarnings("NullAway")
//tag::user_guide[]
@Override
public void interceptTestMethod(Invocation<Void> invocation,
ReflectiveInvocationContext<Method> invocationContext,
Expand Down
7 changes: 5 additions & 2 deletions gradle/base/code-generator-model/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
import org.jetbrains.kotlin.gradle.dsl.JvmTarget.JVM_17

plugins {
`kotlin-dsl`
Expand All @@ -10,5 +10,8 @@ java {
}

kotlin {
compilerOptions.jvmTarget = JvmTarget.JVM_17
compilerOptions {
jvmTarget = JVM_17
freeCompilerArgs.add("-Xjdk-release=17")
}
}
13 changes: 13 additions & 0 deletions gradle/base/dsl-extensions/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,3 +1,16 @@
import org.jetbrains.kotlin.gradle.dsl.JvmTarget.JVM_21

plugins {
`kotlin-dsl`
}

tasks.compileJava {
options.release = 21
}

kotlin {
compilerOptions {
jvmTarget = JVM_21
freeCompilerArgs.add("-Xjdk-release=21")
}
}
2 changes: 1 addition & 1 deletion gradle/gradle-daemon-jvm.properties
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
#This file is generated by updateDaemonJvm
toolchainVersion=21
toolchainVersion=24
4 changes: 4 additions & 0 deletions gradle/plugins/build-parameters/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ plugins {

group = "junitbuild"

tasks.compileJava {
options.release = 21
}

buildParameters {
pluginId("junitbuild.build-parameters")
bool("ci") {
Expand Down
13 changes: 13 additions & 0 deletions gradle/plugins/code-generator/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import org.jetbrains.kotlin.gradle.dsl.JvmTarget.JVM_21

plugins {
`kotlin-dsl`
}
Expand All @@ -10,3 +12,14 @@ dependencies {
implementation(libs.jackson.module.kotlin)
implementation(libs.jte)
}

tasks.compileJava {
options.release = 21
}

kotlin {
compilerOptions {
jvmTarget = JVM_21
freeCompilerArgs.add("-Xjdk-release=21")
}
}
12 changes: 12 additions & 0 deletions gradle/plugins/common/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import junitbuild.extensions.markerCoordinates
import org.jetbrains.kotlin.gradle.dsl.JvmTarget.JVM_21

plugins {
`kotlin-dsl`
Expand All @@ -19,3 +20,14 @@ dependencies {
implementation(libs.plugins.shadow.markerCoordinates)
implementation(libs.plugins.spotless.markerCoordinates)
}

tasks.compileJava {
options.release = 21
}

kotlin {
compilerOptions {
jvmTarget = JVM_21
freeCompilerArgs.add("-Xjdk-release=21")
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,12 @@ tasks.withType<JavaCompile>().configureEach {
options.errorprone {
disableAllChecks = true
nullaway {
enable()
if (java.toolchain.implementation.orNull == JvmImplementation.J9) {
disable()
} else {
enable()
}
isJSpecifyMode = true
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ plugins {
}

project.pluginManager.withPlugin("java") {
val defaultLanguageVersion = JavaLanguageVersion.of(21)
val defaultLanguageVersion = JavaLanguageVersion.of(24)
val javaLanguageVersion = buildParameters.javaToolchain.version.map { JavaLanguageVersion.of(it) }.getOrElse(defaultLanguageVersion)
val jvmImplementation = buildParameters.javaToolchain.implementation.map {
when(it) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@

import org.jetbrains.kotlin.gradle.dsl.JvmTarget
import org.jetbrains.kotlin.gradle.dsl.KotlinVersion.KOTLIN_2_1
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
Expand All @@ -20,7 +21,8 @@ tasks.withType<KotlinCompile>().configureEach {
languageVersion = apiVersion
allWarningsAsErrors.convention(true)
javaParameters = true
freeCompilerArgs.addAll("-opt-in=kotlin.RequiresOptIn")
freeCompilerArgs.add("-opt-in=kotlin.RequiresOptIn")
freeCompilerArgs.add(jvmTarget.map { "-Xjdk-release=${JavaVersion.toVersion(it.target).majorVersion}" })
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,8 @@ tasks.withType<Test>().configureEach {
systemProperty("log4j2.julLoggerAdapter", "org.apache.logging.log4j.jul.CoreLoggerAdapter")
// Avoid overhead (see https://logging.apache.org/log4j/2.x/manual/jmx.html#enabling-jmx)
systemProperty("log4j2.disableJmx", "true")
// https://github.com/raphw/byte-buddy/issues/1803
systemProperty("net.bytebuddy.safe", true)
// Required until ASM officially supports the JDK 14
systemProperty("net.bytebuddy.experimental", true)
if (buildParameters.testing.enableJFR) {
Expand Down
12 changes: 12 additions & 0 deletions gradle/plugins/publishing/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import junitbuild.extensions.markerCoordinates
import org.jetbrains.kotlin.gradle.dsl.JvmTarget.JVM_21

plugins {
`kotlin-dsl`
Expand All @@ -23,3 +24,14 @@ configurations.configureEach {
}
}
}

tasks.compileJava {
options.release = 21
}

kotlin {
compilerOptions {
jvmTarget = JVM_21
freeCompilerArgs.add("-Xjdk-release=21")
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -36,17 +36,15 @@ static void assertTimeout(Duration timeout, Executable executable) {
assertTimeout(timeout, executable, (String) null);
}

@SuppressWarnings("NullAway")
static void assertTimeout(Duration timeout, Executable executable, @Nullable String message) {
assertTimeout(timeout, () -> {
AssertTimeout.<@Nullable Object> assertTimeout(timeout, () -> {
executable.execute();
return null;
}, message);
}

@SuppressWarnings("NullAway")
static void assertTimeout(Duration timeout, Executable executable, Supplier<@Nullable String> messageSupplier) {
assertTimeout(timeout, () -> {
AssertTimeout.<@Nullable Object> assertTimeout(timeout, () -> {
executable.execute();
return null;
}, messageSupplier);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,22 +32,17 @@
@API(status = STABLE, since = "5.9")
public class AssertionFailureBuilder {

@Nullable
private Object message;
private @Nullable Object message;

@Nullable
private Throwable cause;
private @Nullable Throwable cause;

private boolean mismatch;

@Nullable
private Object expected;
private @Nullable Object expected;

@Nullable
private Object actual;
private @Nullable Object actual;

@Nullable
private String reason;
private @Nullable String reason;

private boolean includeValuesInMessage = true;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,7 @@ public abstract class DynamicNode {
private final String displayName;

/** Custom test source {@link URI} associated with this node; potentially {@code null}. */
@Nullable
private final URI testSourceUri;
private final @Nullable URI testSourceUri;

DynamicNode(String displayName, @Nullable URI testSourceUri) {
this.displayName = Preconditions.notBlank(displayName, "displayName must not be null or blank");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,7 @@ public enum OS {

private static final Logger logger = LoggerFactory.getLogger(OS.class);

@Nullable
private static final OS CURRENT_OS = determineCurrentOs();
private static final @Nullable OS CURRENT_OS = determineCurrentOs();

/**
* {@return the current operating system, if known; otherwise, {@code null}}
Expand Down
Loading