Repository navigation
Conversation
Delegate named default-file-system paths to accept(File), preserving subclass filtering after the switch to NIO traversal. Keep direct name matching for other file systems and for null or root paths. Add regressions for File and Path overrides, real file iteration, non-default file systems, and paths without a file name. Generated-by: OpenAI Codex
Resolve the additive WildcardFileFilterTest conflict by keeping the upstream repeated-wildcard regression and the File override regressions. The contribution remains three files and 85 additions against master. On upstream f9de7a4 the two focused suites run 15 tests with the same two regression failures. The merged fix passes 28 related tests and Checkstyle. Generated-by: OpenAI Codex
|
The issue reported in IO-754 is real, and this PR fixes its example. However, forwarding An existing subclass can delegate its File implementation to the superclass’s Path implementation: final WildcardFileFilter filter = new WildcardFileFilter("*.txt") {
private static final long serialVersionUID = 1L;
@Override
public boolean accept(final File file) {
return super.accept(file.toPath(), null) == FileVisitResult.CONTINUE;
}
};
filter.accept(new File("log.txt"));Before this change, the call returns I reproduced this behavior before and after applying the proposed runtime change. The new tests cover File overrides that delegate to Please add this regression case and reconsider where the compatibility dispatch belongs. Fixing FileUtils traversal should preserve existing subclass delegation patterns as well as restore the behavior described in IO-754. I've set this PR to draft. Please rebase on git master and see |
Keep the upstream File-to-super-Path regression and the original PR regressions while updating to master 308cfd2 without rewriting history. The newly added delegation test reproduces StackOverflowError with the existing PR runtime change; the following fix relocates the dispatch. Assisted-By: OpenAI Codex
…daries Keep WildcardFileFilter's Path entry point independent so a File override can safely delegate to super.accept(Path, BasicFileAttributes). Adapt legacy File overrides during FileUtils traversal setup, before the internal file/directory combinations. Preserve explicit Path overrides and stock AND, OR and NOT combinations without duplicating callbacks. Leave custom composite Path implementations intact and retain root short-circuit ordering and path attributes. The upstream recursion regression fails with StackOverflowError before this revision. Upstream 308cfd2 with the final regressions runs 25 tests with 8 failures; the revised runtime passes 106 related tests, Checkstyle, SpotBugs and PMD. No unrelated full-suite rerun was performed. Assisted-By: OpenAI Codex
|
AI-generated update (OpenAI Codex), posted for @sushu0. You're right: the File-to-super-Path delegation test reproduces The revised dispatch is at the Master Validation on JDK 21:
The PR description now reflects this implementation and validation. The full local default build was not repeated, and its checklist item remains unchecked. Earlier full-suite and green CI results are explicitly scoped to their earlier revisions. The PR is ready for re-review. Java CI for the new head is awaiting maintainer approval and has no jobs yet; no current-head hosted test success is claimed. |
Fix IO-754: File-based traversal must honor an existing
WildcardFileFilter.accept(File)override without making the superclass Path implementation call back into that override.The earlier Path-to-File bridge caused a cycle when a File override delegated to
super.accept(Path, BasicFileAttributes). That bridge has been removed.WildcardFileFilterhas no runtime changes relative to current master.The compatibility dispatch now happens at
FileUtilstraversal setup, before its file/directory AND/OR combinations:BasicFileAttributes.Master
308cfd2was incorporated with merge commitc2331ba; the revision is commit98a9ac3. The published branch history was retained through a normal merge and push.Validation on Windows / Zulu OpenJDK 21.0.12.1 / Maven 3.9.16:
testAcceptFileOverrideDelegatingToSuperPath()regression fails withStackOverflowErrorusing the pre-revision runtime after the master merge (c2331ba).308cfd2, with only the final regression tests added, runs 25 tests with 8 failures and no errors or skips. Those failures cover the original acceptance/rejection problem, the delegated File entry points, directory filtering, and composed filters. The same 25 pass with this revision.mvn -Dtest=FileUtilsListFilesTest,WildcardFileFilterTest,FilenameUtilsWildcardTest,AndFileFilterTest,OrFileFilterTest,FileFilterTest test checkstyle:check spotbugs:checkpasses all 106 related tests, with no failures, errors or skips, 0 Checkstyle violations, and 0 SpotBugs bug instances.mvn -U pmd:checkpasses after routing dependency resolution through the existing local proxy.The commands use a task-local Maven settings file. The complete default build was not rerun locally for this revision. Earlier local full-suite results were for
318b0c8against08ea7bf; earlier green hosted checks were forc7edc2d. Neither is presented as validation of the current revision. The default-build checklist item remains unchecked pending current-head evidence.AI disclosure: OpenAI Codex assisted the investigation, implementation, regression tests, conflict resolution, validation and PR text. New commits use the repository's
Assisted-By: OpenAI Codextrailer; earlier provenance trailers are preserved. No independent human review is claimed.