Skip to content

Commit e908a0c

Browse files
committed
Delete deprecated Resource-related methods in ClasspathScanner
1 parent e3f6e65 commit e908a0c

File tree

3 files changed

+4
-74
lines changed

3 files changed

+4
-74
lines changed

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,8 @@ JUnit repository on GitHub.
4242
* Deprecate
4343
`EngineDiscoveryRequestResolver.Builder.addResourceContainerSelectorResolver(Predicate)`
4444
method in favor of `addResourceContainerSelectorResolver(ResourceFilter)`.
45-
* Deprecate `Resource`-related methods in `ClasspathScanner` in favor of new methods using
46-
`org.junit.platform.commons.io.Resource` and `ResourceFilter`:
45+
* Delete deprecated `Resource`-related methods in `ClasspathScanner` in favor of new
46+
methods using `org.junit.platform.commons.io.Resource` and `ResourceFilter`:
4747
- `scanForResourcesInPackage(String, Predicate)`
4848
- `scanForResourcesInClasspathRoot(URI, Predicate)`
4949

junit-platform-commons/src/main/java/org/junit/platform/commons/support/scanning/ClasspathScanner.java

Lines changed: 2 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,10 @@
1010

1111
package org.junit.platform.commons.support.scanning;
1212

13-
import static org.apiguardian.api.API.Status.DEPRECATED;
1413
import static org.apiguardian.api.API.Status.MAINTAINED;
1514

1615
import java.net.URI;
1716
import java.util.List;
18-
import java.util.function.Predicate;
1917

