[570802] Fix TypeId of nested generic
diff --git a/plugins/org.eclipse.ocl.pivot/src/org/eclipse/ocl/pivot/ids/IdManager.java b/plugins/org.eclipse.ocl.pivot/src/org/eclipse/ocl/pivot/ids/IdManager.java
index 37dc399..2f71697 100644
--- a/plugins/org.eclipse.ocl.pivot/src/org/eclipse/ocl/pivot/ids/IdManager.java
+++ b/plugins/org.eclipse.ocl.pivot/src/org/eclipse/ocl/pivot/ids/IdManager.java
@@ -215,9 +215,10 @@
if (aType.eIsProxy()) {
return getUnspecifiedTypeId(aType); // FIXME This occurs for underspecified/wildcard types
}
+ org.eclipse.ocl.pivot.Class unspecializedType = PivotUtil.getUnspecializedTemplateableElement(aType);
String name = aType.getName();
assert name != null;
- org.eclipse.ocl.pivot.Package parentPackage = aType.getOwningPackage();
+ org.eclipse.ocl.pivot.Package parentPackage = unspecializedType.getOwningPackage();
if (parentPackage != null) {
TemplateParameters typeParameters = aType.getTypeParameters();
PackageId packageId = parentPackage.getPackageId();
diff --git a/plugins/org.eclipse.ocl.pivot/src/org/eclipse/ocl/pivot/internal/manager/TemplateParameterSubstitutionVisitor.java b/plugins/org.eclipse.ocl.pivot/src/org/eclipse/ocl/pivot/internal/manager/TemplateParameterSubstitutionVisitor.java
index fb384ee..325032a 100644
--- a/plugins/org.eclipse.ocl.pivot/src/org/eclipse/ocl/pivot/internal/manager/TemplateParameterSubstitutionVisitor.java
+++ b/plugins/org.eclipse.ocl.pivot/src/org/eclipse/ocl/pivot/internal/manager/TemplateParameterSubstitutionVisitor.java
@@ -332,12 +332,14 @@
org.eclipse.ocl.pivot.Class unspecializedType = PivotUtil.getUnspecializedTemplateableElement(partiallySpecializedType);
List<TemplateBinding> ownedTemplateBindings = partiallySpecializedType.getOwnedBindings();
if (ownedTemplateBindings.size() > 0) {
+ // boolean hasActual = false;
List<@NonNull Type> templateArguments = new ArrayList<@NonNull Type>();
for (TemplateBinding ownedTemplateBinding : ownedTemplateBindings) {
for (TemplateParameterSubstitution ownedTemplateParameterSubstitution : ownedTemplateBinding.getOwnedSubstitutions()) {
Type actualType = ownedTemplateParameterSubstitution.getActual();
if (actualType != null) {
actualType = specializeType(actualType);
+ // hasActual = true;
}
else {
TemplateParameter formalParameter = ownedTemplateParameterSubstitution.getFormal();
@@ -351,7 +353,12 @@
templateArguments.add(actualType);
}
}
- return metamodelManager.getLibraryType(unspecializedType, templateArguments);
+ // if (hasActual) {
+ return metamodelManager.getLibraryType(unspecializedType, templateArguments);
+ // }
+ // else {
+ // return unspecializedType;
+ // }
}
TemplateSignature ownedTemplateSignature = partiallySpecializedType.getOwnedSignature();
if (ownedTemplateSignature != null) {
diff --git a/tests/org.eclipse.ocl.examples.xtext.tests/src/org/eclipse/ocl/examples/test/xtext/LoadTests.java b/tests/org.eclipse.ocl.examples.xtext.tests/src/org/eclipse/ocl/examples/test/xtext/LoadTests.java
index 5ba0d32..8cba360 100644
--- a/tests/org.eclipse.ocl.examples.xtext.tests/src/org/eclipse/ocl/examples/test/xtext/LoadTests.java
+++ b/tests/org.eclipse.ocl.examples.xtext.tests/src/org/eclipse/ocl/examples/test/xtext/LoadTests.java
@@ -893,7 +893,7 @@
}
public void testLoad_Wildcard_oclinecore() throws IOException, InterruptedException {
- OCL ocl = createOCL();
+ OCL ocl = createOCLWithProjectMap();
doLoad_Concrete(ocl, getTestModelURI("models/oclinecore/Wildcard.oclinecore"));
ocl.dispose();
}