Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian W. Damus2013-01-03 19:45:58 +0000
committerChristian W. Damus2013-01-07 13:56:48 +0000
commitdd07f4c6e437c657336df6f76eadea0beab5ff57 (patch)
tree8cf77bf39c28e8b7c353835d2496a4a997297da5 /plugins/org.eclipse.emf.cdo.common
parentf81041496d650d8dfb3410890fcdface9f3d07fb (diff)
downloadcdo-dd07f4c6e437c657336df6f76eadea0beab5ff57.tar.gz
cdo-dd07f4c6e437c657336df6f76eadea0beab5ff57.tar.xz
cdo-dd07f4c6e437c657336df6f76eadea0beab5ff57.zip
[397405] Don't check EAnnotations for resolvable proxies
https://bugs.eclipse.org/bugs/show_bug.cgi?id=397405
Diffstat (limited to 'plugins/org.eclipse.emf.cdo.common')
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/model/CDOModelUtil.java106
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/model/EMFUtil.java22
2 files changed, 76 insertions, 52 deletions
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/model/CDOModelUtil.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/model/CDOModelUtil.java
index f9da7208b4..b51bc3332d 100644
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/model/CDOModelUtil.java
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/model/CDOModelUtil.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
+ * Copyright (c) 2004 - 2013 Eike Stepper (Berlin, 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
@@ -9,6 +9,7 @@
* Eike Stepper - initial API and implementation
* Stefan Winkler - Bug 332912 - Caching subtype-relationships in the CDOPackageRegistry
* Erdal Karaca - added support for HASHMAP CDO Type
+ * Christian W. Damus (CEA) - don't validate cross-references in EAnnotations
*/
package org.eclipse.emf.cdo.common.model;
@@ -28,6 +29,7 @@ import org.eclipse.emf.common.notify.Adapter;
import org.eclipse.emf.common.util.EList;
import org.eclipse.emf.common.util.Enumerator;
import org.eclipse.emf.common.util.TreeIterator;
+import org.eclipse.emf.ecore.EAnnotation;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.EClassifier;
import org.eclipse.emf.ecore.EDataType;
@@ -572,63 +574,73 @@ public final class CDOModelUtil implements CDOModelConstants
while (it.hasNext())
{
EObject e = it.next();
- for (EObject r : e.eCrossReferences())
- {
- EObject refTarget = null;
- if (r.eIsProxy())
+ if (e instanceof EAnnotation)
+ {
+ // we don't need to validate the structure of annotations. The applications that
+ // define annotations will have to take what they can get
+ it.prune();
+ }
+ else
+ {
+ for (EObject r : e.eCrossReferences())
{
- String msg = "Package '%s' contains unresolved proxy '%s'";
- msg = String.format(msg, ePackage.getNsURI(), ((InternalEObject)r).eProxyURI());
- throw new IllegalStateException(msg);
- }
+ EObject refTarget = null;
- if (r.eResource() != null && r.eResource() != e.eResource())
- {
- // It's a ref into another resource
- EPackage pkg = null;
- if (r instanceof EClassifier)
- {
- refTarget = r;
- pkg = ((EClassifier)r).getEPackage();
- }
- else if (r instanceof EStructuralFeature)
+ if (r.eIsProxy())
{
- refTarget = r;
- EStructuralFeature feature = (EStructuralFeature)r;
- EClass ownerClass = (EClass)feature.eContainer();
- pkg = ownerClass.getEPackage();
+ String msg = "Package '%s' contains unresolved proxy '%s'";
+ msg = String.format(msg, ePackage.getNsURI(), ((InternalEObject)r).eProxyURI());
+ throw new IllegalStateException(msg);
}
- else if (r instanceof EGenericType)
+
+ if (r.eResource() != null && r.eResource() != e.eResource())
{
- EGenericType genType = (EGenericType)r;
- EClassifier c = genType.getEClassifier();
- if (c != null)
+ // It's a ref into another resource
+ EPackage pkg = null;
+ if (r instanceof EClassifier)
{
- refTarget = c;
- pkg = c.getEPackage();
+ refTarget = r;
+ pkg = ((EClassifier)r).getEPackage();
+ }
+ else if (r instanceof EStructuralFeature)
+ {
+ refTarget = r;
+ EStructuralFeature feature = (EStructuralFeature)r;
+ EClass ownerClass = (EClass)feature.eContainer();
+ pkg = ownerClass.getEPackage();
+ }
+ else if (r instanceof EGenericType)
+ {
+ EGenericType genType = (EGenericType)r;
+ EClassifier c = genType.getEClassifier();
+ if (c != null)
+ {
+ refTarget = c;
+ pkg = c.getEPackage();
+ }
}
- }
- if (pkg == null)
- {
- continue;
- }
+ if (pkg == null)
+ {
+ continue;
+ }
- while (pkg.getESuperPackage() != null)
- {
- pkg = pkg.getESuperPackage();
- }
+ while (pkg.getESuperPackage() != null)
+ {
+ pkg = pkg.getESuperPackage();
+ }
- String resourceURI = refTarget.eResource().getURI().toString();
- if (!resourceURI.toString().equals(pkg.getNsURI()))
- {
- String msg = "URI of the resource (%s) does not match the nsURI (%s) of the top-level package;\n"
- + "this can be fixed by calling Resource.setURI(URI) after loading the packages,\n"
- + "or by configuring a URI mapping from nsURI's to location URI's before loading the packages,\n"
- + "and then loading them with their nsURI's";
- msg = String.format(msg, resourceURI, pkg.getNsURI());
- throw new IllegalStateException(msg);
+ String resourceURI = refTarget.eResource().getURI().toString();
+ if (!resourceURI.toString().equals(pkg.getNsURI()))
+ {
+ String msg = "URI of the resource (%s) does not match the nsURI (%s) of the top-level package;\n"
+ + "this can be fixed by calling Resource.setURI(URI) after loading the packages,\n"
+ + "or by configuring a URI mapping from nsURI's to location URI's before loading the packages,\n"
+ + "and then loading them with their nsURI's";
+ msg = String.format(msg, resourceURI, pkg.getNsURI());
+ throw new IllegalStateException(msg);
+ }
}
}
}
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 b6b3558498..3c0aaf1132 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
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
+ * Copyright (c) 2004 - 2013 Eike Stepper (Berlin, 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
@@ -9,7 +9,8 @@
* Eike Stepper - initial API and implementation
* Victor Roldan Betancort - maintenance
* Simon McDuff - maintenance
- * Christian W. Damus - support registered dynamic UML profiles
+ * 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;
@@ -22,6 +23,7 @@ import org.eclipse.emf.common.notify.Notifier;
import org.eclipse.emf.common.util.EList;
import org.eclipse.emf.common.util.TreeIterator;
import org.eclipse.emf.common.util.URI;
+import org.eclipse.emf.ecore.EAnnotation;
import org.eclipse.emf.ecore.EAttribute;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.EClassifier;
@@ -571,10 +573,20 @@ public final class EMFUtil
if (notifier instanceof EObject)
{
safeResolve((EObject)notifier, resourceSet);
- Iterator<EObject> it2 = ((EObject)notifier).eCrossReferences().iterator();
- while (it2.hasNext())
+
+ if (notifier instanceof EAnnotation)
+ {
+ // we don't need to validate the structure of annotations. The applications that
+ // define annotations will have to take what they can get
+ it.prune();
+ }
+ else
{
- safeResolve(it2.next(), resourceSet);
+ Iterator<EObject> it2 = ((EObject)notifier).eCrossReferences().iterator();
+ while (it2.hasNext())
+ {
+ safeResolve(it2.next(), resourceSet);
+ }
}
}
}

Back to the top