diff --git a/src/api/src/main/java/org/locationtech/geogig/model/HashObjectFunnels.java b/src/api/src/main/java/org/locationtech/geogig/model/HashObjectFunnels.java index 09686f99d4..34ca73174d 100644 --- a/src/api/src/main/java/org/locationtech/geogig/model/HashObjectFunnels.java +++ b/src/api/src/main/java/org/locationtech/geogig/model/HashObjectFunnels.java @@ -35,7 +35,6 @@ import org.opengis.feature.type.PropertyType; import org.opengis.referencing.crs.CoordinateReferenceSystem; -import com.google.common.collect.ImmutableList; import com.google.common.hash.Funnel; import com.google.common.hash.Funnels; import com.google.common.hash.Hasher; @@ -111,8 +110,8 @@ public static ObjectId hashTree(@Nullable List trees, @Nullable List @Nullable SortedMap buckets) { final Hasher hasher = ObjectId.HASH_FUNCTION.newHasher(); - trees = trees == null ? ImmutableList.of() : trees; - features = features == null ? ImmutableList.of() : features; + trees = trees == null ? Collections.emptyList() : trees; + features = features == null ? Collections.emptyList() : features; buckets = buckets == null ? Collections.emptySortedMap() : buckets; HashObjectFunnels.tree(hasher, trees, features, buckets.values()); @@ -154,8 +153,8 @@ public static ObjectId hashTree(@Nullable List trees, @Nullable List @Nullable Iterable buckets) { final Hasher hasher = ObjectId.HASH_FUNCTION.newHasher(); - trees = trees == null ? ImmutableList.of() : trees; - features = features == null ? ImmutableList.of() : features; + trees = trees == null ? Collections.emptyList() : trees; + features = features == null ? Collections.emptyList() : features; buckets = buckets == null ? Collections.emptySet() : buckets; HashObjectFunnels.tree(hasher, trees, features, buckets); diff --git a/src/api/src/main/java/org/locationtech/geogig/model/RevCommit.java b/src/api/src/main/java/org/locationtech/geogig/model/RevCommit.java index 95c004747e..13a1814082 100644 --- a/src/api/src/main/java/org/locationtech/geogig/model/RevCommit.java +++ b/src/api/src/main/java/org/locationtech/geogig/model/RevCommit.java @@ -9,10 +9,9 @@ */ package org.locationtech.geogig.model; +import java.util.List; import java.util.Optional; -import com.google.common.collect.ImmutableList; - /** * A revision commit is an immutable data structure that represents the full state of the repository * at a given point in time (by pointing to a root {@link RevTree tree}), and contains information @@ -91,7 +90,7 @@ public interface RevCommit extends RevObject { * * @return the list of parent commit ids for this commit */ - public ImmutableList getParentIds(); + public List getParentIds(); /** * Short cut for {@code getParentIds().get(parentIndex)}, retuning an optional with the parent diff --git a/src/api/src/main/java/org/locationtech/geogig/model/RevCommitBuilder.java b/src/api/src/main/java/org/locationtech/geogig/model/RevCommitBuilder.java index 3c2047eed3..20d2507c26 100644 --- a/src/api/src/main/java/org/locationtech/geogig/model/RevCommitBuilder.java +++ b/src/api/src/main/java/org/locationtech/geogig/model/RevCommitBuilder.java @@ -15,8 +15,6 @@ import org.locationtech.geogig.repository.DefaultPlatform; import org.locationtech.geogig.repository.Platform; -import com.google.common.collect.ImmutableList; - import lombok.Getter; import lombok.NonNull; import lombok.Setter; @@ -88,8 +86,8 @@ public RevCommit build() { int authorOffset = authorTimeZoneOffset == null ? committerOffset : authorTimeZoneOffset; final ObjectId treeId = this.treeId; - final ImmutableList parentIds = this.parentIds == null ? ImmutableList.of() - : ImmutableList.copyOf(this.parentIds); + final List parentIds = this.parentIds == null ? new ArrayList<>() + : this.parentIds; final RevPerson author = RevPerson.builder().build(this.author, authorEmail, authorTs, authorOffset); @@ -107,7 +105,7 @@ public RevCommit build(@NonNull ObjectId treeId, @NonNull List parents final ObjectId commitId = HashObjectFunnels.hashCommit(treeId, parents, author, committer, message); - return RevObjectFactory.defaultInstance().createCommit(commitId, treeId, - ImmutableList.copyOf(parents), author, committer, message); + return RevObjectFactory.defaultInstance().createCommit(commitId, treeId, parents, author, + committer, message); } } diff --git a/src/api/src/main/java/org/locationtech/geogig/model/RevFeature.java b/src/api/src/main/java/org/locationtech/geogig/model/RevFeature.java index 56a86a4384..8da0e69a6a 100644 --- a/src/api/src/main/java/org/locationtech/geogig/model/RevFeature.java +++ b/src/api/src/main/java/org/locationtech/geogig/model/RevFeature.java @@ -9,13 +9,12 @@ */ package org.locationtech.geogig.model; +import java.util.List; import java.util.Map; import java.util.Optional; import org.locationtech.jts.geom.Geometry; -import com.google.common.collect.ImmutableList; - /** * A {@code RevFeature} is an immutable data structure that contains the attribute value instances * of a GIS feature, in the order defined by the {@link RevFeatureType} it was created for, although @@ -53,7 +52,7 @@ public interface RevFeature extends RevObject, ValueArray { /** * @return a list of values, with {@link Optional#empty()} representing a null value */ - public ImmutableList> getValues(); + public List> getValues(); public static RevFeatureBuilder builder() { return new RevFeatureBuilder(); diff --git a/src/api/src/main/java/org/locationtech/geogig/model/RevFeatureType.java b/src/api/src/main/java/org/locationtech/geogig/model/RevFeatureType.java index d145533ac3..0cde6123a8 100644 --- a/src/api/src/main/java/org/locationtech/geogig/model/RevFeatureType.java +++ b/src/api/src/main/java/org/locationtech/geogig/model/RevFeatureType.java @@ -9,12 +9,12 @@ */ package org.locationtech.geogig.model; +import java.util.List; + import org.opengis.feature.type.FeatureType; import org.opengis.feature.type.Name; import org.opengis.feature.type.PropertyDescriptor; -import com.google.common.collect.ImmutableList; - /** * {@code RevFeatureType} is an immutable data structure that describes the schema for a set of * {@link RevFeature features}, generally being referred to by the {@link Node#getMetadataId() @@ -67,7 +67,7 @@ public interface RevFeatureType extends RevObject { * * @return the {@link PropertyDescriptor}s of the feature type */ - public abstract ImmutableList descriptors(); + public abstract List descriptors(); /** * @return the name of the feature type diff --git a/src/api/src/main/java/org/locationtech/geogig/model/RevObjects.java b/src/api/src/main/java/org/locationtech/geogig/model/RevObjects.java index 6d20bf0a41..d24c2537c1 100644 --- a/src/api/src/main/java/org/locationtech/geogig/model/RevObjects.java +++ b/src/api/src/main/java/org/locationtech/geogig/model/RevObjects.java @@ -9,10 +9,11 @@ */ package org.locationtech.geogig.model; -import static com.google.common.base.Objects.equal; - +import java.util.Arrays; import java.util.Comparator; import java.util.Iterator; +import java.util.List; +import java.util.Objects; import java.util.Optional; import java.util.stream.Collectors; @@ -22,9 +23,7 @@ import org.locationtech.jts.geom.Envelope; import org.opengis.feature.type.PropertyDescriptor; -import com.google.common.base.Objects; import com.google.common.base.Preconditions; -import com.google.common.collect.ImmutableList; import com.google.common.collect.Iterators; import lombok.NonNull; @@ -124,9 +123,9 @@ public static Iterator children(@NonNull RevTree tree, if (tree.featuresSize() == 0) { return tree.trees().iterator(); } - ImmutableList trees = tree.trees(); - ImmutableList features = tree.features(); - return Iterators.mergeSorted(ImmutableList.of(trees.iterator(), features.iterator()), + List trees = tree.trees(); + List features = tree.features(); + return Iterators.mergeSorted(Arrays.asList(trees.iterator(), features.iterator()), comparator); } @@ -261,13 +260,14 @@ private static byte hexToByte(char c) { } public static boolean equals(@NonNull RevPerson p1, @NonNull RevPerson person) { - return equal(p1.getName(), person.getName()) && equal(p1.getEmail(), person.getEmail()) + return Objects.equals(p1.getName(), person.getName()) + && Objects.equals(p1.getEmail(), person.getEmail()) && p1.getTimestamp() == person.getTimestamp() && p1.getTimeZoneOffset() == person.getTimeZoneOffset(); } public static int hashCode(@NonNull RevPerson p) { - return Objects.hashCode(p.getName(), p.getEmail(), p.getTimestamp(), p.getTimeZoneOffset()); + return Objects.hash(p.getName(), p.getEmail(), p.getTimestamp(), p.getTimeZoneOffset()); } public static String toString(@NonNull RevPerson p) { diff --git a/src/api/src/main/java/org/locationtech/geogig/model/RevTree.java b/src/api/src/main/java/org/locationtech/geogig/model/RevTree.java index 888650d427..da92ba9099 100644 --- a/src/api/src/main/java/org/locationtech/geogig/model/RevTree.java +++ b/src/api/src/main/java/org/locationtech/geogig/model/RevTree.java @@ -11,6 +11,7 @@ import java.util.Collections; import java.util.Comparator; +import java.util.List; import java.util.Optional; import java.util.SortedMap; import java.util.SortedSet; @@ -20,7 +21,6 @@ import org.locationtech.geogig.storage.ObjectStore; import com.google.common.base.Preconditions; -import com.google.common.collect.ImmutableList; import com.google.common.collect.Iterables; /** @@ -93,8 +93,8 @@ public ObjectId getId() { } @Override - public ImmutableList trees() { - return ImmutableList.of(); + public List trees() { + return Collections.emptyList(); } @Override @@ -113,8 +113,8 @@ public boolean isEmpty() { } @Override - public ImmutableList features() { - return ImmutableList.of(); + public List features() { + return Collections.emptyList(); } @Override @@ -194,7 +194,7 @@ public default boolean isEmpty() { * * @apiNote the returned list does not contain {@code null} objects */ - public ImmutableList trees(); + public List trees(); /** * @return the number of {@link Node}s in the {@link #trees} property @@ -237,7 +237,7 @@ public default void forEachTree(Consumer consumer) { * * @apiNote the returned list does not contain {@code null} objects */ - public ImmutableList features(); + public List features(); /** * @return the number of {@link Node}s in the {@link #features} property diff --git a/src/api/src/main/java/org/locationtech/geogig/model/impl/RevFeatureImpl.java b/src/api/src/main/java/org/locationtech/geogig/model/impl/RevFeatureImpl.java index 918681b0c3..21db78a5e0 100644 --- a/src/api/src/main/java/org/locationtech/geogig/model/impl/RevFeatureImpl.java +++ b/src/api/src/main/java/org/locationtech/geogig/model/impl/RevFeatureImpl.java @@ -9,6 +9,8 @@ */ package org.locationtech.geogig.model.impl; +import java.util.ArrayList; +import java.util.List; import java.util.Optional; import java.util.function.Consumer; @@ -43,13 +45,13 @@ class RevFeatureImpl extends AbstractRevObject implements RevFeature { this.values = values; } - public @Override ImmutableList> getValues() { + public @Override List> getValues() { final int size = size(); - Builder> builder = ImmutableList.builder(); + List> retvalues = new ArrayList<>(size); for (int i = 0; i < size; i++) { - builder.add(Optional.ofNullable(ValueArray.safeCopy(values[i]))); + retvalues.add(Optional.ofNullable(ValueArray.safeCopy(values[i]))); } - return builder.build(); + return retvalues; } public @Override int size() { diff --git a/src/api/src/main/java/org/locationtech/geogig/model/impl/RevFeatureTypeImpl.java b/src/api/src/main/java/org/locationtech/geogig/model/impl/RevFeatureTypeImpl.java index 8161699fd3..a53f12cb66 100644 --- a/src/api/src/main/java/org/locationtech/geogig/model/impl/RevFeatureTypeImpl.java +++ b/src/api/src/main/java/org/locationtech/geogig/model/impl/RevFeatureTypeImpl.java @@ -9,6 +9,8 @@ */ package org.locationtech.geogig.model.impl; +import java.util.List; + import org.locationtech.geogig.model.ObjectId; import org.locationtech.geogig.model.RevFeatureType; import org.locationtech.geogig.model.RevObjects; @@ -50,7 +52,7 @@ class RevFeatureTypeImpl extends AbstractRevObject implements RevFeatureType { /** * @return the list of {@link PropertyDescriptor}s of the feature type */ - public @Override ImmutableList descriptors() { + public @Override List descriptors() { return ImmutableList.copyOf(featureType.getDescriptors()); } diff --git a/src/api/src/main/java/org/locationtech/geogig/model/impl/RevTreeImpl.java b/src/api/src/main/java/org/locationtech/geogig/model/impl/RevTreeImpl.java index 79940f1c97..294b18f9e4 100644 --- a/src/api/src/main/java/org/locationtech/geogig/model/impl/RevTreeImpl.java +++ b/src/api/src/main/java/org/locationtech/geogig/model/impl/RevTreeImpl.java @@ -11,6 +11,7 @@ import java.util.Arrays; import java.util.Collections; +import java.util.List; import java.util.Optional; import java.util.function.BiConsumer; import java.util.function.Consumer; @@ -22,7 +23,6 @@ import org.locationtech.geogig.model.RevObjects; import org.locationtech.geogig.model.RevTree; -import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableSortedMap; import com.google.common.collect.ImmutableSortedMap.Builder; @@ -43,12 +43,14 @@ public LeafTree(final ObjectId id, final long size, final @Nullable Node[] featu this.trees = trees; } - public @Override ImmutableList features() { - return features == null ? ImmutableList.of() : ImmutableList.copyOf(features); + public @Override List features() { + return features == null ? Collections.emptyList() + : Collections.unmodifiableList(Arrays.asList(features)); } - public @Override ImmutableList trees() { - return trees == null ? ImmutableList.of() : ImmutableList.copyOf(trees); + public @Override List trees() { + return trees == null ? Collections.emptyList() + : Collections.unmodifiableList(Arrays.asList(trees)); } public @Override int numTrees() { @@ -154,12 +156,12 @@ private RevTreeImpl(ObjectId id, long size) { return size; } - public @Override ImmutableList features() { - return ImmutableList.of(); + public @Override List features() { + return Collections.emptyList(); } - public @Override ImmutableList trees() { - return ImmutableList.of(); + public @Override List trees() { + return Collections.emptyList(); } public @Override ImmutableSortedMap buckets() { diff --git a/src/api/src/main/java/org/locationtech/geogig/model/internal/DAG.java b/src/api/src/main/java/org/locationtech/geogig/model/internal/DAG.java index 6b2b22d780..9ef7896cb7 100644 --- a/src/api/src/main/java/org/locationtech/geogig/model/internal/DAG.java +++ b/src/api/src/main/java/org/locationtech/geogig/model/internal/DAG.java @@ -12,6 +12,7 @@ import static com.google.common.base.Objects.equal; import java.io.Serializable; +import java.util.Collections; import java.util.HashMap; import java.util.HashSet; import java.util.List; @@ -24,7 +25,6 @@ import com.google.common.base.Objects; import com.google.common.base.Preconditions; -import com.google.common.collect.ImmutableMap; import com.google.common.collect.ImmutableSet; import com.google.common.collect.Lists; @@ -97,7 +97,7 @@ public void init(DAG from) { public DAG(TreeId id) { this.id = id; - this.children = ImmutableMap.of(); + this.children = Collections.emptyMap(); this.originalTreeId = RevTree.EMPTY_TREE_ID; this.state = STATE.INITIALIZED; } @@ -117,7 +117,7 @@ public DAG(TreeId id, ObjectId originalTreeId) { this.children = new HashMap<>(); this.originalTreeId = originalTreeId; this.state = STATE.INITIALIZED; - this.children = ImmutableMap.of(); + this.children = Collections.emptyMap(); this.buckets = ImmutableSet.of(); } @@ -166,7 +166,7 @@ public STATE getState() { public void clearChildren() { if (!children.isEmpty()) { setMutated(); - this.children = ImmutableMap.of(); + this.children = Collections.emptyMap(); } } diff --git a/src/api/src/main/java/org/locationtech/geogig/model/internal/DAGTreeBuilder.java b/src/api/src/main/java/org/locationtech/geogig/model/internal/DAGTreeBuilder.java index 29c930f99e..e667464118 100644 --- a/src/api/src/main/java/org/locationtech/geogig/model/internal/DAGTreeBuilder.java +++ b/src/api/src/main/java/org/locationtech/geogig/model/internal/DAGTreeBuilder.java @@ -22,6 +22,7 @@ import java.util.Set; import java.util.SortedMap; import java.util.SortedSet; +import java.util.TreeSet; import java.util.concurrent.ExecutionException; import java.util.concurrent.ForkJoinPool; import java.util.concurrent.ForkJoinTask; @@ -46,7 +47,6 @@ import org.locationtech.geogig.storage.ObjectStore; import com.google.common.base.Throwables; -import com.google.common.collect.ImmutableSortedSet; import lombok.NonNull; import lombok.experimental.UtilityClass; @@ -284,9 +284,7 @@ private RevTree buildBucketsTree(final DAG root) long size = 0; int childTreeCount = 0; - ImmutableSortedSet.Builder bucketsByIndex; - bucketsByIndex = ImmutableSortedSet.naturalOrder(); - + SortedSet buckets = new TreeSet<>(); for (Entry> e : subtasks.entrySet()) { Integer bucketIndex = e.getKey(); @@ -306,11 +304,10 @@ private RevTree buildBucketsTree(final DAG root) Bucket bucket = RevObjectFactory.defaultInstance().createBucket( bucketTree.getId(), bucketIndex, RevObjects.boundsOf(bucketTree)); - bucketsByIndex.add(bucket); + buckets.add(bucket); } } - SortedSet buckets = bucketsByIndex.build(); List treeNodes = null; List featureNodes = null; diff --git a/src/api/src/main/java/org/locationtech/geogig/repository/Conflict.java b/src/api/src/main/java/org/locationtech/geogig/repository/Conflict.java index 2655385916..69f3383861 100644 --- a/src/api/src/main/java/org/locationtech/geogig/repository/Conflict.java +++ b/src/api/src/main/java/org/locationtech/geogig/repository/Conflict.java @@ -9,9 +9,10 @@ */ package org.locationtech.geogig.repository; +import java.util.Objects; + import org.locationtech.geogig.model.ObjectId; -import com.google.common.base.Objects; import com.google.common.base.Preconditions; import lombok.NonNull; @@ -88,9 +89,9 @@ public String getPath() { public boolean equals(Object x) { if (x instanceof Conflict) { Conflict that = (Conflict) x; - return Objects.equal(this.ancestor, that.ancestor) - && Objects.equal(this.theirs, that.theirs) - && Objects.equal(this.ours, that.ours) && Objects.equal(this.path, that.path); + return Objects.equals(this.ancestor, that.ancestor) + && Objects.equals(this.theirs, that.theirs) + && Objects.equals(this.ours, that.ours) && Objects.equals(this.path, that.path); } else { return false; } @@ -100,7 +101,7 @@ public boolean equals(Object x) { * Generates a hash code for the conflict. */ public int hashCode() { - return Objects.hashCode(ancestor, theirs, ours, path); + return Objects.hash(ancestor, theirs, ours, path); } /** diff --git a/src/api/src/main/java/org/locationtech/geogig/repository/IndexInfo.java b/src/api/src/main/java/org/locationtech/geogig/repository/IndexInfo.java index 11c832e277..9c639c30c9 100644 --- a/src/api/src/main/java/org/locationtech/geogig/repository/IndexInfo.java +++ b/src/api/src/main/java/org/locationtech/geogig/repository/IndexInfo.java @@ -9,6 +9,7 @@ */ package org.locationtech.geogig.repository; +import java.util.Collections; import java.util.Map; import java.util.Objects; import java.util.Set; @@ -61,7 +62,7 @@ public IndexInfo(String treeName, String attributeName, IndexType indexType, this.treeName = treeName; this.attributeName = attributeName; this.indexType = indexType; - this.metadata = metadata == null ? ImmutableMap.of() : ImmutableMap.copyOf(metadata); + this.metadata = metadata == null ? Collections.emptyMap() : ImmutableMap.copyOf(metadata); } public ObjectId getId() { diff --git a/src/api/src/main/java/org/locationtech/geogig/repository/Remote.java b/src/api/src/main/java/org/locationtech/geogig/repository/Remote.java index 0b34abc4e7..3d630f071a 100644 --- a/src/api/src/main/java/org/locationtech/geogig/repository/Remote.java +++ b/src/api/src/main/java/org/locationtech/geogig/repository/Remote.java @@ -11,6 +11,8 @@ import java.net.URI; import java.net.URISyntaxException; +import java.util.Collections; +import java.util.List; import java.util.Optional; import org.eclipse.jdt.annotation.Nullable; @@ -18,7 +20,6 @@ import com.google.common.base.Preconditions; import com.google.common.base.Strings; -import com.google.common.collect.ImmutableList; import lombok.NonNull; @@ -34,7 +35,7 @@ public class Remote { private String pushurl; - private ImmutableList fetchSpecs; + private List fetchSpecs; private String fetch; @@ -68,8 +69,8 @@ public Remote(String name, String fetchurl, String pushurl, String fetch, boolea this.mappedBranch = Optional.ofNullable(mappedBranch).orElse("*"); this.username = username; this.password = password; - this.fetchSpecs = Strings.isNullOrEmpty(fetch) ? ImmutableList.of() - : ImmutableList.copyOf(LocalRemoteRefSpec.parse(name, fetch)); + this.fetchSpecs = Strings.isNullOrEmpty(fetch) ? Collections.emptyList() + : Collections.unmodifiableList(LocalRemoteRefSpec.parse(name, fetch)); } /** @@ -120,7 +121,7 @@ public String getFetchSpec() { return fetch; } - public ImmutableList getFetchSpecs() { + public List getFetchSpecs() { return fetchSpecs; } diff --git a/src/api/src/main/java/org/locationtech/geogig/storage/GraphDatabase.java b/src/api/src/main/java/org/locationtech/geogig/storage/GraphDatabase.java index 8026089c2f..5d1f53ce0c 100644 --- a/src/api/src/main/java/org/locationtech/geogig/storage/GraphDatabase.java +++ b/src/api/src/main/java/org/locationtech/geogig/storage/GraphDatabase.java @@ -11,11 +11,11 @@ import java.io.Closeable; import java.util.Iterator; +import java.util.List; import org.locationtech.geogig.model.ObjectId; import com.google.common.annotations.Beta; -import com.google.common.collect.ImmutableList; /** * Provides an interface for implementations of a graph database, which keeps track of the @@ -161,7 +161,7 @@ public int hashCode() { * @return a list of the parents of the provided commit * @throws IllegalArgumentException */ - public ImmutableList getParents(ObjectId commitId) throws IllegalArgumentException; + public List getParents(ObjectId commitId) throws IllegalArgumentException; /** * Retrieves all of the children for the given commit. @@ -170,7 +170,7 @@ public int hashCode() { * @return a list of the children of the provided commit * @throws IllegalArgumentException */ - public ImmutableList getChildren(ObjectId commitId) throws IllegalArgumentException; + public List getChildren(ObjectId commitId) throws IllegalArgumentException; /** * Adds a commit to the database with the given parents. If a commit with the same id already @@ -180,7 +180,7 @@ public int hashCode() { * @param parentIds the commit ids of the commit's parents * @return true if the commit id was inserted or updated, false if it was already there */ - public boolean put(final ObjectId commitId, ImmutableList parentIds); + public boolean put(final ObjectId commitId, List parentIds); /** * Maps a commit to another original commit. This is used in sparse repositories. diff --git a/src/api/src/main/java/org/locationtech/geogig/storage/StorageProvider.java b/src/api/src/main/java/org/locationtech/geogig/storage/StorageProvider.java index 978cca100f..ad16b9c156 100644 --- a/src/api/src/main/java/org/locationtech/geogig/storage/StorageProvider.java +++ b/src/api/src/main/java/org/locationtech/geogig/storage/StorageProvider.java @@ -11,8 +11,6 @@ import java.util.ServiceLoader; -import com.google.common.collect.ImmutableList; - /** * A plug-in mechanism for providers of storage backends for the different kinds of geogig * databases. @@ -68,6 +66,6 @@ public abstract class StorageProvider { public static Iterable findProviders() { ServiceLoader loader = ServiceLoader.load(StorageProvider.class, StorageProvider.class.getClassLoader()); - return ImmutableList.copyOf(loader.iterator()); + return loader; } } diff --git a/src/api/src/test/java/org/locationtech/geogig/model/HashObjectFunnelsTest.java b/src/api/src/test/java/org/locationtech/geogig/model/HashObjectFunnelsTest.java index 96300d585b..f5d570e508 100644 --- a/src/api/src/test/java/org/locationtech/geogig/model/HashObjectFunnelsTest.java +++ b/src/api/src/test/java/org/locationtech/geogig/model/HashObjectFunnelsTest.java @@ -15,6 +15,7 @@ import java.math.BigDecimal; import java.math.BigInteger; +import java.util.Collections; import java.util.HashMap; import java.util.LinkedList; import java.util.List; @@ -81,7 +82,7 @@ public ObjectId getTreeId() { } @Override - public ImmutableList getParentIds() { + public List getParentIds() { return parents; } @@ -196,12 +197,12 @@ public int numTrees() { } @Override - public ImmutableList trees() { + public List trees() { return ImmutableList.copyOf(trees); } @Override - public ImmutableList features() { + public List features() { return ImmutableList.copyOf(features); } @@ -265,7 +266,7 @@ public ObjectId getId() { } @Override - public ImmutableList> getValues() { + public List> getValues() { return ImmutableList.copyOf(values); } @@ -301,7 +302,7 @@ public Optional get(int index, GeometryFactory gf) { ObjectId emptyFeatureId1 = ObjectId.create(rawKey); hasher = Hashing.sha1().newHasher(); - HashObjectFunnels.feature(hasher, ImmutableList.of()); + HashObjectFunnels.feature(hasher, Collections.emptyList()); rawKey = hasher.hash().asBytes(); assertEquals(ObjectId.NUM_BYTES, rawKey.length); ObjectId emptyFeatureId2 = ObjectId.create(rawKey); @@ -472,7 +473,7 @@ public FeatureType type() { } @Override - public ImmutableList descriptors() { + public List descriptors() { return ImmutableList.copyOf(featureType.getDescriptors()); } diff --git a/src/api/src/test/java/org/locationtech/geogig/model/NodeRefTest.java b/src/api/src/test/java/org/locationtech/geogig/model/NodeRefTest.java index 6a15a56490..6656c9997f 100644 --- a/src/api/src/test/java/org/locationtech/geogig/model/NodeRefTest.java +++ b/src/api/src/test/java/org/locationtech/geogig/model/NodeRefTest.java @@ -20,6 +20,8 @@ import static org.locationtech.geogig.model.NodeRef.isDirectChild; import static org.locationtech.geogig.model.NodeRef.parentPath; +import java.util.Collections; + import org.junit.Rule; import org.junit.Test; import org.junit.rules.ExpectedException; @@ -266,7 +268,7 @@ public void testCreateRoot() { public void testSplit() { assertEquals(ImmutableList.of("Points", "sub", "points.1"), NodeRef.split("Points/sub/points.1")); - assertEquals(ImmutableList.of(), NodeRef.split("")); + assertEquals(Collections.emptyList(), NodeRef.split("")); exception.expect(NullPointerException.class); NodeRef.split(null); diff --git a/src/api/src/test/java/org/locationtech/geogig/model/RevObjectTestUtil.java b/src/api/src/test/java/org/locationtech/geogig/model/RevObjectTestUtil.java index b084ccee31..d9d506b559 100644 --- a/src/api/src/test/java/org/locationtech/geogig/model/RevObjectTestUtil.java +++ b/src/api/src/test/java/org/locationtech/geogig/model/RevObjectTestUtil.java @@ -34,7 +34,6 @@ import org.opengis.referencing.crs.CoordinateReferenceSystem; import com.google.common.base.Objects; -import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableMap; import com.google.common.collect.Lists; @@ -128,8 +127,8 @@ public static void deepEquals(@NonNull RevFeatureType expected, assertNotNull(actual.getName()); assertEquals(expected.getName(), actual.getName()); assertEquals(expected.getType(), actual.getType()); - ImmutableList eds = expected.descriptors(); - ImmutableList ads = actual.descriptors(); + List eds = expected.descriptors(); + List ads = actual.descriptors(); assertEquals(eds.size(), ads.size()); for (int i = 0; i < eds.size(); i++) { PropertyDescriptor ed = eds.get(i); diff --git a/src/api/src/test/java/org/locationtech/geogig/model/RevTreeTest.java b/src/api/src/test/java/org/locationtech/geogig/model/RevTreeTest.java index 739dae8e7c..f5abb74af8 100644 --- a/src/api/src/test/java/org/locationtech/geogig/model/RevTreeTest.java +++ b/src/api/src/test/java/org/locationtech/geogig/model/RevTreeTest.java @@ -13,6 +13,7 @@ import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertTrue; +import java.util.ArrayList; import java.util.Collections; import java.util.Comparator; import java.util.Iterator; @@ -27,7 +28,6 @@ import org.locationtech.geogig.model.RevObject.TYPE; import org.locationtech.jts.geom.Envelope; -import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableSortedMap; public class RevTreeTest { @@ -47,7 +47,6 @@ public void testEmptyTree() { assertTrue(emptyTree.isEmpty()); assertTrue(emptyTree.toString().contains("EMPTY TREE")); assertEquals(emptyTree, emptyTree); - assertFalse(emptyTree.equals(RevTree.EMPTY_TREE_ID)); } @Test @@ -80,13 +79,13 @@ public int numTrees() { } @Override - public ImmutableList trees() { - return ImmutableList.copyOf(trees); + public List trees() { + return new ArrayList<>(trees); } @Override - public ImmutableList features() { - return ImmutableList.copyOf(features); + public List features() { + return new ArrayList<>(features); } @Override @@ -132,13 +131,13 @@ public int numTrees() { } @Override - public ImmutableList trees() { - return ImmutableList.of(); + public List trees() { + return Collections.emptyList(); } @Override - public ImmutableList features() { - return ImmutableList.of(); + public List features() { + return Collections.emptyList(); } @Override @@ -176,13 +175,13 @@ public int numTrees() { } @Override - public ImmutableList trees() { - return ImmutableList.of(); + public List trees() { + return Collections.emptyList(); } @Override - public ImmutableList features() { - return ImmutableList.of(); + public List features() { + return Collections.emptyList(); } @Override @@ -237,13 +236,13 @@ public int numTrees() { } @Override - public ImmutableList trees() { - return ImmutableList.copyOf(trees); + public List trees() { + return new ArrayList<>(trees); } @Override - public ImmutableList features() { - return ImmutableList.copyOf(features); + public List features() { + return new ArrayList<>(features); } @Override diff --git a/src/api/src/test/java/org/locationtech/geogig/repository/FeatureInfoTest.java b/src/api/src/test/java/org/locationtech/geogig/repository/FeatureInfoTest.java index 4c7a5a7fa6..b7e5c2b150 100644 --- a/src/api/src/test/java/org/locationtech/geogig/repository/FeatureInfoTest.java +++ b/src/api/src/test/java/org/locationtech/geogig/repository/FeatureInfoTest.java @@ -11,6 +11,8 @@ import static org.junit.Assert.assertEquals; +import java.util.Collections; +import java.util.List; import java.util.Optional; import java.util.function.Consumer; @@ -21,8 +23,6 @@ import org.locationtech.jts.geom.Geometry; import org.locationtech.jts.geom.GeometryFactory; -import com.google.common.collect.ImmutableList; - public class FeatureInfoTest { @Test @@ -41,8 +41,8 @@ public ObjectId getId() { } @Override - public ImmutableList> getValues() { - return ImmutableList.of(); + public List> getValues() { + return Collections.emptyList(); } @Override diff --git a/src/cli/core/src/main/java/org/locationtech/geogig/cli/plumbing/DiffTree.java b/src/cli/core/src/main/java/org/locationtech/geogig/cli/plumbing/DiffTree.java index 3b17c8d5ef..d39f19ee8e 100644 --- a/src/cli/core/src/main/java/org/locationtech/geogig/cli/plumbing/DiffTree.java +++ b/src/cli/core/src/main/java/org/locationtech/geogig/cli/plumbing/DiffTree.java @@ -40,7 +40,6 @@ import com.beust.jcommander.Parameter; import com.beust.jcommander.Parameters; import com.google.common.base.Suppliers; -import com.google.common.collect.ImmutableList; import com.google.common.collect.Lists; import com.google.common.collect.Maps; import com.google.common.collect.Sets; @@ -114,7 +113,7 @@ protected void runInternal(GeogigCLI cli) throws IOException { Optional obj = geogig.command(RevObjectParse.class) .setObjectId(noderef.getObjectId()).call(); RevFeature feature = (RevFeature) obj.get(); - ImmutableList descriptors = featureType.descriptors(); + List descriptors = featureType.descriptors(); int idx = 0; for (PropertyDescriptor descriptor : descriptors) { if (diffs.containsKey(descriptor)) { diff --git a/src/cli/core/src/main/java/org/locationtech/geogig/cli/plumbing/WalkGraph.java b/src/cli/core/src/main/java/org/locationtech/geogig/cli/plumbing/WalkGraph.java index ab446ca4ce..b7500421e5 100644 --- a/src/cli/core/src/main/java/org/locationtech/geogig/cli/plumbing/WalkGraph.java +++ b/src/cli/core/src/main/java/org/locationtech/geogig/cli/plumbing/WalkGraph.java @@ -11,6 +11,7 @@ import java.io.IOException; import java.util.List; +import java.util.function.Function; import org.locationtech.geogig.cli.AbstractCommand; import org.locationtech.geogig.cli.CLICommand; @@ -32,7 +33,6 @@ import com.beust.jcommander.Parameter; import com.beust.jcommander.Parameters; -import com.google.common.base.Function; import com.google.common.collect.Lists; /** diff --git a/src/cli/core/src/main/java/org/locationtech/geogig/cli/porcelain/Show.java b/src/cli/core/src/main/java/org/locationtech/geogig/cli/porcelain/Show.java index c0e6423a58..f85ca7d539 100644 --- a/src/cli/core/src/main/java/org/locationtech/geogig/cli/porcelain/Show.java +++ b/src/cli/core/src/main/java/org/locationtech/geogig/cli/porcelain/Show.java @@ -45,7 +45,6 @@ import com.beust.jcommander.Parameters; import com.google.common.base.Strings; import com.google.common.base.Suppliers; -import com.google.common.collect.ImmutableList; /** * Shows formatted information about a commit, tree, feature or feature type @@ -95,7 +94,7 @@ private void printRaw(GeogigCLI cli) throws IOException { .setRefSpec(ref).call(); if (opt.isPresent()) { RevFeatureType ft = opt.get(); - ImmutableList attribs = ft.descriptors(); + List attribs = ft.descriptors(); RevFeature feature = (RevFeature) revObject; Ansi ansi = super.newAnsi(console); ansi.a(ref).newline(); @@ -146,7 +145,7 @@ public void printFormatted(GeogigCLI cli) throws IOException { .setRefSpec(ref).call(); if (opt.isPresent()) { RevFeatureType ft = opt.get(); - ImmutableList attribs = ft.descriptors(); + List attribs = ft.descriptors(); RevFeature feature = (RevFeature) revObject; Ansi ansi = super.newAnsi(console); ansi.newline().fg(Color.YELLOW).a("ID: ").reset().a(feature.getId().toString()) @@ -231,7 +230,7 @@ private String getFullRef(String ref) { } private void printFeatureType(Ansi ansi, RevFeatureType ft, boolean useDefaultKeyword) { - ImmutableList attribs = ft.descriptors(); + List attribs = ft.descriptors(); ansi.fg(Color.YELLOW).a(useDefaultKeyword ? "DEFAULT " : "").a("FEATURE TYPE ID: ").reset() .a(ft.getId().toString()).newline().newline(); diff --git a/src/core/src/main/java/org/locationtech/geogig/data/retrieve/BulkFeatureRetriever.java b/src/core/src/main/java/org/locationtech/geogig/data/retrieve/BulkFeatureRetriever.java index 3567b13fbc..d72412411e 100644 --- a/src/core/src/main/java/org/locationtech/geogig/data/retrieve/BulkFeatureRetriever.java +++ b/src/core/src/main/java/org/locationtech/geogig/data/retrieve/BulkFeatureRetriever.java @@ -9,8 +9,6 @@ */ package org.locationtech.geogig.data.retrieve; -import static com.google.common.base.Preconditions.checkNotNull; - import java.util.Iterator; import java.util.List; @@ -41,6 +39,8 @@ import com.google.common.base.Function; +import lombok.NonNull; + /** * This is the main entry class for retrieving features from GeoGIG. * @@ -67,9 +67,7 @@ public BulkFeatureRetriever(ObjectStore db) { this(db, db); } - public BulkFeatureRetriever(ObjectStore leftDb, ObjectStore rightDb) { - checkNotNull(leftDb); - checkNotNull(rightDb); + public BulkFeatureRetriever(@NonNull ObjectStore leftDb, @NonNull ObjectStore rightDb) { this.leftDb = leftDb; this.odb = rightDb; } diff --git a/src/core/src/main/java/org/locationtech/geogig/plumbing/DiffBounds.java b/src/core/src/main/java/org/locationtech/geogig/plumbing/DiffBounds.java index dfb2aa72ad..02692d1adb 100644 --- a/src/core/src/main/java/org/locationtech/geogig/plumbing/DiffBounds.java +++ b/src/core/src/main/java/org/locationtech/geogig/plumbing/DiffBounds.java @@ -11,6 +11,7 @@ import static com.google.common.base.Preconditions.checkArgument; +import java.util.Collections; import java.util.List; import java.util.Optional; import java.util.concurrent.ConcurrentHashMap; @@ -57,7 +58,7 @@ public class DiffBounds extends AbstractGeoGigOp pathFilters = ImmutableList.of(); + private List pathFilters = Collections.emptyList(); private CoordinateReferenceSystem crs; @@ -95,7 +96,7 @@ public DiffBounds setNewVersion(RevTree newVersion) { public DiffBounds setPathFilters(@Nullable final List pathFilters) { if (null == pathFilters) { - this.pathFilters = ImmutableList.of(); + this.pathFilters = Collections.emptyList(); } else { this.pathFilters = ImmutableList.copyOf(pathFilters); } diff --git a/src/core/src/main/java/org/locationtech/geogig/plumbing/HashObject.java b/src/core/src/main/java/org/locationtech/geogig/plumbing/HashObject.java index c544d722dd..4dc198ec87 100644 --- a/src/core/src/main/java/org/locationtech/geogig/plumbing/HashObject.java +++ b/src/core/src/main/java/org/locationtech/geogig/plumbing/HashObject.java @@ -94,8 +94,8 @@ public static ObjectId hashFeature(List values) { public static ObjectId hashTree(@Nullable List trees, @Nullable List features, @Nullable SortedMap buckets) { - final List t = trees == null ? ImmutableList.of() : trees; - final List f = features == null ? ImmutableList.of() : features; + final List t = trees == null ? Collections.emptyList() : trees; + final List f = features == null ? Collections.emptyList() : features; final Iterable b = buckets == null ? Collections.emptySet() : buckets.values(); return hash(h -> HashObjectFunnels.tree(h, t, f, b)); diff --git a/src/core/src/main/java/org/locationtech/geogig/plumbing/RevParse.java b/src/core/src/main/java/org/locationtech/geogig/plumbing/RevParse.java index 5663115a69..36e7114df3 100644 --- a/src/core/src/main/java/org/locationtech/geogig/plumbing/RevParse.java +++ b/src/core/src/main/java/org/locationtech/geogig/plumbing/RevParse.java @@ -30,8 +30,6 @@ import org.locationtech.geogig.storage.ObjectDatabase; import org.locationtech.geogig.storage.ObjectStore; -import com.google.common.collect.ImmutableList; - /** * Resolves the reference given by a ref spec to the {@link ObjectId} it finally points to, * dereferencing symbolic refs as necessary. @@ -245,7 +243,7 @@ private Optional resolveAncestor(ObjectId objectId, int ancestorN) { ObjectId ancestor = objectId; for (int i = 0; i < ancestorN; i++) { - ImmutableList parents = graph.getParents(ancestor); + List parents = graph.getParents(ancestor); if (parents.isEmpty()) { return Optional.empty(); } diff --git a/src/core/src/main/java/org/locationtech/geogig/plumbing/diff/FeatureDiff.java b/src/core/src/main/java/org/locationtech/geogig/plumbing/diff/FeatureDiff.java index d3350129bb..084b51fa5d 100644 --- a/src/core/src/main/java/org/locationtech/geogig/plumbing/diff/FeatureDiff.java +++ b/src/core/src/main/java/org/locationtech/geogig/plumbing/diff/FeatureDiff.java @@ -12,6 +12,7 @@ import java.util.BitSet; import java.util.HashMap; import java.util.Iterator; +import java.util.List; import java.util.Map; import java.util.Map.Entry; import java.util.Optional; @@ -24,7 +25,6 @@ import org.opengis.feature.type.PropertyDescriptor; import com.google.common.base.Preconditions; -import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableMap; import com.google.common.collect.Maps; @@ -79,7 +79,7 @@ public FeatureDiff(String path, @Nullable RevFeature newRevFeature, Preconditions.checkArgument(oldRevFeatureType != null, "Old feature type must be provided."); - ImmutableList oldAttributes = oldRevFeatureType.descriptors(); + List oldAttributes = oldRevFeatureType.descriptors(); for (int i = 0; i < oldAttributes.size(); i++) { Optional oldValue = oldRevFeature.get(i); @@ -96,7 +96,7 @@ public FeatureDiff(String path, @Nullable RevFeature newRevFeature, Preconditions.checkArgument(newRevFeatureType != null, "New feature type must be provided."); - ImmutableList newAttributes = newRevFeatureType.descriptors(); + List newAttributes = newRevFeatureType.descriptors(); for (int i = 0; i < newAttributes.size(); i++) { Optional newValue = newRevFeature.get(i); @@ -110,8 +110,8 @@ public FeatureDiff(String path, @Nullable RevFeature newRevFeature, } } } else { - ImmutableList oldAttributes = oldRevFeatureType.descriptors(); - ImmutableList newAttributes = newRevFeatureType.descriptors(); + List oldAttributes = oldRevFeatureType.descriptors(); + List newAttributes = newRevFeatureType.descriptors(); BitSet updatedAttributes = new BitSet(newRevFeature.size()); for (int i = 0; i < oldAttributes.size(); i++) { Optional oldValue = oldRevFeature.get(i); diff --git a/src/core/src/main/java/org/locationtech/geogig/plumbing/diff/MutableTree.java b/src/core/src/main/java/org/locationtech/geogig/plumbing/diff/MutableTree.java index b78e6ae079..780ad94453 100644 --- a/src/core/src/main/java/org/locationtech/geogig/plumbing/diff/MutableTree.java +++ b/src/core/src/main/java/org/locationtech/geogig/plumbing/diff/MutableTree.java @@ -39,7 +39,6 @@ import com.google.common.base.Preconditions; import com.google.common.base.Strings; import com.google.common.base.Supplier; -import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableMap; import com.google.common.collect.Lists; import com.google.common.collect.Maps; @@ -290,7 +289,7 @@ public RevTree build(ObjectStore store) { final RevTree original = EMPTY_TREE_ID.equals(treeId) ? EMPTY : store.getTree(treeId); RevTreeBuilder builder = RevTreeBuilder.builder(store, original); - ImmutableList currentTrees = original.trees(); + List currentTrees = original.trees(); currentTrees.forEach(builder::remove); for (MutableTree childTree : this.childTrees.values()) { diff --git a/src/core/src/main/java/org/locationtech/geogig/plumbing/diff/Patch.java b/src/core/src/main/java/org/locationtech/geogig/plumbing/diff/Patch.java index 42a06fe593..12bbad0908 100644 --- a/src/core/src/main/java/org/locationtech/geogig/plumbing/diff/Patch.java +++ b/src/core/src/main/java/org/locationtech/geogig/plumbing/diff/Patch.java @@ -161,7 +161,7 @@ public Optional getFeatureTypeFromId(ObjectId id) { * * @return */ - public ImmutableList getAlteredTrees() { + public List getAlteredTrees() { return ImmutableList.copyOf(alteredTrees); } @@ -254,8 +254,8 @@ private String featureTypeDiffAsString(FeatureTypeDiff diff) { && !diff.getOldFeatureType().equals(ObjectId.NULL)) { RevFeatureType oldFeatureType = getFeatureTypeFromId(diff.getOldFeatureType()).get(); RevFeatureType newFeatureType = getFeatureTypeFromId(diff.getNewFeatureType()).get(); - ImmutableList oldDescriptors = oldFeatureType.descriptors(); - ImmutableList newDescriptors = newFeatureType.descriptors(); + List oldDescriptors = oldFeatureType.descriptors(); + List newDescriptors = newFeatureType.descriptors(); BitSet updatedDescriptors = new BitSet(newDescriptors.size()); for (int i = 0; i < oldDescriptors.size(); i++) { PropertyDescriptor oldDescriptor = oldDescriptors.get(i); diff --git a/src/core/src/main/java/org/locationtech/geogig/plumbing/diff/VerifyPatchOp.java b/src/core/src/main/java/org/locationtech/geogig/plumbing/diff/VerifyPatchOp.java index 16da8a01f1..34a5e077f9 100644 --- a/src/core/src/main/java/org/locationtech/geogig/plumbing/diff/VerifyPatchOp.java +++ b/src/core/src/main/java/org/locationtech/geogig/plumbing/diff/VerifyPatchOp.java @@ -31,7 +31,6 @@ import com.google.common.base.Objects; import com.google.common.base.Preconditions; -import com.google.common.collect.ImmutableList; /** * Verifies if a patch can be applied to the current working tree @@ -98,7 +97,7 @@ protected VerifyPatchResults _call() throws RuntimeException { Optional noderef = depthSearch.find(workingTree().getTree(), path); RevFeatureType featureType = command(RevObjectParse.class) .setObjectId(noderef.get().getMetadataId()).call(RevFeatureType.class).get(); - ImmutableList descriptors = featureType.descriptors(); + List descriptors = featureType.descriptors(); Set> attrDiffs = diff.getDiffs().entrySet(); boolean ok = true; for (Iterator> iterator = attrDiffs @@ -174,7 +173,7 @@ protected VerifyPatchResults _call() throws RuntimeException { } } } - ImmutableList alteredTrees = patch.getAlteredTrees(); + List alteredTrees = patch.getAlteredTrees(); for (FeatureTypeDiff diff : alteredTrees) { DepthSearch depthSearch = new DepthSearch(objectDatabase()); Optional noderef = depthSearch.find(workingTree().getTree(), diff.getPath()); diff --git a/src/core/src/main/java/org/locationtech/geogig/plumbing/index/BuildFullHistoryIndexOp.java b/src/core/src/main/java/org/locationtech/geogig/plumbing/index/BuildFullHistoryIndexOp.java index 203db3b4ec..41c288a4e8 100644 --- a/src/core/src/main/java/org/locationtech/geogig/plumbing/index/BuildFullHistoryIndexOp.java +++ b/src/core/src/main/java/org/locationtech/geogig/plumbing/index/BuildFullHistoryIndexOp.java @@ -31,8 +31,6 @@ import org.locationtech.geogig.repository.IndexInfo; import org.locationtech.geogig.repository.ProgressListener; -import com.google.common.collect.ImmutableList; - /** * Builds an index for every commit a given type tree is present at. Returns the number of trees * that were built. @@ -102,8 +100,7 @@ protected Integer _call() { * @return the number of trees that were built */ private int indexHistory(IndexInfo index) { - ImmutableList branches = command(BranchListOp.class).setLocal(true).setRemotes(true) - .call(); + List branches = command(BranchListOp.class).setLocal(true).setRemotes(true).call(); int builtTrees = 0; ProgressListener listener = getProgressListener(); for (Ref ref : branches) { @@ -144,7 +141,7 @@ private boolean indexCommit(IndexInfo index, RevCommit commit) { return false; } RevTree newCanonicalTree = objectDatabase().getTree(treeNode.get().getObjectId()); - ImmutableList oldCommits = graphDatabase().getChildren(commit.getId()); + List oldCommits = graphDatabase().getChildren(commit.getId()); RevTree oldCanonicalTree = RevTree.EMPTY; for (ObjectId oldCommitId : oldCommits) { Optional oldTreeId = command(ResolveTreeish.class) diff --git a/src/core/src/main/java/org/locationtech/geogig/plumbing/index/BuildIndexOp.java b/src/core/src/main/java/org/locationtech/geogig/plumbing/index/BuildIndexOp.java index 1aefd006b6..8223b21c4c 100644 --- a/src/core/src/main/java/org/locationtech/geogig/plumbing/index/BuildIndexOp.java +++ b/src/core/src/main/java/org/locationtech/geogig/plumbing/index/BuildIndexOp.java @@ -12,6 +12,7 @@ import static com.google.common.base.Preconditions.checkState; import java.util.HashMap; +import java.util.List; import java.util.Map; import java.util.Optional; import java.util.Set; @@ -36,7 +37,6 @@ import com.google.common.base.Stopwatch; import com.google.common.base.Throwables; -import com.google.common.collect.ImmutableList; /** * Builds an index tree for the given canonical tree. @@ -186,7 +186,7 @@ private Map attributeIndexMapping(Set attNames) { } private int indexOf(String attName, RevFeatureType featureType) { - ImmutableList descriptors = featureType.descriptors(); + List descriptors = featureType.descriptors(); for (int i = 0; i < descriptors.size(); i++) { String name = descriptors.get(i).getName().getLocalPart(); if (attName.equals(name)) { diff --git a/src/core/src/main/java/org/locationtech/geogig/plumbing/merge/MergeFeaturesOp.java b/src/core/src/main/java/org/locationtech/geogig/plumbing/merge/MergeFeaturesOp.java index 5b274f1c8d..043a79acec 100644 --- a/src/core/src/main/java/org/locationtech/geogig/plumbing/merge/MergeFeaturesOp.java +++ b/src/core/src/main/java/org/locationtech/geogig/plumbing/merge/MergeFeaturesOp.java @@ -13,6 +13,7 @@ import static com.google.common.base.Preconditions.checkState; import java.util.Iterator; +import java.util.List; import java.util.Map; import java.util.Objects; @@ -125,7 +126,7 @@ private Feature merge(RevFeature featureA, RevFeature featureB, RevFeature ances SimpleFeatureBuilder featureBuilder = new SimpleFeatureBuilder( (SimpleFeatureType) featureType.type()); - ImmutableList descriptors = featureType.descriptors(); + List descriptors = featureType.descriptors(); for (int i = 0; i < descriptors.size(); i++) { final PropertyDescriptor descriptor = descriptors.get(i); final boolean isGeom = descriptor instanceof GeometryDescriptor; diff --git a/src/core/src/main/java/org/locationtech/geogig/plumbing/merge/ReportCommitConflictsOp.java b/src/core/src/main/java/org/locationtech/geogig/plumbing/merge/ReportCommitConflictsOp.java index ff51d4f0c6..08603dbb49 100644 --- a/src/core/src/main/java/org/locationtech/geogig/plumbing/merge/ReportCommitConflictsOp.java +++ b/src/core/src/main/java/org/locationtech/geogig/plumbing/merge/ReportCommitConflictsOp.java @@ -11,6 +11,7 @@ import java.util.HashMap; import java.util.Iterator; +import java.util.List; import java.util.Map; import java.util.Map.Entry; import java.util.Optional; @@ -41,7 +42,6 @@ import org.opengis.feature.type.PropertyDescriptor; import com.google.common.base.Preconditions; -import com.google.common.collect.ImmutableList; /** * Used for cherry pick and rebase to see if the changes from a single commit conflict with another @@ -173,7 +173,7 @@ protected MergeScenarioReport _call() { .get(); final RevFeatureType headFeatureType = ftCache .get(headFeatureRef.getMetadataId()); - ImmutableList descriptors = headFeatureType.descriptors(); + List descriptors = headFeatureType.descriptors(); FeatureDiff featureDiff = DiffFeature.compare(path, oldFeature, newFeature, ftCache.get(diff.oldMetadataId()), ftCache.get(diff.newMetadataId())); diff --git a/src/core/src/main/java/org/locationtech/geogig/porcelain/ApplyPatchOp.java b/src/core/src/main/java/org/locationtech/geogig/porcelain/ApplyPatchOp.java index ffd663f2c5..92a0250ea4 100644 --- a/src/core/src/main/java/org/locationtech/geogig/porcelain/ApplyPatchOp.java +++ b/src/core/src/main/java/org/locationtech/geogig/porcelain/ApplyPatchOp.java @@ -42,7 +42,6 @@ import org.opengis.feature.type.PropertyDescriptor; import com.google.common.base.Preconditions; -import com.google.common.collect.ImmutableList; import com.google.common.collect.Lists; import com.google.common.collect.Maps; @@ -166,8 +165,8 @@ private void applyPatch(Patch patch) { .call(RevFeature.class).get(); RevFeatureType newRevFeatureType = getFeatureType(diff, feature, oldRevFeatureType); - ImmutableList oldDescriptors = oldRevFeatureType.descriptors(); - ImmutableList newDescriptors = newRevFeatureType.descriptors(); + List oldDescriptors = oldRevFeatureType.descriptors(); + List newDescriptors = newRevFeatureType.descriptors(); SimpleFeatureBuilder featureBuilder = new SimpleFeatureBuilder( (SimpleFeatureType) newRevFeatureType.type()); Map attrs = Maps.newHashMap(); @@ -201,7 +200,7 @@ private void applyPatch(Patch patch) { workTree.insert(featureInfo); } - ImmutableList alteredTrees = patch.getAlteredTrees(); + List alteredTrees = patch.getAlteredTrees(); for (FeatureTypeDiff diff : alteredTrees) { Optional featureType; if (diff.getOldFeatureType().isNull()) { diff --git a/src/core/src/main/java/org/locationtech/geogig/porcelain/LogOp.java b/src/core/src/main/java/org/locationtech/geogig/porcelain/LogOp.java index 555097838a..21d7e352d4 100644 --- a/src/core/src/main/java/org/locationtech/geogig/porcelain/LogOp.java +++ b/src/core/src/main/java/org/locationtech/geogig/porcelain/LogOp.java @@ -39,7 +39,6 @@ import com.google.common.base.Preconditions; import com.google.common.base.Predicate; import com.google.common.collect.AbstractIterator; -import com.google.common.collect.ImmutableList; import com.google.common.collect.Iterators; import com.google.common.collect.Lists; import com.google.common.collect.Sets; @@ -470,7 +469,7 @@ protected RevCommit computeNext() { lastCommit = repo.getCommit(parent.get()); } - ImmutableList children = this.graphDb.getChildren(lastCommit.getId()); + List children = this.graphDb.getChildren(lastCommit.getId()); if (children.size() > 1) { stopPoints.add(lastCommit.getId()); } diff --git a/src/core/src/main/java/org/locationtech/geogig/porcelain/SquashOp.java b/src/core/src/main/java/org/locationtech/geogig/porcelain/SquashOp.java index d169af9d30..a905b2ac05 100644 --- a/src/core/src/main/java/org/locationtech/geogig/porcelain/SquashOp.java +++ b/src/core/src/main/java/org/locationtech/geogig/porcelain/SquashOp.java @@ -40,7 +40,6 @@ import com.google.common.base.Predicate; import com.google.common.base.Suppliers; import com.google.common.collect.Collections2; -import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableSet; import com.google.common.collect.Lists; import com.google.common.collect.Maps; @@ -159,7 +158,7 @@ protected ObjectId _call() { || commitToSquash.getParentIds().size() > 1, "The commits to squash include a branch starting point. Squashing that type of commit is not supported."); } - ImmutableList parentIds = commitToSquash.getParentIds(); + List parentIds = commitToSquash.getParentIds(); for (int i = 1; i < parentIds.size(); i++) { secondaryParents.add(parentIds.get(i)); } diff --git a/src/core/src/main/java/org/locationtech/geogig/repository/impl/WorkingTreeInsertHelper.java b/src/core/src/main/java/org/locationtech/geogig/repository/impl/WorkingTreeInsertHelper.java index 319df7724f..63116be4d1 100644 --- a/src/core/src/main/java/org/locationtech/geogig/repository/impl/WorkingTreeInsertHelper.java +++ b/src/core/src/main/java/org/locationtech/geogig/repository/impl/WorkingTreeInsertHelper.java @@ -17,6 +17,7 @@ import java.util.concurrent.Callable; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ExecutorService; +import java.util.function.Function; import org.eclipse.jdt.annotation.Nullable; import org.locationtech.geogig.model.Node; @@ -37,7 +38,6 @@ import org.opengis.feature.type.FeatureType; import org.opengis.geometry.BoundingBox; -import com.google.common.base.Function; import com.google.common.collect.Lists; import com.google.common.collect.Maps; diff --git a/src/core/src/main/java/org/locationtech/geogig/storage/datastream/FormatCommonV2.java b/src/core/src/main/java/org/locationtech/geogig/storage/datastream/FormatCommonV2.java index 4a04e11610..c8afcb062e 100644 --- a/src/core/src/main/java/org/locationtech/geogig/storage/datastream/FormatCommonV2.java +++ b/src/core/src/main/java/org/locationtech/geogig/storage/datastream/FormatCommonV2.java @@ -253,8 +253,8 @@ public RevTree readTree(@Nullable ObjectId id, DataInput in) throws IOException } checkState(nBuckets == buckets.size(), "expected %s buckets, got %s", nBuckets, buckets.size()); - ImmutableList trees = treesBuilder.build(); - ImmutableList features = featuresBuilder.build(); + List trees = treesBuilder.build(); + List features = featuresBuilder.build(); if (id == null) { id = HashObject.hashTree(trees, features, buckets); @@ -592,7 +592,7 @@ public void writeNodeRef(NodeRef nodeRef, DataOutput data) throws IOException { public void writeFeatureType(RevFeatureType object, DataOutput data) throws IOException { writeName(object.getName(), data); - ImmutableList descriptors = object.descriptors(); + List descriptors = object.descriptors(); writeUnsignedVarInt(descriptors.size(), data); for (PropertyDescriptor desc : object.type().getDescriptors()) { diff --git a/src/core/src/main/java/org/locationtech/geogig/storage/datastream/v2_3/NodeSet.java b/src/core/src/main/java/org/locationtech/geogig/storage/datastream/v2_3/NodeSet.java index a4cf14a7b8..d1be7fda5f 100644 --- a/src/core/src/main/java/org/locationtech/geogig/storage/datastream/v2_3/NodeSet.java +++ b/src/core/src/main/java/org/locationtech/geogig/storage/datastream/v2_3/NodeSet.java @@ -22,6 +22,7 @@ import java.lang.ref.SoftReference; import java.util.ArrayList; import java.util.BitSet; +import java.util.Collections; import java.util.List; import java.util.Map; import java.util.Optional; @@ -38,7 +39,6 @@ import com.google.common.base.Preconditions; import com.google.common.base.Supplier; import com.google.common.collect.ImmutableList; -import com.google.common.collect.ImmutableMap; class NodeSet { @@ -447,7 +447,7 @@ public Optional getBounds(final int nodeIndex, final int boundsIndex) public Map getExtraData(final int nodeExtraDataRelOffset) { if (nodeExtraDataRelOffset < 0) { - return ImmutableMap.of(); + return Collections.emptyMap(); } Map extraData; try { diff --git a/src/core/src/main/java/org/locationtech/geogig/storage/datastream/v2_3/StringTable.java b/src/core/src/main/java/org/locationtech/geogig/storage/datastream/v2_3/StringTable.java index d1bed0c225..c5c28e1660 100644 --- a/src/core/src/main/java/org/locationtech/geogig/storage/datastream/v2_3/StringTable.java +++ b/src/core/src/main/java/org/locationtech/geogig/storage/datastream/v2_3/StringTable.java @@ -13,6 +13,7 @@ import java.io.DataOutput; import java.io.IOException; import java.util.ArrayList; +import java.util.Collections; import java.util.List; import java.util.NoSuchElementException; @@ -23,7 +24,7 @@ abstract class StringTable { - public static final StringTable EMPTY = new Immutable(ImmutableList.of()); + public static final StringTable EMPTY = new Immutable(Collections.emptyList()); /** * Factory method for a mutable string table that ensures it contains no duplicates diff --git a/src/core/src/main/java/org/locationtech/geogig/storage/impl/Blobs.java b/src/core/src/main/java/org/locationtech/geogig/storage/impl/Blobs.java index ec10986eb3..73916c38b1 100644 --- a/src/core/src/main/java/org/locationtech/geogig/storage/impl/Blobs.java +++ b/src/core/src/main/java/org/locationtech/geogig/storage/impl/Blobs.java @@ -9,6 +9,7 @@ */ package org.locationtech.geogig.storage.impl; +import java.util.Collections; import java.util.List; import java.util.Optional; @@ -16,7 +17,6 @@ import com.google.common.base.Charsets; import com.google.common.base.Splitter; -import com.google.common.collect.ImmutableList; /** * Utility methods to manipulate BLOBs in a {@link BlobStore} @@ -45,7 +45,7 @@ public static Optional getBlob(BlobStore blobStore, final String blobNam } public static List readLines(Optional blob) { - List lines = ImmutableList.of(); + List lines = Collections.emptyList(); if (blob.isPresent()) { String contents = new String(blob.get(), Charsets.UTF_8); lines = Splitter.on("\n").splitToList(contents); diff --git a/src/core/src/main/java/org/locationtech/geogig/storage/impl/SynchronizedGraphDatabase.java b/src/core/src/main/java/org/locationtech/geogig/storage/impl/SynchronizedGraphDatabase.java index a7cd408d79..71be9a9469 100644 --- a/src/core/src/main/java/org/locationtech/geogig/storage/impl/SynchronizedGraphDatabase.java +++ b/src/core/src/main/java/org/locationtech/geogig/storage/impl/SynchronizedGraphDatabase.java @@ -9,11 +9,12 @@ */ package org.locationtech.geogig.storage.impl; +import java.util.List; + import org.locationtech.geogig.model.ObjectId; import org.locationtech.geogig.storage.GraphDatabase; import com.google.common.base.Preconditions; -import com.google.common.collect.ImmutableList; public class SynchronizedGraphDatabase implements GraphDatabase { private final GraphDatabase delegate; @@ -47,19 +48,19 @@ public boolean exists(final ObjectId commitId) { } } - public ImmutableList getParents(ObjectId commitId) throws IllegalArgumentException { + public List getParents(ObjectId commitId) throws IllegalArgumentException { synchronized (delegate) { return delegate.getParents(commitId); } } - public ImmutableList getChildren(ObjectId commitId) throws IllegalArgumentException { + public List getChildren(ObjectId commitId) throws IllegalArgumentException { synchronized (delegate) { return delegate.getChildren(commitId); } } - public boolean put(ObjectId commitId, ImmutableList parentIds) { + public boolean put(ObjectId commitId, List parentIds) { synchronized (delegate) { return delegate.put(commitId, parentIds); } diff --git a/src/core/src/main/java/org/locationtech/geogig/storage/text/TextRevObjectSerializer.java b/src/core/src/main/java/org/locationtech/geogig/storage/text/TextRevObjectSerializer.java index 3bd47ad43a..2c69bd97f3 100644 --- a/src/core/src/main/java/org/locationtech/geogig/storage/text/TextRevObjectSerializer.java +++ b/src/core/src/main/java/org/locationtech/geogig/storage/text/TextRevObjectSerializer.java @@ -67,7 +67,6 @@ import com.google.common.base.Function; import com.google.common.base.Preconditions; import com.google.common.base.Splitter; -import com.google.common.collect.ImmutableCollection; import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableList.Builder; import com.google.common.collect.Lists; @@ -404,8 +403,7 @@ protected void print(RevTree revTree, Writer w) throws IOException { writeBuckets(w, revTree.getBuckets()); } - private void writeChildren(Writer w, ImmutableCollection children) - throws IOException { + private void writeChildren(Writer w, Collection children) throws IOException { for (Node ref : children) { writeNode(w, ref); } diff --git a/src/core/src/test/java/org/locationtech/geogig/model/impl/LegacyTreeBuilder.java b/src/core/src/test/java/org/locationtech/geogig/model/impl/LegacyTreeBuilder.java index 216d3d5019..2ccdd5507b 100644 --- a/src/core/src/test/java/org/locationtech/geogig/model/impl/LegacyTreeBuilder.java +++ b/src/core/src/test/java/org/locationtech/geogig/model/impl/LegacyTreeBuilder.java @@ -373,7 +373,6 @@ public static RevTree createLeafTree(long size, Collection features, ImmutableList featuresList = ImmutableList.of(); ImmutableList treesList = ImmutableList.of(); - if (!features.isEmpty()) { featuresList = NODE_STORAGE_ORDER.immutableSortedCopy(features); } diff --git a/src/core/src/test/java/org/locationtech/geogig/plumbing/WriteTree2Test.java b/src/core/src/test/java/org/locationtech/geogig/plumbing/WriteTree2Test.java index 20c06ae529..0a7d2cedea 100644 --- a/src/core/src/test/java/org/locationtech/geogig/plumbing/WriteTree2Test.java +++ b/src/core/src/test/java/org/locationtech/geogig/plumbing/WriteTree2Test.java @@ -11,6 +11,7 @@ import java.util.Arrays; import java.util.Iterator; +import java.util.List; import java.util.Set; import java.util.SortedSet; @@ -687,8 +688,8 @@ private RevTree forceTreeId(RevTreeBuilder b, ObjectId treeId) { RevTree tree = b.build(); long size = tree.size(); int childTreeCount = tree.numTrees(); - ImmutableList trees = tree.trees(); - ImmutableList features = tree.features(); + List trees = tree.trees(); + List features = tree.features(); SortedSet buckets = ImmutableSortedSet.copyOf(tree.getBuckets()); RevObjectFactory factory = RevObjectFactory.defaultInstance(); RevTree fakenId; diff --git a/src/core/src/test/java/org/locationtech/geogig/storage/cache/ObjectCacheStressTest.java b/src/core/src/test/java/org/locationtech/geogig/storage/cache/ObjectCacheStressTest.java index a1cf32e7cb..f960f5bb84 100644 --- a/src/core/src/test/java/org/locationtech/geogig/storage/cache/ObjectCacheStressTest.java +++ b/src/core/src/test/java/org/locationtech/geogig/storage/cache/ObjectCacheStressTest.java @@ -256,7 +256,7 @@ private List createFeatures(int count) { private RevFeature fakeFeature(ObjectId forcedId) { // String oidString = objectId.toString(); // ObjectId treeId = ObjectId.forString("tree" + oidString); - // ImmutableList parentIds = ImmutableList.of(); + // ImmutableList parentIds = Collections.emptyList(); // RevPerson author = new RevPersonImpl("Gabriel", "groldan@boundlessgeo.com", 1000, -3); // RevPerson committer = new RevPersonImpl("Gabriel", "groldan@boundlessgeo.com", 1000, -3); // String message = "message " + oidString; diff --git a/src/core/src/test/java/org/locationtech/geogig/storage/datastream/v2_3/TestSupport.java b/src/core/src/test/java/org/locationtech/geogig/storage/datastream/v2_3/TestSupport.java index 61af8bd72d..6a3c12b9ea 100644 --- a/src/core/src/test/java/org/locationtech/geogig/storage/datastream/v2_3/TestSupport.java +++ b/src/core/src/test/java/org/locationtech/geogig/storage/datastream/v2_3/TestSupport.java @@ -147,9 +147,9 @@ public static RevTree tree(int treeSize, List treeNodes, List featur ObjectId id = HashObject.hashTree(treeNodes, featureNodes, buckets); - ImmutableList trees = treeNodes == null ? ImmutableList.of() + List trees = treeNodes == null ? Collections.emptyList() : ImmutableList.copyOf(treeNodes); - ImmutableList features = featureNodes == null ? ImmutableList.of() + List features = featureNodes == null ? Collections.emptyList() : ImmutableList.copyOf(featureNodes); buckets = buckets == null ? Collections.emptySortedSet() : buckets; int childTreeCount = treeNodes == null ? 0 : treeNodes.size(); diff --git a/src/core/src/test/java/org/locationtech/geogig/storage/impl/ConflictsDatabaseConformanceTest.java b/src/core/src/test/java/org/locationtech/geogig/storage/impl/ConflictsDatabaseConformanceTest.java index 9721ac6439..0d2882bf04 100644 --- a/src/core/src/test/java/org/locationtech/geogig/storage/impl/ConflictsDatabaseConformanceTest.java +++ b/src/core/src/test/java/org/locationtech/geogig/storage/impl/ConflictsDatabaseConformanceTest.java @@ -15,6 +15,7 @@ import static org.locationtech.geogig.model.ObjectId.NULL; import java.util.ArrayList; +import java.util.Collections; import java.util.Iterator; import java.util.List; import java.util.Map; @@ -212,16 +213,16 @@ public void testGetByPrefix() { conflicts.addConflicts(txId, pois); testGetByPrefix(null, "rivers", rivers); - testGetByPrefix(txId, "rivers", ImmutableList.of()); + testGetByPrefix(txId, "rivers", Collections.emptyList()); testGetByPrefix(null, "roads", highways); - testGetByPrefix(txId, "roads", ImmutableList.of()); + testGetByPrefix(txId, "roads", Collections.emptyList()); testGetByPrefix(txId, "buildings", buildings); - testGetByPrefix(null, "buildings", ImmutableList.of()); + testGetByPrefix(null, "buildings", Collections.emptyList()); testGetByPrefix(txId, "pois", pois); - testGetByPrefix(null, "pois", ImmutableList.of()); + testGetByPrefix(null, "pois", Collections.emptyList()); List defaultns = new ArrayList<>(rivers); defaultns.addAll(highways); diff --git a/src/core/src/test/java/org/locationtech/geogig/storage/impl/GraphDatabaseTest.java b/src/core/src/test/java/org/locationtech/geogig/storage/impl/GraphDatabaseTest.java index 3310333b4a..f44e15773e 100644 --- a/src/core/src/test/java/org/locationtech/geogig/storage/impl/GraphDatabaseTest.java +++ b/src/core/src/test/java/org/locationtech/geogig/storage/impl/GraphDatabaseTest.java @@ -17,6 +17,7 @@ import java.io.File; import java.io.IOException; import java.util.ArrayList; +import java.util.Collections; import java.util.Iterator; import java.util.List; import java.util.concurrent.ExecutionException; @@ -77,7 +78,7 @@ public void tearDown() throws Exception { @Test public void testNodes() throws IOException { ObjectId rootId = RevObjectTestSupport.hashString("root"); - ImmutableList parents = ImmutableList.of(); + List parents = Collections.emptyList(); database.put(rootId, parents); ObjectId commit1 = RevObjectTestSupport.hashString("c1"); parents = ImmutableList.of(rootId); @@ -86,7 +87,7 @@ public void testNodes() throws IOException { parents = ImmutableList.of(commit1); database.put(commit2, parents); - ImmutableList children = database.getChildren(commit2); + List children = database.getChildren(commit2); parents = database.getParents(commit2); assertTrue(database.exists(commit2)); assertEquals("Size of " + children, 0, children.size()); @@ -150,7 +151,7 @@ public void testDepth() throws IOException { // | // o - commit11 ObjectId rootId = RevObjectTestSupport.hashString("root commit"); - ImmutableList parents = ImmutableList.of(); + List parents = Collections.emptyList(); database.put(rootId, parents); ObjectId commit1 = RevObjectTestSupport.hashString("commit1"); parents = ImmutableList.of(rootId); @@ -180,7 +181,7 @@ public void testDepth() throws IOException { parents = ImmutableList.of(commit7, commit8); database.put(commit9, parents); ObjectId commit10 = RevObjectTestSupport.hashString("commit10"); - parents = ImmutableList.of(); + parents = Collections.emptyList(); database.put(commit10, parents); ObjectId commit11 = RevObjectTestSupport.hashString("commit11"); parents = ImmutableList.of(commit10); @@ -197,7 +198,7 @@ public void testDepth() throws IOException { @Test public void testProperties() throws IOException { ObjectId rootId = RevObjectTestSupport.hashString("root"); - ImmutableList parents = ImmutableList.of(); + List parents = Collections.emptyList(); database.put(rootId, parents); database.setProperty(rootId, GraphDatabase.SPARSE_FLAG, "true"); @@ -207,7 +208,7 @@ public void testProperties() throws IOException { @Test public void testEdges() throws IOException { ObjectId rootId = RevObjectTestSupport.hashString("root"); - database.put(rootId, ImmutableList.of()); + database.put(rootId, Collections.emptyList()); ObjectId commit1 = RevObjectTestSupport.hashString("c1"); database.put(commit1, ImmutableList.of(rootId)); ObjectId commit2 = RevObjectTestSupport.hashString("c2"); @@ -241,7 +242,7 @@ public void testEdges() throws IOException { @Test public void testTruncate() throws IOException { ObjectId rootId = RevObjectTestSupport.hashString("root"); - database.put(rootId, ImmutableList.of()); + database.put(rootId, Collections.emptyList()); ObjectId commit1 = RevObjectTestSupport.hashString("c1"); database.put(commit1, ImmutableList.of(rootId)); ObjectId commit2 = RevObjectTestSupport.hashString("c2"); @@ -273,13 +274,13 @@ public void testTruncate() throws IOException { @Test public void testGetChildren() { ObjectId rootId = RevObjectTestSupport.hashString("root"); - database.put(rootId, ImmutableList.of()); + database.put(rootId, Collections.emptyList()); ObjectId commit1 = RevObjectTestSupport.hashString("c1"); database.put(commit1, ImmutableList.of(rootId)); ObjectId commit2 = RevObjectTestSupport.hashString("c2"); database.put(commit2, ImmutableList.of(commit1, rootId)); - ImmutableList children = database.getChildren(rootId); + List children = database.getChildren(rootId); assertEquals(2, children.size()); assertTrue(children.contains(commit1)); assertTrue(children.contains(commit2)); @@ -298,13 +299,13 @@ public void testGetChildren() { @Test public void testGetParents() { ObjectId rootId = RevObjectTestSupport.hashString("root"); - database.put(rootId, ImmutableList.of()); + database.put(rootId, Collections.emptyList()); ObjectId commit1 = RevObjectTestSupport.hashString("c1"); database.put(commit1, ImmutableList.of(rootId)); ObjectId commit2 = RevObjectTestSupport.hashString("c2"); database.put(commit2, ImmutableList.of(commit1, rootId)); - ImmutableList parents = database.getParents(rootId); + List parents = database.getParents(rootId); assertEquals(0, parents.size()); parents = database.getParents(commit1); @@ -324,7 +325,7 @@ public void testGetParents() { public void testUpdateNode() { ObjectId nodeId = RevObjectTestSupport.hashString("node"); ObjectId nodeParent = RevObjectTestSupport.hashString("nodeParent"); - boolean updated = database.put(nodeId, ImmutableList.of()); + boolean updated = database.put(nodeId, Collections.emptyList()); assertTrue(updated); GraphNode node = database.getNode(nodeId); @@ -346,7 +347,7 @@ public void testUpdateNode() { @Test public void testSparseNode() { ObjectId nodeId = RevObjectTestSupport.hashString("node"); - database.put(nodeId, ImmutableList.of()); + database.put(nodeId, Collections.emptyList()); GraphNode node = database.getNode(nodeId); assertFalse(node.isSparse()); @@ -378,7 +379,7 @@ public void testPutConcurrency() throws InterruptedException, ExecutionException Future future = executor.submit(new Runnable() { @Override public void run() { - database.put(rootId, ImmutableList.of()); + database.put(rootId, Collections.emptyList()); database.put(commit1, ImmutableList.of(rootId)); database.put(commit2, ImmutableList.of(commit1, rootId)); } @@ -435,15 +436,15 @@ public void testUpdateConcurrency() throws InterruptedException, ExecutionExcept final ObjectId commit1 = RevObjectTestSupport.hashString("c1"); final ObjectId commit2 = RevObjectTestSupport.hashString("c2"); - database.put(rootId, ImmutableList.of()); - database.put(commit1, ImmutableList.of()); - database.put(commit2, ImmutableList.of()); + database.put(rootId, Collections.emptyList()); + database.put(commit1, Collections.emptyList()); + database.put(commit2, Collections.emptyList()); for (int t = 0; t < taskCount; t++) { Future future = executor.submit(new Runnable() { @Override public void run() { - database.put(rootId, ImmutableList.of()); + database.put(rootId, Collections.emptyList()); database.put(commit1, ImmutableList.of(rootId)); database.put(commit2, ImmutableList.of(commit1, rootId)); } @@ -500,7 +501,7 @@ public void testGetConcurrency() throws InterruptedException, ExecutionException final ObjectId commit1 = RevObjectTestSupport.hashString("c1"); final ObjectId commit2 = RevObjectTestSupport.hashString("c2"); - database.put(rootId, ImmutableList.of()); + database.put(rootId, Collections.emptyList()); database.put(commit1, ImmutableList.of(rootId)); database.put(commit2, ImmutableList.of(commit1, rootId)); diff --git a/src/core/src/test/java/org/locationtech/geogig/storage/impl/IndexDatabaseConformanceTest.java b/src/core/src/test/java/org/locationtech/geogig/storage/impl/IndexDatabaseConformanceTest.java index cde1b23d90..4452492473 100644 --- a/src/core/src/test/java/org/locationtech/geogig/storage/impl/IndexDatabaseConformanceTest.java +++ b/src/core/src/test/java/org/locationtech/geogig/storage/impl/IndexDatabaseConformanceTest.java @@ -15,6 +15,7 @@ import static org.junit.Assert.assertTrue; import java.io.IOException; +import java.util.Collections; import java.util.HashMap; import java.util.HashSet; import java.util.List; @@ -39,7 +40,6 @@ import org.locationtech.geogig.storage.memory.HeapIndexDatabase; import org.locationtech.jts.geom.Envelope; -import com.google.common.collect.ImmutableMap; import com.google.common.collect.Sets; /** @@ -122,7 +122,7 @@ public void testUpdateIndexAddMetadata() { assertEquals(treeName, index.getTreeName()); assertEquals(attributeName, index.getAttributeName()); assertEquals(IndexType.QUADTREE, index.getIndexType()); - assertEquals(ImmutableMap.of(), index.getMetadata()); + assertEquals(Collections.emptyMap(), index.getMetadata()); assertEquals(IndexInfo.getIndexId(treeName, attributeName), index.getId()); Map metadata = new HashMap(); @@ -167,7 +167,7 @@ public void testUpdateIndexRemoveMetadata() { assertEquals(treeName, index.getTreeName()); assertEquals(attributeName, index.getAttributeName()); assertEquals(IndexType.QUADTREE, index.getIndexType()); - assertEquals(ImmutableMap.of(), index.getMetadata()); + assertEquals(Collections.emptyMap(), index.getMetadata()); assertEquals(IndexInfo.getIndexId(treeName, attributeName), index.getId()); index = indexDb.getIndexInfo(treeName, attributeName).get(); @@ -175,7 +175,7 @@ public void testUpdateIndexRemoveMetadata() { assertEquals(treeName, index.getTreeName()); assertEquals(attributeName, index.getAttributeName()); assertEquals(IndexType.QUADTREE, index.getIndexType()); - assertEquals(ImmutableMap.of(), index.getMetadata()); + assertEquals(Collections.emptyMap(), index.getMetadata()); assertEquals(IndexInfo.getIndexId(treeName, attributeName), index.getId()); } diff --git a/src/core/src/test/java/org/locationtech/geogig/storage/impl/ObjectStoreConformanceTest.java b/src/core/src/test/java/org/locationtech/geogig/storage/impl/ObjectStoreConformanceTest.java index 2e431f7487..af15773d62 100644 --- a/src/core/src/test/java/org/locationtech/geogig/storage/impl/ObjectStoreConformanceTest.java +++ b/src/core/src/test/java/org/locationtech/geogig/storage/impl/ObjectStoreConformanceTest.java @@ -26,6 +26,7 @@ import java.io.IOException; import java.util.ArrayList; +import java.util.Collections; import java.util.HashSet; import java.util.Iterator; import java.util.List; @@ -110,9 +111,9 @@ public void testChecksClosed() { checkClosed(() -> db.exists(RevTree.EMPTY_TREE_ID)); checkClosed(() -> db.get(RevTree.EMPTY_TREE_ID)); checkClosed(() -> db.get(RevTree.EMPTY_TREE_ID, RevTree.class)); - checkClosed(() -> db.getAll(ImmutableList.of())); - checkClosed(() -> db.getAll(ImmutableList.of(), NOOP_LISTENER)); - checkClosed(() -> db.getAll(ImmutableList.of(), NOOP_LISTENER, RevTree.class)); + checkClosed(() -> db.getAll(Collections.emptyList())); + checkClosed(() -> db.getAll(Collections.emptyList(), NOOP_LISTENER)); + checkClosed(() -> db.getAll(Collections.emptyList(), NOOP_LISTENER, RevTree.class)); checkClosed(() -> db.getIfPresent(ObjectId.NULL)); checkClosed(() -> db.getIfPresent(RevTree.EMPTY_TREE_ID, RevTree.class)); checkClosed(() -> db.lookUp("abcd1234")); @@ -133,8 +134,8 @@ public void testChecksNullArgs() { checkNullArgument(() -> db.get(RevTree.EMPTY_TREE_ID, null)); checkNullArgument(() -> db.getAll(null)); checkNullArgument(() -> db.getAll(null, NOOP_LISTENER)); - checkNullArgument(() -> db.getAll(ImmutableList.of(), NOOP_LISTENER, null)); - checkNullArgument(() -> db.getAll(ImmutableList.of(), null)); + checkNullArgument(() -> db.getAll(Collections.emptyList(), NOOP_LISTENER, null)); + checkNullArgument(() -> db.getAll(Collections.emptyList(), null)); checkNullArgument(() -> db.getIfPresent(null)); checkNullArgument(() -> db.getIfPresent(null, RevTree.class)); checkNullArgument(() -> db.getIfPresent(RevTree.EMPTY_TREE_ID, null)); diff --git a/src/core/src/test/java/org/locationtech/geogig/storage/memory/HeapGraphDatabase.java b/src/core/src/test/java/org/locationtech/geogig/storage/memory/HeapGraphDatabase.java index e1a89b7822..ccf9231bc7 100644 --- a/src/core/src/test/java/org/locationtech/geogig/storage/memory/HeapGraphDatabase.java +++ b/src/core/src/test/java/org/locationtech/geogig/storage/memory/HeapGraphDatabase.java @@ -117,7 +117,7 @@ public ImmutableList getChildren(ObjectId commitId) throws IllegalArgu } @Override - public boolean put(ObjectId commitId, ImmutableList parentIds) { + public boolean put(ObjectId commitId, List parentIds) { Node n = graph.getOrAdd(commitId); synchronized (n) { if (parentIds.isEmpty()) { diff --git a/src/core/src/test/java/org/locationtech/geogig/test/integration/AddOpTest.java b/src/core/src/test/java/org/locationtech/geogig/test/integration/AddOpTest.java index cce778af16..a90048d0bb 100644 --- a/src/core/src/test/java/org/locationtech/geogig/test/integration/AddOpTest.java +++ b/src/core/src/test/java/org/locationtech/geogig/test/integration/AddOpTest.java @@ -9,6 +9,7 @@ */ package org.locationtech.geogig.test.integration; +import java.util.Collections; import java.util.List; import java.util.Optional; @@ -32,7 +33,6 @@ import org.locationtech.geogig.storage.AutoCloseableIterator; import org.opengis.feature.Feature; -import com.google.common.collect.ImmutableList; import com.google.common.collect.Lists; public class AddOpTest extends RepositoryTestCase { @@ -59,7 +59,7 @@ public void testAddMultipleFeatures() throws Exception { insert(points3); geogig.command(AddOp.class).call(); List unstaged = toList(repo.workingTree().getUnstaged(null)); - assertEquals(ImmutableList.of(), unstaged); + assertEquals(Collections.emptyList(), unstaged); } @Test diff --git a/src/core/src/test/java/org/locationtech/geogig/test/integration/ApplyPatchOpTest.java b/src/core/src/test/java/org/locationtech/geogig/test/integration/ApplyPatchOpTest.java index cfb423fea8..3b76164463 100644 --- a/src/core/src/test/java/org/locationtech/geogig/test/integration/ApplyPatchOpTest.java +++ b/src/core/src/test/java/org/locationtech/geogig/test/integration/ApplyPatchOpTest.java @@ -10,6 +10,7 @@ package org.locationtech.geogig.test.integration; import java.util.ArrayList; +import java.util.List; import java.util.Map; import java.util.Optional; @@ -34,7 +35,6 @@ import org.locationtech.geogig.storage.AutoCloseableIterator; import org.opengis.feature.type.PropertyDescriptor; -import com.google.common.collect.ImmutableList; import com.google.common.collect.Lists; import com.google.common.collect.Maps; @@ -109,7 +109,7 @@ public void testModifyFeatureAttributePatch() throws Exception { Optional feature = geogig.command(RevObjectParse.class) .setRefSpec("WORK_HEAD:" + path).call(RevFeature.class); assertTrue(feature.isPresent()); - ImmutableList> values = feature.get().getValues(); + List> values = feature.get().getValues(); assertEquals("new", values.get(0).get()); } @@ -151,7 +151,7 @@ public void testRemoveFeatureAttributePatch() throws Exception { Optional feature = geogig.command(RevObjectParse.class) .setRefSpec("WORK_HEAD:" + path).call(RevFeature.class); assertTrue(feature.isPresent()); - ImmutableList> values = feature.get().getValues(); + List> values = feature.get().getValues(); assertEquals(points1.getProperties().size(), values.size()); assertFalse(values.contains(Optional.of("ExtraString"))); diff --git a/src/core/src/test/java/org/locationtech/geogig/test/integration/SquashOpTest.java b/src/core/src/test/java/org/locationtech/geogig/test/integration/SquashOpTest.java index 6777e49d38..120e3e4b83 100644 --- a/src/core/src/test/java/org/locationtech/geogig/test/integration/SquashOpTest.java +++ b/src/core/src/test/java/org/locationtech/geogig/test/integration/SquashOpTest.java @@ -30,7 +30,6 @@ import org.locationtech.geogig.porcelain.SquashOp; import org.opengis.feature.Feature; -import com.google.common.collect.ImmutableList; import com.google.common.collect.Lists; public class SquashOpTest extends RepositoryTestCase { @@ -220,7 +219,7 @@ public void testSquashWithMergedBranch() throws Exception { ArrayList log = Lists .newArrayList(geogig.command(LogOp.class).setFirstParentOnly(true).call()); assertEquals(3, log.size()); - ImmutableList parents = log.get(0).getParentIds(); + List parents = log.get(0).getParentIds(); assertEquals(2, parents.size()); assertEquals("Squashed", log.get(1).getMessage()); assertEquals(log.get(1).getId(), parents.get(0)); @@ -301,7 +300,7 @@ public void testSquashWithMergeCommit() throws Exception { ArrayList log = Lists .newArrayList(geogig.command(LogOp.class).setFirstParentOnly(true).call()); assertEquals(2, log.size()); - ImmutableList parents = log.get(0).getParentIds(); + List parents = log.get(0).getParentIds(); assertEquals(c1.getId(), parents.get(0)); assertEquals(c2.getId(), parents.get(1)); diff --git a/src/core/src/test/java/org/locationtech/geogig/test/integration/repository/IndexTest.java b/src/core/src/test/java/org/locationtech/geogig/test/integration/repository/IndexTest.java index e3a2bcaaff..5d23b4c262 100644 --- a/src/core/src/test/java/org/locationtech/geogig/test/integration/repository/IndexTest.java +++ b/src/core/src/test/java/org/locationtech/geogig/test/integration/repository/IndexTest.java @@ -12,6 +12,7 @@ import static org.locationtech.geogig.model.NodeRef.appendChild; import java.util.Collection; +import java.util.Collections; import java.util.List; import java.util.Optional; @@ -39,7 +40,6 @@ import com.google.common.base.Supplier; import com.google.common.base.Suppliers; import com.google.common.collect.Collections2; -import com.google.common.collect.ImmutableList; public class IndexTest extends RepositoryTestCase { @@ -285,7 +285,7 @@ public void testWriteTree2() throws Exception { final ObjectId oId2_1 = insertAndAdd(lines1); {// simulate a commit so the repo head points to this new tree - List parents = ImmutableList.of(); + List parents = Collections.emptyList(); RevCommit commit = RevCommit.builder().treeId(newRepoTreeId1).parentIds(parents) .build(); @@ -325,7 +325,7 @@ public void testWriteTree2() throws Exception { } {// simulate a commit so the repo head points to this new tree - List parents = ImmutableList.of(); + List parents = Collections.emptyList(); RevCommit commit = RevCommit.builder().treeId(newRepoTreeId2).parentIds(parents) .build(); ObjectId commitId = commit.getId(); diff --git a/src/core/src/test/java/org/locationtech/geogig/test/performance/AbstractObjectStoreStressTest.java b/src/core/src/test/java/org/locationtech/geogig/test/performance/AbstractObjectStoreStressTest.java index 9aa1dd5d37..8933671d88 100644 --- a/src/core/src/test/java/org/locationtech/geogig/test/performance/AbstractObjectStoreStressTest.java +++ b/src/core/src/test/java/org/locationtech/geogig/test/performance/AbstractObjectStoreStressTest.java @@ -323,7 +323,7 @@ private RevObject fakeObject(int i) { private RevObject fakeObject(ObjectId forcedId) { // String oidString = objectId.toString(); // ObjectId treeId = ObjectId.forString("tree" + oidString); - // ImmutableList parentIds = ImmutableList.of(); + // ImmutableList parentIds = Collections.emptyList(); // RevPerson author = new RevPersonImpl("Gabriel", "groldan@boundlessgeo.com", 1000, -3); // RevPerson committer = new RevPersonImpl("Gabriel", "groldan@boundlessgeo.com", 1000, -3); // String message = "message " + oidString; diff --git a/src/datastore/src/main/java/org/locationtech/geogig/geotools/data/reader/FeatureReaderBuilder.java b/src/datastore/src/main/java/org/locationtech/geogig/geotools/data/reader/FeatureReaderBuilder.java index 446eb20e9d..fc0882374d 100644 --- a/src/datastore/src/main/java/org/locationtech/geogig/geotools/data/reader/FeatureReaderBuilder.java +++ b/src/datastore/src/main/java/org/locationtech/geogig/geotools/data/reader/FeatureReaderBuilder.java @@ -85,7 +85,6 @@ import com.google.common.base.Preconditions; import com.google.common.base.Predicate; import com.google.common.base.Predicates; -import com.google.common.collect.ImmutableList; import com.google.common.collect.Iterators; import com.google.common.collect.Lists; import com.google.common.collect.Sets; @@ -925,7 +924,7 @@ private boolean canFilterBuckets(Filter preFilter) { } private List createFidFilter(Filter filter) { - List pathFilters = ImmutableList.of(); + List pathFilters = Collections.emptyList(); if (filter instanceof Id) { final Set identifiers = ((Id) filter).getIdentifiers(); Iterator featureIds = Iterators diff --git a/src/datastore/src/test/java/org/locationtech/geogig/geotools/data/GeoGigDataStoreFactoryTest.java b/src/datastore/src/test/java/org/locationtech/geogig/geotools/data/GeoGigDataStoreFactoryTest.java index ddfdeb56ef..9c05b30d1d 100644 --- a/src/datastore/src/test/java/org/locationtech/geogig/geotools/data/GeoGigDataStoreFactoryTest.java +++ b/src/datastore/src/test/java/org/locationtech/geogig/geotools/data/GeoGigDataStoreFactoryTest.java @@ -15,6 +15,7 @@ import java.io.IOException; import java.io.Serializable; import java.net.URI; +import java.util.Collections; import java.util.Iterator; import java.util.Map; @@ -65,7 +66,7 @@ public void testDataStoreFinder() throws Exception { Map params; DataStore dataStore; - params = ImmutableMap.of(); + params = Collections.emptyMap(); dataStore = DataStoreFinder.getDataStore(params); assertNull(dataStore); @@ -79,7 +80,7 @@ public void testDataStoreFinder() throws Exception { public void testCanProcess() { final File workingDir = repoDirectory; - Map params = ImmutableMap.of(); + Map params = Collections.emptyMap(); assertFalse(factory.canProcess(params)); params = ImmutableMap.of(REPOSITORY.key, (Serializable) (workingDir.getName() + "/testCanProcess")); diff --git a/src/geotools/src/main/java/org/locationtech/geogig/geotools/plumbing/ExportOp.java b/src/geotools/src/main/java/org/locationtech/geogig/geotools/plumbing/ExportOp.java index 16665572f1..deaa88c469 100644 --- a/src/geotools/src/main/java/org/locationtech/geogig/geotools/plumbing/ExportOp.java +++ b/src/geotools/src/main/java/org/locationtech/geogig/geotools/plumbing/ExportOp.java @@ -14,6 +14,7 @@ import java.io.IOException; import java.util.HashSet; import java.util.Iterator; +import java.util.List; import java.util.Optional; import java.util.Set; import java.util.concurrent.ConcurrentHashMap; @@ -71,7 +72,6 @@ import com.google.common.base.Supplier; import com.google.common.base.Suppliers; import com.google.common.base.Throwables; -import com.google.common.collect.ImmutableList; import com.google.common.collect.Iterators; import com.google.common.collect.Lists; import com.google.common.collect.PeekingIterator; @@ -338,8 +338,8 @@ private Iterator alter(Iterator plainFeatures, final RevFeature oldFeature; oldFeature = (RevFeature) sf.getUserData().get(RevFeature.class); - ImmutableList oldAttributes = oldFeatureType.descriptors(); - ImmutableList newAttributes = targetType.descriptors(); + List oldAttributes = oldFeatureType.descriptors(); + List newAttributes = targetType.descriptors(); RevFeatureBuilder builder = RevFeature.builder(); for (int i = 0; i < newAttributes.size(); i++) { diff --git a/src/geotools/src/main/java/org/locationtech/geogig/geotools/plumbing/ImportOp.java b/src/geotools/src/main/java/org/locationtech/geogig/geotools/plumbing/ImportOp.java index a53161e575..53c30972a3 100644 --- a/src/geotools/src/main/java/org/locationtech/geogig/geotools/plumbing/ImportOp.java +++ b/src/geotools/src/main/java/org/locationtech/geogig/geotools/plumbing/ImportOp.java @@ -81,7 +81,6 @@ import com.google.common.base.Charsets; import com.google.common.base.Function; import com.google.common.base.Preconditions; -import com.google.common.collect.ImmutableList; import com.google.common.collect.Iterators; import com.google.common.collect.Lists; import com.google.common.collect.Sets; @@ -610,8 +609,8 @@ private Feature alter(NodeRef node, RevFeatureType featureType) { RevFeatureType oldFeatureType; oldFeatureType = command(RevObjectParse.class).setObjectId(node.getMetadataId()) .call(RevFeatureType.class).get(); - ImmutableList oldAttributes = oldFeatureType.descriptors(); - ImmutableList newAttributes = featureType.descriptors(); + List oldAttributes = oldFeatureType.descriptors(); + List newAttributes = featureType.descriptors(); RevFeatureBuilder builder = RevFeature.builder(); for (int i = 0; i < newAttributes.size(); i++) { int idx = oldAttributes.indexOf(newAttributes.get(i)); diff --git a/src/geotools/src/test/java/org/locationtech/geogig/geotools/plumbing/DescribeOpTest.java b/src/geotools/src/test/java/org/locationtech/geogig/geotools/plumbing/DescribeOpTest.java index 788b286698..815896ba93 100644 --- a/src/geotools/src/test/java/org/locationtech/geogig/geotools/plumbing/DescribeOpTest.java +++ b/src/geotools/src/test/java/org/locationtech/geogig/geotools/plumbing/DescribeOpTest.java @@ -13,6 +13,7 @@ import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertTrue; +import java.util.Collections; import java.util.Map; import java.util.Optional; @@ -21,8 +22,6 @@ import org.junit.rules.ExpectedException; import org.locationtech.geogig.geotools.TestHelper; -import com.google.common.collect.ImmutableMap; - public class DescribeOpTest { @Rule @@ -40,7 +39,7 @@ public void testNullDataStore() throws Exception { public void testNullTable() throws Exception { DescribeOp describe = new DescribeOp(); describe.setDataStore( - TestHelper.createEmptyTestFactory().createDataStore(ImmutableMap.of())); + TestHelper.createEmptyTestFactory().createDataStore(Collections.emptyMap())); exception.expect(GeoToolsOpException.class); describe.call(); } @@ -50,7 +49,7 @@ public void testEmptyTable() throws Exception { DescribeOp describe = new DescribeOp(); describe.setTable(""); describe.setDataStore( - TestHelper.createEmptyTestFactory().createDataStore(ImmutableMap.of())); + TestHelper.createEmptyTestFactory().createDataStore(Collections.emptyMap())); exception.expect(GeoToolsOpException.class); describe.call(); } @@ -59,7 +58,7 @@ public void testEmptyTable() throws Exception { public void testEmptyDataStore() throws Exception { DescribeOp describe = new DescribeOp(); describe.setDataStore( - TestHelper.createEmptyTestFactory().createDataStore(ImmutableMap.of())); + TestHelper.createEmptyTestFactory().createDataStore(Collections.emptyMap())); describe.setTable("table1"); Optional> features = describe.call(); assertFalse(features.isPresent()); @@ -68,8 +67,8 @@ public void testEmptyDataStore() throws Exception { @Test public void testTypeNameException() throws Exception { DescribeOp describe = new DescribeOp(); - describe.setDataStore( - TestHelper.createFactoryWithGetNamesException().createDataStore(ImmutableMap.of())); + describe.setDataStore(TestHelper.createFactoryWithGetNamesException() + .createDataStore(Collections.emptyMap())); describe.setTable("table1"); exception.expect(GeoToolsOpException.class); describe.call(); @@ -79,7 +78,7 @@ public void testTypeNameException() throws Exception { public void testGetFeatureSourceException() throws Exception { DescribeOp describe = new DescribeOp(); describe.setDataStore(TestHelper.createFactoryWithGetFeatureSourceException() - .createDataStore(ImmutableMap.of())); + .createDataStore(Collections.emptyMap())); describe.setTable("table1"); exception.expect(GeoToolsOpException.class); describe.call(); @@ -88,7 +87,8 @@ public void testGetFeatureSourceException() throws Exception { @Test public void testDescribe() throws Exception { DescribeOp describe = new DescribeOp(); - describe.setDataStore(TestHelper.createTestFactory().createDataStore(ImmutableMap.of())); + describe.setDataStore( + TestHelper.createTestFactory().createDataStore(Collections.emptyMap())); describe.setTable("table1"); Optional> properties = describe.call(); assertTrue(properties.isPresent()); diff --git a/src/geotools/src/test/java/org/locationtech/geogig/geotools/plumbing/ImportOpTest.java b/src/geotools/src/test/java/org/locationtech/geogig/geotools/plumbing/ImportOpTest.java index f3988438e5..d269b44633 100644 --- a/src/geotools/src/test/java/org/locationtech/geogig/geotools/plumbing/ImportOpTest.java +++ b/src/geotools/src/test/java/org/locationtech/geogig/geotools/plumbing/ImportOpTest.java @@ -16,7 +16,9 @@ import java.io.IOException; import java.util.ArrayList; +import java.util.Collections; import java.util.Iterator; +import java.util.List; import java.util.Optional; import java.util.TreeSet; @@ -53,8 +55,6 @@ import org.opengis.referencing.FactoryException; import org.opengis.referencing.crs.CoordinateReferenceSystem; -import com.google.common.collect.ImmutableList; -import com.google.common.collect.ImmutableMap; import com.google.common.collect.Lists; import com.google.common.collect.Sets; @@ -75,7 +75,7 @@ public void testNullDataStore() throws Exception { public void testNullTableNotAll() throws Exception { ImportOp importOp = geogig.command(ImportOp.class); importOp.setDataStore( - TestHelper.createEmptyTestFactory().createDataStore(ImmutableMap.of())); + TestHelper.createEmptyTestFactory().createDataStore(Collections.emptyMap())); importOp.setAll(false); exception.expect(GeoToolsOpException.class); importOp.call(); @@ -87,7 +87,7 @@ public void testEmptyTableNotAll() throws Exception { importOp.setTable(""); importOp.setAll(false); importOp.setDataStore( - TestHelper.createEmptyTestFactory().createDataStore(ImmutableMap.of())); + TestHelper.createEmptyTestFactory().createDataStore(Collections.emptyMap())); exception.expect(GeoToolsOpException.class); importOp.call(); } @@ -97,7 +97,8 @@ public void testEmptyTableAndAll() throws Exception { ImportOp importOp = geogig.command(ImportOp.class); importOp.setTable(""); importOp.setAll(true); - importOp.setDataStore(TestHelper.createTestFactory().createDataStore(ImmutableMap.of())); + importOp.setDataStore( + TestHelper.createTestFactory().createDataStore(Collections.emptyMap())); importOp.call(); } @@ -107,7 +108,7 @@ public void testTableAndAll() throws Exception { importOp.setTable("table1"); importOp.setAll(true); importOp.setDataStore( - TestHelper.createEmptyTestFactory().createDataStore(ImmutableMap.of())); + TestHelper.createEmptyTestFactory().createDataStore(Collections.emptyMap())); exception.expect(GeoToolsOpException.class); importOp.call(); } @@ -116,7 +117,7 @@ public void testTableAndAll() throws Exception { public void testTableNotFound() throws Exception { ImportOp importOp = geogig.command(ImportOp.class); importOp.setDataStore( - TestHelper.createEmptyTestFactory().createDataStore(ImmutableMap.of())); + TestHelper.createEmptyTestFactory().createDataStore(Collections.emptyMap())); importOp.setAll(false); importOp.setTable("table1"); exception.expect(GeoToolsOpException.class); @@ -127,7 +128,7 @@ public void testTableNotFound() throws Exception { public void testNoFeaturesFound() throws Exception { ImportOp importOp = geogig.command(ImportOp.class); importOp.setDataStore( - TestHelper.createEmptyTestFactory().createDataStore(ImmutableMap.of())); + TestHelper.createEmptyTestFactory().createDataStore(Collections.emptyMap())); importOp.setAll(true); exception.expect(GeoToolsOpException.class); importOp.call(); @@ -136,8 +137,8 @@ public void testNoFeaturesFound() throws Exception { @Test public void testTypeNameException() throws Exception { ImportOp importOp = geogig.command(ImportOp.class); - importOp.setDataStore( - TestHelper.createFactoryWithGetNamesException().createDataStore(ImmutableMap.of())); + importOp.setDataStore(TestHelper.createFactoryWithGetNamesException() + .createDataStore(Collections.emptyMap())); importOp.setAll(false); importOp.setTable("table1"); exception.expect(GeoToolsOpException.class); @@ -148,7 +149,7 @@ public void testTypeNameException() throws Exception { public void testGetFeatureSourceException() throws Exception { ImportOp importOp = geogig.command(ImportOp.class); importOp.setDataStore(TestHelper.createFactoryWithGetFeatureSourceException() - .createDataStore(ImmutableMap.of())); + .createDataStore(Collections.emptyMap())); importOp.setAll(false); importOp.setTable("table1"); exception.expect(GeoToolsOpException.class); @@ -158,7 +159,8 @@ public void testGetFeatureSourceException() throws Exception { @Test public void testImportTable() throws Exception { ImportOp importOp = geogig.command(ImportOp.class); - importOp.setDataStore(TestHelper.createTestFactory().createDataStore(ImmutableMap.of())); + importOp.setDataStore( + TestHelper.createTestFactory().createDataStore(Collections.emptyMap())); importOp.setAll(false); importOp.setTable("table1"); @@ -176,7 +178,8 @@ public void testImportTable() throws Exception { public void testImportTableWithNoFeatures() throws Exception { ImportOp importOp = geogig.command(ImportOp.class); - importOp.setDataStore(TestHelper.createTestFactory().createDataStore(ImmutableMap.of())); + importOp.setDataStore( + TestHelper.createTestFactory().createDataStore(Collections.emptyMap())); importOp.setAll(false); importOp.setTable("table4"); importOp.call(); @@ -190,7 +193,8 @@ public void testImportTableWithNoFeatures() throws Exception { @Test public void testImportAll() throws Exception { ImportOp importOp = geogig.command(ImportOp.class); - importOp.setDataStore(TestHelper.createTestFactory().createDataStore(ImmutableMap.of())); + importOp.setDataStore( + TestHelper.createTestFactory().createDataStore(Collections.emptyMap())); importOp.setAll(true); RevTree newWorkingTree = importOp.call(); @@ -210,7 +214,8 @@ public void testImportAll() throws Exception { @Test public void testImportAllWithDifferentFeatureTypesAndDestPath() throws Exception { ImportOp importOp = geogig.command(ImportOp.class); - importOp.setDataStore(TestHelper.createTestFactory().createDataStore(ImmutableMap.of())); + importOp.setDataStore( + TestHelper.createTestFactory().createDataStore(Collections.emptyMap())); importOp.setAll(true); importOp.setDestinationPath("dest"); importOp.setAdaptToDefaultFeatureType(false); @@ -248,7 +253,8 @@ public void testImportAllWithDifferentFeatureTypesAndDestPathAndAdd() throws Exc WorkingTree workingTree = geogig.getRepository().workingTree(); workingTree.insert(fi); ImportOp importOp = geogig.command(ImportOp.class); - importOp.setDataStore(TestHelper.createTestFactory().createDataStore(ImmutableMap.of())); + importOp.setDataStore( + TestHelper.createTestFactory().createDataStore(Collections.emptyMap())); importOp.setAll(true); importOp.setOverwrite(false); importOp.setDestinationPath("dest"); @@ -273,12 +279,14 @@ public void testImportAllWithDifferentFeatureTypesAndDestPathAndAdd() throws Exc @Test public void testAddUsingOriginalFeatureType() throws Exception { ImportOp importOp = geogig.command(ImportOp.class); - importOp.setDataStore(TestHelper.createTestFactory().createDataStore(ImmutableMap.of())); + importOp.setDataStore( + TestHelper.createTestFactory().createDataStore(Collections.emptyMap())); importOp.setTable("table1"); importOp.call(); importOp = geogig.command(ImportOp.class); - importOp.setDataStore(TestHelper.createTestFactory().createDataStore(ImmutableMap.of())); + importOp.setDataStore( + TestHelper.createTestFactory().createDataStore(Collections.emptyMap())); importOp.setTable("table2"); importOp.setAdaptToDefaultFeatureType(false); importOp.setDestinationPath("table1"); @@ -298,7 +306,8 @@ public void testAddUsingOriginalFeatureType() throws Exception { @Test public void testAlter() throws Exception { ImportOp importOp = geogig.command(ImportOp.class); - importOp.setDataStore(TestHelper.createTestFactory().createDataStore(ImmutableMap.of())); + importOp.setDataStore( + TestHelper.createTestFactory().createDataStore(Collections.emptyMap())); importOp.setTable("table1"); importOp.call(); importOp.setTable("table2"); @@ -312,7 +321,7 @@ public void testAlter() throws Exception { Optional feature = geogig.command(RevObjectParse.class) .setRefSpec("WORK_HEAD:table1/feature1").call(RevFeature.class); assertTrue(feature.isPresent()); - ImmutableList> values = feature.get().getValues(); + List> values = feature.get().getValues(); assertEquals(2, values.size()); assertTrue(values.get(0).isPresent()); assertFalse(values.get(1).isPresent()); @@ -331,7 +340,8 @@ public void testAlter() throws Exception { @Test public void testImportWithOverriddenGeomName() throws Exception { ImportOp importOp = geogig.command(ImportOp.class); - importOp.setDataStore(TestHelper.createTestFactory().createDataStore(ImmutableMap.of())); + importOp.setDataStore( + TestHelper.createTestFactory().createDataStore(Collections.emptyMap())); importOp.setTable("table1"); importOp.setGeometryNameOverride("my_geom_name"); importOp.call(); @@ -350,7 +360,8 @@ public void testImportWithOverriddenGeomName() throws Exception { @Test public void testImportWithOverriddenGeomNameAlredyInUse() throws Exception { ImportOp importOp = geogig.command(ImportOp.class); - importOp.setDataStore(TestHelper.createTestFactory().createDataStore(ImmutableMap.of())); + importOp.setDataStore( + TestHelper.createTestFactory().createDataStore(Collections.emptyMap())); importOp.setTable("table1"); importOp.setGeometryNameOverride("label"); try { @@ -364,7 +375,8 @@ public void testImportWithOverriddenGeomNameAlredyInUse() throws Exception { @Test public void testImportWithFid() throws Exception { ImportOp importOp = geogig.command(ImportOp.class); - importOp.setDataStore(TestHelper.createTestFactory().createDataStore(ImmutableMap.of())); + importOp.setDataStore( + TestHelper.createTestFactory().createDataStore(Collections.emptyMap())); importOp.setTable("table3"); importOp.setDestinationPath("table3"); importOp.setFidAttribute("number"); @@ -382,7 +394,8 @@ public void testDeleteException() throws Exception { doThrow(new RuntimeException("Exception")).when(workTree).delete(any(String.class)); ImportOp importOp = new ImportOp(); importOp.setContext(cmdl); - importOp.setDataStore(TestHelper.createTestFactory().createDataStore(ImmutableMap.of())); + importOp.setDataStore( + TestHelper.createTestFactory().createDataStore(Collections.emptyMap())); importOp.setAll(true); exception.expect(GeoToolsOpException.class); importOp.call(); @@ -391,7 +404,8 @@ public void testDeleteException() throws Exception { @Test public void testAdaptFeatureType() throws Exception { ImportOp importOp = geogig.command(ImportOp.class); - importOp.setDataStore(TestHelper.createTestFactory().createDataStore(ImmutableMap.of())); + importOp.setDataStore( + TestHelper.createTestFactory().createDataStore(Collections.emptyMap())); importOp.setTable("shpLikeTable"); importOp.setDestinationPath("table"); importOp.call(); @@ -409,7 +423,7 @@ public void testAdaptFeatureType() throws Exception { .setRefSpec("WORK_HEAD:table/feature1").call().get(); assertEquals(originalFeatureType.getId(), featureType.getId()); GeometryFactory gf = new GeometryFactory(); - ImmutableList> values = feature.get().getValues(); + List> values = feature.get().getValues(); assertEquals(values.get(0).get(), gf.createPoint(new Coordinate(0, 7))); assertEquals(values.get(1).get(), 3.2); assertEquals(values.get(2).get(), 1100.0); @@ -430,7 +444,8 @@ public void testAdaptFeatureType() throws Exception { @Test public void testCannotAdaptFeatureTypeIfCRSChanges() throws Exception { ImportOp importOp = geogig.command(ImportOp.class); - importOp.setDataStore(TestHelper.createTestFactory().createDataStore(ImmutableMap.of())); + importOp.setDataStore( + TestHelper.createTestFactory().createDataStore(Collections.emptyMap())); importOp.setTable("GeoJsonLikeTable"); importOp.setDestinationPath("table"); importOp.call(); diff --git a/src/geotools/src/test/java/org/locationtech/geogig/geotools/plumbing/ListOpTest.java b/src/geotools/src/test/java/org/locationtech/geogig/geotools/plumbing/ListOpTest.java index 905cc04a1e..8d4ef1099d 100644 --- a/src/geotools/src/test/java/org/locationtech/geogig/geotools/plumbing/ListOpTest.java +++ b/src/geotools/src/test/java/org/locationtech/geogig/geotools/plumbing/ListOpTest.java @@ -12,6 +12,7 @@ import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertTrue; +import java.util.Collections; import java.util.List; import java.util.Optional; @@ -20,8 +21,6 @@ import org.junit.rules.ExpectedException; import org.locationtech.geogig.geotools.TestHelper; -import com.google.common.collect.ImmutableMap; - public class ListOpTest { @Rule @@ -37,7 +36,8 @@ public void testNullDataStore() throws Exception { @Test public void testEmptyDataStore() throws Exception { ListOp list = new ListOp(); - list.setDataStore(TestHelper.createEmptyTestFactory().createDataStore(ImmutableMap.of())); + list.setDataStore( + TestHelper.createEmptyTestFactory().createDataStore(Collections.emptyMap())); Optional> features = list.call(); assertFalse(features.isPresent()); } @@ -45,8 +45,8 @@ public void testEmptyDataStore() throws Exception { @Test public void testTypeNameException() throws Exception { ListOp list = new ListOp(); - list.setDataStore( - TestHelper.createFactoryWithGetNamesException().createDataStore(ImmutableMap.of())); + list.setDataStore(TestHelper.createFactoryWithGetNamesException() + .createDataStore(Collections.emptyMap())); exception.expect(GeoToolsOpException.class); list.call(); } @@ -54,7 +54,7 @@ public void testTypeNameException() throws Exception { @Test public void testList() throws Exception { ListOp list = new ListOp(); - list.setDataStore(TestHelper.createTestFactory().createDataStore(ImmutableMap.of())); + list.setDataStore(TestHelper.createTestFactory().createDataStore(Collections.emptyMap())); Optional> features = list.call(); assertTrue(features.isPresent()); diff --git a/src/remoting/src/main/java/org/locationtech/geogig/remotes/CloneOp.java b/src/remoting/src/main/java/org/locationtech/geogig/remotes/CloneOp.java index 899f6a3d5c..4bc41b5d73 100644 --- a/src/remoting/src/main/java/org/locationtech/geogig/remotes/CloneOp.java +++ b/src/remoting/src/main/java/org/locationtech/geogig/remotes/CloneOp.java @@ -13,6 +13,7 @@ import java.net.URI; import java.util.Collection; +import java.util.Collections; import java.util.HashSet; import java.util.Map; import java.util.Optional; @@ -44,7 +45,6 @@ import com.google.common.base.Function; import com.google.common.base.Throwables; -import com.google.common.collect.ImmutableList; import com.google.common.collect.Iterables; /** @@ -273,7 +273,7 @@ private Collection fetchRemoteData(final Repository clone, Remote remot String fetchURL = remote.getFetchURL(); Collection refs = changedRefs.get(fetchURL); if (refs == null) { - refs = ImmutableList.of(); + refs = Collections.emptyList(); } return refs; } diff --git a/src/remoting/src/main/java/org/locationtech/geogig/remotes/internal/AbstractMappedRemoteRepo.java b/src/remoting/src/main/java/org/locationtech/geogig/remotes/internal/AbstractMappedRemoteRepo.java index a3f137c2e6..4bcb6bebd5 100644 --- a/src/remoting/src/main/java/org/locationtech/geogig/remotes/internal/AbstractMappedRemoteRepo.java +++ b/src/remoting/src/main/java/org/locationtech/geogig/remotes/internal/AbstractMappedRemoteRepo.java @@ -38,7 +38,6 @@ import com.google.common.base.Preconditions; import com.google.common.base.Predicate; import com.google.common.base.Suppliers; -import com.google.common.collect.ImmutableList; /** * Abstract base implementation for mapped (sparse) clone. @@ -81,7 +80,7 @@ protected Evaluation evaluate(CommitNode commitNode) { } @Override - protected ImmutableList getParentsInternal(ObjectId commitId) { + protected List getParentsInternal(ObjectId commitId) { return source.getParents(commitId); } @@ -113,7 +112,7 @@ protected Evaluation evaluate(CommitNode commitNode) { } @Override - protected ImmutableList getParentsInternal(ObjectId commitId) { + protected List getParentsInternal(ObjectId commitId) { return source.graphDatabase().getParents(commitId); } diff --git a/src/remoting/src/main/java/org/locationtech/geogig/remotes/internal/AbstractRemoteRepo.java b/src/remoting/src/main/java/org/locationtech/geogig/remotes/internal/AbstractRemoteRepo.java index 856f0e2c13..feb08af2e2 100644 --- a/src/remoting/src/main/java/org/locationtech/geogig/remotes/internal/AbstractRemoteRepo.java +++ b/src/remoting/src/main/java/org/locationtech/geogig/remotes/internal/AbstractRemoteRepo.java @@ -9,6 +9,7 @@ */ package org.locationtech.geogig.remotes.internal; +import java.util.List; import java.util.Optional; import org.locationtech.geogig.model.ObjectId; @@ -22,7 +23,6 @@ import org.locationtech.geogig.repository.Repository; import com.google.common.base.Preconditions; -import com.google.common.collect.ImmutableList; /** * Provides a base implementation for different representations of the {@link IRemoteRepo}. @@ -75,7 +75,7 @@ protected Evaluation evaluate(CommitNode commitNode) { } @Override - protected ImmutableList getParentsInternal(ObjectId commitId) { + protected List getParentsInternal(ObjectId commitId) { return source.getParents(commitId); } @@ -128,7 +128,7 @@ protected Evaluation evaluate(CommitNode commitNode) { } @Override - protected ImmutableList getParentsInternal(ObjectId commitId) { + protected List getParentsInternal(ObjectId commitId) { return source.getParents(commitId); } @@ -164,7 +164,7 @@ protected Evaluation evaluate(CommitNode commitNode) { } @Override - protected ImmutableList getParentsInternal(ObjectId commitId) { + protected List getParentsInternal(ObjectId commitId) { return source.getParents(commitId); } diff --git a/src/remoting/src/main/java/org/locationtech/geogig/remotes/internal/CommitTraverser.java b/src/remoting/src/main/java/org/locationtech/geogig/remotes/internal/CommitTraverser.java index 1d9f28f10d..cef9052a7d 100644 --- a/src/remoting/src/main/java/org/locationtech/geogig/remotes/internal/CommitTraverser.java +++ b/src/remoting/src/main/java/org/locationtech/geogig/remotes/internal/CommitTraverser.java @@ -17,8 +17,6 @@ import org.locationtech.geogig.model.ObjectId; -import com.google.common.collect.ImmutableList; - /** * Provides a method of traversing the commit graph with overridable functions to determine when to * prune the traversal, and when to process a commit node. @@ -31,7 +29,7 @@ public abstract class CommitTraverser { public List have; - private Hashtable> commitParents; + private Hashtable> commitParents; /** * Traversal node that stores information about the ObjectId of the commit and it's depth from @@ -104,7 +102,7 @@ protected enum Evaluation { public CommitTraverser() { commits = new Stack(); have = new LinkedList(); - commitParents = new Hashtable>(); + commitParents = new Hashtable>(); } /** @@ -121,7 +119,7 @@ public CommitTraverser() { * * @param commitNode the commit to apply */ - protected void apply(CommitNode commitNode, ImmutableList parents) { + protected void apply(CommitNode commitNode, List parents) { if (commits.contains(commitNode.getObjectId())) { commits.remove(commitNode.getObjectId()); } @@ -140,7 +138,7 @@ public final void traverse(ObjectId startPoint) { while (!commitQueue.isEmpty()) { CommitNode node = commitQueue.remove(); Evaluation evaluation = evaluate(node); - ImmutableList parents; + List parents; switch (evaluation) { case INCLUDE_AND_PRUNE: parents = getParents(node.getObjectId()); @@ -173,7 +171,7 @@ public final void traverse(ObjectId startPoint) { * * @param commitNode the commit whose parents need to be added */ - private void addParents(CommitNode commitNode, ImmutableList parents) { + private void addParents(CommitNode commitNode, List parents) { for (ObjectId parent : parents) { CommitNode parentNode = new CommitNode(parent, commitNode.getDepth() + 1); if (commitQueue.contains(parentNode)) { @@ -183,8 +181,8 @@ private void addParents(CommitNode commitNode, ImmutableList parents) } } - private ImmutableList getParents(ObjectId commitId) { - ImmutableList parents = commitParents.get(commitId); + private List getParents(ObjectId commitId) { + List parents = commitParents.get(commitId); if (parents == null) { parents = getParentsInternal(commitId); commitParents.put(commitId, parents); @@ -198,7 +196,7 @@ private ImmutableList getParents(ObjectId commitId) { * @param commitId the id of the commit whose parents need to be retrieved * @return the list of parents */ - protected abstract ImmutableList getParentsInternal(ObjectId commitId); + protected abstract List getParentsInternal(ObjectId commitId); /** * Determines if the given commitId exists in the destination. diff --git a/src/remoting/src/main/java/org/locationtech/geogig/remotes/internal/LocalRepositoryWrapper.java b/src/remoting/src/main/java/org/locationtech/geogig/remotes/internal/LocalRepositoryWrapper.java index 3b4fbfc8fa..4ced06e1f6 100644 --- a/src/remoting/src/main/java/org/locationtech/geogig/remotes/internal/LocalRepositoryWrapper.java +++ b/src/remoting/src/main/java/org/locationtech/geogig/remotes/internal/LocalRepositoryWrapper.java @@ -9,13 +9,12 @@ */ package org.locationtech.geogig.remotes.internal; +import java.util.List; import java.util.Optional; import org.locationtech.geogig.model.ObjectId; import org.locationtech.geogig.repository.Repository; -import com.google.common.collect.ImmutableList; - /** * Provides an interface to make basic queries to a local repository. */ @@ -50,7 +49,7 @@ public boolean objectExists(ObjectId objectId) { * @return a list of parent ids for the commit */ @Override - public ImmutableList getParents(ObjectId commitId) { + public List getParents(ObjectId commitId) { return localRepository.graphDatabase().getParents(commitId); } diff --git a/src/remoting/src/main/java/org/locationtech/geogig/remotes/internal/RepositoryWrapper.java b/src/remoting/src/main/java/org/locationtech/geogig/remotes/internal/RepositoryWrapper.java index 44111a6ba4..479efb2817 100644 --- a/src/remoting/src/main/java/org/locationtech/geogig/remotes/internal/RepositoryWrapper.java +++ b/src/remoting/src/main/java/org/locationtech/geogig/remotes/internal/RepositoryWrapper.java @@ -9,12 +9,11 @@ */ package org.locationtech.geogig.remotes.internal; +import java.util.List; import java.util.Optional; import org.locationtech.geogig.model.ObjectId; -import com.google.common.collect.ImmutableList; - /** * Provides an interface to make basic queries to a repository. */ @@ -34,7 +33,7 @@ public interface RepositoryWrapper { * @param commit the id of the commit whose parents to retrieve * @return a list of parent ids for the commit */ - public ImmutableList getParents(ObjectId commitId); + public List getParents(ObjectId commitId); /** * Gets the depth of the given commit. diff --git a/src/storage/postgres/src/main/java/org/locationtech/geogig/storage/postgresql/v9/PGGraphDatabase.java b/src/storage/postgres/src/main/java/org/locationtech/geogig/storage/postgresql/v9/PGGraphDatabase.java index 9706ec1ba8..a6a4a8b00e 100644 --- a/src/storage/postgres/src/main/java/org/locationtech/geogig/storage/postgresql/v9/PGGraphDatabase.java +++ b/src/storage/postgres/src/main/java/org/locationtech/geogig/storage/postgresql/v9/PGGraphDatabase.java @@ -141,7 +141,7 @@ private boolean exists(final PGId node, final Connection cx) throws SQLException } @Override - public ImmutableList getParents(ObjectId commitId) throws IllegalArgumentException { + public List getParents(ObjectId commitId) throws IllegalArgumentException { final PGId node = PGId.valueOf(commitId); // (p) -> p.toObjectId() @@ -156,7 +156,7 @@ public ObjectId apply(PGId p) { } @Override - public ImmutableList getChildren(ObjectId commitId) throws IllegalArgumentException { + public List getChildren(ObjectId commitId) throws IllegalArgumentException { // (p) -> p.toObjectId() Function fn = new Function() { @@ -170,7 +170,7 @@ public ObjectId apply(PGId p) { } @Override - public boolean put(ObjectId commitId, ImmutableList parentIds) { + public boolean put(ObjectId commitId, List parentIds) { try (Connection cx = PGStorage.newConnection(dataSource)) { return put(cx, commitId, parentIds); } catch (SQLException e) { @@ -259,7 +259,7 @@ private void putWithoutUpsert(Connection cx, Stream commits) throws S try (PreparedStatement ps = cx.prepareStatement(insert)) { for (RevCommit c : uniqueCommits) { src = PGId.valueOf(c.getId()); - ImmutableList parentIds = c.getParentIds(); + List parentIds = c.getParentIds(); for (int parentIndex = 0; parentIndex < parentIds.size(); parentIndex++) { ObjectId parent = parentIds.get(parentIndex); dst = PGId.valueOf(parent); @@ -306,7 +306,7 @@ private void putWithUpsert(Connection cx, Stream commits) throws SQLE RevCommit c = iterator.next(); count++; src = PGId.valueOf(c.getId()); - ImmutableList parentIds = c.getParentIds(); + List parentIds = c.getParentIds(); for (int parentIndex = 0; parentIndex < parentIds.size(); parentIndex++) { ObjectId parent = parentIds.get(parentIndex); dst = PGId.valueOf(parent); diff --git a/src/storage/postgres/src/main/java/org/locationtech/geogig/storage/postgresql/v9/PGObjectStore.java b/src/storage/postgres/src/main/java/org/locationtech/geogig/storage/postgresql/v9/PGObjectStore.java index 2a0b80b19b..bf941a2bd8 100644 --- a/src/storage/postgres/src/main/java/org/locationtech/geogig/storage/postgresql/v9/PGObjectStore.java +++ b/src/storage/postgres/src/main/java/org/locationtech/geogig/storage/postgresql/v9/PGObjectStore.java @@ -28,6 +28,7 @@ import java.sql.SQLException; import java.util.ArrayList; import java.util.Collection; +import java.util.Collections; import java.util.HashMap; import java.util.HashSet; import java.util.Iterator; @@ -79,7 +80,6 @@ import com.google.common.base.Preconditions; import com.google.common.base.Throwables; import com.google.common.collect.ArrayListMultimap; -import com.google.common.collect.ImmutableMap; import com.google.common.collect.Iterators; import com.google.common.util.concurrent.Futures; import com.google.common.util.concurrent.ThreadFactoryBuilder; @@ -675,7 +675,7 @@ public Void call() { return null; } try (Connection cx = PGStorage.newConnection(ds)) { - Map insertResults = ImmutableMap.of(); + Map insertResults = Collections.emptyMap(); cx.setAutoCommit(false); try { insertResults = doInsert(cx, batch); diff --git a/src/storage/postgres/src/test/java/org/locationtech/geogig/storage/postgresql/performance/PGObjectDatabaseStressTest.java b/src/storage/postgres/src/test/java/org/locationtech/geogig/storage/postgresql/performance/PGObjectDatabaseStressTest.java index 484de8a20f..5176bd73c9 100644 --- a/src/storage/postgres/src/test/java/org/locationtech/geogig/storage/postgresql/performance/PGObjectDatabaseStressTest.java +++ b/src/storage/postgres/src/test/java/org/locationtech/geogig/storage/postgresql/performance/PGObjectDatabaseStressTest.java @@ -348,7 +348,7 @@ private RevObject fakeObject(int i) { private RevObject fakeObject(ObjectId forcedId) { // String oidString = objectId.toString(); // ObjectId treeId = ObjectId.forString("tree" + oidString); - // ImmutableList parentIds = ImmutableList.of(); + // ImmutableList parentIds = Collections.emptyList(); // RevPerson author = new RevPersonImpl("Gabriel", "groldan@boundlessgeo.com", 1000, -3); // RevPerson committer = new RevPersonImpl("Gabriel", "groldan@boundlessgeo.com", 1000, -3); // String message = "message " + oidString; diff --git a/src/storage/rocksdb/src/main/java/org/locationtech/geogig/rocksdb/DBConfig.java b/src/storage/rocksdb/src/main/java/org/locationtech/geogig/rocksdb/DBConfig.java index 4fdde8ff03..4a7f5bb20e 100644 --- a/src/storage/rocksdb/src/main/java/org/locationtech/geogig/rocksdb/DBConfig.java +++ b/src/storage/rocksdb/src/main/java/org/locationtech/geogig/rocksdb/DBConfig.java @@ -28,7 +28,7 @@ class DBConfig { private Set columnFamilyNames; public DBConfig(String dbpath, boolean readOnly) { - this(dbpath, readOnly, ImmutableMap.of(), Collections.emptySet()); + this(dbpath, readOnly, Collections.emptyMap(), Collections.emptySet()); } public DBConfig(String dbpath, boolean readOnly, Map defaultMetadata, diff --git a/src/storage/rocksdb/src/main/java/org/locationtech/geogig/rocksdb/RocksdbGraphDatabase.java b/src/storage/rocksdb/src/main/java/org/locationtech/geogig/rocksdb/RocksdbGraphDatabase.java index 3ae19f9bf6..6ee8798aae 100644 --- a/src/storage/rocksdb/src/main/java/org/locationtech/geogig/rocksdb/RocksdbGraphDatabase.java +++ b/src/storage/rocksdb/src/main/java/org/locationtech/geogig/rocksdb/RocksdbGraphDatabase.java @@ -15,6 +15,7 @@ import java.io.IOException; import java.net.URI; import java.util.ArrayList; +import java.util.Collections; import java.util.HashMap; import java.util.Iterator; import java.util.LinkedList; @@ -124,25 +125,25 @@ public boolean exists(ObjectId commitId) { } @Override - public ImmutableList getParents(ObjectId commitId) throws IllegalArgumentException { + public List getParents(ObjectId commitId) throws IllegalArgumentException { NodeData node = getNodeInternal(commitId, false); if (node != null) { return ImmutableList.copyOf(node.outgoing); } - return ImmutableList.of(); + return Collections.emptyList(); } @Override - public ImmutableList getChildren(ObjectId commitId) throws IllegalArgumentException { + public List getChildren(ObjectId commitId) throws IllegalArgumentException { NodeData node = getNodeInternal(commitId, false); if (node != null) { return ImmutableList.copyOf(node.incoming); } - return ImmutableList.of(); + return Collections.emptyList(); } @Override - public boolean put(ObjectId commitId, ImmutableList parentIds) { + public boolean put(ObjectId commitId, List parentIds) { try (WriteBatchWithIndex batch = new WriteBatchWithIndex(); // RocksDBReference dbRef = dbhandle.getReference(); WriteOptions wo = new WriteOptions()) { @@ -173,7 +174,7 @@ public void putAll(Iterable commits) { wo.setSync(true); for (RevCommit c : commits) { ObjectId commitId = c.getId(); - ImmutableList parentIds = c.getParentIds(); + List parentIds = c.getParentIds(); put(dbRef, commitId, parentIds, batch); count++; } @@ -186,8 +187,8 @@ public void putAll(Iterable commits) { } } - private boolean put(RocksDBReference dbref, ObjectId commitId, - ImmutableList parentIds, WriteBatchWithIndex batch) { + private boolean put(RocksDBReference dbref, ObjectId commitId, List parentIds, + WriteBatchWithIndex batch) { @Nullable NodeData node = getNodeInternal(dbref, commitId, false, batch); diff --git a/src/storage/temporary-rocksdb/src/main/java/org/locationtech/geogig/tempstorage/rocksdb/RocksdbNodeStore.java b/src/storage/temporary-rocksdb/src/main/java/org/locationtech/geogig/tempstorage/rocksdb/RocksdbNodeStore.java index bdb1562d5c..fedfbf61a4 100644 --- a/src/storage/temporary-rocksdb/src/main/java/org/locationtech/geogig/tempstorage/rocksdb/RocksdbNodeStore.java +++ b/src/storage/temporary-rocksdb/src/main/java/org/locationtech/geogig/tempstorage/rocksdb/RocksdbNodeStore.java @@ -12,6 +12,7 @@ import java.io.ByteArrayOutputStream; import java.io.DataOutputStream; import java.io.IOException; +import java.util.Collections; import java.util.HashMap; import java.util.Map; import java.util.Set; @@ -31,7 +32,6 @@ import com.google.common.base.Charsets; import com.google.common.base.Preconditions; -import com.google.common.collect.ImmutableMap; import com.google.common.io.ByteStreams; class RocksdbNodeStore { @@ -90,7 +90,7 @@ private RocksDB db() { public Map getAll(Set nodeIds) { if (nodeIds.isEmpty()) { - return ImmutableMap.of(); + return Collections.emptyMap(); } Map res = new HashMap<>(); lock.readLock().lock(); diff --git a/src/web/api/src/main/java/org/locationtech/geogig/spring/service/LegacyMergeFeatureService.java b/src/web/api/src/main/java/org/locationtech/geogig/spring/service/LegacyMergeFeatureService.java index 168e36b175..3ddacb1810 100644 --- a/src/web/api/src/main/java/org/locationtech/geogig/spring/service/LegacyMergeFeatureService.java +++ b/src/web/api/src/main/java/org/locationtech/geogig/spring/service/LegacyMergeFeatureService.java @@ -14,6 +14,7 @@ import java.math.BigInteger; import java.text.SimpleDateFormat; import java.util.Date; +import java.util.List; import java.util.Map; import java.util.Optional; import java.util.UUID; @@ -48,7 +49,6 @@ import org.springframework.stereotype.Service; import com.google.common.base.Preconditions; -import com.google.common.collect.ImmutableList; import com.google.gson.JsonElement; import com.google.gson.JsonObject; import com.google.gson.JsonParser; @@ -147,7 +147,7 @@ public RevFeature mergeFeatures(RepositoryProvider provider, String repoName, St (SimpleFeatureType) (ourFeatureType != null ? ourFeatureType.type() : theirFeatureType.type())); - ImmutableList descriptors = (ourFeatureType == null ? + List descriptors = (ourFeatureType == null ? theirFeatureType : ourFeatureType).descriptors(); for (Map.Entry entry : merges.entrySet()) { @@ -496,7 +496,7 @@ private Object valueFromString(FieldType type, String value) throws Exception { throw new IOException(); } - private int getDescriptorIndex(String key, ImmutableList properties) { + private int getDescriptorIndex(String key, List properties) { for (int i = 0; i < properties.size(); i++) { PropertyDescriptor prop = properties.get(i); if (prop.getName().toString().equals(key)) { diff --git a/src/web/api/src/main/java/org/locationtech/geogig/spring/service/RepositoryService.java b/src/web/api/src/main/java/org/locationtech/geogig/spring/service/RepositoryService.java index 1f43ddf67c..ebcae29c34 100644 --- a/src/web/api/src/main/java/org/locationtech/geogig/spring/service/RepositoryService.java +++ b/src/web/api/src/main/java/org/locationtech/geogig/spring/service/RepositoryService.java @@ -9,6 +9,8 @@ */ package org.locationtech.geogig.spring.service; +import java.util.Collections; +import java.util.List; import java.util.Optional; import org.geotools.feature.simple.SimpleFeatureBuilder; @@ -43,7 +45,6 @@ import org.springframework.stereotype.Service; import com.google.common.base.Preconditions; -import com.google.common.collect.ImmutableList; /** * Service for Repository stats. @@ -63,21 +64,21 @@ public RepositoryInfo getRepositoryInfo(RepositoryProvider provider, String repo return null; } - public ImmutableList getBranchList(RepositoryProvider provider, String repoName, + public List getBranchList(RepositoryProvider provider, String repoName, boolean includeRemotes) { Repository repository = getRepository(provider, repoName); if (repository != null) { return repository.command(BranchListOp.class).setRemotes(includeRemotes).call(); } - return ImmutableList.of(); + return Collections.emptyList(); } - public ImmutableList getTagList(RepositoryProvider provider, String repoName) { + public List getTagList(RepositoryProvider provider, String repoName) { Repository repository = getRepository(provider, repoName); if (repository != null) { return repository.command(TagListOp.class).call(); } - return ImmutableList.of(); + return Collections.emptyList(); } public Ref getCurrentHead(RepositoryProvider provider, String repoName) { @@ -144,7 +145,7 @@ private Optional parseID(ObjectId commitId, String path, Repository geo } } - private int getDescriptorIndex(String key, ImmutableList properties) { + private int getDescriptorIndex(String key, List properties) { for (int i = 0; i < properties.size(); i++) { PropertyDescriptor prop = properties.get(i); if (prop.getName().toString().equals(key)) { @@ -213,7 +214,7 @@ public RevFeature mergeFeatures(RepositoryProvider provider, String repoName, (SimpleFeatureType) (ourFeatureType != null ? ourFeatureType.type() : theirFeatureType.type())); // get an iterator of the feature properties - ImmutableList descriptors = (ourFeatureType == null ? + List descriptors = (ourFeatureType == null ? theirFeatureType : ourFeatureType).descriptors(); // configure the builder for (Merge merge : request.getMerges()) { diff --git a/src/web/api/src/main/java/org/locationtech/geogig/web/api/ResponseWriter.java b/src/web/api/src/main/java/org/locationtech/geogig/web/api/ResponseWriter.java index 0da45cfc72..48bfbe702a 100644 --- a/src/web/api/src/main/java/org/locationtech/geogig/web/api/ResponseWriter.java +++ b/src/web/api/src/main/java/org/locationtech/geogig/web/api/ResponseWriter.java @@ -81,7 +81,6 @@ import org.springframework.http.MediaType; import com.google.common.base.Function; -import com.google.common.collect.ImmutableList; import com.google.common.collect.Iterables; import com.google.common.collect.Iterators; import com.google.common.collect.Lists; @@ -287,7 +286,7 @@ private void writeCommitImpl(RevCommit commit, String tag, @Nullable Integer add writeElement("id", commit.getId().toString()); writeElement("tree", commit.getTreeId().toString()); - ImmutableList parentIds = commit.getParentIds(); + List parentIds = commit.getParentIds(); out.writeStartElement("parents"); out.writeStartArray("id"); for (ObjectId parentId : parentIds) { @@ -396,7 +395,7 @@ public void writeFeatureType(RevFeatureType featureType, String tag) out.writeStartElement(tag); writeElement("id", featureType.getId().toString()); writeElement("name", featureType.getName().toString()); - ImmutableList descriptors = featureType.descriptors(); + List descriptors = featureType.descriptors(); out.writeStartArray("attribute"); for (PropertyDescriptor descriptor : descriptors) { out.writeStartArrayElement("attribute"); @@ -757,7 +756,7 @@ public void writeTagCreateResponse(RevTag tag) throws StreamWriterException { writeTag(tag, "Tag", false); } - public void writeRebuildGraphResponse(ImmutableList updatedObjects, boolean quiet) + public void writeRebuildGraphResponse(List updatedObjects, boolean quiet) throws StreamWriterException { out.writeStartElement("RebuildGraph"); if (updatedObjects.size() > 0) { diff --git a/src/web/api/src/test/java/org/locationtech/geogig/spring/controller/ApplyChangesControllerTest.java b/src/web/api/src/test/java/org/locationtech/geogig/spring/controller/ApplyChangesControllerTest.java index 41bd21a522..8fd03ff4ee 100644 --- a/src/web/api/src/test/java/org/locationtech/geogig/spring/controller/ApplyChangesControllerTest.java +++ b/src/web/api/src/test/java/org/locationtech/geogig/spring/controller/ApplyChangesControllerTest.java @@ -16,6 +16,7 @@ import java.io.ByteArrayOutputStream; import java.util.Iterator; +import java.util.List; import org.junit.Test; import org.locationtech.geogig.model.DiffEntry; @@ -35,7 +36,6 @@ import org.springframework.test.web.servlet.request.MockMvcRequestBuilders; import com.google.common.base.Supplier; -import com.google.common.collect.ImmutableList; /** * @@ -72,7 +72,7 @@ public void testApplyChanges() throws Exception { ByteArrayOutputStream baos = new ByteArrayOutputStream(); serialFac.write(masterCommit, baos); // number of parent IDs? - ImmutableList parentIds = masterCommit.getParentIds(); + List parentIds = masterCommit.getParentIds(); baos.write(parentIds.size()); for (ObjectId parent : parentIds) { baos.write(parent.getRawValue()); diff --git a/src/web/api/src/test/java/org/locationtech/geogig/spring/controller/ParentsControllerTest.java b/src/web/api/src/test/java/org/locationtech/geogig/spring/controller/ParentsControllerTest.java index fe375560e7..4fff79c6a0 100644 --- a/src/web/api/src/test/java/org/locationtech/geogig/spring/controller/ParentsControllerTest.java +++ b/src/web/api/src/test/java/org/locationtech/geogig/spring/controller/ParentsControllerTest.java @@ -15,6 +15,7 @@ import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; import java.util.Iterator; +import java.util.List; import org.junit.Test; import org.locationtech.geogig.model.ObjectId; @@ -26,8 +27,6 @@ import org.springframework.test.web.servlet.request.MockHttpServletRequestBuilder; import org.springframework.test.web.servlet.request.MockMvcRequestBuilders; -import com.google.common.collect.ImmutableList; - /** * */ @@ -79,7 +78,7 @@ public void testGetParents() throws Exception { assertTrue(call.hasNext()); while (call.hasNext()) { RevCommit next = call.next(); - ImmutableList parentIds = next.getParentIds(); + List parentIds = next.getParentIds(); // build the API request String oid = next.getId().toString(); MockHttpServletRequestBuilder get =