aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordiamondm <diamondm@google.com>2017-05-31 10:52:17 -0700
committerRon Shapiro <ronshapiro@google.com>2017-06-05 15:28:28 -0400
commit0535c651b2b9682e06436c17cb91e6c19feeef9a (patch)
treeb80084b3dca53e7b97cc6117f87e754c2fbc6b58
parent3299e69f75cf524e6d101d88e8c202c1b24bf25a (diff)
downloadjimfs-0535c651b2b9682e06436c17cb91e6c19feeef9a.tar.gz
Fix comparison in JimfsPath that will always return false (as ArrayDeque is not
a List) to simply compare the collections' elements. Eclipse caught this issue, warning "Unlikely argument type for equals(): ImmutableList<Name> seems to be unrelated to Deque<Name>". Also applied two ErrorProne fixes to "Use grouping parenthesis to make the operator precedence explicit". ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=157605901
-rw-r--r--jimfs/src/main/java/com/google/common/jimfs/JimfsPath.java8
1 files changed, 3 insertions, 5 deletions
diff --git a/jimfs/src/main/java/com/google/common/jimfs/JimfsPath.java b/jimfs/src/main/java/com/google/common/jimfs/JimfsPath.java
index 691073b..4877129 100644
--- a/jimfs/src/main/java/com/google/common/jimfs/JimfsPath.java
+++ b/jimfs/src/main/java/com/google/common/jimfs/JimfsPath.java
@@ -22,7 +22,6 @@ import static com.google.common.base.Preconditions.checkNotNull;
import com.google.common.collect.ComparisonChain;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.Iterables;
-
import java.io.File;
import java.io.IOException;
import java.net.URI;
@@ -42,7 +41,6 @@ import java.util.Deque;
import java.util.Iterator;
import java.util.List;
import java.util.Objects;
-
import javax.annotation.Nullable;
/**
@@ -134,7 +132,7 @@ final class JimfsPath implements Path {
@Override
public JimfsPath getParent() {
- if (names.isEmpty() || names.size() == 1 && root == null) {
+ if (names.isEmpty() || (names.size() == 1 && root == null)) {
return null;
}
@@ -227,7 +225,7 @@ final class JimfsPath implements Path {
}
}
- return newNames.equals(names) ? this : pathService.createPath(root, newNames);
+ return Iterables.elementsEqual(newNames, names) ? this : pathService.createPath(root, newNames);
}
/**
@@ -235,7 +233,7 @@ final class JimfsPath implements Path {
* "." names and contains no ".." names in a location other than the start of the path.
*/
private boolean isNormal() {
- if (getNameCount() == 0 || getNameCount() == 1 && !isAbsolute()) {
+ if (getNameCount() == 0 || (getNameCount() == 1 && !isAbsolute())) {
return true;
}