junit-team/junit5 · warning · UnsupportedOperationException
Implement scanForResourcesInClasspathRoot(URI…
Error message
Implement scanForResourcesInClasspathRoot(URI, ResourceFilter) instead
What it means
UnsupportedOperationException thrown by the deprecated default method scanForResourcesInClasspathRoot(URI, Predicate<Resource>) on the ClasspathScanner interface (deprecated since 1.14, forRemoval=true). Implementers must override the new scanForResourcesInClasspathRoot(URI, ResourceFilter) variant that takes the typed ResourceFilter.
Solutions
- Override scanForResourcesInClasspathRoot(URI, ResourceFilter) in the custom ClasspathScanner
- Stop calling the deprecated overload
- Align all junit-platform-* artifacts on the same version
Example fix
// before
@Override
public List<Resource> scanForResourcesInClasspathRoot(URI root, Predicate<Resource> f) { ... }
// after
@Override
public List<Resource> scanForResourcesInClasspathRoot(URI root, ResourceFilter f) { ... } Defensive patterns
Strategy: validation
Prevention
- Migrate custom ClasspathScanner implementations to the 1.14 ResourceFilter API
- Keep all junit-platform-* versions aligned via junit-bom
- Treat @Deprecated(forRemoval=true) SPI methods as already removed
When it happens
Trigger: A ClasspathScanner implementation lacking the new scanForResourcesInClasspathRoot(URI, ResourceFilter) override, while the framework or a caller invokes the deprecated Predicate-based default method.
Common situations: Unmigrated custom ClasspathScanner SPI implementation; version skew between junit-platform-commons and a third-party scanner; shading pulling in an old scanner that only implements the Predicate overload.
Related errors
- Implement scanForResourcesInPackage(String, ResourceFilter)…
- AnnotationBasedArgumentsProvider does not override the…
- ArgumentConverter does not override the convert(Object…
- ArgumentsAggregator does not override the…
- ArgumentsProvider does not override the…
AI-assisted analysis of junit-team/junit5@f070c699a0 (2026-08-11).
Data as JSON: /api/errors/2df8813cf9bc943c.
Report an issue: GitHub.
Appendix: source
Thrown at junit-platform-commons/src/main/java/org/junit/platform/commons/support/scanning/ClasspathScanner.java:111
* that match the specified {@code resourceFilter} predicate.
*
* <p>The classpath scanning algorithm searches recursively in subpackages
* beginning with the root of the classpath.
*
* @param root the URI for the classpath root in which to scan; never
* {@code null}
* @param resourceFilter the resource type filter; never {@code null}
* @return a list of all such resources found; never {@code null}
* but potentially empty
* @deprecated Please implement
* {@link #scanForResourcesInClasspathRoot(URI, ResourceFilter)} instead
*/
@API(status = DEPRECATED, since = "1.14")
@Deprecated(since = "1.14", forRemoval = true)
@SuppressWarnings("removal")
default List<org.junit.platform.commons.support.Resource> scanForResourcesInClasspathRoot(URI root,
Predicate<org.junit.platform.commons.support.Resource> resourceFilter) {
throw new UnsupportedOperationException(
"Implement scanForResourcesInClasspathRoot(URI, ResourceFilter) instead");
}
/**
* Find all {@linkplain Resource resources} in the supplied classpath {@code root}
* that match the specified {@code resourceFilter} predicate.
*
* <p>The classpath scanning algorithm searches recursively in subpackages
* beginning with the root of the classpath.
*
* @param basePackageName the name of the base package in which to start
* scanning; must not be {@code null} and must be valid in terms of Java
* syntax
* @param resourceFilter the resource type filter; never {@code null}
* @return a list of all such resources found; never {@code null}
* but potentially empty
* @since 1.14
*/View on GitHub (pinned to f070c699a0)