Guava: No replacement for Files.fileTreeTraverser() and MoreFiles.directoryTreeTraverser()

Created on 27 Oct 2017  路  5Comments  路  Source: google/guava

As of 23.3, com.google.common.collect.TreeTraverser is deprecated. Are Files.fileTreeTraverser() and MoreFiles.directoryTreeTraverser() deprecated too? Should users migrate to java.nio.file.SimpleFileVisitor?

Note that MoreFiles.directoryTreeTraverser() appeared in 21.0 (Java 8), despite SimpleFileVisitor presence (Java 7).

P1 package=io status=fixed type=other

Most helpful comment

We're adding Files.fileTraverser() and MoreFiles.fileTraverser() as graph.Traverser versions of the TreeTraverser-returning methods and will be deprecating those methods. That should be in this week's release.

All 5 comments

The immediate intent of deprecatingcommon.collect.TreeTraverser is to discourage new uses of it in favor of common.graph.Traverser.

The Files and MoreFiles methods are not deprecated at this time, and I don't know what the plans are for them. Options include (a) removing them outright, and (b) replacing them with methods that use Traverser; we probably won't just leave them alone indefinitely.

My understanding was that there won鈥檛 be any breaking changes after 22.0. So option (a) is actually not an option, is it?

@szarnekow I thought that too, but then I remembered that the Guava team also announced that @Beta stuff will still be eligible for consideration of removal. Given that TreeTraverser's still in @Beta, option (a) is still a valid option AFAICT.

Files and MoreFiles are also each @Beta.

We're adding Files.fileTraverser() and MoreFiles.fileTraverser() as graph.Traverser versions of the TreeTraverser-returning methods and will be deprecating those methods. That should be in this week's release.

Was this page helpful?
0 / 5 - 0 ratings