Skip to content

Commit fa4b78a

Browse files
authored
Merge branch 'main' into marc/5098-package-private-hidden-methods
2 parents b2c6c30 + 52fffcf commit fa4b78a

File tree

14 files changed

+142
-43
lines changed

14 files changed

+142
-43
lines changed

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,8 @@ repository on GitHub.
4545
to avoid conflicts with other control characters.
4646
* Fix `IllegalAccessError` thrown when using the Kotlin-specific `assertDoesNotThrow`
4747
assertion.
48+
* Stop reporting discovery issues for synthetic methods, particularly in conjunction with
49+
Kotlin suspend functions.
4850
* Fix support for test methods with the same signature as a package-private methods
4951
declared in super classes in different packages.
5052

documentation/src/docs/asciidoc/user-guide/running-tests.adoc

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -748,10 +748,12 @@ include::{consoleLauncherDiscoverOptionsFile}[]
748748
===== Executing tests
749749

750750
.Exit Code
751-
NOTE: The `{ConsoleLauncher}` exits with a status code of `1` if any containers or tests
752-
failed. If no tests are discovered and the `--fail-if-no-tests` command-line option is
753-
supplied, the `ConsoleLauncher` exits with a status code of `2`. Otherwise, the exit code
754-
is `0`.
751+
NOTE: On successful runs, the `{ConsoleLauncher}` exits with a status code of `0`.
752+
All non-zero codes indicate an error of some sort. For example, status code `1`
753+
is returned if any containers or tests failed. If no tests are discovered and the
754+
`--fail-if-no-tests` command-line option is supplied, the `ConsoleLauncher` exits
755+
with a status code of `2`. Unexpected or invalid user input yields a status code
756+
of `3`. An exit code of `-1` indicates an unspecified error condition.
755757

756758
----
757759
include::{consoleLauncherExecuteOptionsFile}[]

