Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

suggest java.nio.Files.walkFileTree as replacement for DirectoryScanner #133

Merged
merged 1 commit into from
Apr 30, 2023

Conversation

elharo
Copy link
Contributor

@elharo elharo commented Mar 5, 2023

No description provided.

@elharo elharo requested a review from michael-o March 10, 2023 12:16
Copy link
Member

@michael-o michael-o left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking at those I don't see both as a 1:1 alternative, no? It still requires addon code.

@elharo
Copy link
Contributor Author

elharo commented Mar 11, 2023

That is correct. It's not a 1:1 replacement, but it does serve the same purpose. Starting from a green field it's no more work to write new code on top of Files.walkFileTree or DirectoryStream instead of DirectoryScanner; and those are more familiar since they're in the JDK. However, migrating from existing DirectoryScanner to one of the JDK alternatives is not a simple search and replace. I'm working on some of those migrations now which is where I noticed Files.walkFileTree was also a good option.

Copy link
Member

@michael-o michael-o left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please mention the missing bits in your deprecation notice.

@elharo
Copy link
Contributor Author

elharo commented Mar 11, 2023

Are there missing bits you're especially concerned about like the default exclusions? Nothing is really missing from the alternatives. It's just that you have to write different code, sort of like the difference between going from 14th Street to Penn Station via subway or taxi. Both have the same endpoints but the route and procedure are quite different.

@elharo
Copy link
Contributor Author

elharo commented Mar 11, 2023

apache/maven-dependency-analyzer#81 is an example of the sort of change needed to replace these methods, though in that case it's moving from the plexus-utils version

@michael-o michael-o self-requested a review April 30, 2023 20:00
@slawekjaranowski slawekjaranowski merged commit 1980a20 into master Apr 30, 2023
@slawekjaranowski slawekjaranowski deleted the elharo-patch-3 branch April 30, 2023 20:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants