Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEike Stepper2019-12-14 12:17:15 +0000
committerEike Stepper2019-12-14 12:17:15 +0000
commitbbc713c9c99479824038894dbb055bcf1a4bc27f (patch)
tree65d5b722eeeaae5ad7feeef7c5269f0bf860abd4
parentfb21060053c5e2d335aedde561619bf46bff7368 (diff)
downloadcdo-bbc713c9c99479824038894dbb055bcf1a4bc27f.tar.gz
cdo-bbc713c9c99479824038894dbb055bcf1a4bc27f.tar.xz
cdo-bbc713c9c99479824038894dbb055bcf1a4bc27f.zip
[Releng] Deprecate org.eclipse.net4j.util.Predicate in favor of java.util.function.Predicate
-rw-r--r--plugins/org.eclipse.emf.cdo.common/.settings/.api_filters32
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/model/EMFPredicates.java97
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/model/EMFUtil.java21
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/revision/CDORevisionData.java11
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/revision/delta/CDORevisionDelta.java11
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/delta/CDODetachedRevisionDeltaImpl.java11
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/delta/CDORevisionDeltaImpl.java15
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/revision/AbstractCDORevision.java18
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/revision/DelegatingCDORevision.java14
-rw-r--r--plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/mem/MEMStore.java9
-rw-r--r--plugins/org.eclipse.emf.cdo/.settings/.api_filters7
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/transaction/CDOPushTransaction.java22
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/transaction/CDOTransaction.java26
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/transaction/CDOTransactionImpl.java27
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/spi/cdo/CDOMergingConflictResolver.java6
-rw-r--r--plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/internal/util/table/ComposedRange.java8
-rw-r--r--plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/Predicate.java24
-rw-r--r--plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/Predicates.java32
-rw-r--r--plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/collection/AbstractFilteredIterator.java32
-rw-r--r--plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/collection/PredicateIterator.java2
20 files changed, 372 insertions, 53 deletions
diff --git a/plugins/org.eclipse.emf.cdo.common/.settings/.api_filters b/plugins/org.eclipse.emf.cdo.common/.settings/.api_filters
index a4a60d1e07..4daa23022f 100644
--- a/plugins/org.eclipse.emf.cdo.common/.settings/.api_filters
+++ b/plugins/org.eclipse.emf.cdo.common/.settings/.api_filters
@@ -247,6 +247,24 @@
</message_arguments>
</filter>
</resource>
+ <resource path="src/org/eclipse/emf/cdo/common/revision/CDORevisionData.java" type="org.eclipse.emf.cdo.common.revision.CDORevisionData">
+ <filter id="1209008130">
+ <message_arguments>
+ <message_argument value="4.2"/>
+ <message_argument value="4.9"/>
+ <message_argument value="accept(CDORevisionValueVisitor, Predicate&lt;EStructuralFeature&gt;)"/>
+ </message_arguments>
+ </filter>
+ </resource>
+ <resource path="src/org/eclipse/emf/cdo/common/revision/delta/CDORevisionDelta.java" type="org.eclipse.emf.cdo.common.revision.delta.CDORevisionDelta">
+ <filter id="1209008130">
+ <message_arguments>
+ <message_argument value="4.2"/>
+ <message_argument value="4.9"/>
+ <message_argument value="accept(CDOFeatureDeltaVisitor, Predicate&lt;EStructuralFeature&gt;)"/>
+ </message_arguments>
+ </filter>
+ </resource>
<resource path="src/org/eclipse/emf/cdo/common/util/RepositoryStateChangedEvent.java" type="org.eclipse.emf.cdo.common.util.RepositoryStateChangedEvent">
<filter id="576725006">
<message_arguments>
@@ -364,6 +382,13 @@
<message_argument value="AbstractCDORevision"/>
</message_arguments>
</filter>
+ <filter id="1141899266">
+ <message_arguments>
+ <message_argument value="4.2"/>
+ <message_argument value="4.9"/>
+ <message_argument value="accept(CDORevisionValueVisitor, Predicate&lt;EStructuralFeature&gt;)"/>
+ </message_arguments>
+ </filter>
</resource>
<resource path="src/org/eclipse/emf/cdo/spi/common/revision/DelegatingCDORevision.java" type="org.eclipse.emf.cdo.spi.common.revision.DelegatingCDORevision">
<filter id="576725006">
@@ -372,6 +397,13 @@
<message_argument value="DelegatingCDORevision"/>
</message_arguments>
</filter>
+ <filter id="1141899266">
+ <message_arguments>
+ <message_argument value="4.2"/>
+ <message_argument value="4.9"/>
+ <message_argument value="accept(CDORevisionValueVisitor, Predicate&lt;EStructuralFeature&gt;)"/>
+ </message_arguments>
+ </filter>
</resource>
<resource path="src/org/eclipse/emf/cdo/spi/common/revision/DelegatingCDORevisionManager.java" type="org.eclipse.emf.cdo.spi.common.revision.DelegatingCDORevisionManager">
<filter id="576725006">
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/model/EMFPredicates.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/model/EMFPredicates.java
new file mode 100644
index 0000000000..54497f0eab
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/model/EMFPredicates.java
@@ -0,0 +1,97 @@
+/*
+ * Copyright (c) 2009-2013, 2015, 2016, 2018, 2019 Eike Stepper (Loehne, Germany) and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Eike Stepper - initial API and implementation
+ * Victor Roldan Betancort - maintenance
+ * Simon McDuff - maintenance
+ * Christian W. Damus (CEA) - support registered dynamic UML profiles
+ * Christian W. Damus (CEA) - don't process EAnnotations for proxy resolution
+ */
+package org.eclipse.emf.cdo.common.model;
+
+import org.eclipse.emf.ecore.EAttribute;
+import org.eclipse.emf.ecore.EReference;
+import org.eclipse.emf.ecore.EStructuralFeature;
+
+import java.util.function.Predicate;
+
+/**
+ * Predefined {@link java.util.function.Predicate predicates} to test for various {@link EStructuralFeature feature} types.
+ *
+ * @author Eike Stepper
+ * @since 4.9
+ */
+public final class EMFPredicates
+{
+ public static final Predicate<EStructuralFeature> ATTRIBUTES = new Predicate<EStructuralFeature>()
+ {
+ @Override
+ public boolean test(EStructuralFeature feature)
+ {
+ return feature instanceof EAttribute;
+ }
+ };
+
+ public static final Predicate<EStructuralFeature> REFERENCES = new Predicate<EStructuralFeature>()
+ {
+ @Override
+ public boolean test(EStructuralFeature feature)
+ {
+ return feature instanceof EReference;
+ }
+ };
+
+ public static final Predicate<EStructuralFeature> CONTAINER_REFERENCES = new Predicate<EStructuralFeature>()
+ {
+ @Override
+ public boolean test(EStructuralFeature feature)
+ {
+ if (feature instanceof EReference)
+ {
+ EReference reference = (EReference)feature;
+ return reference.isContainer();
+ }
+
+ return false;
+ }
+ };
+
+ public static final Predicate<EStructuralFeature> CROSS_REFERENCES = new Predicate<EStructuralFeature>()
+ {
+ @Override
+ public boolean test(EStructuralFeature feature)
+ {
+ if (feature instanceof EReference)
+ {
+ EReference reference = (EReference)feature;
+ return !(reference.isContainer() || reference.isContainment());
+ }
+
+ return false;
+ }
+ };
+
+ public static final Predicate<EStructuralFeature> CONTAINMENT_REFERENCES = new Predicate<EStructuralFeature>()
+ {
+ @Override
+ public boolean test(EStructuralFeature feature)
+ {
+ if (feature instanceof EReference)
+ {
+ EReference reference = (EReference)feature;
+ return reference.isContainment();
+ }
+
+ return false;
+ }
+ };
+
+ private EMFPredicates()
+ {
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/model/EMFUtil.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/model/EMFUtil.java
index cac18804f1..dea292b4ee 100644
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/model/EMFUtil.java
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/model/EMFUtil.java
@@ -16,7 +16,6 @@ package org.eclipse.emf.cdo.common.model;
import org.eclipse.emf.cdo.spi.common.model.InternalCDOPackageRegistry;
-import org.eclipse.net4j.util.Predicate;
import org.eclipse.net4j.util.WrappedException;
import org.eclipse.emf.common.notify.Adapter;
@@ -118,8 +117,10 @@ public final class EMFUtil
/**
* @since 4.2
+ * @deprecated As of 4.9 use {@link EMFPredicates#ATTRIBUTES}.
*/
- public static final Predicate<EStructuralFeature> ATTRIBUTES = new Predicate<EStructuralFeature>()
+ @Deprecated
+ public static final org.eclipse.net4j.util.Predicate<EStructuralFeature> ATTRIBUTES = new org.eclipse.net4j.util.Predicate<EStructuralFeature>()
{
@Override
public boolean apply(EStructuralFeature feature)
@@ -130,8 +131,10 @@ public final class EMFUtil
/**
* @since 4.2
+ * @deprecated As of 4.9 use {@link EMFPredicates#REFERENCES}.
*/
- public static final Predicate<EStructuralFeature> REFERENCES = new Predicate<EStructuralFeature>()
+ @Deprecated
+ public static final org.eclipse.net4j.util.Predicate<EStructuralFeature> REFERENCES = new org.eclipse.net4j.util.Predicate<EStructuralFeature>()
{
@Override
public boolean apply(EStructuralFeature feature)
@@ -142,8 +145,10 @@ public final class EMFUtil
/**
* @since 4.2
+ * @deprecated As of 4.9 use {@link EMFPredicates#CONTAINER_REFERENCES}.
*/
- public static final Predicate<EStructuralFeature> CONTAINER_REFERENCES = new Predicate<EStructuralFeature>()
+ @Deprecated
+ public static final org.eclipse.net4j.util.Predicate<EStructuralFeature> CONTAINER_REFERENCES = new org.eclipse.net4j.util.Predicate<EStructuralFeature>()
{
@Override
public boolean apply(EStructuralFeature feature)
@@ -160,8 +165,10 @@ public final class EMFUtil
/**
* @since 4.2
+ * @deprecated As of 4.9 use {@link EMFPredicates#CROSS_REFERENCES}.
*/
- public static final Predicate<EStructuralFeature> CROSS_REFERENCES = new Predicate<EStructuralFeature>()
+ @Deprecated
+ public static final org.eclipse.net4j.util.Predicate<EStructuralFeature> CROSS_REFERENCES = new org.eclipse.net4j.util.Predicate<EStructuralFeature>()
{
@Override
public boolean apply(EStructuralFeature feature)
@@ -178,8 +185,10 @@ public final class EMFUtil
/**
* @since 4.2
+ * @deprecated As of 4.9 use {@link EMFPredicates#CONTAINMENT_REFERENCES}.
*/
- public static final Predicate<EStructuralFeature> CONTAINMENT_REFERENCES = new Predicate<EStructuralFeature>()
+ @Deprecated
+ public static final org.eclipse.net4j.util.Predicate<EStructuralFeature> CONTAINMENT_REFERENCES = new org.eclipse.net4j.util.Predicate<EStructuralFeature>()
{
@Override
public boolean apply(EStructuralFeature feature)
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/revision/CDORevisionData.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/revision/CDORevisionData.java
index 24895827bb..34dad18943 100644
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/revision/CDORevisionData.java
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/revision/CDORevisionData.java
@@ -12,8 +12,6 @@ package org.eclipse.emf.cdo.common.revision;
import org.eclipse.emf.cdo.common.id.CDOID;
-import org.eclipse.net4j.util.Predicate;
-
import org.eclipse.emf.ecore.EStructuralFeature;
import org.eclipse.emf.ecore.EStructuralFeature.Internal.DynamicValueHolder;
import org.eclipse.emf.ecore.impl.BasicEObjectImpl;
@@ -118,6 +116,13 @@ public interface CDORevisionData
/**
* @since 4.2
+ * @deprecated As of 4.9 use {@link #accept(CDORevisionValueVisitor, java.util.function.Predicate)}.
+ */
+ @Deprecated
+ public void accept(CDORevisionValueVisitor visitor, org.eclipse.net4j.util.Predicate<EStructuralFeature> filter);
+
+ /**
+ * @since 4.9
*/
- public void accept(CDORevisionValueVisitor visitor, Predicate<EStructuralFeature> filter);
+ public void accept(CDORevisionValueVisitor visitor, java.util.function.Predicate<EStructuralFeature> filter);
}
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/revision/delta/CDORevisionDelta.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/revision/delta/CDORevisionDelta.java
index 14d4ab253a..0ccbd221a6 100644
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/revision/delta/CDORevisionDelta.java
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/revision/delta/CDORevisionDelta.java
@@ -19,8 +19,6 @@ import org.eclipse.emf.cdo.common.revision.CDORevisionData;
import org.eclipse.emf.cdo.common.revision.CDORevisionKey;
import org.eclipse.emf.cdo.internal.common.revision.delta.CDODetachedRevisionDeltaImpl;
-import org.eclipse.net4j.util.Predicate;
-
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.EStructuralFeature;
@@ -99,6 +97,13 @@ public interface CDORevisionDelta extends CDORevisionKey
/**
* @since 4.2
+ * @deprecated As of 4.9 use {@link #accept(CDOFeatureDeltaVisitor, java.util.function.Predicate)}.
+ */
+ @Deprecated
+ public void accept(CDOFeatureDeltaVisitor visitor, org.eclipse.net4j.util.Predicate<EStructuralFeature> filter);
+
+ /**
+ * @since 4.9
*/
- public void accept(CDOFeatureDeltaVisitor visitor, Predicate<EStructuralFeature> filter);
+ public void accept(CDOFeatureDeltaVisitor visitor, java.util.function.Predicate<EStructuralFeature> filter);
}
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/delta/CDODetachedRevisionDeltaImpl.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/delta/CDODetachedRevisionDeltaImpl.java
index 25c462391d..44b62fbcaa 100644
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/delta/CDODetachedRevisionDeltaImpl.java
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/delta/CDODetachedRevisionDeltaImpl.java
@@ -18,8 +18,6 @@ import org.eclipse.emf.cdo.common.revision.delta.CDOFeatureDelta;
import org.eclipse.emf.cdo.common.revision.delta.CDOFeatureDeltaVisitor;
import org.eclipse.emf.cdo.common.revision.delta.CDORevisionDelta;
-import org.eclipse.net4j.util.Predicate;
-
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.EStructuralFeature;
@@ -119,7 +117,14 @@ public class CDODetachedRevisionDeltaImpl implements CDORevisionDelta
}
@Override
- public void accept(CDOFeatureDeltaVisitor visitor, Predicate<EStructuralFeature> filter)
+ @Deprecated
+ public void accept(CDOFeatureDeltaVisitor visitor, org.eclipse.net4j.util.Predicate<EStructuralFeature> filter)
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public void accept(CDOFeatureDeltaVisitor visitor, java.util.function.Predicate<EStructuralFeature> filter)
{
throw new UnsupportedOperationException();
}
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/delta/CDORevisionDeltaImpl.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/delta/CDORevisionDeltaImpl.java
index 943d0223c9..e5b635f3a1 100644
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/delta/CDORevisionDeltaImpl.java
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/delta/CDORevisionDeltaImpl.java
@@ -41,8 +41,6 @@ import org.eclipse.emf.cdo.spi.common.revision.InternalCDOFeatureDelta;
import org.eclipse.emf.cdo.spi.common.revision.InternalCDORevision;
import org.eclipse.emf.cdo.spi.common.revision.InternalCDORevisionDelta;
-import org.eclipse.net4j.util.Predicate;
-import org.eclipse.net4j.util.Predicates;
import org.eclipse.net4j.util.om.OMPlatform;
import org.eclipse.emf.common.util.ECollections;
@@ -370,16 +368,23 @@ public class CDORevisionDeltaImpl implements InternalCDORevisionDelta, ListCompa
@Override
public void accept(CDOFeatureDeltaVisitor visitor)
{
- accept(visitor, Predicates.<EStructuralFeature> alwaysTrue());
+ accept(visitor, (java.util.function.Predicate<EStructuralFeature>)t -> true);
}
@Override
- public void accept(CDOFeatureDeltaVisitor visitor, Predicate<EStructuralFeature> filter)
+ @Deprecated
+ public void accept(CDOFeatureDeltaVisitor visitor, org.eclipse.net4j.util.Predicate<EStructuralFeature> filter)
+ {
+ accept(visitor, org.eclipse.net4j.util.Predicates.toJava8(filter));
+ }
+
+ @Override
+ public void accept(CDOFeatureDeltaVisitor visitor, java.util.function.Predicate<EStructuralFeature> filter)
{
for (CDOFeatureDelta featureDelta : featureDeltas.values())
{
EStructuralFeature feature = featureDelta.getFeature();
- if (filter.apply(feature))
+ if (filter.test(feature))
{
((CDOFeatureDeltaImpl)featureDelta).accept(visitor);
}
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/revision/AbstractCDORevision.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/revision/AbstractCDORevision.java
index 72af3ac9da..11b011fbca 100644
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/revision/AbstractCDORevision.java
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/revision/AbstractCDORevision.java
@@ -28,8 +28,6 @@ import org.eclipse.emf.cdo.spi.common.model.InternalCDOClassInfo;
import org.eclipse.net4j.util.ImplementationError;
import org.eclipse.net4j.util.ObjectUtil;
-import org.eclipse.net4j.util.Predicate;
-import org.eclipse.net4j.util.Predicates;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.EStructuralFeature;
@@ -193,18 +191,28 @@ public abstract class AbstractCDORevision implements InternalCDORevision
@Override
public void accept(CDORevisionValueVisitor visitor)
{
- accept(visitor, Predicates.<EStructuralFeature> alwaysTrue());
+ accept(visitor, (java.util.function.Predicate<EStructuralFeature>)t -> true);
}
/**
* @since 4.2
*/
@Override
- public void accept(CDORevisionValueVisitor visitor, Predicate<EStructuralFeature> filter)
+ @Deprecated
+ public void accept(CDORevisionValueVisitor visitor, org.eclipse.net4j.util.Predicate<EStructuralFeature> filter)
+ {
+ accept(visitor, org.eclipse.net4j.util.Predicates.toJava8(filter));
+ }
+
+ /**
+ * @since 4.9
+ */
+ @Override
+ public void accept(CDORevisionValueVisitor visitor, java.util.function.Predicate<EStructuralFeature> filter)
{
for (EStructuralFeature feature : classInfo.getAllPersistentFeatures())
{
- if (filter.apply(feature))
+ if (filter.test(feature))
{
if (feature.isMany())
{
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/revision/DelegatingCDORevision.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/revision/DelegatingCDORevision.java
index 79696e010f..4c9dcacb3e 100644
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/revision/DelegatingCDORevision.java
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/revision/DelegatingCDORevision.java
@@ -27,8 +27,6 @@ import org.eclipse.emf.cdo.common.security.CDOPermission;
import org.eclipse.emf.cdo.spi.common.branch.InternalCDOBranch;
import org.eclipse.emf.cdo.spi.common.model.InternalCDOClassInfo;
-import org.eclipse.net4j.util.Predicate;
-
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.EStructuralFeature;
@@ -522,7 +520,17 @@ public abstract class DelegatingCDORevision implements InternalCDORevision
* @since 4.2
*/
@Override
- public void accept(CDORevisionValueVisitor visitor, Predicate<EStructuralFeature> filter)
+ @Deprecated
+ public void accept(CDORevisionValueVisitor visitor, org.eclipse.net4j.util.Predicate<EStructuralFeature> filter)
+ {
+ getDelegate().accept(visitor, filter);
+ }
+
+ /**
+ * @since 4.2
+ */
+ @Override
+ public void accept(CDORevisionValueVisitor visitor, java.util.function.Predicate<EStructuralFeature> filter)
{
getDelegate().accept(visitor, filter);
}
diff --git a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/mem/MEMStore.java b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/mem/MEMStore.java
index b657bc9782..345175c999 100644
--- a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/mem/MEMStore.java
+++ b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/mem/MEMStore.java
@@ -57,13 +57,11 @@ import org.eclipse.emf.cdo.spi.server.StoreAccessorPool;
import org.eclipse.emf.internal.cdo.transaction.CDOTransactionImpl;
import org.eclipse.net4j.util.HexUtil;
-import org.eclipse.net4j.util.Predicate;
import org.eclipse.net4j.util.ReflectUtil.ExcludeFromDump;
import org.eclipse.net4j.util.collection.AbstractFilteredIterator;
import org.eclipse.net4j.util.collection.BidirectionalIterator;
import org.eclipse.net4j.util.collection.LimitedIterator;
import org.eclipse.net4j.util.collection.Pair;
-import org.eclipse.net4j.util.collection.PredicateIterator;
import org.eclipse.net4j.util.concurrent.IRWLockManager.LockType;
import org.eclipse.net4j.util.io.IOUtil;
import org.eclipse.net4j.util.om.monitor.OMMonitor;
@@ -94,6 +92,7 @@ import java.util.ListIterator;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;
+import java.util.function.Predicate;
/**
* @author Simon McDuff
@@ -366,7 +365,7 @@ public class MEMStore extends LongIDStore implements IMEMStore, BranchLoader3, D
else if (startTime != CDOBranchPoint.UNSPECIFIED_DATE || endTime != CDOBranchPoint.UNSPECIFIED_DATE)
{
Predicate<CDOTimeProvider> predicate = forward ? new UpTo(endTime) : new DownTo(endTime);
- iterator = new PredicateIterator<>(iterator, predicate);
+ iterator = new AbstractFilteredIterator.Predicated<>(iterator, predicate);
}
while (iterator.hasNext())
@@ -1322,7 +1321,7 @@ public class MEMStore extends LongIDStore implements IMEMStore, BranchLoader3, D
}
@Override
- public boolean apply(CDOTimeProvider commitInfo)
+ public boolean test(CDOTimeProvider commitInfo)
{
return commitInfo.getTimeStamp() <= timeStamp;
}
@@ -1341,7 +1340,7 @@ public class MEMStore extends LongIDStore implements IMEMStore, BranchLoader3, D
}
@Override
- public boolean apply(CDOTimeProvider commitInfo)
+ public boolean test(CDOTimeProvider commitInfo)
{
return commitInfo.getTimeStamp() >= timeStamp;
}
diff --git a/plugins/org.eclipse.emf.cdo/.settings/.api_filters b/plugins/org.eclipse.emf.cdo/.settings/.api_filters
index 75b4b3fa5e..48c52a3722 100644
--- a/plugins/org.eclipse.emf.cdo/.settings/.api_filters
+++ b/plugins/org.eclipse.emf.cdo/.settings/.api_filters
@@ -344,6 +344,13 @@
<message_argument value="CDOTransaction"/>
</message_arguments>
</filter>
+ <filter id="1209008130">
+ <message_arguments>
+ <message_argument value="4.8"/>
+ <message_argument value="4.9"/>
+ <message_argument value="commit(Runnable, Predicate&lt;Long&gt;, IProgressMonitor)"/>
+ </message_arguments>
+ </filter>
</resource>
<resource path="src/org/eclipse/emf/cdo/util/CDOUtil.java" type="org.eclipse.emf.cdo.util.CDOUtil">
<filter id="421662840">
diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/transaction/CDOPushTransaction.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/transaction/CDOPushTransaction.java
index 9b40de8d10..bb39785d16 100644
--- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/transaction/CDOPushTransaction.java
+++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/transaction/CDOPushTransaction.java
@@ -44,7 +44,6 @@ import org.eclipse.emf.cdo.view.CDOViewSet;
import org.eclipse.emf.internal.cdo.bundle.OM;
import org.eclipse.net4j.util.AdapterUtil;
-import org.eclipse.net4j.util.Predicate;
import org.eclipse.net4j.util.collection.CloseableIterator;
import org.eclipse.net4j.util.concurrent.IRWLockManager.LockType;
import org.eclipse.net4j.util.event.IListener;
@@ -286,7 +285,15 @@ public class CDOPushTransaction extends Notifier implements CDOTransaction
}
@Override
- public <T> CommitResult<T> commit(Callable<T> callable, Predicate<Long> retry, IProgressMonitor monitor)
+ @Deprecated
+ public <T> CommitResult<T> commit(Callable<T> callable, org.eclipse.net4j.util.Predicate<Long> retry, IProgressMonitor monitor)
+ throws ConcurrentAccessException, CommitException, Exception
+ {
+ return delegate.commit(callable, retry, monitor);
+ }
+
+ @Override
+ public <T> CommitResult<T> commit(Callable<T> callable, java.util.function.Predicate<Long> retry, IProgressMonitor monitor)
throws ConcurrentAccessException, CommitException, Exception
{
return delegate.commit(callable, retry, monitor);
@@ -299,7 +306,16 @@ public class CDOPushTransaction extends Notifier implements CDOTransaction
}
@Override
- public CDOCommitInfo commit(Runnable runnable, Predicate<Long> retry, IProgressMonitor monitor) throws ConcurrentAccessException, CommitException
+ @Deprecated
+ public CDOCommitInfo commit(Runnable runnable, org.eclipse.net4j.util.Predicate<Long> retry, IProgressMonitor monitor)
+ throws ConcurrentAccessException, CommitException
+ {
+ return delegate.commit(runnable, retry, monitor);
+ }
+
+ @Override
+ public CDOCommitInfo commit(Runnable runnable, java.util.function.Predicate<Long> retry, IProgressMonitor monitor)
+ throws ConcurrentAccessException, CommitException
{
return delegate.commit(runnable, retry, monitor);
}
diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/transaction/CDOTransaction.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/transaction/CDOTransaction.java
index 13dd525855..acc52754a8 100644
--- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/transaction/CDOTransaction.java
+++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/transaction/CDOTransaction.java
@@ -37,7 +37,6 @@ import org.eclipse.emf.cdo.util.ConcurrentAccessException;
import org.eclipse.emf.cdo.view.CDOQuery;
import org.eclipse.emf.cdo.view.CDOView;
-import org.eclipse.net4j.util.Predicate;
import org.eclipse.net4j.util.options.IOptionsEvent;
import org.eclipse.emf.common.util.URI;
@@ -268,8 +267,16 @@ public interface CDOTransaction extends CDOView, CDOCommonTransaction, CDOUserTr
/**
* @since 4.8
+ * @deprecated As of 4.9 use {@link #commit(Callable, java.util.function.Predicate, IProgressMonitor)}.
*/
- public <T> CommitResult<T> commit(Callable<T> callable, Predicate<Long> retry, IProgressMonitor monitor)
+ @Deprecated
+ public <T> CommitResult<T> commit(Callable<T> callable, org.eclipse.net4j.util.Predicate<Long> retry, IProgressMonitor monitor)
+ throws ConcurrentAccessException, CommitException, Exception;
+
+ /**
+ * @since 4.9
+ */
+ public <T> CommitResult<T> commit(Callable<T> callable, java.util.function.Predicate<Long> retry, IProgressMonitor monitor)
throws ConcurrentAccessException, CommitException, Exception;
/**
@@ -278,9 +285,18 @@ public interface CDOTransaction extends CDOView, CDOCommonTransaction, CDOUserTr
public <T> CommitResult<T> commit(Callable<T> callable, int attempts, IProgressMonitor monitor) throws ConcurrentAccessException, CommitException, Exception;
/**
- * @since 4.8
- */
- public CDOCommitInfo commit(Runnable runnable, Predicate<Long> retry, IProgressMonitor monitor) throws ConcurrentAccessException, CommitException;
+ * @since 4.8
+ * @deprecated As of 4.9 use {@link #commit(Runnable, java.util.function.Predicate, IProgressMonitor)}.
+ */
+ @Deprecated
+ public CDOCommitInfo commit(Runnable runnable, org.eclipse.net4j.util.Predicate<Long> retry, IProgressMonitor monitor)
+ throws ConcurrentAccessException, CommitException;
+
+ /**
+ * @since 4.9
+ */
+ public CDOCommitInfo commit(Runnable runnable, java.util.function.Predicate<Long> retry, IProgressMonitor monitor)
+ throws ConcurrentAccessException, CommitException;
/**
* @since 4.8
diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/transaction/CDOTransactionImpl.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/transaction/CDOTransactionImpl.java
index 99259f96e2..2c67eb1db8 100644
--- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/transaction/CDOTransactionImpl.java
+++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/transaction/CDOTransactionImpl.java
@@ -139,7 +139,6 @@ import org.eclipse.emf.internal.cdo.view.CDOViewImpl;
import org.eclipse.net4j.util.CheckUtil;
import org.eclipse.net4j.util.ObjectUtil;
-import org.eclipse.net4j.util.Predicate;
import org.eclipse.net4j.util.WrappedException;
import org.eclipse.net4j.util.collection.AbstractCloseableIterator;
import org.eclipse.net4j.util.collection.ByteArrayWrapper;
@@ -209,6 +208,7 @@ import java.util.Set;
import java.util.WeakHashMap;
import java.util.concurrent.Callable;
import java.util.concurrent.atomic.AtomicInteger;
+import java.util.function.Predicate;
/**
* @author Eike Stepper
@@ -1743,7 +1743,15 @@ public class CDOTransactionImpl extends CDOViewImpl implements InternalCDOTransa
}
@Override
- public <T> CommitResult<T> commit(final Callable<T> callable, Predicate<Long> retry, IProgressMonitor monitor)
+ @Deprecated
+ public <T> CommitResult<T> commit(final Callable<T> callable, org.eclipse.net4j.util.Predicate<Long> retry, IProgressMonitor monitor)
+ throws ConcurrentAccessException, CommitException, Exception
+ {
+ return commit(callable, org.eclipse.net4j.util.Predicates.toJava8(retry), monitor);
+ }
+
+ @Override
+ public <T> CommitResult<T> commit(Callable<T> callable, java.util.function.Predicate<Long> retry, IProgressMonitor monitor)
throws ConcurrentAccessException, CommitException, Exception
{
final Object[] result = { null };
@@ -1788,7 +1796,16 @@ public class CDOTransactionImpl extends CDOViewImpl implements InternalCDOTransa
}
@Override
- public CDOCommitInfo commit(Runnable runnable, Predicate<Long> retry, IProgressMonitor monitor) throws ConcurrentAccessException, CommitException
+ @Deprecated
+ public CDOCommitInfo commit(Runnable runnable, org.eclipse.net4j.util.Predicate<Long> retry, IProgressMonitor monitor)
+ throws ConcurrentAccessException, CommitException
+ {
+ return commit(runnable, org.eclipse.net4j.util.Predicates.toJava8(retry), monitor);
+ }
+
+ @Override
+ public CDOCommitInfo commit(Runnable runnable, java.util.function.Predicate<Long> retry, IProgressMonitor monitor)
+ throws ConcurrentAccessException, CommitException
{
long start = System.currentTimeMillis();
SubMonitor subMonitor = SubMonitor.convert(monitor);
@@ -1809,7 +1826,7 @@ public class CDOTransactionImpl extends CDOViewImpl implements InternalCDOTransa
}
catch (ConcurrentAccessException ex)
{
- if (retry.apply(System.currentTimeMillis() - start))
+ if (retry.test(System.currentTimeMillis() - start))
{
rollback();
continue;
@@ -5073,7 +5090,7 @@ public class CDOTransactionImpl extends CDOViewImpl implements InternalCDOTransa
}
@Override
- public boolean apply(Long startMillis)
+ public boolean test(Long startMillis)
{
return ++attempt < attempts;
}
diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/spi/cdo/CDOMergingConflictResolver.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/spi/cdo/CDOMergingConflictResolver.java
index 8eedbc30f7..6579fde102 100644
--- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/spi/cdo/CDOMergingConflictResolver.java
+++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/spi/cdo/CDOMergingConflictResolver.java
@@ -18,7 +18,7 @@ import org.eclipse.emf.cdo.common.commit.CDOChangeSet;
import org.eclipse.emf.cdo.common.commit.CDOChangeSetData;
import org.eclipse.emf.cdo.common.id.CDOID;
import org.eclipse.emf.cdo.common.id.CDOIDUtil;
-import org.eclipse.emf.cdo.common.model.EMFUtil;
+import org.eclipse.emf.cdo.common.model.EMFPredicates;
import org.eclipse.emf.cdo.common.revision.CDOList;
import org.eclipse.emf.cdo.common.revision.CDORevisionKey;
import org.eclipse.emf.cdo.common.revision.CDORevisionValueVisitor;
@@ -363,11 +363,11 @@ public class CDOMergingConflictResolver extends AbstractChangeSetsConflictResolv
{
recurse(objectsUpdater, (CDOID)value);
}
- }, EMFUtil.CONTAINMENT_REFERENCES);
+ }, EMFPredicates.CONTAINMENT_REFERENCES);
}
}
}
- }, EMFUtil.CONTAINMENT_REFERENCES);
+ }, EMFPredicates.CONTAINMENT_REFERENCES);
}
private Map<CDOID, CDORevisionDelta> getRemoteDeltas(CDOChangeSet remoteChangeSet)
diff --git a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/internal/util/table/ComposedRange.java b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/internal/util/table/ComposedRange.java
index 8d1be7672f..e87e640d5a 100644
--- a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/internal/util/table/ComposedRange.java
+++ b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/internal/util/table/ComposedRange.java
@@ -10,10 +10,9 @@
*/
package org.eclipse.net4j.internal.util.table;
-import org.eclipse.net4j.util.Predicates;
+import org.eclipse.net4j.util.collection.AbstractFilteredIterator;
import org.eclipse.net4j.util.collection.AbstractIterator;
import org.eclipse.net4j.util.collection.ComposedIterator;
-import org.eclipse.net4j.util.collection.PredicateIterator;
import java.util.ArrayList;
import java.util.HashSet;
@@ -85,10 +84,11 @@ final class ComposedRange extends AbstractRange
}
}
- iterator = new PredicateIterator<>(Predicates.excluded(excludedCells), iterator);
+ iterator = new AbstractFilteredIterator.Predicated<>(t -> !excludedCells.contains(t), iterator);
}
- return new PredicateIterator<>(Predicates.unique(), iterator);
+ Set<Cell> tested = new HashSet<>();
+ return new AbstractFilteredIterator.Predicated<>(t -> tested.add(t), iterator);
}
private static void addRanges(List<Range> list, Range... ranges)
diff --git a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/Predicate.java b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/Predicate.java
index 968a957eea..808d69abe6 100644
--- a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/Predicate.java
+++ b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/Predicate.java
@@ -13,8 +13,32 @@ package org.eclipse.net4j.util;
/**
* @author Eike Stepper
* @since 3.3
+ * @deprecated As of 3.10 use {@link java.util.function.Predicate}.
*/
+@Deprecated
public interface Predicate<T>
{
public boolean apply(T element);
+
+ /**
+ * @author Eike Stepper
+ * @since 3.10
+ * @deprecated As of 3.10 use {@link java.util.function.Predicate}.
+ */
+ @Deprecated
+ public static final class DelegatingPredicate<T> implements Predicate<T>
+ {
+ private final java.util.function.Predicate<T> delegate;
+
+ public DelegatingPredicate(java.util.function.Predicate<T> delegate)
+ {
+ this.delegate = delegate;
+ }
+
+ @Override
+ public boolean apply(T element)
+ {
+ return delegate.test(element);
+ }
+ }
}
diff --git a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/Predicates.java b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/Predicates.java
index b007c182e3..30d9df397c 100644
--- a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/Predicates.java
+++ b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/Predicates.java
@@ -16,7 +16,9 @@ import java.util.Set;
/**
* @author Eike Stepper
* @since 3.3
+ * @deprecated As of 3.10 use {@link java.util.function.Predicate}.
*/
+@Deprecated
public final class Predicates
{
private Predicates()
@@ -24,6 +26,36 @@ public final class Predicates
}
/**
+ * @since 3.10
+ */
+ public static <T> java.util.function.Predicate<T> toJava8(Predicate<T> from)
+ {
+ return new java.util.function.Predicate<T>()
+ {
+ @Override
+ public boolean test(T t)
+ {
+ return from.apply(t);
+ }
+ };
+ }
+
+ /**
+ * @since 3.10
+ */
+ public static <T> Predicate<T> fromJava8(java.util.function.Predicate<T> from)
+ {
+ return new Predicate<T>()
+ {
+ @Override
+ public boolean apply(T t)
+ {
+ return from.test(t);
+ }
+ };
+ }
+
+ /**
* @since 3.4
*/
public static <T> Predicate<T> included(Set<T> inclusions)
diff --git a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/collection/AbstractFilteredIterator.java b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/collection/AbstractFilteredIterator.java
index 2ba6a9e373..1dac546fd4 100644
--- a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/collection/AbstractFilteredIterator.java
+++ b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/collection/AbstractFilteredIterator.java
@@ -43,4 +43,36 @@ public abstract class AbstractFilteredIterator<T> extends AbstractIterator<T>
}
protected abstract boolean isValid(T element);
+
+ /**
+ * @author Eike Stepper
+ * @since 3.10
+ */
+ public static class Predicated<T> extends AbstractFilteredIterator<T>
+ {
+ private final java.util.function.Predicate<? super T> predicate;
+
+ public Predicated(Iterator<T> delegate, java.util.function.Predicate<? super T> predicate)
+ {
+ super(delegate);
+ this.predicate = predicate;
+ }
+
+ public Predicated(java.util.function.Predicate<? super T> predicate, Iterator<T> delegate)
+ {
+ super(delegate);
+ this.predicate = predicate;
+ }
+
+ public java.util.function.Predicate<? super T> getPredicate()
+ {
+ return predicate;
+ }
+
+ @Override
+ protected boolean isValid(T element)
+ {
+ return predicate.test(element);
+ }
+ }
}
diff --git a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/collection/PredicateIterator.java b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/collection/PredicateIterator.java
index 9647fd246a..2c5d79e6ba 100644
--- a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/collection/PredicateIterator.java
+++ b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/collection/PredicateIterator.java
@@ -17,7 +17,9 @@ import java.util.Iterator;
/**
* @author Eike Stepper
* @since 3.3
+ * @deprecated As of 3.10 use {@link AbstractFilteredIterator.Predicated}.
*/
+@Deprecated
public class PredicateIterator<T> extends AbstractFilteredIterator<T>
{
private final Predicate<? super T> predicate;

Back to the top