Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEd Merks2018-11-07 04:00:21 +0000
committerEd Merks2018-11-07 04:00:21 +0000
commit4d16bfa6756ec1e4f672e9c0b26c29434c3b34a1 (patch)
treef3a61e39dd1dd2f871738a98c0ad337a81a0c0b0
parent13b823e8947543fa344e50040dc5dc1920a6957a (diff)
downloadorg.eclipse.emf-4d16bfa6756ec1e4f672e9c0b26c29434c3b34a1.tar.gz
org.eclipse.emf-4d16bfa6756ec1e4f672e9c0b26c29434c3b34a1.tar.xz
org.eclipse.emf-4d16bfa6756ec1e4f672e9c0b26c29434c3b34a1.zip
[540041] StackOverflow with circular contained EClass proxy
Ensure that setting an classifier name clears the name maps used for proxy resolution.
-rw-r--r--plugins/org.eclipse.emf.ecore/src/org/eclipse/emf/ecore/impl/EClassifierImpl.java4
-rw-r--r--plugins/org.eclipse.emf.ecore/src/org/eclipse/emf/ecore/impl/EPackageImpl.java2
-rw-r--r--tests/org.eclipse.emf.test.core/src/org/eclipse/emf/test/core/ecore/EcoreTest.java28
3 files changed, 29 insertions, 5 deletions
diff --git a/plugins/org.eclipse.emf.ecore/src/org/eclipse/emf/ecore/impl/EClassifierImpl.java b/plugins/org.eclipse.emf.ecore/src/org/eclipse/emf/ecore/impl/EClassifierImpl.java
index 53e4b362b..4fb61f483 100644
--- a/plugins/org.eclipse.emf.ecore/src/org/eclipse/emf/ecore/impl/EClassifierImpl.java
+++ b/plugins/org.eclipse.emf.ecore/src/org/eclipse/emf/ecore/impl/EClassifierImpl.java
@@ -932,7 +932,9 @@ public abstract class EClassifierImpl extends ENamedElementImpl implements EClas
{
if (eContainer instanceof EPackageImpl)
{
- ((EPackageImpl)eContainer).eNameToEClassifierMap = null;
+ EPackageImpl ePackage = (EPackageImpl)eContainer;
+ ePackage.eNameToEClassifierMap = null;
+ ePackage.eNameToENamedElementMaps = null;
}
super.setName(newName);
}
diff --git a/plugins/org.eclipse.emf.ecore/src/org/eclipse/emf/ecore/impl/EPackageImpl.java b/plugins/org.eclipse.emf.ecore/src/org/eclipse/emf/ecore/impl/EPackageImpl.java
index da96eb7e6..81a82e304 100644
--- a/plugins/org.eclipse.emf.ecore/src/org/eclipse/emf/ecore/impl/EPackageImpl.java
+++ b/plugins/org.eclipse.emf.ecore/src/org/eclipse/emf/ecore/impl/EPackageImpl.java
@@ -1957,7 +1957,7 @@ public class EPackageImpl extends ENamedElementImpl implements EPackage, BasicEx
}
}
- private List<Map<String, ENamedElement>> eNameToENamedElementMaps;
+ List<Map<String, ENamedElement>> eNameToENamedElementMaps;
@Override
EObject eObjectForURIFragmentNameSegment(String name, int count)
diff --git a/tests/org.eclipse.emf.test.core/src/org/eclipse/emf/test/core/ecore/EcoreTest.java b/tests/org.eclipse.emf.test.core/src/org/eclipse/emf/test/core/ecore/EcoreTest.java
index 43683dda9..105cd8f38 100644
--- a/tests/org.eclipse.emf.test.core/src/org/eclipse/emf/test/core/ecore/EcoreTest.java
+++ b/tests/org.eclipse.emf.test.core/src/org/eclipse/emf/test/core/ecore/EcoreTest.java
@@ -172,14 +172,36 @@ public class EcoreTest
validEClass.setName("Valid");
ePackage.getEClassifiers().add(validEClass);
- EPackage eSubPackage = EcoreFactory.eINSTANCE.createEPackage();
- ((InternalEObject)eSubPackage).eSetProxyURI(uri.appendFragment("//package"));
- ePackage.getESubpackages().add(eSubPackage);
+ EPackage circularSubPackage = EcoreFactory.eINSTANCE.createEPackage();
+ ((InternalEObject)circularSubPackage).eSetProxyURI(uri.appendFragment("//package"));
+ ePackage.getESubpackages().add(circularSubPackage);
+
+ EPackage validSubPackage = EcoreFactory.eINSTANCE.createEPackage();
+ validSubPackage.setName("valid");
+ ePackage.getESubpackages().add(validSubPackage);
try
{
EObject eObject = resourceSet.getEObject(uri.appendFragment("//Valid"), false);
assertSame(validEClass, eObject);
+
+ eObject = resourceSet.getEObject(uri.appendFragment("//valid"), false);
+ assertSame(validSubPackage, eObject);
+ }
+ catch (StackOverflowError error)
+ {
+ fail("Stack overflow");
+ }
+
+ try
+ {
+ validEClass.setName("Valid1");
+ EObject eObject = resourceSet.getEObject(uri.appendFragment("//Valid1"), false);
+ assertSame(validEClass, eObject);
+
+ validSubPackage.setName("valid1");
+ eObject = resourceSet.getEObject(uri.appendFragment("//valid1"), false);
+ assertSame(validSubPackage, eObject);
}
catch (StackOverflowError error)
{

Back to the top