{"record":{"id":"9d92db476cc44101","repo":"junit-team/junit5","slug":"implement-scanforresourcesinpackage-string-resour","errorCode":null,"errorMessage":"Implement scanForResourcesInPackage(String, ResourceFilter) instead","messagePattern":"Implement scanForResourcesInPackage\\(String, ResourceFilter\\) instead","errorType":"exception","errorClass":"UnsupportedOperationException","httpStatus":null,"severity":"warning","filePath":"junit-platform-commons/src/main/java/org/junit/platform/commons/support/scanning/ClasspathScanner.java","lineNumber":88,"sourceCode":"\t *\n\t * <p>The classpath scanning algorithm searches recursively in subpackages\n\t * beginning with the root of the classpath.\n\t *\n\t * @param basePackageName the name of the base package in which to start\n\t * scanning; must not be {@code null} and must be valid in terms of Java\n\t * syntax\n\t * @param resourceFilter the resource type filter; never {@code null}\n\t * @return a list of all such resources found; never {@code null}\n\t * but potentially empty\n\t * @deprecated Please implement\n\t * {@link #scanForResourcesInPackage(String, ResourceFilter)} instead\n\t */\n\t@API(status = DEPRECATED, since = \"1.14\")\n\t@Deprecated(since = \"1.14\", forRemoval = true)\n\t@SuppressWarnings({ \"removal\", \"unused\" })\n\tdefault List<org.junit.platform.commons.support.Resource> scanForResourcesInPackage(String basePackageName,\n\t\t\tPredicate<org.junit.platform.commons.support.Resource> resourceFilter) {\n\t\tthrow new UnsupportedOperationException(\"Implement scanForResourcesInPackage(String, ResourceFilter) instead\");\n\t}\n\n\t/**\n\t * Find all {@linkplain org.junit.platform.commons.support.Resource resources} in the supplied classpath {@code root}\n\t * that match the specified {@code resourceFilter} predicate.\n\t *\n\t * <p>The classpath scanning algorithm searches recursively in subpackages\n\t * beginning with the root of the classpath.\n\t *\n\t * @param root the URI for the classpath root in which to scan; never\n\t * {@code null}\n\t * @param resourceFilter the resource type filter; never {@code null}\n\t * @return a list of all such resources found; never {@code null}\n\t * but potentially empty\n\t * @deprecated Please implement\n\t * {@link #scanForResourcesInClasspathRoot(URI, ResourceFilter)} instead\n\t */\n\t@API(status = DEPRECATED, since = \"1.14\")","sourceCodeStart":70,"sourceCodeEnd":106,"githubUrl":"https://github.com/junit-team/junit5/blob/f070c699a08b5d8393df9afd147af5c5e90bb21b/junit-platform-commons/src/main/java/org/junit/platform/commons/support/scanning/ClasspathScanner.java#L70-L106","documentation":"UnsupportedOperationException thrown by the deprecated default method scanForResourcesInPackage(String, Predicate<Resource>) on the ClasspathScanner interface (deprecated since 1.14, forRemoval=true). The default impl throws because implementers must override the new scanForResourcesInPackage(String, ResourceFilter) variant that takes the typed ResourceFilter instead of a raw Predicate.","triggerScenarios":"A ClasspathScanner ServiceLoader implementation that does not override the new ResourceFilter-based scanForResourcesInPackage, while the framework or a caller invokes the deprecated Predicate-based default method.","commonSituations":"Custom ClasspathScanner SPI implementation not yet migrated to the 1.14 API; version skew between junit-platform-commons and a third-party scanner; shading pulling in an old scanner that only knows the Predicate overload.","solutions":["Implement scanForResourcesInPackage(String, ResourceFilter) in the custom ClasspathScanner","Stop calling the deprecated Predicate-based overload","Align all junit-platform-* artifacts on the same version"],"exampleFix":"// before\n@Override\npublic List<Resource> scanForResourcesInPackage(String pkg, Predicate<Resource> f) { ... }\n\n// after\n@Override\npublic List<Resource> scanForResourcesInPackage(String pkg, ResourceFilter f) { ... }","handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":["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"],"tags":["classpath-scanning","deprecated-api","migration","spi"],"backgroundTag":null,"analyzedSha":"f070c699a08b5d8393df9afd147af5c5e90bb21b","analyzedAt":"2026-08-11T20:31:00.530Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}