File tree Expand file tree Collapse file tree 7 files changed +98
-2
lines changed
documentation/src/docs/asciidoc/release-notes
java9/org/junit/platform/commons/util
java/org/junit/platform/commons/util
platform-tooling-support-tests/projects/vintage/src/test/java Expand file tree Collapse file tree 7 files changed +98
-2
lines changed Original file line number Diff line number Diff line change @@ -16,7 +16,8 @@ on GitHub.
1616[[release-notes-5.11.3-junit-platform-bug-fixes]]
1717==== Bug Fixes
1818
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.
2021
2122[[release-notes-5.11.3-junit-platform-deprecations-and-breaking-changes]]
2223==== Deprecations and Breaking Changes
Original file line number Diff line number Diff line change @@ -29,6 +29,7 @@ tasks.jar {
2929
3030tasks.codeCoverageClassesJar {
3131 exclude(" org/junit/platform/commons/util/ModuleUtils.class" )
32+ exclude(" org/junit/platform/commons/util/PackageNameUtils.class" )
3233}
3334
3435eclipse {
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 1919import static org .apiguardian .api .API .Status .INTERNAL ;
2020import static org .apiguardian .api .API .Status .STABLE ;
2121import static org .junit .platform .commons .util .CollectionUtils .toUnmodifiableList ;
22+ import static org .junit .platform .commons .util .PackageNameUtils .getPackageName ;
2223import static org .junit .platform .commons .util .ReflectionUtils .HierarchyTraversalMode .BOTTOM_UP ;
2324import static org .junit .platform .commons .util .ReflectionUtils .HierarchyTraversalMode .TOP_DOWN ;
2425
@@ -1903,7 +1904,7 @@ private static boolean isPackagePrivate(Member member) {
19031904 }
19041905
19051906 private static boolean declaredInSamePackage (Method m1 , Method m2 ) {
1906- return m1 .getDeclaringClass (). getPackage (). getName (). equals (m2 .getDeclaringClass (). getPackage (). getName ( ));
1907+ return getPackageName ( m1 .getDeclaringClass ()). equals (getPackageName ( m2 .getDeclaringClass ()));
19071908 }
19081909
19091910 /**
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 1515import org .junit .Test ;
1616
1717public class VintageTest {
18+ void packagePrivateMethod () {
19+ }
20+
1821 @ Test
1922 public void success () {
2023 // pass
You can’t perform that action at this time.
0 commit comments