Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEike Stepper2012-08-30 10:39:03 +0000
committerEike Stepper2012-08-30 10:39:03 +0000
commitfe49c7d03e8368779f6620fa1923a4c631931635 (patch)
tree20f1f1d089a2970c2f1a1460c0a9f3f529c1366b /plugins
parent1c6bf4ef2a299dace8d5a4398105cd1c971989e7 (diff)
downloadcdo-fe49c7d03e8368779f6620fa1923a4c631931635.tar.gz
cdo-fe49c7d03e8368779f6620fa1923a4c631931635.tar.xz
cdo-fe49c7d03e8368779f6620fa1923a4c631931635.zip
[386989] Nested generic types can't be committed
https://bugs.eclipse.org/bugs/show_bug.cgi?id=386989
Diffstat (limited to 'plugins')
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/util/CompletePackageClosure.java92
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/util/CrossReferencesPackageClosure.java11
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/util/IPackageClosure.java4
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/util/PackageClosure.java6
4 files changed, 50 insertions, 63 deletions
diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/util/CompletePackageClosure.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/util/CompletePackageClosure.java
index b17adde7b3..a74a1c877e 100644
--- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/util/CompletePackageClosure.java
+++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/util/CompletePackageClosure.java
@@ -41,8 +41,6 @@ public class CompletePackageClosure extends PackageClosure
private boolean excludeEcore;
- private Set<EPackage> visitedPackages;
-
public CompletePackageClosure()
{
}
@@ -63,127 +61,133 @@ public class CompletePackageClosure extends PackageClosure
return;
}
- this.visitedPackages = visitedPackages;
- Set<EClassifier> visitedClassifiers = new HashSet<EClassifier>();
+ Set<Object> visited = new HashSet<Object>();
for (EClassifier classifier : ePackage.getEClassifiers())
{
- handleEClassifier(classifier, visitedClassifiers);
+ handleEClassifier(classifier, visitedPackages, visited);
}
- for (EClassifier classifier : visitedClassifiers)
+ for (Object object : visited)
{
- final EPackage p = classifier.getEPackage();
- if (p != null)
+ if (object instanceof EClassifier)
{
- if (visitedPackages.add(p))
+ EClassifier classifier = (EClassifier)object;
+ final EPackage p = classifier.getEPackage();
+ if (p != null)
{
- if (TRACER.isEnabled())
+ if (visitedPackages.add(p))
{
- TRACER.trace("Found package " + p.getNsURI()); //$NON-NLS-1$
+ if (TRACER.isEnabled())
+ {
+ TRACER.trace("Found package " + p.getNsURI()); //$NON-NLS-1$
+ }
}
}
- }
- else
- {
- OM.LOG.warn(MessageFormat.format(Messages.getString("CompletePackageClosure.0"), classifier.getName())); //$NON-NLS-1$
+ else
+ {
+ OM.LOG.warn(MessageFormat.format(Messages.getString("CompletePackageClosure.0"), classifier.getName())); //$NON-NLS-1$
+ }
}
}
}
}
- protected void handleEClassifier(EClassifier classifier, Set<EClassifier> visited)
+ protected void handleEClassifier(EClassifier classifier, Set<EPackage> visitedPackages, Set<Object> visited)
{
if (classifier != null && visited.add(classifier))
{
handleEPackage(classifier.getEPackage(), visitedPackages);
- handleETypeParameters(classifier.getETypeParameters(), visited);
+ handleETypeParameters(classifier.getETypeParameters(), visitedPackages, visited);
if (classifier instanceof EClass)
{
EClass eClass = (EClass)classifier;
- handleEStructuralFeatures(eClass.getEStructuralFeatures(), visited);
- handleEOperations(eClass.getEOperations(), visited);
- handleEGenericTypes(eClass.getEGenericSuperTypes(), visited);
+ handleEStructuralFeatures(eClass.getEStructuralFeatures(), visitedPackages, visited);
+ handleEOperations(eClass.getEOperations(), visitedPackages, visited);
+ handleEGenericTypes(eClass.getEGenericSuperTypes(), visitedPackages, visited);
}
}
}
- protected void handleEStructuralFeatures(List<EStructuralFeature> structuralFeatures, Set<EClassifier> visited)
+ protected void handleEStructuralFeatures(List<EStructuralFeature> structuralFeatures, Set<EPackage> visitedPackages,
+ Set<Object> visited)
{
if (structuralFeatures != null)
{
for (EStructuralFeature structuralFeature : structuralFeatures)
{
- handleEGenericType(structuralFeature.getEGenericType(), visited);
+ handleEGenericType(structuralFeature.getEGenericType(), visitedPackages, visited);
}
}
}
- protected void handleEOperations(List<EOperation> operations, Set<EClassifier> visited)
+ protected void handleEOperations(List<EOperation> operations, Set<EPackage> visitedPackages, Set<Object> visited)
{
if (operations != null)
{
for (EOperation operation : operations)
{
- handleEGenericType(operation.getEGenericType(), visited);
- handleETypeParameters(operation.getETypeParameters(), visited);
- handleEParameters(operation.getEParameters(), visited);
- handleEGenericTypes(operation.getEGenericExceptions(), visited);
+ handleEGenericType(operation.getEGenericType(), visitedPackages, visited);
+ handleETypeParameters(operation.getETypeParameters(), visitedPackages, visited);
+ handleEParameters(operation.getEParameters(), visitedPackages, visited);
+ handleEGenericTypes(operation.getEGenericExceptions(), visitedPackages, visited);
}
}
}
- protected void handleEParameters(List<EParameter> parameters, Set<EClassifier> visited)
+ protected void handleEParameters(List<EParameter> parameters, Set<EPackage> visitedPackages, Set<Object> visited)
{
if (parameters != null)
{
for (EParameter parameter : parameters)
{
- handleEClassifier(parameter.getEType(), visited);
- handleEGenericType(parameter.getEGenericType(), visited);
+ handleEClassifier(parameter.getEType(), visitedPackages, visited);
+ handleEGenericType(parameter.getEGenericType(), visitedPackages, visited);
}
}
}
- protected void handleEGenericTypes(EList<EGenericType> genericTypes, Set<EClassifier> visited)
+ protected void handleEGenericTypes(EList<EGenericType> genericTypes, Set<EPackage> visitedPackages,
+ Set<Object> visited)
{
if (genericTypes != null)
{
for (EGenericType genericType : genericTypes)
{
- handleEGenericType(genericType, visited);
+ handleEGenericType(genericType, visitedPackages, visited);
}
}
}
- protected void handleEGenericType(EGenericType genericType, Set<EClassifier> visited)
+ protected void handleEGenericType(EGenericType genericType, Set<EPackage> visitedPackages, Set<Object> visited)
{
- if (genericType != null)
+ if (genericType != null && visited.add(genericType))
{
- handleEClassifier(genericType.getEClassifier(), visited);
- handleEClassifier(genericType.getERawType(), visited);
- handleEGenericType(genericType.getELowerBound(), visited);
- handleEGenericType(genericType.getEUpperBound(), visited);
- handleEGenericTypes(genericType.getETypeArguments(), visited);
- handleETypeParameter(genericType.getETypeParameter(), visited);
+ handleEClassifier(genericType.getEClassifier(), visitedPackages, visited);
+ handleEClassifier(genericType.getERawType(), visitedPackages, visited);
+ handleEGenericType(genericType.getELowerBound(), visitedPackages, visited);
+ handleEGenericType(genericType.getEUpperBound(), visitedPackages, visited);
+ handleEGenericTypes(genericType.getETypeArguments(), visitedPackages, visited);
+ handleETypeParameter(genericType.getETypeParameter(), visitedPackages, visited);
}
}
- protected void handleETypeParameters(EList<ETypeParameter> typeParameters, Set<EClassifier> visited)
+ protected void handleETypeParameters(EList<ETypeParameter> typeParameters, Set<EPackage> visitedPackages,
+ Set<Object> visited)
{
if (typeParameters != null)
{
for (ETypeParameter typeParameter : typeParameters)
{
- handleETypeParameter(typeParameter, visited);
+ handleETypeParameter(typeParameter, visitedPackages, visited);
}
}
}
- protected void handleETypeParameter(ETypeParameter typeParameter, Set<EClassifier> visited)
+ protected void handleETypeParameter(ETypeParameter typeParameter, Set<EPackage> visitedPackages, Set<Object> visited)
{
if (typeParameter != null)
{
- handleEGenericTypes(typeParameter.getEBounds(), visited);
+ handleEGenericTypes(typeParameter.getEBounds(), visitedPackages, visited);
}
}
}
diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/util/CrossReferencesPackageClosure.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/util/CrossReferencesPackageClosure.java
index 9753823a92..b8571c498c 100644
--- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/util/CrossReferencesPackageClosure.java
+++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/util/CrossReferencesPackageClosure.java
@@ -4,7 +4,7 @@
* 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
*/
@@ -14,7 +14,6 @@ import org.eclipse.emf.common.util.EList;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.EPackage;
-import java.util.HashSet;
import java.util.Iterator;
import java.util.Set;
@@ -28,14 +27,6 @@ public class CrossReferencesPackageClosure extends PackageClosure
}
@Override
- public Set<EPackage> calculate(EPackage ePackage)
- {
- Set<EPackage> visited = new HashSet<EPackage>();
- handleEPackage(ePackage, visited);
- return visited;
- }
-
- @Override
protected void handleEPackage(EPackage ePackage, Set<EPackage> visited)
{
visited.add(ePackage);
diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/util/IPackageClosure.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/util/IPackageClosure.java
index a2459884ef..854cb5b12e 100644
--- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/util/IPackageClosure.java
+++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/util/IPackageClosure.java
@@ -4,7 +4,7 @@
* 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
*/
@@ -24,6 +24,4 @@ public interface IPackageClosure
public static final Set<EPackage> EMPTY_CLOSURE = Collections.emptySet();
public Set<EPackage> calculate(Collection<EPackage> ePackages);
-
- public Set<EPackage> calculate(EPackage ePackage);
}
diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/util/PackageClosure.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/util/PackageClosure.java
index bfcdffb04a..93de8a00bf 100644
--- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/util/PackageClosure.java
+++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/util/PackageClosure.java
@@ -18,7 +18,6 @@ import org.eclipse.net4j.util.om.trace.ContextTracer;
import org.eclipse.emf.ecore.EPackage;
import java.util.Collection;
-import java.util.Collections;
import java.util.HashSet;
import java.util.Set;
@@ -33,11 +32,6 @@ public abstract class PackageClosure implements IPackageClosure
{
}
- public Set<EPackage> calculate(EPackage ePackage)
- {
- return calculate(Collections.singletonList(ePackage));
- }
-
public Set<EPackage> calculate(Collection<EPackage> ePackages)
{
// Optimize no packages

Back to the top