Skip to content

Commit

Permalink
support recursive class file walk
Browse files Browse the repository at this point in the history
  • Loading branch information
i36lib committed Apr 12, 2024
1 parent 4ddcf0f commit 3c5ccf0
Showing 1 changed file with 9 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,16 @@ public static void walkClassFiles(
} else {
packagePath = Paths.get(packageDirUrl.toURI());
}
try (DirectoryStream<Path> paths = Files.newDirectoryStream(packagePath, "*.class")) {
try (DirectoryStream<Path> paths = Files.newDirectoryStream(packagePath)) {
for (Path path : paths) {
walker.accept(path, buildCanonicalName(packagePrefix, path.getFileName().toString()));
if (Files.isDirectory(path)) {
walkClassFiles(walker, packagePrefix + "." + path.getFileName().toString());
continue;
}
if (path.getFileSystem().getPathMatcher("glob:*.class")
.matches(path.getFileName())) {
walker.accept(path, buildCanonicalName(packagePrefix, path.getFileName().toString()));
}
}
}
} finally {
Expand Down

0 comments on commit 3c5ccf0

Please sign in to comment.