Skip to content

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

Merged
slawekjaranowski merged 1 commit into
masterfrom
elharo-patch-3
Apr 30, 2023
Merged

slawekjaranowski merged 1 commit into
masterfrom
elharo-patch-3

Conversation

@elharo

@elharo elharo commented Mar 5, 2023

Copy link
Copy Markdown
Contributor

No description provided.

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

@michael-o michael-o left a comment

Copy link
Copy Markdown
Member

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

elharo commented Mar 11, 2023

Copy link
Copy Markdown
Contributor Author

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.

@michael-o michael-o left a comment

Copy link
Copy Markdown
Member

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

elharo commented Mar 11, 2023

Copy link
Copy Markdown
Contributor Author

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

elharo commented Mar 11, 2023

Copy link
Copy Markdown
Contributor Author

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