Skip to content

Commit

Permalink
Remove Files.fileTreeTraverser().
Browse files Browse the repository at this point in the history
RELNOTES=`io`: Removed deprecated `Files.fileTreeTraverser()` and `MoreFiles.directoryTreeTraverser()`.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=194276111
  • Loading branch information
cgdecker committed Apr 25, 2018
1 parent 62b40aa commit ce6d93c
Show file tree
Hide file tree
Showing 7 changed files with 6 additions and 229 deletions.

This file was deleted.

3 changes: 1 addition & 2 deletions android/guava-tests/test/com/google/common/io/FilesTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,7 @@
/**
* Unit test for {@link Files}.
*
* <p>Note: {@link Files#fileTreeTraverser()} is tested in {@link FileTreeTraverserTest} and {@link
* Files#fileTraverser()} is tested in {@link FilesFileTraverserTest}.
* <p>Note: {@link Files#fileTraverser()} is tested in {@link FilesFileTraverserTest}.
*
* @author Chris Nokleberg
*/
Expand Down
5 changes: 2 additions & 3 deletions android/guava/src/com/google/common/io/Files.java
Original file line number Diff line number Diff line change
Expand Up @@ -802,11 +802,10 @@ public static String getNameWithoutExtension(String file) {
*
* @since 15.0
* @deprecated The returned {@link TreeTraverser} type is deprecated. Use the replacement method
* {@link #fileTraverser()} instead with the same semantics as this method. This method is
* scheduled to be removed in April 2018.
* {@link #fileTraverser()} instead with the same semantics as this method.
*/
@Deprecated
public static TreeTraverser<File> fileTreeTraverser() {
static TreeTraverser<File> fileTreeTraverser() {
return FILE_TREE_TRAVERSER;
}

Expand Down
92 changes: 0 additions & 92 deletions guava-tests/test/com/google/common/io/FileTreeTraverserTest.java

This file was deleted.

3 changes: 1 addition & 2 deletions guava-tests/test/com/google/common/io/FilesTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,7 @@
/**
* Unit test for {@link Files}.
*
* <p>Note: {@link Files#fileTreeTraverser()} is tested in {@link FileTreeTraverserTest} and {@link
* Files#fileTraverser()} is tested in {@link FilesFileTraverserTest}.
* <p>Note: {@link Files#fileTraverser()} is tested in {@link FilesFileTraverserTest}.
*
* @author Chris Nokleberg
*/
Expand Down
5 changes: 2 additions & 3 deletions guava/src/com/google/common/io/Files.java
Original file line number Diff line number Diff line change
Expand Up @@ -802,11 +802,10 @@ public static String getNameWithoutExtension(String file) {
*
* @since 15.0
* @deprecated The returned {@link TreeTraverser} type is deprecated. Use the replacement method
* {@link #fileTraverser()} instead with the same semantics as this method. This method is
* scheduled to be removed in April 2018.
* {@link #fileTraverser()} instead with the same semantics as this method.
*/
@Deprecated
public static TreeTraverser<File> fileTreeTraverser() {
static TreeTraverser<File> fileTreeTraverser() {
return FILE_TREE_TRAVERSER;
}

Expand Down
35 changes: 0 additions & 35 deletions guava/src/com/google/common/io/MoreFiles.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
import com.google.common.base.Optional;
import com.google.common.base.Predicate;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.TreeTraverser;
import com.google.common.graph.SuccessorsFunction;
import com.google.common.graph.Traverser;
import com.google.common.io.ByteSource.AsCharSource;
Expand Down Expand Up @@ -267,40 +266,6 @@ public static ImmutableList<Path> listFiles(Path dir) throws IOException {
}
}

/**
* Returns a {@link TreeTraverser} for traversing a directory tree. The returned traverser
* attempts to avoid following symbolic links to directories. However, the traverser cannot
* guarantee that it will not follow symbolic links to directories as it is possible for a
* directory to be replaced with a symbolic link between checking if the file is a directory and
* actually reading the contents of that directory.
*
* <p>Note that if the {@link Path} passed to one of the traversal methods does not exist, no
* exception will be thrown and the returned {@link Iterable} will contain a single element: that
* path.
*
* <p>{@link DirectoryIteratorException} may be thrown when iterating {@link Iterable} instances
* created by this traverser if an {@link IOException} is thrown by a call to {@link
* #listFiles(Path)}.
*
* @deprecated The returned {@link TreeTraverser} type is deprecated. Use the replacement method
* {@link #fileTraverser()} instead with the same semantics as this method. This method is
* scheduled to be removed in April 2018.
*/
@Deprecated
public static TreeTraverser<Path> directoryTreeTraverser() {
return DirectoryTreeTraverser.INSTANCE;
}

private static final class DirectoryTreeTraverser extends TreeTraverser<Path> {

private static final DirectoryTreeTraverser INSTANCE = new DirectoryTreeTraverser();

@Override
public Iterable<Path> children(Path dir) {
return fileTreeChildren(dir);
}
}

/**
* Returns a {@link Traverser} instance for the file and directory tree. The returned traverser
* starts from a {@link Path} and will return all files and directories it encounters.
Expand Down

0 comments on commit ce6d93c

Please sign in to comment.