File tree 7 files changed +98
-2
lines changed
documentation/src/docs/asciidoc/release-notes
java/org/junit/platform/commons/util
java9/org/junit/platform/commons/util
platform-tooling-support-tests/projects/vintage/src/test/java
7 files changed +98
-2
lines changed Original file line number Diff line number Diff line change @@ -16,7 +16,8 @@ on GitHub.
16
16
[[release-notes-5.11.3-junit-platform-bug-fixes]]
17
17
==== Bug Fixes
18
18
19
- * ❓
19
+ * Fixed a regression in method search algorithms introduced in 5.11.0 when classes reside
20
+ in the default package and using a Java 8 runtime.
20
21
21
22
[[release-notes-5.11.3-junit-platform-deprecations-and-breaking-changes]]
22
23
==== Deprecations and Breaking Changes
Original file line number Diff line number Diff line change @@ -29,6 +29,7 @@ tasks.jar {
29
29
30
30
tasks.codeCoverageClassesJar {
31
31
exclude(" org/junit/platform/commons/util/ModuleUtils.class" )
32
+ exclude(" org/junit/platform/commons/util/PackageNameUtils.class" )
32
33
}
33
34
34
35
eclipse {
Original file line number Diff line number Diff line change
1
+ /*
2
+ * Copyright 2015-2024 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 .commons .util ;
12
+
13
+ import static org .junit .platform .commons .util .PackageUtils .DEFAULT_PACKAGE_NAME ;
14
+
15
+ /**
16
+ * Collection of utilities for working with package names.
17
+ *
18
+ * <h2>DISCLAIMER</h2>
19
+ *
20
+ * <p>These utilities are intended solely for usage within the JUnit framework
21
+ * itself. <strong>Any usage by external parties is not supported.</strong>
22
+ * Use at your own risk!
23
+ *
24
+ * @since 1.11.3
25
+ */
26
+ class PackageNameUtils {
27
+
28
+ static String getPackageName (Class <?> clazz ) {
29
+ Package p = clazz .getPackage ();
30
+ if (p != null ) {
31
+ return p .getName ();
32
+ }
33
+ String className = clazz .getName ();
34
+ int index = className .lastIndexOf ('.' );
35
+ return index == -1 ? DEFAULT_PACKAGE_NAME : className .substring (0 , index );
36
+ }
37
+
38
+ }
Original file line number Diff line number Diff line change 19
19
import static org .apiguardian .api .API .Status .INTERNAL ;
20
20
import static org .apiguardian .api .API .Status .STABLE ;
21
21
import static org .junit .platform .commons .util .CollectionUtils .toUnmodifiableList ;
22
+ import static org .junit .platform .commons .util .PackageNameUtils .getPackageName ;
22
23
import static org .junit .platform .commons .util .ReflectionUtils .HierarchyTraversalMode .BOTTOM_UP ;
23
24
import static org .junit .platform .commons .util .ReflectionUtils .HierarchyTraversalMode .TOP_DOWN ;
24
25
@@ -1899,7 +1900,7 @@ private static boolean isPackagePrivate(Member member) {
1899
1900
}
1900
1901
1901
1902
private static boolean declaredInSamePackage (Method m1 , Method m2 ) {
1902
- return m1 .getDeclaringClass (). getPackage (). getName (). equals (m2 .getDeclaringClass (). getPackage (). getName ( ));
1903
+ return getPackageName ( m1 .getDeclaringClass ()). equals (getPackageName ( m2 .getDeclaringClass ()));
1903
1904
}
1904
1905
1905
1906
/**
Original file line number Diff line number Diff line change
1
+ /*
2
+ * Copyright 2015-2024 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 .commons .util ;
12
+
13
+ /**
14
+ * Collection of utilities for working with package names.
15
+ *
16
+ * <h2>DISCLAIMER</h2>
17
+ *
18
+ * <p>These utilities are intended solely for usage within the JUnit framework
19
+ * itself. <strong>Any usage by external parties is not supported.</strong>
20
+ * Use at your own risk!
21
+ *
22
+ * @since 1.11.3
23
+ */
24
+ class PackageNameUtils {
25
+
26
+ static String getPackageName (Class <?> clazz ) {
27
+ return clazz .getPackageName ();
28
+ }
29
+
30
+ }
Original file line number Diff line number Diff line change
1
+
2
+ /*
3
+ * Copyright 2015-2024 the original author or authors.
4
+ *
5
+ * All rights reserved. This program and the accompanying materials are
6
+ * made available under the terms of the Eclipse Public License v2.0 which
7
+ * accompanies this distribution and is available at
8
+ *
9
+ * https://www.eclipse.org/legal/epl-v20.html
10
+ */
11
+ import com .example .vintage .VintageTest ;
12
+
13
+ import org .junit .Ignore ;
14
+
15
+ /**
16
+ * Reproducer for https://github.com/junit-team/junit5/issues/4076
17
+ */
18
+ @ Ignore
19
+ public class DefaultPackageTest extends VintageTest {
20
+ void packagePrivateMethod () {
21
+ }
22
+ }
Original file line number Diff line number Diff line change 15
15
import org .junit .Test ;
16
16
17
17
public class VintageTest {
18
+ void packagePrivateMethod () {
19
+ }
20
+
18
21
@ Test
19
22
public void success () {
20
23
// pass
You can’t perform that action at this time.
0 commit comments