aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorcgdecker <cgdecker@google.com>2015-02-25 12:57:08 -0800
committerColin Decker <cgdecker@google.com>2015-02-25 15:59:56 -0500
commit3754b9ed377552b2d85168b20a609a97f3e5aa0d (patch)
tree951edfe748127a433532b2ce52bfd52b51ffada0
parenta27e6950930139aa38d4f60bfdec70f454621b06 (diff)
downloadjimfs-3754b9ed377552b2d85168b20a609a97f3e5aa0d.tar.gz
Change usages of deprecated Objects methods to MoreObjects.
Also change usages of base.Objects methods to java.util.Objects where possible. ------------- Created by MOE: http://code.google.com/p/moe-java MOE_MIGRATED_REVID=87182713
-rw-r--r--jimfs/src/main/java/com/google/common/jimfs/AbstractWatchService.java9
-rw-r--r--jimfs/src/main/java/com/google/common/jimfs/DirectoryEntry.java9
-rw-r--r--jimfs/src/main/java/com/google/common/jimfs/File.java4
-rw-r--r--jimfs/src/main/java/com/google/common/jimfs/FileSystemView.java4
-rw-r--r--jimfs/src/main/java/com/google/common/jimfs/JimfsPath.java6
-rw-r--r--jimfs/src/main/java/com/google/common/jimfs/PathMatchers.java4
-rw-r--r--jimfs/src/test/java/com/google/common/jimfs/PathSubject.java6
-rw-r--r--jimfs/src/test/java/com/google/common/jimfs/TestUtils.java4
8 files changed, 24 insertions, 22 deletions
diff --git a/jimfs/src/main/java/com/google/common/jimfs/AbstractWatchService.java b/jimfs/src/main/java/com/google/common/jimfs/AbstractWatchService.java
index ed0fb83..ac3556f 100644
--- a/jimfs/src/main/java/com/google/common/jimfs/AbstractWatchService.java
+++ b/jimfs/src/main/java/com/google/common/jimfs/AbstractWatchService.java
@@ -21,7 +21,7 @@ import static com.google.common.base.Preconditions.checkNotNull;
import static java.nio.file.StandardWatchEventKinds.OVERFLOW;
import com.google.common.annotations.VisibleForTesting;
-import com.google.common.base.Objects;
+import com.google.common.base.MoreObjects;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableSet;
@@ -34,6 +34,7 @@ import java.nio.file.Watchable;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
+import java.util.Objects;
import java.util.concurrent.ArrayBlockingQueue;
import java.util.concurrent.BlockingQueue;
import java.util.concurrent.LinkedBlockingQueue;
@@ -188,19 +189,19 @@ abstract class AbstractWatchService implements WatchService {
Event<?> other = (Event<?>) obj;
return kind().equals(other.kind())
&& count() == other.count()
- && Objects.equal(context(), other.context());
+ && Objects.equals(context(), other.context());
}
return false;
}
@Override
public int hashCode() {
- return Objects.hashCode(kind(), count(), context());
+ return Objects.hash(kind(), count(), context());
}
@Override
public String toString() {
- return Objects.toStringHelper(this)
+ return MoreObjects.toStringHelper(this)
.add("kind", kind())
.add("count", count())
.add("context", context())
diff --git a/jimfs/src/main/java/com/google/common/jimfs/DirectoryEntry.java b/jimfs/src/main/java/com/google/common/jimfs/DirectoryEntry.java
index e2902a7..f7d4d80 100644
--- a/jimfs/src/main/java/com/google/common/jimfs/DirectoryEntry.java
+++ b/jimfs/src/main/java/com/google/common/jimfs/DirectoryEntry.java
@@ -19,13 +19,14 @@ package com.google.common.jimfs;
import static com.google.common.base.Preconditions.checkNotNull;
import static com.google.common.base.Preconditions.checkState;
-import com.google.common.base.Objects;
+import com.google.common.base.MoreObjects;
import java.nio.file.FileAlreadyExistsException;
import java.nio.file.NoSuchFileException;
import java.nio.file.NotDirectoryException;
import java.nio.file.NotLinkException;
import java.nio.file.Path;
+import java.util.Objects;
import javax.annotation.Nullable;
@@ -157,19 +158,19 @@ final class DirectoryEntry {
DirectoryEntry other = (DirectoryEntry) obj;
return directory.equals(other.directory)
&& name.equals(other.name)
- && Objects.equal(file, other.file);
+ && Objects.equals(file, other.file);
}
return false;
}
@Override
public int hashCode() {
- return Objects.hashCode(directory, name, file);
+ return Objects.hash(directory, name, file);
}
@Override
public String toString() {
- return Objects.toStringHelper(this)
+ return MoreObjects.toStringHelper(this)
.add("directory", directory)
.add("name", name)
.add("file", file)
diff --git a/jimfs/src/main/java/com/google/common/jimfs/File.java b/jimfs/src/main/java/com/google/common/jimfs/File.java
index 9fd8c29..d47248f 100644
--- a/jimfs/src/main/java/com/google/common/jimfs/File.java
+++ b/jimfs/src/main/java/com/google/common/jimfs/File.java
@@ -19,7 +19,7 @@ package com.google.common.jimfs;
import static com.google.common.base.Preconditions.checkNotNull;
import com.google.common.annotations.VisibleForTesting;
-import com.google.common.base.Objects;
+import com.google.common.base.MoreObjects;
import com.google.common.collect.HashBasedTable;
import com.google.common.collect.ImmutableSet;
import com.google.common.collect.Table;
@@ -323,7 +323,7 @@ public abstract class File {
@Override
public final String toString() {
- return Objects.toStringHelper(this)
+ return MoreObjects.toStringHelper(this)
.add("id", id())
.toString();
}
diff --git a/jimfs/src/main/java/com/google/common/jimfs/FileSystemView.java b/jimfs/src/main/java/com/google/common/jimfs/FileSystemView.java
index 70555d3..b7ab122 100644
--- a/jimfs/src/main/java/com/google/common/jimfs/FileSystemView.java
+++ b/jimfs/src/main/java/com/google/common/jimfs/FileSystemView.java
@@ -24,7 +24,6 @@ import static java.nio.file.StandardOpenOption.CREATE_NEW;
import static java.nio.file.StandardOpenOption.TRUNCATE_EXISTING;
import static java.nio.file.StandardOpenOption.WRITE;
-import com.google.common.base.Objects;
import com.google.common.base.Supplier;
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.ImmutableSortedSet;
@@ -46,6 +45,7 @@ import java.nio.file.attribute.FileAttribute;
import java.nio.file.attribute.FileAttributeView;
import java.util.ArrayList;
import java.util.List;
+import java.util.Objects;
import java.util.Set;
import java.util.concurrent.locks.Lock;
import java.util.concurrent.locks.ReadWriteLock;
@@ -199,7 +199,7 @@ final class FileSystemView {
try {
File file = lookUp(path, Options.FOLLOW_LINKS).fileOrNull();
File file2 = view2.lookUp(path2, Options.FOLLOW_LINKS).fileOrNull();
- return file != null && Objects.equal(file, file2);
+ return file != null && Objects.equals(file, file2);
} finally {
store.readLock().unlock();
}
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 e157efa..868a95e 100644
--- a/jimfs/src/main/java/com/google/common/jimfs/JimfsPath.java
+++ b/jimfs/src/main/java/com/google/common/jimfs/JimfsPath.java
@@ -19,7 +19,6 @@ package com.google.common.jimfs;
import static com.google.common.base.Preconditions.checkArgument;
import static com.google.common.base.Preconditions.checkNotNull;
-import com.google.common.base.Objects;
import com.google.common.collect.ComparisonChain;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.Iterables;
@@ -42,6 +41,7 @@ import java.util.Collections;
import java.util.Deque;
import java.util.Iterator;
import java.util.List;
+import java.util.Objects;
import javax.annotation.Nullable;
@@ -172,7 +172,7 @@ final class JimfsPath implements Path {
JimfsPath otherPath = checkPath(other);
return otherPath != null
&& getFileSystem().equals(otherPath.getFileSystem())
- && Objects.equal(root, otherPath.root)
+ && Objects.equals(root, otherPath.root)
&& startsWith(names, otherPath.names);
}
@@ -318,7 +318,7 @@ final class JimfsPath implements Path {
throw new ProviderMismatchException(other.toString());
}
- checkArgument(Objects.equal(root, otherPath.root),
+ checkArgument(Objects.equals(root, otherPath.root),
"Paths have different roots: %s, %s", this, other);
if (equals(other)) {
diff --git a/jimfs/src/main/java/com/google/common/jimfs/PathMatchers.java b/jimfs/src/main/java/com/google/common/jimfs/PathMatchers.java
index 473c1da..49dc57f 100644
--- a/jimfs/src/main/java/com/google/common/jimfs/PathMatchers.java
+++ b/jimfs/src/main/java/com/google/common/jimfs/PathMatchers.java
@@ -21,7 +21,7 @@ import static com.google.common.base.Preconditions.checkNotNull;
import com.google.common.annotations.VisibleForTesting;
import com.google.common.base.Ascii;
-import com.google.common.base.Objects;
+import com.google.common.base.MoreObjects;
import com.google.common.collect.ImmutableSet;
import java.nio.file.FileSystem;
@@ -91,7 +91,7 @@ final class PathMatchers {
@Override
public String toString() {
- return Objects.toStringHelper(this).addValue(pattern).toString();
+ return MoreObjects.toStringHelper(this).addValue(pattern).toString();
}
}
}
diff --git a/jimfs/src/test/java/com/google/common/jimfs/PathSubject.java b/jimfs/src/test/java/com/google/common/jimfs/PathSubject.java
index 4c4b6f6..c5387a1 100644
--- a/jimfs/src/test/java/com/google/common/jimfs/PathSubject.java
+++ b/jimfs/src/test/java/com/google/common/jimfs/PathSubject.java
@@ -19,7 +19,6 @@ package com.google.common.jimfs;
import static com.google.common.base.Preconditions.checkNotNull;
import static java.nio.charset.StandardCharsets.UTF_8;
-import com.google.common.base.Objects;
import com.google.common.collect.ImmutableList;
import com.google.common.io.BaseEncoding;
import com.google.common.truth.FailureStrategy;
@@ -36,6 +35,7 @@ import java.nio.file.PathMatcher;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
+import java.util.Objects;
import javax.annotation.Nullable;
@@ -423,7 +423,7 @@ public final class PathSubject extends Subject<PathSubject, Path> {
@Override
public Attribute is(Object value) throws IOException {
Object actualValue = Files.getAttribute(getSubject(), attribute, linkOptions);
- if (!Objects.equal(value, actualValue)) {
+ if (!Objects.equals(value, actualValue)) {
fail("attribute '" + attribute + "' is", value);
}
return this;
@@ -432,7 +432,7 @@ public final class PathSubject extends Subject<PathSubject, Path> {
@Override
public Attribute isNot(Object value) throws IOException {
Object actualValue = Files.getAttribute(getSubject(), attribute, linkOptions);
- if (Objects.equal(value, actualValue)) {
+ if (Objects.equals(value, actualValue)) {
fail("attribute '" + attribute + "' is not", value);
}
return this;
diff --git a/jimfs/src/test/java/com/google/common/jimfs/TestUtils.java b/jimfs/src/test/java/com/google/common/jimfs/TestUtils.java
index 41282ac..fb6b016 100644
--- a/jimfs/src/test/java/com/google/common/jimfs/TestUtils.java
+++ b/jimfs/src/test/java/com/google/common/jimfs/TestUtils.java
@@ -19,7 +19,6 @@ package com.google.common.jimfs;
import static java.nio.file.LinkOption.NOFOLLOW_LINKS;
import static org.junit.Assert.assertFalse;
-import com.google.common.base.Objects;
import com.google.common.collect.ImmutableList;
import java.io.IOException;
@@ -31,6 +30,7 @@ import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashSet;
import java.util.List;
+import java.util.Objects;
import java.util.Set;
/**
@@ -134,7 +134,7 @@ public final class TestUtils {
// equivalent to the Junit 4.11 method.
public static void assertNotEquals(Object unexpected, Object actual) {
assertFalse("Values should be different. Actual: " + actual,
- Objects.equal(unexpected, actual));
+ Objects.equals(unexpected, actual));
}
static RegularFile regularFile(int size) {