2018
import org.apiguardian.api.API;
2119
import org.junit.platform.commons.io.Resource;
@@ -64,54 +62,6 @@ public interface ClasspathScanner {
6462
*/
6563
List<Class<?>> scanForClassesInClasspathRoot(URI root, ClassFilter classFilter);
6664

67-
/**
68-
* Find all {@linkplain org.junit.platform.commons.support.Resource resources} in the supplied classpath {@code root}
69-
* that match the specified {@code resourceFilter} predicate.
70-
*
71-
* <p>The classpath scanning algorithm searches recursively in subpackages
72-
* beginning with the root of the classpath.
73-
*
74-
* @param basePackageName the name of the base package in which to start
75-
* scanning; must not be {@code null} and must be valid in terms of Java
76-
* syntax
77-
* @param resourceFilter the resource type filter; never {@code null}
78-
* @return a list of all such resources found; never {@code null}
79-
* but potentially empty
80-
* @deprecated Please implement
81-
* {@link #scanForResourcesInPackage(String, ResourceFilter)} instead
82-
*/
83-
@API(status = DEPRECATED, since = "6.0")
84-
@Deprecated(since = "6.0", forRemoval = true)
85-
@SuppressWarnings({ "removal", "unused" })
86-
default List<org.junit.platform.commons.support.Resource> scanForResourcesInPackage(String basePackageName,
87-
Predicate<org.junit.platform.commons.support.Resource> resourceFilter) {
88-
throw new UnsupportedOperationException("Implement scanForResourcesInPackage(String, ResourceFilter) instead");
89-
}
90-
91-
/**
92-
* Find all {@linkplain org.junit.platform.commons.support.Resource resources} in the supplied classpath {@code root}
93-
* that match the specified {@code resourceFilter} predicate.
94-
*
95-
* <p>The classpath scanning algorithm searches recursively in subpackages
96-
* beginning with the root of the classpath.
97-
*
98-
* @param root the URI for the classpath root in which to scan; never
99-
* {@code null}
100-
* @param resourceFilter the resource type filter; never {@code null}
101-
* @return a list of all such resources found; never {@code null}
102-
* but potentially empty
103-
* @deprecated Please implement
104-
* {@link #scanForResourcesInClasspathRoot(URI, ResourceFilter)} instead
105-
*/
106-
@API(status = DEPRECATED, since = "6.0")
107-
@Deprecated(since = "6.0", forRemoval = true)
108-
@SuppressWarnings("removal")
109-
default List<org.junit.platform.commons.support.Resource> scanForResourcesInClasspathRoot(URI root,
110-
Predicate<org.junit.platform.commons.support.Resource> resourceFilter) {
111-
throw new UnsupportedOperationException(
112-
"Implement scanForResourcesInClasspathRoot(URI, ResourceFilter) instead");
113-
}
114-
11565
/**
11666
* Find all {@linkplain Resource resources} in the supplied classpath {@code root}
11767
* that match the specified {@code resourceFilter} predicate.
@@ -128,12 +78,7 @@ default List<org.junit.platform.commons.support.Resource> scanForResourcesInClas
12878
* @since 6.0
12979
*/
13080
@API(status = MAINTAINED, since = "6.0")
131-
@SuppressWarnings("removal")
132-
default List<Resource> scanForResourcesInPackage(String basePackageName, ResourceFilter resourceFilter) {
133-
return scanForResourcesInPackage(basePackageName, resource -> resourceFilter.match(oldToNew(resource))).stream() //
134-
.map(ClasspathScanner::oldToNew) //
135-
.toList();
136-
}
81+
List<Resource> scanForResourcesInPackage(String basePackageName, ResourceFilter resourceFilter);
13782

13883
/**
13984
* Find all {@linkplain Resource resources} in the supplied classpath {@code root}
@@ -150,16 +95,6 @@ default List<Resource> scanForResourcesInPackage(String basePackageName, Resourc
15095
* @since 6.0
15196
*/
15297
@API(status = MAINTAINED, since = "6.0")
153-
@SuppressWarnings("removal")
154-
default List<Resource> scanForResourcesInClasspathRoot(URI root, ResourceFilter resourceFilter) {
155-
return scanForResourcesInClasspathRoot(root, r -> resourceFilter.match(oldToNew(r))).stream() //
156-
.map(ClasspathScanner::oldToNew) //
157-
.toList();
158-
}
159-
160-
@SuppressWarnings("removal")
161-
private static Resource oldToNew(org.junit.platform.commons.support.Resource oldResource) {
162-
return Resource.of(oldResource.getName(), oldResource.getUri());
163-
}
98+
List<Resource> scanForResourcesInClasspathRoot(URI root, ResourceFilter resourceFilter);
16499

165100
}

platform-tooling-support-tests/src/archUnit/java/platform/tooling/support/tests/ArchUnitTests.java

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,6 @@
6565
import org.junit.jupiter.api.extension.MediaType;
6666
import org.junit.jupiter.params.aggregator.ArgumentsAccessor;
6767
import org.junit.jupiter.params.support.ParameterInfo;
68-
import org.junit.platform.commons.support.scanning.ClasspathScanner;
6968
import org.junit.platform.engine.TestDescriptor;
7069
import org.junit.platform.engine.reporting.OutputDirectoryProvider;
7170

@@ -154,17 +153,13 @@ void freeOfGroupCycles(JavaClasses classes) {
154153
slices().matching("org.junit.(*)..").should().beFreeOfCycles().check(classes);
155154
}
156155

157-
@SuppressWarnings("removal")
158156
@ArchTest
159157
void freeOfPackageCycles(JavaClasses classes) {
160158
slices().matching("org.junit.(**)").should().beFreeOfCycles() //
161159

162160
// https://github.com/junit-team/junit-framework/issues/4886
163161
.ignoreDependency(TestReporter.class, MediaType.class) //
164162

165-
// https://github.com/junit-team/junit-framework/issues/4885
166-
.ignoreDependency(ClasspathScanner.class, org.junit.platform.commons.support.Resource.class) //
167-
168163
// Needs more investigation
169164
.ignoreDependency(ParameterInfo.class, ArgumentsAccessor.class)
170165

0 commit comments

Comments
 (0)