Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLaurent Delaigue2017-01-20 11:06:35 -0500
committerLaurent Delaigue2017-02-01 02:09:54 -0500
commita55783195ce2bb283dd8cdc332f995d3ae846a2b (patch)
tree34577a6fb8aca03d8bac35b4546203f46c1e1d7f
parent3ac8e983bd1c153dc847690d71a244a2af163445 (diff)
downloadorg.eclipse.emf.compare-a55783195ce2bb283dd8cdc332f995d3ae846a2b.tar.gz
org.eclipse.emf.compare-a55783195ce2bb283dd8cdc332f995d3ae846a2b.tar.xz
org.eclipse.emf.compare-a55783195ce2bb283dd8cdc332f995d3ae846a2b.zip
[509791] Avoid use of Iterators.emptyIterator()
This method has been removed from guava 19, using JDK-1.7's Collections.emptyIterator() prevents the incompatibility. Bug: 509791 Also-By: Laurent Goubet <laurent.goubet@obeo.fr> Change-Id: I6751d547dbb5347ec9b6aefb6ca482f2d42b1275
-rw-r--r--plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/handler/AbstractCompareHandler.java4
-rw-r--r--plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/logical/EmptyComparisonScope.java8
-rw-r--r--plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/match/IdentifierEObjectMatcherTest.java4
-rw-r--r--plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/monitor/MonitorCancelTest.java9
-rw-r--r--plugins/org.eclipse.emf.compare/src/org/eclipse/emf/compare/internal/utils/Graph.java5
-rw-r--r--plugins/org.eclipse.emf.compare/src/org/eclipse/emf/compare/match/DefaultMatchEngine.java11
-rw-r--r--plugins/org.eclipse.emf.compare/src/org/eclipse/emf/compare/scope/FilterComparisonScope.java8
7 files changed, 26 insertions, 23 deletions
diff --git a/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/handler/AbstractCompareHandler.java b/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/handler/AbstractCompareHandler.java
index cda85bc40..a82d4a3f2 100644
--- a/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/handler/AbstractCompareHandler.java
+++ b/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/handler/AbstractCompareHandler.java
@@ -10,7 +10,7 @@
*******************************************************************************/
package org.eclipse.emf.compare.ide.ui.internal.handler;
-import com.google.common.collect.Iterators;
+import static java.util.Collections.emptyIterator;
import java.util.Iterator;
@@ -239,7 +239,7 @@ public abstract class AbstractCompareHandler extends AbstractHandler {
if (origin != null) {
originEObjects = scope.getChildren(origin);
} else {
- originEObjects = Iterators.emptyIterator();
+ originEObjects = emptyIterator();
}
getEObjectMatcher().createMatches(comparison, leftEObjects, rightEObjects, originEObjects,
diff --git a/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/logical/EmptyComparisonScope.java b/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/logical/EmptyComparisonScope.java
index e92a39b81..6c50b0723 100644
--- a/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/logical/EmptyComparisonScope.java
+++ b/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/logical/EmptyComparisonScope.java
@@ -10,7 +10,7 @@
*******************************************************************************/
package org.eclipse.emf.compare.ide.ui.internal.logical;
-import com.google.common.collect.Iterators;
+import static java.util.Collections.emptyIterator;
import java.util.Iterator;
@@ -34,16 +34,16 @@ public class EmptyComparisonScope extends AbstractComparisonScope {
/** {@inheritDoc} */
public Iterator<? extends Resource> getCoveredResources(ResourceSet resourceSet) {
- return Iterators.emptyIterator();
+ return emptyIterator();
}
/** {@inheritDoc} */
public Iterator<? extends EObject> getCoveredEObjects(Resource resource) {
- return Iterators.emptyIterator();
+ return emptyIterator();
}
/** {@inheritDoc} */
public Iterator<? extends EObject> getChildren(EObject eObject) {
- return Iterators.emptyIterator();
+ return emptyIterator();
}
}
diff --git a/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/match/IdentifierEObjectMatcherTest.java b/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/match/IdentifierEObjectMatcherTest.java
index e62a86e34..59e494ed3 100644
--- a/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/match/IdentifierEObjectMatcherTest.java
+++ b/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/match/IdentifierEObjectMatcherTest.java
@@ -10,10 +10,10 @@
*******************************************************************************/
package org.eclipse.emf.compare.tests.match;
+import static java.util.Collections.emptyIterator;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
-import com.google.common.collect.Iterators;
import com.google.common.collect.Lists;
import java.io.IOException;
@@ -66,7 +66,7 @@ public class IdentifierEObjectMatcherTest {
Iterator<? extends EObject> leftEObjects = nodes.iterator();
Iterator<? extends EObject> rightEObjects = nodes.iterator();
- Iterator<? extends EObject> originEObjects = Iterators.emptyIterator();
+ Iterator<? extends EObject> originEObjects = emptyIterator();
List<EObject> leftEObjectsNoID = Lists.newArrayList();
List<EObject> rightEObjectsNoID = Lists.newArrayList();
List<EObject> originEObjectsNoID = Lists.newArrayList();
diff --git a/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/monitor/MonitorCancelTest.java b/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/monitor/MonitorCancelTest.java
index 063433443..c700146a7 100644
--- a/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/monitor/MonitorCancelTest.java
+++ b/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/monitor/MonitorCancelTest.java
@@ -10,10 +10,9 @@
*******************************************************************************/
package org.eclipse.emf.compare.tests.monitor;
+import static java.util.Collections.emptyIterator;
import static org.junit.Assert.assertEquals;
-import com.google.common.collect.Iterators;
-
import java.io.IOException;
import java.util.Arrays;
import java.util.Iterator;
@@ -159,15 +158,15 @@ public class MonitorCancelTest {
return new AbstractComparisonScope(null, null, null) {
public Iterator<? extends Resource> getCoveredResources(ResourceSet resourceSet) {
- return Iterators.emptyIterator();
+ return emptyIterator();
}
public Iterator<? extends EObject> getCoveredEObjects(Resource resource) {
- return Iterators.emptyIterator();
+ return emptyIterator();
}
public Iterator<? extends EObject> getChildren(EObject eObject) {
- return Iterators.emptyIterator();
+ return emptyIterator();
}
};
}
diff --git a/plugins/org.eclipse.emf.compare/src/org/eclipse/emf/compare/internal/utils/Graph.java b/plugins/org.eclipse.emf.compare/src/org/eclipse/emf/compare/internal/utils/Graph.java
index 03076813c..cb1729e3b 100644
--- a/plugins/org.eclipse.emf.compare/src/org/eclipse/emf/compare/internal/utils/Graph.java
+++ b/plugins/org.eclipse.emf.compare/src/org/eclipse/emf/compare/internal/utils/Graph.java
@@ -13,6 +13,7 @@ package org.eclipse.emf.compare.internal.utils;
import static com.google.common.base.Preconditions.checkNotNull;
import static com.google.common.collect.Iterators.concat;
+import static java.util.Collections.emptyIterator;
import com.google.common.base.Preconditions;
import com.google.common.base.Predicate;
@@ -772,10 +773,10 @@ public class Graph<E> implements IGraph<E> {
&& SubgraphBuilder.this.set.add(nextNode.getElement())) {
nextNodeIterator = new NodeIterator(nextNode);
} else {
- nextNodeIterator = Iterators.emptyIterator();
+ nextNodeIterator = emptyIterator();
}
} else {
- nextNodeIterator = Iterators.emptyIterator();
+ nextNodeIterator = emptyIterator();
}
}
}
diff --git a/plugins/org.eclipse.emf.compare/src/org/eclipse/emf/compare/match/DefaultMatchEngine.java b/plugins/org.eclipse.emf.compare/src/org/eclipse/emf/compare/match/DefaultMatchEngine.java
index 9517751fe..3aae2aeea 100644
--- a/plugins/org.eclipse.emf.compare/src/org/eclipse/emf/compare/match/DefaultMatchEngine.java
+++ b/plugins/org.eclipse.emf.compare/src/org/eclipse/emf/compare/match/DefaultMatchEngine.java
@@ -12,6 +12,7 @@
package org.eclipse.emf.compare.match;
import static com.google.common.base.Preconditions.checkNotNull;
+import static java.util.Collections.emptyIterator;
import com.google.common.collect.Iterators;
import com.google.common.collect.Lists;
@@ -189,7 +190,7 @@ public class DefaultMatchEngine implements IMatchEngine {
if (origin != null) {
originChildren = scope.getCoveredResources(origin);
} else {
- originChildren = Iterators.emptyIterator();
+ originChildren = emptyIterator();
}
// TODO Change API to pass the monitor to createMappings()
@@ -296,19 +297,19 @@ public class DefaultMatchEngine implements IMatchEngine {
if (left != null) {
leftEObjects = scope.getCoveredEObjects(left);
} else {
- leftEObjects = Iterators.emptyIterator();
+ leftEObjects = emptyIterator();
}
final Iterator<? extends EObject> rightEObjects;
if (right != null) {
rightEObjects = scope.getCoveredEObjects(right);
} else {
- rightEObjects = Iterators.emptyIterator();
+ rightEObjects = emptyIterator();
}
final Iterator<? extends EObject> originEObjects;
if (origin != null) {
originEObjects = scope.getCoveredEObjects(origin);
} else {
- originEObjects = Iterators.emptyIterator();
+ originEObjects = emptyIterator();
}
getEObjectMatcher().createMatches(comparison, leftEObjects, rightEObjects, originEObjects, monitor);
@@ -350,7 +351,7 @@ public class DefaultMatchEngine implements IMatchEngine {
if (origin != null) {
originEObjects = Iterators.concat(Iterators.singletonIterator(origin), scope.getChildren(origin));
} else {
- originEObjects = Iterators.emptyIterator();
+ originEObjects = emptyIterator();
}
getEObjectMatcher().createMatches(comparison, leftEObjects, rightEObjects, originEObjects, monitor);
diff --git a/plugins/org.eclipse.emf.compare/src/org/eclipse/emf/compare/scope/FilterComparisonScope.java b/plugins/org.eclipse.emf.compare/src/org/eclipse/emf/compare/scope/FilterComparisonScope.java
index 5560a965a..5e0985492 100644
--- a/plugins/org.eclipse.emf.compare/src/org/eclipse/emf/compare/scope/FilterComparisonScope.java
+++ b/plugins/org.eclipse.emf.compare/src/org/eclipse/emf/compare/scope/FilterComparisonScope.java
@@ -11,6 +11,8 @@
*******************************************************************************/
package org.eclipse.emf.compare.scope;
+import static java.util.Collections.emptyIterator;
+
import com.google.common.base.Predicate;
import com.google.common.base.Predicates;
import com.google.common.collect.ForwardingIterator;
@@ -74,7 +76,7 @@ public class FilterComparisonScope extends AbstractComparisonScope {
*/
public Iterator<? extends Resource> getCoveredResources(ResourceSet resourceSet) {
if (resourceSet == null) {
- return Iterators.emptyIterator();
+ return emptyIterator();
}
final Iterator<Resource> allResources = resourceSet.getResources().iterator();
@@ -96,7 +98,7 @@ public class FilterComparisonScope extends AbstractComparisonScope {
*/
public Iterator<? extends EObject> getCoveredEObjects(Resource resource) {
if (resource == null) {
- return Iterators.emptyIterator();
+ return emptyIterator();
}
final Iterator<EObject> properContent = EcoreUtil.getAllProperContents(resource, false);
@@ -118,7 +120,7 @@ public class FilterComparisonScope extends AbstractComparisonScope {
*/
public Iterator<? extends EObject> getChildren(EObject eObject) {
if (eObject == null) {
- return Iterators.emptyIterator();
+ return emptyIterator();
}
final Iterator<EObject> properContent = EcoreUtil.getAllProperContents(eObject, false);

Back to the top