Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEike Stepper2020-03-21 17:11:25 +0000
committerEike Stepper2020-03-21 17:11:25 +0000
commitca3b7daf2a04ad8654054fd477482c0ae45dd937 (patch)
tree5d33494f299a575ab7c9eb757f502eab79feb6e2 /plugins/org.eclipse.emf.cdo.common/src
parent5bb5274f9d41dd0f6004c089050634b6cff69642 (diff)
downloadcdo-ca3b7daf2a04ad8654054fd477482c0ae45dd937.tar.gz
cdo-ca3b7daf2a04ad8654054fd477482c0ae45dd937.tar.xz
cdo-ca3b7daf2a04ad8654054fd477482c0ae45dd937.zip
[561250] First element in EMap is not always visible from another session
https://bugs.eclipse.org/bugs/show_bug.cgi?id=561250 Change-Id: Ie5a657108db1ed1e5df35407dc38571651c2ce67
Diffstat (limited to 'plugins/org.eclipse.emf.cdo.common/src')
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/model/CDOClassInfo.java5
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/model/CDOClassInfoImpl.java21
2 files changed, 26 insertions, 0 deletions
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/model/CDOClassInfo.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/model/CDOClassInfo.java
index 93ef0a5a50..ab1aed0231 100644
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/model/CDOClassInfo.java
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/model/CDOClassInfo.java
@@ -63,6 +63,11 @@ public interface CDOClassInfo extends Adapter
public EStructuralFeature[] getAllPersistentContainments();
/**
+ * @since 4.10
+ */
+ public EStructuralFeature[] getAllPersistentMapFeatures();
+
+ /**
* @deprecated As of 4.2 pushed down to {@link InternalCDOClassInfo#getPersistentFeatureIndex(EStructuralFeature)}.
*/
@Deprecated
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/model/CDOClassInfoImpl.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/model/CDOClassInfoImpl.java
index c5e75baf65..1f45544c87 100644
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/model/CDOClassInfoImpl.java
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/model/CDOClassInfoImpl.java
@@ -69,6 +69,8 @@ public final class CDOClassInfoImpl implements InternalCDOClassInfo, Adapter.Int
private EStructuralFeature[] allPersistentContainments;
+ private EStructuralFeature[] allPersistentMapFeatures;
+
private int[] persistentFeatureIndices;
private int settingsFeatureCount;
@@ -197,6 +199,12 @@ public final class CDOClassInfoImpl implements InternalCDOClassInfo, Adapter.Int
}
@Override
+ public EStructuralFeature[] getAllPersistentMapFeatures()
+ {
+ return allPersistentMapFeatures;
+ }
+
+ @Override
public int getPersistentFeatureIndex(EStructuralFeature feature) throws IllegalArgumentException
{
int featureID = eClass.getFeatureID(feature);
@@ -288,6 +296,7 @@ public final class CDOClassInfoImpl implements InternalCDOClassInfo, Adapter.Int
List<EStructuralFeature> persistentFeatures = new ArrayList<>();
List<EReference> persistentReferences = new ArrayList<>();
List<EStructuralFeature> persistentContainments = new ArrayList<>();
+ List<EStructuralFeature> persistentMapFeatures = new ArrayList<>();
// Used for tests for containment
EStructuralFeature[] containments = ((EClassImpl.FeatureSubsetSupplier)eClass.getEAllStructuralFeatures()).containments();
@@ -322,6 +331,11 @@ public final class CDOClassInfoImpl implements InternalCDOClassInfo, Adapter.Int
}
}
+ if (isMap(feature))
+ {
+ persistentMapFeatures.add(feature);
+ }
+
if (feature.isMany() || FeatureMapUtil.isFeatureMap(feature))
{
settingsFeatureIndices[i] = settingsFeatureCount++;
@@ -354,6 +368,7 @@ public final class CDOClassInfoImpl implements InternalCDOClassInfo, Adapter.Int
allPersistentFeatures = persistentFeatures.toArray(new EStructuralFeature[persistentFeatures.size()]);
allPersistentReferences = persistentReferences.toArray(new EReference[persistentReferences.size()]);
allPersistentContainments = persistentContainments.toArray(new EStructuralFeature[persistentContainments.size()]);
+ allPersistentMapFeatures = persistentMapFeatures.toArray(new EStructuralFeature[persistentMapFeatures.size()]);
persistentFeatureIndices = new int[allFeatures.size()];
Arrays.fill(persistentFeatureIndices, NO_SLOT);
@@ -453,6 +468,12 @@ public final class CDOClassInfoImpl implements InternalCDOClassInfo, Adapter.Int
return DEBUG ? getDump() : eClass.toString();
}
+ public static boolean isMap(EStructuralFeature eStructuralFeature)
+ {
+ // Java ensures that string constants are interned, so == is actually more efficient than equals().
+ return eStructuralFeature.getEType().getInstanceClassName() == "java.util.Map$Entry"; //$NON-NLS-1$
+ }
+
/**
* @author Eike Stepper
*/

Back to the top