gradle/libs.versions.toml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,14 +32,16 @@ bndlib = { module = "biz.aQute.bnd:biz.aQute.bndlib", version.ref = "bnd" }
3232
checkstyle = { module = "com.puppycrawl.tools:checkstyle", version.ref = "checkstyle" }
3333
classgraph = { module = "io.github.classgraph:classgraph", version = "4.8.184" }
3434
commons-io = { module = "commons-io:commons-io", version = "2.20.0" }
35-
error-prone-contrib = { module = "tech.picnic.error-prone-support:error-prone-contrib", version = "0.25.0" }
35+
error-prone-contrib = { module = "tech.picnic.error-prone-support:error-prone-contrib", version = "0.26.0" }
3636
error-prone-core = { module = "com.google.errorprone:error_prone_core", version = "2.43.0" }
3737
fastcsv = { module = "de.siegmar:fastcsv", version = "4.1.0" }
3838
groovy = { module = "org.apache.groovy:groovy", version = "5.0.2" }
3939
groovy2-bom = { module = "org.codehaus.groovy:groovy-bom", version = "2.5.23" }
4040
hamcrest = { module = "org.hamcrest:hamcrest", version = "3.0" }
4141
jackson-dataformat-yaml = { module = "com.fasterxml.jackson.dataformat:jackson-dataformat-yaml", version.ref = "jackson" }
4242
jackson-module-kotlin = { module = "com.fasterxml.jackson.module:jackson-module-kotlin", version.ref = "jackson" }
43+
jaxb-api = { module = "jakarta.xml.bind:jakarta.xml.bind-api", version = "4.0.4" }
44+
jaxb-runtime = { module = "org.glassfish.jaxb:jaxb-runtime", version = "4.0.6" }
4345
jfrunit = { module = "org.moditect.jfrunit:jfrunit-core", version = "1.0.0.Alpha2" }
4446
jimfs = { module = "com.google.jimfs:jimfs", version = "1.3.1" }
4547
jmh-core = { module = "org.openjdk.jmh:jmh-core", version.ref = "jmh" }
@@ -72,6 +74,7 @@ snapshotTests-xml = { module = "de.skuzzle.test:snapshot-tests-xml", version.ref
7274
spock1 = { module = "org.spockframework:spock-core", version = "1.3-groovy-2.5" }
7375
xmlunit-assertj = { module = "org.xmlunit:xmlunit-assertj3", version.ref = "xmlunit" }
7476
xmlunit-placeholders = { module = "org.xmlunit:xmlunit-placeholders", version.ref = "xmlunit" }
77+
xmlunit-jakarta-jaxb-impl = { module = "org.xmlunit:xmlunit-jakarta-jaxb-impl", version.ref = "xmlunit" }
7578
testingAnnotations = { module = "com.gradle:develocity-testing-annotations", version = "2.0.1" }
7679
woodstox = { module = "com.fasterxml.woodstox:woodstox-core", version = "7.1.1" }
7780

@@ -87,7 +90,7 @@ ktlint-cli = { module = "com.pinterest.ktlint:ktlint-cli", version.ref = "ktlint
8790
[bundles]
8891
ant = ["ant", "ant-junit", "ant-junitlauncher"]
8992
log4j = ["log4j-core", "log4j-jul"]
90-
xmlunit = ["xmlunit-assertj", "xmlunit-placeholders"]
93+
xmlunit = ["xmlunit-assertj", "xmlunit-placeholders", "xmlunit-jakarta-jaxb-impl", "jaxb-api", "jaxb-runtime"]
9194

9295
[plugins]
9396
asciidoctorConvert = { id = "org.asciidoctor.jvm.convert", version.ref = "asciidoctor-plugins" }

gradle/plugins/common/src/main/kotlin/junitbuild.checkstyle-nohttp.gradle.kts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@ dependencies {
1515
}
1616
checkstyle("ch.qos.logback:logback-classic") {
1717
version {
18-
require("1.5.18")
18+
require("1.5.19")
1919
}
20-
because("Workaround for CVE-2024-12798 and CVE-2024-12801")
20+
because("Workaround for CVE-2025-11226")
2121
}
2222
}
2323
}

junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/discovery/predicates/IsTestableMethod.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ abstract class IsTestableMethod implements Predicate<Method> {
4545

4646
@Override
4747
public boolean test(Method candidate) {
48-
if (isAnnotated(candidate, this.annotationType)) {
48+
if (!candidate.isSynthetic() && isAnnotated(candidate, this.annotationType)) {
4949
return condition.check(candidate) && isNotAbstract(candidate);
5050
}
5151
return false;

junit-platform-commons/src/main/java/org/junit/platform/commons/util/KotlinReflectionUtils.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ private static Try<Class<? extends Annotation>> tryToLoadKotlinMetadataClass() {
6767
*/
6868
@API(status = INTERNAL, since = "6.0")
6969
public static boolean isKotlinSuspendingFunction(Method method) {
70-
if (kotlinCoroutineContinuation != null && isKotlinType(method.getDeclaringClass())) {
70+
if (!method.isSynthetic() && kotlinCoroutineContinuation != null && isKotlinType(method.getDeclaringClass())) {
7171
int parameterCount = method.getParameterCount();
7272
return parameterCount > 0 //
7373
&& method.getParameterTypes()[parameterCount - 1] == kotlinCoroutineContinuation;

junit-platform-console/src/main/java/org/junit/platform/console/command/BaseCommand.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,14 +59,14 @@ static CommandLine initialize(CommandLine commandLine) {
5959
return commandLine //
6060
.setParameterExceptionHandler((ex, args) -> {
6161
defaultParameterExceptionHandler.handleParseException(ex, args);
62-
return CommandResult.FAILURE;
62+
return ExitCode.ANY_ERROR;
6363
}) //
6464
.setExecutionExceptionHandler((ex, cmd, __) -> {
6565
commandLine.getErr().println(cmd.getColorScheme().richStackTraceString(ex));
6666
commandLine.getErr().println();
6767
commandLine.getErr().flush();
6868
cmd.usage(commandLine.getOut());
69-
return CommandResult.FAILURE;
69+
return ExitCode.ANY_ERROR;
7070
}) //
7171
.setCaseInsensitiveEnumValuesAllowed(true) //
7272
.setAtFileCommentChar(null);

junit-platform-console/src/main/java/org/junit/platform/console/command/CommandResult.java

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -22,23 +22,8 @@
2222
*/
2323
@API(status = INTERNAL, since = "1.10")
2424
public class CommandResult<T> {
25-
26-
/**
27-
* Exit code indicating successful execution.
28-
*/
29-
public static final int SUCCESS = 0;
30-
31-
/**
32-
* Exit code indicating any failure(s).
33-
*/
34-
protected static final int FAILURE = -1;
35-
3625
public static <T> CommandResult<T> success() {
37-
return create(SUCCESS, null);
38-
}
39-
40-
public static <T> CommandResult<T> failure() {
41-
return create(FAILURE, null);
26+
return create(ExitCode.SUCCESS, null);
4227
}
4328

4429
public static <T> CommandResult<T> create(int exitCode, @Nullable T value) {

junit-platform-console/src/main/java/org/junit/platform/console/command/ExecuteTestsCommand.java

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,9 @@
1010

1111
package org.junit.platform.console.command;
1212

13-
import static org.junit.platform.console.command.CommandResult.SUCCESS;
13+
import static org.junit.platform.console.command.ExitCode.NO_TESTS_FOUND;
14+
import static org.junit.platform.console.command.ExitCode.SUCCESS;
15+
import static org.junit.platform.console.command.ExitCode.TEST_FAILED;
1416

1517
import java.io.PrintWriter;
1618
import java.nio.file.Path;
@@ -34,17 +36,6 @@
3436
description = "Execute tests" //
3537
)
3638
class ExecuteTestsCommand extends BaseCommand<TestExecutionSummary> implements CommandLine.IExitCodeGenerator {
37-
38-
/**
39-
* Exit code indicating test failure(s)
40-
*/
41-
private static final int TEST_FAILED = 1;
42-
43-
/**
44-
* Exit code indicating no tests found
45-
*/
46-
private static final int NO_TESTS_FOUND = 2;
47-
4839
private final ConsoleTestExecutor.Factory consoleTestExecutorFactory;
4940

5041
@Mixin
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
/*
2+
* Copyright 2015-2025 the original author or authors.
3+
*
4+
* All rights reserved. This program and the accompanying materials are
5+
* made available under the terms of the Eclipse Public License v2.0 which
6+
* accompanies this distribution and is available at
7+
*
8+
* https://www.eclipse.org/legal/epl-v20.html
9+
*/
10+
11+
package org.junit.platform.console.command;
12+
13+
/**
14+
* Well-known exit codes of the {@code junit} tool.
15+
*
16+
* @since 6.0.1
17+
*/
18+
final class ExitCode {
19+
/**
20+
* Exit code indicating a successful tool run.
21+
*/
22+
public static final int SUCCESS = 0;
23+
24+
/**
25+
* Exit code indicating an unsuccessful run.
26+
*/
27+
public static final int ANY_ERROR = -1;
28+
29+
/**
30+
* Exit code indicating test failure(s).
31+
*/
32+
public static final int TEST_FAILED = 1;
33+
34+
/**
35+
* Exit code indicating no tests found.
36+
*/
37+
public static final int NO_TESTS_FOUND = 2;
38+
39+
/**
40+
* Exit code indicating invalid user input.
41+
*/
42+
public static final int INVALID_INPUT = 3;
43+
44+
private ExitCode() {
45+
}
46+
}

0 commit comments

Comments
 (0)