[496810] Provide full Executor meta-type system
diff --git a/examples/org.eclipse.ocl.examples.codegen/emf-gen/org/eclipse/ocl/examples/codegen/cgmodel/impl/CGExecutorTypeImpl.java b/examples/org.eclipse.ocl.examples.codegen/emf-gen/org/eclipse/ocl/examples/codegen/cgmodel/impl/CGExecutorTypeImpl.java
index 1c4ed35..c55e62b 100644
--- a/examples/org.eclipse.ocl.examples.codegen/emf-gen/org/eclipse/ocl/examples/codegen/cgmodel/impl/CGExecutorTypeImpl.java
+++ b/examples/org.eclipse.ocl.examples.codegen/emf-gen/org/eclipse/ocl/examples/codegen/cgmodel/impl/CGExecutorTypeImpl.java
@@ -4,7 +4,7 @@
  * are made available under the terms of the Eclipse Public License v2.0
  * which accompanies this distribution, and is available at
  * http://www.eclipse.org/legal/epl-v20.html
- * 
+ *
  * Contributors:
  *   E.D.Willink(CEA LIST) - Initial API and implementation
  *******************************************************************************/
diff --git a/examples/org.eclipse.ocl.examples.codegen/src/org/eclipse/ocl/examples/codegen/java/CG2JavaPreVisitor.java b/examples/org.eclipse.ocl.examples.codegen/src/org/eclipse/ocl/examples/codegen/java/CG2JavaPreVisitor.java
index c54b1e6..96368e0 100644
--- a/examples/org.eclipse.ocl.examples.codegen/src/org/eclipse/ocl/examples/codegen/java/CG2JavaPreVisitor.java
+++ b/examples/org.eclipse.ocl.examples.codegen/src/org/eclipse/ocl/examples/codegen/java/CG2JavaPreVisitor.java
@@ -62,6 +62,7 @@
 import org.eclipse.ocl.pivot.CollectionLiteralExp;
 import org.eclipse.ocl.pivot.MapLiteralExp;
 import org.eclipse.ocl.pivot.Property;
+import org.eclipse.ocl.pivot.Type;
 import org.eclipse.ocl.pivot.ids.CollectionTypeId;
 import org.eclipse.ocl.pivot.ids.ElementId;
 import org.eclipse.ocl.pivot.ids.EnumerationLiteralId;
@@ -381,7 +382,10 @@
 		if (cgTypeId != null) {
 			cgTypeId.accept(this);
 		}
-		cgExecutorType.setTypeId(analyzer.getTypeId(JavaConstants.CLASS_TYPE_ID));		// FIXME
+		Type asType = CGUtil.getAST(cgExecutorType);
+		Type asMetaType = codeGenerator.getEnvironmentFactory().getStandardLibrary().getMetaclass(asType);
+	//	cgExecutorType.setTypeId(analyzer.getTypeId(JavaConstants.CLASS_TYPE_ID));		// FIXME
+		cgExecutorType.setTypeId(analyzer.getTypeId(asMetaType.getTypeId()));
 		return super.visitCGExecutorType(cgExecutorType);
 	}
 
diff --git a/examples/org.eclipse.ocl.examples.codegen/src/org/eclipse/ocl/examples/codegen/java/CG2JavaVisitor.java b/examples/org.eclipse.ocl.examples.codegen/src/org/eclipse/ocl/examples/codegen/java/CG2JavaVisitor.java
index a13b6a2..0164a66 100644
--- a/examples/org.eclipse.ocl.examples.codegen/src/org/eclipse/ocl/examples/codegen/java/CG2JavaVisitor.java
+++ b/examples/org.eclipse.ocl.examples.codegen/src/org/eclipse/ocl/examples/codegen/java/CG2JavaVisitor.java
@@ -1877,10 +1877,17 @@
 	public @NonNull Boolean visitCGExecutorType(@NonNull CGExecutorType cgExecutorType) {
 		js.appendDeclaration(cgExecutorType);
 		js.append(" = ");
-		js.appendValueName(localContext.getIdResolverVariable(cgExecutorType));
-		js.append(".getClass(");
-		js.appendIdReference(cgExecutorType.getUnderlyingTypeId().getElementId());
-		js.append(", null);\n");
+		SubStream castBody1 = new SubStream() {
+			@Override
+			public void append() {
+				js.appendValueName(localContext.getIdResolverVariable(cgExecutorType));
+				js.append(".getClass(");
+				js.appendIdReference(cgExecutorType.getUnderlyingTypeId().getElementId());
+				js.append(", null)");
+			}
+		};
+		js.appendClassCast(cgExecutorType, castBody1);
+		js.append(";\n");
 		return true;
 	}
 
diff --git a/examples/org.eclipse.ocl.examples.codegen/src/org/eclipse/ocl/examples/codegen/oclinecore/OCLinEcoreTables.java b/examples/org.eclipse.ocl.examples.codegen/src/org/eclipse/ocl/examples/codegen/oclinecore/OCLinEcoreTables.java
index 3f6a864..5c1d631 100644
--- a/examples/org.eclipse.ocl.examples.codegen/src/org/eclipse/ocl/examples/codegen/oclinecore/OCLinEcoreTables.java
+++ b/examples/org.eclipse.ocl.examples.codegen/src/org/eclipse/ocl/examples/codegen/oclinecore/OCLinEcoreTables.java
@@ -33,6 +33,7 @@
 import org.eclipse.jdt.annotation.Nullable;
 import org.eclipse.ocl.examples.codegen.genmodel.OCLGenModelUtil;
 import org.eclipse.ocl.pivot.AnyType;
+import org.eclipse.ocl.pivot.BagType;
 import org.eclipse.ocl.pivot.CollectionType;
 import org.eclipse.ocl.pivot.CompleteClass;
 import org.eclipse.ocl.pivot.Enumeration;
@@ -42,6 +43,7 @@
 import org.eclipse.ocl.pivot.Operation;
 import org.eclipse.ocl.pivot.OrderedSetType;
 import org.eclipse.ocl.pivot.ParameterTypes;
+import org.eclipse.ocl.pivot.PrimitiveType;
 import org.eclipse.ocl.pivot.Property;
 import org.eclipse.ocl.pivot.SequenceType;
 import org.eclipse.ocl.pivot.SetType;
@@ -53,11 +55,18 @@
 import org.eclipse.ocl.pivot.ids.IdManager;
 import org.eclipse.ocl.pivot.ids.TemplateParameterId;
 import org.eclipse.ocl.pivot.ids.TypeId;
+import org.eclipse.ocl.pivot.internal.library.ecore.EcoreExecutorAnyType;
+import org.eclipse.ocl.pivot.internal.library.ecore.EcoreExecutorBagType;
+import org.eclipse.ocl.pivot.internal.library.ecore.EcoreExecutorCollectionType;
 import org.eclipse.ocl.pivot.internal.library.ecore.EcoreExecutorEnumeration;
 import org.eclipse.ocl.pivot.internal.library.ecore.EcoreExecutorEnumerationLiteral;
 import org.eclipse.ocl.pivot.internal.library.ecore.EcoreExecutorInvalidType;
+import org.eclipse.ocl.pivot.internal.library.ecore.EcoreExecutorOrderedSetType;
 import org.eclipse.ocl.pivot.internal.library.ecore.EcoreExecutorPackage;
+import org.eclipse.ocl.pivot.internal.library.ecore.EcoreExecutorPrimitiveType;
 import org.eclipse.ocl.pivot.internal.library.ecore.EcoreExecutorProperty;
+import org.eclipse.ocl.pivot.internal.library.ecore.EcoreExecutorSequenceType;
+import org.eclipse.ocl.pivot.internal.library.ecore.EcoreExecutorSetType;
 import org.eclipse.ocl.pivot.internal.library.ecore.EcoreExecutorType;
 import org.eclipse.ocl.pivot.internal.library.ecore.EcoreExecutorVoidType;
 import org.eclipse.ocl.pivot.internal.library.ecore.EcoreLibraryOppositeProperty;
@@ -869,11 +878,42 @@
 	}
 
 	protected void declareType(org.eclipse.ocl.pivot.@NonNull Class asClass) {
-		Class<?> typeClass =
-				asClass instanceof Enumeration ? EcoreExecutorEnumeration.class :
-					asClass instanceof InvalidType ? EcoreExecutorInvalidType.class :
-						asClass instanceof VoidType ? EcoreExecutorVoidType.class :
-							EcoreExecutorType.class;
+		Class<?> typeClass;
+		if (asClass instanceof Enumeration) {
+			typeClass = EcoreExecutorEnumeration.class;
+		}
+		else if (asClass instanceof AnyType) {
+			typeClass = EcoreExecutorAnyType.class;
+		}
+		else if (asClass instanceof InvalidType) {
+			typeClass = EcoreExecutorInvalidType.class;
+		}
+		else if (asClass instanceof VoidType) {
+			typeClass = EcoreExecutorVoidType.class;
+		}
+		else if (asClass instanceof CollectionType) {
+			if (asClass instanceof BagType) {
+				typeClass = EcoreExecutorBagType.class;
+			}
+			else if (asClass instanceof OrderedSetType) {
+				typeClass = EcoreExecutorOrderedSetType.class;
+			}
+			else if (asClass instanceof SequenceType) {
+				typeClass = EcoreExecutorSequenceType.class;
+			}
+			else if (asClass instanceof SetType) {
+				typeClass = EcoreExecutorSetType.class;
+			}
+			else {
+				typeClass = EcoreExecutorCollectionType.class;
+			}
+		}
+		else if (asClass instanceof PrimitiveType) {
+			typeClass = EcoreExecutorPrimitiveType.class;
+		}
+		else {
+			typeClass = EcoreExecutorType.class;
+		}
 		EClassifier eClassifier = ClassUtil.nonNullState((EClassifier)asClass.getESObject());
 		s.append("		public static final ");
 		s.appendClassReference(true, typeClass);
diff --git a/examples/org.eclipse.ocl.examples.codegen/src/org/eclipse/ocl/examples/codegen/utilities/CGUtil.java b/examples/org.eclipse.ocl.examples.codegen/src/org/eclipse/ocl/examples/codegen/utilities/CGUtil.java
index db8f3a0..901853d 100644
--- a/examples/org.eclipse.ocl.examples.codegen/src/org/eclipse/ocl/examples/codegen/utilities/CGUtil.java
+++ b/examples/org.eclipse.ocl.examples.codegen/src/org/eclipse/ocl/examples/codegen/utilities/CGUtil.java
@@ -41,6 +41,7 @@
 import org.eclipse.ocl.examples.codegen.cgmodel.CGVariableExp;
 import org.eclipse.ocl.pivot.Constraint;
 import org.eclipse.ocl.pivot.OCLExpression;
+import org.eclipse.ocl.pivot.Type;
 import org.eclipse.ocl.pivot.Variable;
 import org.eclipse.ocl.pivot.VariableDeclaration;
 import org.eclipse.ocl.pivot.ids.ElementId;
@@ -187,6 +188,10 @@
 		return ClassUtil.nonNullState((Constraint)cgConstraint.getAst());
 	}
 
+	public static @NonNull Type getAST(@NonNull CGExecutorType cgExecutorType) {
+		return ClassUtil.nonNullState((Type)cgExecutorType.getAst());
+	}
+
 	public static @NonNull Variable getAST(@NonNull CGIterator cgIterator) {
 		return ClassUtil.nonNullState((Variable)cgIterator.getAst());
 	}
diff --git a/plugins/org.eclipse.ocl.pivot/emf-gen/org/eclipse/ocl/pivot/StandardLibrary.java b/plugins/org.eclipse.ocl.pivot/emf-gen/org/eclipse/ocl/pivot/StandardLibrary.java
index f6170f8..0fe8b13 100644
--- a/plugins/org.eclipse.ocl.pivot/emf-gen/org/eclipse/ocl/pivot/StandardLibrary.java
+++ b/plugins/org.eclipse.ocl.pivot/emf-gen/org/eclipse/ocl/pivot/StandardLibrary.java
@@ -145,14 +145,15 @@
 	@NonNull MapType getMapType(org.eclipse.ocl.pivot.@NonNull Class containerType, @NonNull Type keyType, @NonNull Type valueType);
 
 	/**
-	 * Return the instance of the Metaclass metatype whose class is classType.
+	 * Return the metaclass to which classType conforms.
 	 */
 	org.eclipse.ocl.pivot.@NonNull Class getMetaclass(@NonNull Type classType);
 
 	/**
 	 * Returns the meta-type of a given type.
 	 */
-	Type getMetaType(@NonNull Type type);
+	@Deprecated /* @deprecated use getMetaclass */
+	@NonNull Type getMetaType(@NonNull Type type);
 
 	org.eclipse.ocl.pivot.Package getNsURIPackage(@NonNull String nsURI);
 
diff --git a/plugins/org.eclipse.ocl.pivot/emf-gen/org/eclipse/ocl/pivot/internal/StandardLibraryImpl.java b/plugins/org.eclipse.ocl.pivot/emf-gen/org/eclipse/ocl/pivot/internal/StandardLibraryImpl.java
index 2e33c87..ff8cea1 100644
--- a/plugins/org.eclipse.ocl.pivot/emf-gen/org/eclipse/ocl/pivot/internal/StandardLibraryImpl.java
+++ b/plugins/org.eclipse.ocl.pivot/emf-gen/org/eclipse/ocl/pivot/internal/StandardLibraryImpl.java
@@ -606,10 +606,10 @@
 	}
 
 	@Override
-	public Type getMetaType(@NonNull Type instanceType) {
-		if (instanceType instanceof PrimitiveType) {
-			return getASClass(TypeId.PRIMITIVE_TYPE_NAME);
-		}
+	public @NonNull Type getMetaType(@NonNull Type instanceType) {
+	//	if (instanceType instanceof PrimitiveType) {
+	//		return getASClass(TypeId.PRIMITIVE_TYPE_NAME);
+	//	}
 		//		throw new UnsupportedOperationException();
 		return getMetaclass(instanceType);
 	}
diff --git a/plugins/org.eclipse.ocl.pivot/emf-gen/org/eclipse/ocl/pivot/internal/TypeExpImpl.java b/plugins/org.eclipse.ocl.pivot/emf-gen/org/eclipse/ocl/pivot/internal/TypeExpImpl.java
index 51c8b6d..9cec9f1 100644
--- a/plugins/org.eclipse.ocl.pivot/emf-gen/org/eclipse/ocl/pivot/internal/TypeExpImpl.java
+++ b/plugins/org.eclipse.ocl.pivot/emf-gen/org/eclipse/ocl/pivot/internal/TypeExpImpl.java
@@ -12,8 +12,8 @@
 
 import java.lang.reflect.InvocationTargetException;
 import java.util.Collection;
-
 import java.util.Map;
+
 import org.eclipse.emf.common.notify.Notification;
 import org.eclipse.emf.common.util.DiagnosticChain;
 import org.eclipse.emf.common.util.EList;
@@ -26,6 +26,7 @@
 import org.eclipse.ocl.pivot.ElementExtension;
 import org.eclipse.ocl.pivot.PivotPackage;
 import org.eclipse.ocl.pivot.ReferringElement;
+import org.eclipse.ocl.pivot.TemplateParameter;
 import org.eclipse.ocl.pivot.Type;
 import org.eclipse.ocl.pivot.TypeExp;
 import org.eclipse.ocl.pivot.ValueSpecification;
@@ -129,6 +130,7 @@
 	 */
 	@Override
 	public void setReferredType(Type newReferredType) {
+		assert !(newReferredType instanceof TemplateParameter);
 		Type oldReferredType = referredType;
 		referredType = newReferredType;
 		if (eNotificationRequired())
diff --git a/plugins/org.eclipse.ocl.pivot/emf-gen/org/eclipse/ocl/pivot/oclstdlib/OCLstdlibTables.java b/plugins/org.eclipse.ocl.pivot/emf-gen/org/eclipse/ocl/pivot/oclstdlib/OCLstdlibTables.java
index 01a7fd5..57c32e7 100644
--- a/plugins/org.eclipse.ocl.pivot/emf-gen/org/eclipse/ocl/pivot/oclstdlib/OCLstdlibTables.java
+++ b/plugins/org.eclipse.ocl.pivot/emf-gen/org/eclipse/ocl/pivot/oclstdlib/OCLstdlibTables.java
@@ -25,9 +25,16 @@
 import org.eclipse.ocl.pivot.TemplateParameters;
 import org.eclipse.ocl.pivot.ids.IdManager;
 import org.eclipse.ocl.pivot.ids.TypeId;
+import org.eclipse.ocl.pivot.internal.library.ecore.EcoreExecutorAnyType;
+import org.eclipse.ocl.pivot.internal.library.ecore.EcoreExecutorBagType;
+import org.eclipse.ocl.pivot.internal.library.ecore.EcoreExecutorCollectionType;
 import org.eclipse.ocl.pivot.internal.library.ecore.EcoreExecutorInvalidType;
+import org.eclipse.ocl.pivot.internal.library.ecore.EcoreExecutorOrderedSetType;
 import org.eclipse.ocl.pivot.internal.library.ecore.EcoreExecutorPackage;
+import org.eclipse.ocl.pivot.internal.library.ecore.EcoreExecutorPrimitiveType;
 import org.eclipse.ocl.pivot.internal.library.ecore.EcoreExecutorProperty;
+import org.eclipse.ocl.pivot.internal.library.ecore.EcoreExecutorSequenceType;
+import org.eclipse.ocl.pivot.internal.library.ecore.EcoreExecutorSetType;
 import org.eclipse.ocl.pivot.internal.library.ecore.EcoreExecutorType;
 import org.eclipse.ocl.pivot.internal.library.ecore.EcoreExecutorVoidType;
 import org.eclipse.ocl.pivot.internal.library.ecore.EcoreLibraryOppositeProperty;
@@ -159,12 +166,12 @@
 			TypeParameters.init();
 		}
 
-		public static final @NonNull EcoreExecutorType _Bag = new EcoreExecutorType(TypeId.BAG, PACKAGE, 0, TypeParameters._Bag_T);
-		public static final @NonNull EcoreExecutorType _Boolean = new EcoreExecutorType(TypeId.BOOLEAN, PACKAGE, 0);
-		public static final @NonNull EcoreExecutorType _Collection = new EcoreExecutorType(TypeId.COLLECTION, PACKAGE, 0 | ExecutorType.ABSTRACT, TypeParameters._Collection_T);
-		public static final @NonNull EcoreExecutorType _Integer = new EcoreExecutorType(TypeId.INTEGER, PACKAGE, 0);
+		public static final @NonNull EcoreExecutorBagType _Bag = new EcoreExecutorBagType(TypeId.BAG, PACKAGE, 0, TypeParameters._Bag_T);
+		public static final @NonNull EcoreExecutorPrimitiveType _Boolean = new EcoreExecutorPrimitiveType(TypeId.BOOLEAN, PACKAGE, 0);
+		public static final @NonNull EcoreExecutorCollectionType _Collection = new EcoreExecutorCollectionType(TypeId.COLLECTION, PACKAGE, 0 | ExecutorType.ABSTRACT, TypeParameters._Collection_T);
+		public static final @NonNull EcoreExecutorPrimitiveType _Integer = new EcoreExecutorPrimitiveType(TypeId.INTEGER, PACKAGE, 0);
 		public static final @NonNull EcoreExecutorType _Map = new EcoreExecutorType(OCLstdlibPackage.Literals.MAP, PACKAGE, 0, TypeParameters._Map_K, TypeParameters._Map_V);
-		public static final @NonNull EcoreExecutorType _OclAny = new EcoreExecutorType(TypeId.OCL_ANY, PACKAGE, 0 | ExecutorType.ABSTRACT);
+		public static final @NonNull EcoreExecutorAnyType _OclAny = new EcoreExecutorAnyType(TypeId.OCL_ANY, PACKAGE, 0 | ExecutorType.ABSTRACT);
 		public static final @NonNull EcoreExecutorType _OclComparable = new EcoreExecutorType(OCLstdlibPackage.Literals.OCL_COMPARABLE, PACKAGE, 0 | ExecutorType.ABSTRACT);
 		public static final @NonNull EcoreExecutorType _OclElement = new EcoreExecutorType(OCLstdlibPackage.Literals.OCL_ELEMENT, PACKAGE, 0 | ExecutorType.ABSTRACT);
 		public static final @NonNull EcoreExecutorType _OclEnumeration = new EcoreExecutorType(OCLstdlibPackage.Literals.OCL_ENUMERATION, PACKAGE, 0 | ExecutorType.ABSTRACT);
@@ -178,14 +185,14 @@
 		public static final @NonNull EcoreExecutorType _OclTuple = new EcoreExecutorType(OCLstdlibPackage.Literals.OCL_TUPLE, PACKAGE, 0 | ExecutorType.ABSTRACT);
 		public static final @NonNull EcoreExecutorType _OclType = new EcoreExecutorType(OCLstdlibPackage.Literals.OCL_TYPE, PACKAGE, 0 | ExecutorType.ABSTRACT);
 		public static final @NonNull EcoreExecutorVoidType _OclVoid = new EcoreExecutorVoidType(TypeId.OCL_VOID, PACKAGE, 0 | ExecutorType.ABSTRACT);
-		public static final @NonNull EcoreExecutorType _OrderedCollection = new EcoreExecutorType(TypeId.ORDERED_COLLECTION, PACKAGE, 0 | ExecutorType.ABSTRACT, TypeParameters._OrderedCollection_T);
-		public static final @NonNull EcoreExecutorType _OrderedSet = new EcoreExecutorType(TypeId.ORDERED_SET, PACKAGE, ExecutorType.ORDERED | ExecutorType.UNIQUE, TypeParameters._OrderedSet_T);
-		public static final @NonNull EcoreExecutorType _Real = new EcoreExecutorType(TypeId.REAL, PACKAGE, 0);
-		public static final @NonNull EcoreExecutorType _Sequence = new EcoreExecutorType(TypeId.SEQUENCE, PACKAGE, ExecutorType.ORDERED, TypeParameters._Sequence_T);
-		public static final @NonNull EcoreExecutorType _Set = new EcoreExecutorType(TypeId.SET, PACKAGE, ExecutorType.UNIQUE, TypeParameters._Set_T);
-		public static final @NonNull EcoreExecutorType _String = new EcoreExecutorType(TypeId.STRING, PACKAGE, 0);
-		public static final @NonNull EcoreExecutorType _UniqueCollection = new EcoreExecutorType(TypeId.UNIQUE_COLLECTION, PACKAGE, 0 | ExecutorType.ABSTRACT, TypeParameters._UniqueCollection_T);
-		public static final @NonNull EcoreExecutorType _UnlimitedNatural = new EcoreExecutorType(TypeId.UNLIMITED_NATURAL, PACKAGE, 0);
+		public static final @NonNull EcoreExecutorCollectionType _OrderedCollection = new EcoreExecutorCollectionType(TypeId.ORDERED_COLLECTION, PACKAGE, 0 | ExecutorType.ABSTRACT, TypeParameters._OrderedCollection_T);
+		public static final @NonNull EcoreExecutorOrderedSetType _OrderedSet = new EcoreExecutorOrderedSetType(TypeId.ORDERED_SET, PACKAGE, ExecutorType.ORDERED | ExecutorType.UNIQUE, TypeParameters._OrderedSet_T);
+		public static final @NonNull EcoreExecutorPrimitiveType _Real = new EcoreExecutorPrimitiveType(TypeId.REAL, PACKAGE, 0);
+		public static final @NonNull EcoreExecutorSequenceType _Sequence = new EcoreExecutorSequenceType(TypeId.SEQUENCE, PACKAGE, ExecutorType.ORDERED, TypeParameters._Sequence_T);
+		public static final @NonNull EcoreExecutorSetType _Set = new EcoreExecutorSetType(TypeId.SET, PACKAGE, ExecutorType.UNIQUE, TypeParameters._Set_T);
+		public static final @NonNull EcoreExecutorPrimitiveType _String = new EcoreExecutorPrimitiveType(TypeId.STRING, PACKAGE, 0);
+		public static final @NonNull EcoreExecutorCollectionType _UniqueCollection = new EcoreExecutorCollectionType(TypeId.UNIQUE_COLLECTION, PACKAGE, 0 | ExecutorType.ABSTRACT, TypeParameters._UniqueCollection_T);
+		public static final @NonNull EcoreExecutorPrimitiveType _UnlimitedNatural = new EcoreExecutorPrimitiveType(TypeId.UNLIMITED_NATURAL, PACKAGE, 0);
 
 		private static final @NonNull EcoreExecutorType @NonNull [] types = {
 			_Bag,
diff --git a/plugins/org.eclipse.ocl.pivot/emf-gen/org/eclipse/ocl/pivot/oclstdlib/util/OCLstdlibAdapterFactory.java b/plugins/org.eclipse.ocl.pivot/emf-gen/org/eclipse/ocl/pivot/oclstdlib/util/OCLstdlibAdapterFactory.java
index 43d40aa..8c29254 100644
--- a/plugins/org.eclipse.ocl.pivot/emf-gen/org/eclipse/ocl/pivot/oclstdlib/util/OCLstdlibAdapterFactory.java
+++ b/plugins/org.eclipse.ocl.pivot/emf-gen/org/eclipse/ocl/pivot/oclstdlib/util/OCLstdlibAdapterFactory.java
@@ -22,6 +22,7 @@
 import org.eclipse.emf.common.notify.impl.AdapterFactoryImpl;
 import org.eclipse.emf.ecore.EObject;
 import org.eclipse.jdt.annotation.Nullable;
+import org.eclipse.ocl.pivot.oclstdlib.*;
 import org.eclipse.ocl.pivot.oclstdlib.OCLstdlibPackage;
 import org.eclipse.ocl.pivot.values.Bag;
 import org.eclipse.ocl.pivot.values.OrderedSet;
diff --git a/plugins/org.eclipse.ocl.pivot/emf-gen/org/eclipse/ocl/pivot/oclstdlib/util/OCLstdlibSwitch.java b/plugins/org.eclipse.ocl.pivot/emf-gen/org/eclipse/ocl/pivot/oclstdlib/util/OCLstdlibSwitch.java
index 4edc769..c9e9fb1 100644
--- a/plugins/org.eclipse.ocl.pivot/emf-gen/org/eclipse/ocl/pivot/oclstdlib/util/OCLstdlibSwitch.java
+++ b/plugins/org.eclipse.ocl.pivot/emf-gen/org/eclipse/ocl/pivot/oclstdlib/util/OCLstdlibSwitch.java
@@ -21,6 +21,7 @@
 import org.eclipse.emf.ecore.EPackage;
 import org.eclipse.emf.ecore.util.Switch;
 import org.eclipse.jdt.annotation.Nullable;
+import org.eclipse.ocl.pivot.oclstdlib.*;
 import org.eclipse.ocl.pivot.oclstdlib.OCLstdlibPackage;
 import org.eclipse.ocl.pivot.values.Bag;
 import org.eclipse.ocl.pivot.values.OrderedSet;
@@ -102,34 +103,34 @@
 				return result;
 			}
 			case 3: {
-				Object oclAny = theEObject;
+				Object oclAny = (Object)theEObject;
 				T1 result = caseOclAny(oclAny);
 				if (result == null) result = defaultCase(theEObject);
 				return result;
 			}
 			case 4: {
-				Object oclComparable = theEObject;
+				Object oclComparable = (Object)theEObject;
 				T1 result = caseOclComparable(oclComparable);
 				if (result == null) result = caseOclAny(oclComparable);
 				if (result == null) result = defaultCase(theEObject);
 				return result;
 			}
 			case 5: {
-				Object oclElement = theEObject;
+				Object oclElement = (Object)theEObject;
 				T1 result = caseOclElement(oclElement);
 				if (result == null) result = caseOclAny(oclElement);
 				if (result == null) result = defaultCase(theEObject);
 				return result;
 			}
 			case 6: {
-				Object oclEnumeration = theEObject;
+				Object oclEnumeration = (Object)theEObject;
 				T1 result = caseOclEnumeration(oclEnumeration);
 				if (result == null) result = caseOclAny(oclEnumeration);
 				if (result == null) result = defaultCase(theEObject);
 				return result;
 			}
 			case 7: {
-				Object oclInvalid = theEObject;
+				Object oclInvalid = (Object)theEObject;
 				T1 result = caseOclInvalid(oclInvalid);
 				if (result == null) result = caseOclVoid(oclInvalid);
 				if (result == null) result = caseOclAny(oclInvalid);
@@ -137,35 +138,35 @@
 				return result;
 			}
 			case 8: {
-				Object oclLambda = theEObject;
+				Object oclLambda = (Object)theEObject;
 				T1 result = caseOclLambda(oclLambda);
 				if (result == null) result = caseOclAny(oclLambda);
 				if (result == null) result = defaultCase(theEObject);
 				return result;
 			}
 			case 9: {
-				Object oclMessage = theEObject;
+				Object oclMessage = (Object)theEObject;
 				T1 result = caseOclMessage(oclMessage);
 				if (result == null) result = caseOclAny(oclMessage);
 				if (result == null) result = defaultCase(theEObject);
 				return result;
 			}
 			case 10: {
-				Object oclSelf = theEObject;
+				Object oclSelf = (Object)theEObject;
 				T1 result = caseOclSelf(oclSelf);
 				if (result == null) result = caseOclAny(oclSelf);
 				if (result == null) result = defaultCase(theEObject);
 				return result;
 			}
 			case 11: {
-				Object oclState = theEObject;
+				Object oclState = (Object)theEObject;
 				T1 result = caseOclState(oclState);
 				if (result == null) result = caseOclAny(oclState);
 				if (result == null) result = defaultCase(theEObject);
 				return result;
 			}
 			case 12: {
-				Object oclStereotype = theEObject;
+				Object oclStereotype = (Object)theEObject;
 				T1 result = caseOclStereotype(oclStereotype);
 				if (result == null) result = caseOclType(oclStereotype);
 				if (result == null) result = caseOclElement(oclStereotype);
@@ -174,21 +175,21 @@
 				return result;
 			}
 			case 13: {
-				Object oclSummable = theEObject;
+				Object oclSummable = (Object)theEObject;
 				T1 result = caseOclSummable(oclSummable);
 				if (result == null) result = caseOclAny(oclSummable);
 				if (result == null) result = defaultCase(theEObject);
 				return result;
 			}
 			case 14: {
-				Object oclTuple = theEObject;
+				Object oclTuple = (Object)theEObject;
 				T1 result = caseOclTuple(oclTuple);
 				if (result == null) result = caseOclAny(oclTuple);
 				if (result == null) result = defaultCase(theEObject);
 				return result;
 			}
 			case 15: {
-				Object oclType = theEObject;
+				Object oclType = (Object)theEObject;
 				T1 result = caseOclType(oclType);
 				if (result == null) result = caseOclElement(oclType);
 				if (result == null) result = caseOclAny(oclType);
@@ -196,7 +197,7 @@
 				return result;
 			}
 			case 16: {
-				Object oclVoid = theEObject;
+				Object oclVoid = (Object)theEObject;
 				T1 result = caseOclVoid(oclVoid);
 				if (result == null) result = caseOclAny(oclVoid);
 				if (result == null) result = defaultCase(theEObject);
diff --git a/plugins/org.eclipse.ocl.pivot/src/org/eclipse/ocl/pivot/ids/TypeId.java b/plugins/org.eclipse.ocl.pivot/src/org/eclipse/ocl/pivot/ids/TypeId.java
index 7a15063..bd3fe07 100644
--- a/plugins/org.eclipse.ocl.pivot/src/org/eclipse/ocl/pivot/ids/TypeId.java
+++ b/plugins/org.eclipse.ocl.pivot/src/org/eclipse/ocl/pivot/ids/TypeId.java
@@ -32,6 +32,7 @@
  */
 public interface TypeId extends ElementId
 {
+	public static final @NonNull String ANY_TYPE_NAME = "AnyType";
 	public static final @NonNull String BAG_NAME = "Bag";
 	public static final @NonNull String BAG_TYPE_NAME = "BagType";
 	public static final @NonNull String BOOLEAN_NAME = "Boolean";
@@ -42,6 +43,7 @@
 	public static final @NonNull String ENUMERATION_NAME = "Enumeration";
 	public static final @NonNull String INTEGER_NAME = "Integer";
 	public static final @NonNull String INTEGER_RANGE_NAME = "IntegerRange";
+	public static final @NonNull String INVALID_TYPE_NAME = "InvalidType";
 	/**
 	 * @since 1.6
 	 */
@@ -100,11 +102,13 @@
 	public static final @NonNull String SEQUENCE_TYPE_NAME = "SequenceType";
 	public static final @NonNull String SET_NAME = "Set";
 	public static final @NonNull String SET_TYPE_NAME = "SetType";
+	public static final @NonNull String STEREOTYPE_NAME = "Stereotype";
 	public static final @NonNull String STRING_NAME = "String";
 	public static final @NonNull String TUPLE_NAME = "Tuple";
 	public static final @NonNull String TUPLE_TYPE_NAME = "TupleType";
 	public static final @NonNull String UNIQUE_COLLECTION_NAME = "UniqueCollection";
 	public static final @NonNull String UNLIMITED_NATURAL_NAME = "UnlimitedNatural";
+	public static final @NonNull String VOID_TYPE_NAME = "VoidType";
 
 	public static final @NonNull PrimitiveTypeId BOOLEAN = IdManager.getPrimitiveTypeId(BOOLEAN_NAME);
 	public static final @NonNull PrimitiveTypeId INTEGER = IdManager.getPrimitiveTypeId(INTEGER_NAME);
diff --git a/plugins/org.eclipse.ocl.pivot/src/org/eclipse/ocl/pivot/internal/ecore/es2as/Ecore2ASReferenceSwitch.java b/plugins/org.eclipse.ocl.pivot/src/org/eclipse/ocl/pivot/internal/ecore/es2as/Ecore2ASReferenceSwitch.java
index c427267..49908c5 100644
--- a/plugins/org.eclipse.ocl.pivot/src/org/eclipse/ocl/pivot/internal/ecore/es2as/Ecore2ASReferenceSwitch.java
+++ b/plugins/org.eclipse.ocl.pivot/src/org/eclipse/ocl/pivot/internal/ecore/es2as/Ecore2ASReferenceSwitch.java
@@ -47,6 +47,7 @@
 import org.eclipse.ocl.pivot.Parameter;
 import org.eclipse.ocl.pivot.PivotFactory;
 import org.eclipse.ocl.pivot.Property;
+import org.eclipse.ocl.pivot.Stereotype;
 import org.eclipse.ocl.pivot.TemplateParameter;
 import org.eclipse.ocl.pivot.Type;
 import org.eclipse.ocl.pivot.TypedElement;
@@ -117,8 +118,8 @@
 		}
 		doSwitchAll(org.eclipse.ocl.pivot.Class.class, ClassUtil.<org.eclipse.ocl.pivot.Class>nullFree(pivotElement.getSuperClasses()), eClass.getEGenericSuperTypes());
 		if (pivotElement.getSuperClasses().isEmpty() && !(pivotElement instanceof AnyType)) {
-			org.eclipse.ocl.pivot.Class oclElementType = standardLibrary.getOclElementType();
-			pivotElement.getSuperClasses().add(oclElementType);
+			org.eclipse.ocl.pivot.Class superType = pivotElement instanceof Stereotype ? standardLibrary.getOclStereotypeType() : standardLibrary.getOclElementType();
+			pivotElement.getSuperClasses().add(superType);
 		}
 		return pivotElement;
 	}
diff --git a/plugins/org.eclipse.ocl.pivot/src/org/eclipse/ocl/pivot/internal/evaluation/BasicEvaluationVisitor.java b/plugins/org.eclipse.ocl.pivot/src/org/eclipse/ocl/pivot/internal/evaluation/BasicEvaluationVisitor.java
index d8ad1a6..eadba44 100644
--- a/plugins/org.eclipse.ocl.pivot/src/org/eclipse/ocl/pivot/internal/evaluation/BasicEvaluationVisitor.java
+++ b/plugins/org.eclipse.ocl.pivot/src/org/eclipse/ocl/pivot/internal/evaluation/BasicEvaluationVisitor.java
@@ -844,13 +844,6 @@
 	 */
 	@Override
 	public Object visitTypeExp(@NonNull TypeExp t) {
-		//		DomainMetaclass domainMetaclass = (DomainMetaclass)t.getType();
-		//		DomainType instanceType = domainMetaclass.getInstanceType();
-		//		assert instanceType != null;
-		//		return ValuesUtil.createTypeValue(instanceType);
-		//		DomainMetaclass domainMetaclass = (DomainMetaclass)t.getType();
-		//		DomainType instanceType = domainMetaclass.getInstanceType();
-		//		assert instanceType != null;
 		return t.getReferredType();
 	}
 
diff --git a/plugins/org.eclipse.ocl.pivot/src/org/eclipse/ocl/pivot/internal/executor/ExecutorBagType.java b/plugins/org.eclipse.ocl.pivot/src/org/eclipse/ocl/pivot/internal/executor/ExecutorBagType.java
new file mode 100644
index 0000000..c02a955
--- /dev/null
+++ b/plugins/org.eclipse.ocl.pivot/src/org/eclipse/ocl/pivot/internal/executor/ExecutorBagType.java
@@ -0,0 +1,26 @@
+/*******************************************************************************
+ * Copyright (c) 2022 Willink Transformations and others.
+ * All rights reserved.   This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v2.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v20.html
+ *
+ * Contributors:
+ *   E.D.Willink - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.ocl.pivot.internal.executor;
+
+import org.eclipse.jdt.annotation.NonNull;
+import org.eclipse.jdt.annotation.Nullable;
+import org.eclipse.ocl.pivot.BagType;
+import org.eclipse.ocl.pivot.Type;
+import org.eclipse.ocl.pivot.values.IntegerValue;
+import org.eclipse.ocl.pivot.values.UnlimitedNaturalValue;
+
+public class ExecutorBagType extends ExecutorCollectionType implements BagType
+{
+	public ExecutorBagType(@NonNull String name, org.eclipse.ocl.pivot.@NonNull Class containerType,
+			@NonNull Type elementType, boolean isNullFree, @Nullable IntegerValue lower, @Nullable UnlimitedNaturalValue upper) {
+		super(name, containerType, elementType, isNullFree, lower, upper);
+	}
+}
\ No newline at end of file
diff --git a/plugins/org.eclipse.ocl.pivot/src/org/eclipse/ocl/pivot/internal/executor/ExecutorOrderedSetType.java b/plugins/org.eclipse.ocl.pivot/src/org/eclipse/ocl/pivot/internal/executor/ExecutorOrderedSetType.java
new file mode 100644
index 0000000..54175bb
--- /dev/null
+++ b/plugins/org.eclipse.ocl.pivot/src/org/eclipse/ocl/pivot/internal/executor/ExecutorOrderedSetType.java
@@ -0,0 +1,26 @@
+/*******************************************************************************
+ * Copyright (c) 2022 Willink Transformations and others.
+ * All rights reserved.   This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v2.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v20.html
+ *
+ * Contributors:
+ *   E.D.Willink - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.ocl.pivot.internal.executor;
+
+import org.eclipse.jdt.annotation.NonNull;
+import org.eclipse.jdt.annotation.Nullable;
+import org.eclipse.ocl.pivot.OrderedSetType;
+import org.eclipse.ocl.pivot.Type;
+import org.eclipse.ocl.pivot.values.IntegerValue;
+import org.eclipse.ocl.pivot.values.UnlimitedNaturalValue;
+
+public class ExecutorOrderedSetType extends ExecutorCollectionType implements OrderedSetType
+{
+	public ExecutorOrderedSetType(@NonNull String name, org.eclipse.ocl.pivot.@NonNull Class containerType,
+			@NonNull Type elementType, boolean isNullFree, @Nullable IntegerValue lower, @Nullable UnlimitedNaturalValue upper) {
+		super(name, containerType, elementType, isNullFree, lower, upper);
+	}
+}
\ No newline at end of file
diff --git a/plugins/org.eclipse.ocl.pivot/src/org/eclipse/ocl/pivot/internal/executor/ExecutorSequenceType.java b/plugins/org.eclipse.ocl.pivot/src/org/eclipse/ocl/pivot/internal/executor/ExecutorSequenceType.java
new file mode 100644
index 0000000..d6895b6
--- /dev/null
+++ b/plugins/org.eclipse.ocl.pivot/src/org/eclipse/ocl/pivot/internal/executor/ExecutorSequenceType.java
@@ -0,0 +1,26 @@
+/*******************************************************************************
+ * Copyright (c) 2022 Willink Transformations and others.
+ * All rights reserved.   This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v2.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v20.html
+ *
+ * Contributors:
+ *   E.D.Willink - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.ocl.pivot.internal.executor;
+
+import org.eclipse.jdt.annotation.NonNull;
+import org.eclipse.jdt.annotation.Nullable;
+import org.eclipse.ocl.pivot.SequenceType;
+import org.eclipse.ocl.pivot.Type;
+import org.eclipse.ocl.pivot.values.IntegerValue;
+import org.eclipse.ocl.pivot.values.UnlimitedNaturalValue;
+
+public class ExecutorSequenceType extends ExecutorCollectionType implements SequenceType
+{
+	public ExecutorSequenceType(@NonNull String name, org.eclipse.ocl.pivot.@NonNull Class containerType,
+			@NonNull Type elementType, boolean isNullFree, @Nullable IntegerValue lower, @Nullable UnlimitedNaturalValue upper) {
+		super(name, containerType, elementType, isNullFree, lower, upper);
+	}
+}
\ No newline at end of file
diff --git a/plugins/org.eclipse.ocl.pivot/src/org/eclipse/ocl/pivot/internal/executor/ExecutorSetType.java b/plugins/org.eclipse.ocl.pivot/src/org/eclipse/ocl/pivot/internal/executor/ExecutorSetType.java
new file mode 100644
index 0000000..3dd1bcd
--- /dev/null
+++ b/plugins/org.eclipse.ocl.pivot/src/org/eclipse/ocl/pivot/internal/executor/ExecutorSetType.java
@@ -0,0 +1,26 @@
+/*******************************************************************************
+ * Copyright (c) 2022 Willink Transformations and others.
+ * All rights reserved.   This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v2.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v20.html
+ *
+ * Contributors:
+ *   E.D.Willink - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.ocl.pivot.internal.executor;
+
+import org.eclipse.jdt.annotation.NonNull;
+import org.eclipse.jdt.annotation.Nullable;
+import org.eclipse.ocl.pivot.SetType;
+import org.eclipse.ocl.pivot.Type;
+import org.eclipse.ocl.pivot.values.IntegerValue;
+import org.eclipse.ocl.pivot.values.UnlimitedNaturalValue;
+
+public class ExecutorSetType extends ExecutorCollectionType implements SetType
+{
+	public ExecutorSetType(@NonNull String name, org.eclipse.ocl.pivot.@NonNull Class containerType,
+			@NonNull Type elementType, boolean isNullFree, @Nullable IntegerValue lower, @Nullable UnlimitedNaturalValue upper) {
+		super(name, containerType, elementType, isNullFree, lower, upper);
+	}
+}
\ No newline at end of file
diff --git a/plugins/org.eclipse.ocl.pivot/src/org/eclipse/ocl/pivot/internal/executor/PivotExecutorStandardLibrary.java b/plugins/org.eclipse.ocl.pivot/src/org/eclipse/ocl/pivot/internal/executor/PivotExecutorStandardLibrary.java
index 20f1aaf..649557a 100644
--- a/plugins/org.eclipse.ocl.pivot/src/org/eclipse/ocl/pivot/internal/executor/PivotExecutorStandardLibrary.java
+++ b/plugins/org.eclipse.ocl.pivot/src/org/eclipse/ocl/pivot/internal/executor/PivotExecutorStandardLibrary.java
@@ -35,6 +35,7 @@
 import org.eclipse.ocl.pivot.resource.BasicProjectManager;
 import org.eclipse.ocl.pivot.utilities.ClassUtil;
 
+@Deprecated /* @deprecated not used */
 public class PivotExecutorStandardLibrary extends ExecutableStandardLibrary
 {
 	protected final @NonNull EnvironmentFactoryInternal environmentFactory;
diff --git a/plugins/org.eclipse.ocl.pivot/src/org/eclipse/ocl/pivot/internal/ids/OclInvalidTypeIdImpl.java b/plugins/org.eclipse.ocl.pivot/src/org/eclipse/ocl/pivot/internal/ids/OclInvalidTypeIdImpl.java
index 2427607..7364b0d 100644
--- a/plugins/org.eclipse.ocl.pivot/src/org/eclipse/ocl/pivot/internal/ids/OclInvalidTypeIdImpl.java
+++ b/plugins/org.eclipse.ocl.pivot/src/org/eclipse/ocl/pivot/internal/ids/OclInvalidTypeIdImpl.java
@@ -39,6 +39,6 @@
 
 	@Override
 	public @NonNull String getMetaTypeName() {
-		return "InvalidType";
+		return TypeId.INVALID_TYPE_NAME;
 	}
 }
\ No newline at end of file
diff --git a/plugins/org.eclipse.ocl.pivot/src/org/eclipse/ocl/pivot/internal/ids/OclVoidTypeIdImpl.java b/plugins/org.eclipse.ocl.pivot/src/org/eclipse/ocl/pivot/internal/ids/OclVoidTypeIdImpl.java
index d2eb854..0dfa460 100644
--- a/plugins/org.eclipse.ocl.pivot/src/org/eclipse/ocl/pivot/internal/ids/OclVoidTypeIdImpl.java
+++ b/plugins/org.eclipse.ocl.pivot/src/org/eclipse/ocl/pivot/internal/ids/OclVoidTypeIdImpl.java
@@ -67,7 +67,7 @@
 
 	@Override
 	public @NonNull String getMetaTypeName() {
-		return "VoidType";
+		return TypeId.VOID_TYPE_NAME;
 	}
 
 	public @Nullable Element getOrigin() {
diff --git a/plugins/org.eclipse.ocl.pivot/src/org/eclipse/ocl/pivot/internal/library/ecore/EcoreExecutorAnyType.java b/plugins/org.eclipse.ocl.pivot/src/org/eclipse/ocl/pivot/internal/library/ecore/EcoreExecutorAnyType.java
new file mode 100644
index 0000000..ca911b2
--- /dev/null
+++ b/plugins/org.eclipse.ocl.pivot/src/org/eclipse/ocl/pivot/internal/library/ecore/EcoreExecutorAnyType.java
@@ -0,0 +1,24 @@
+/*******************************************************************************
+ * Copyright (c) 2012, 2022 Willink Transformations and others.
+ * All rights reserved.   This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v2.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v20.html
+ *
+ * Contributors:
+ *   E.D.Willink - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.ocl.pivot.internal.library.ecore;
+
+import org.eclipse.jdt.annotation.NonNull;
+import org.eclipse.ocl.pivot.AnyType;
+import org.eclipse.ocl.pivot.ids.BuiltInTypeId;
+import org.eclipse.ocl.pivot.internal.library.executor.ExecutorPackage;
+import org.eclipse.ocl.pivot.internal.library.executor.ExecutorTypeParameter;
+
+public class EcoreExecutorAnyType extends EcoreExecutorType implements AnyType
+{
+	public EcoreExecutorAnyType(@NonNull BuiltInTypeId typeId, @NonNull ExecutorPackage evaluationPackage, int flags, @NonNull ExecutorTypeParameter @NonNull ... typeParameters) {
+		super(typeId, evaluationPackage, flags, typeParameters);
+	}
+}
diff --git a/plugins/org.eclipse.ocl.pivot/src/org/eclipse/ocl/pivot/internal/library/ecore/EcoreExecutorBagType.java b/plugins/org.eclipse.ocl.pivot/src/org/eclipse/ocl/pivot/internal/library/ecore/EcoreExecutorBagType.java
new file mode 100644
index 0000000..bd0bcc2
--- /dev/null
+++ b/plugins/org.eclipse.ocl.pivot/src/org/eclipse/ocl/pivot/internal/library/ecore/EcoreExecutorBagType.java
@@ -0,0 +1,24 @@
+/*******************************************************************************
+ * Copyright (c) 2012, 2022 Willink Transformations and others.
+ * All rights reserved.   This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v2.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v20.html
+ *
+ * Contributors:
+ *   E.D.Willink - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.ocl.pivot.internal.library.ecore;
+
+import org.eclipse.jdt.annotation.NonNull;
+import org.eclipse.ocl.pivot.BagType;
+import org.eclipse.ocl.pivot.ids.BuiltInTypeId;
+import org.eclipse.ocl.pivot.internal.library.executor.ExecutorPackage;
+import org.eclipse.ocl.pivot.internal.library.executor.ExecutorTypeParameter;
+
+public class EcoreExecutorBagType extends EcoreExecutorCollectionType implements BagType
+{
+	public EcoreExecutorBagType(@NonNull BuiltInTypeId typeId, @NonNull ExecutorPackage evaluationPackage, int flags, @NonNull ExecutorTypeParameter @NonNull ... typeParameters) {
+		super(typeId, evaluationPackage, flags, typeParameters);
+	}
+}
diff --git a/plugins/org.eclipse.ocl.pivot/src/org/eclipse/ocl/pivot/internal/library/ecore/EcoreExecutorCollectionType.java b/plugins/org.eclipse.ocl.pivot/src/org/eclipse/ocl/pivot/internal/library/ecore/EcoreExecutorCollectionType.java
new file mode 100644
index 0000000..a2e477f
--- /dev/null
+++ b/plugins/org.eclipse.ocl.pivot/src/org/eclipse/ocl/pivot/internal/library/ecore/EcoreExecutorCollectionType.java
@@ -0,0 +1,104 @@
+/*******************************************************************************
+ * Copyright (c) 2012, 2022 Willink Transformations and others.
+ * All rights reserved.   This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v2.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v20.html
+ *
+ * Contributors:
+ *   E.D.Willink - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.ocl.pivot.internal.library.ecore;
+
+import org.eclipse.jdt.annotation.NonNull;
+import org.eclipse.ocl.pivot.Class;
+import org.eclipse.ocl.pivot.CollectionType;
+import org.eclipse.ocl.pivot.Type;
+import org.eclipse.ocl.pivot.ids.BuiltInTypeId;
+import org.eclipse.ocl.pivot.ids.CollectionTypeId;
+import org.eclipse.ocl.pivot.internal.library.executor.ExecutorPackage;
+import org.eclipse.ocl.pivot.internal.library.executor.ExecutorTypeParameter;
+import org.eclipse.ocl.pivot.values.IntegerValue;
+import org.eclipse.ocl.pivot.values.UnlimitedNaturalValue;
+
+public class EcoreExecutorCollectionType extends EcoreExecutorType implements CollectionType
+{
+	public EcoreExecutorCollectionType(@NonNull BuiltInTypeId typeId, @NonNull ExecutorPackage evaluationPackage, int flags, @NonNull ExecutorTypeParameter @NonNull ... typeParameters) {
+		super(typeId, evaluationPackage, flags, typeParameters);
+	}
+
+	@Override
+	public @NonNull Class getContainerType() {
+		throw new UnsupportedOperationException();
+	}
+
+	@Override
+	public Type getElementType() {
+		throw new UnsupportedOperationException();
+	}
+
+	@Override
+	public Number getLower() {
+		throw new UnsupportedOperationException();
+	}
+
+	@Override
+	public @NonNull IntegerValue getLowerValue() {
+		throw new UnsupportedOperationException();
+	}
+
+	@Override
+	public @NonNull CollectionTypeId getTypeId() {
+		throw new UnsupportedOperationException();
+	}
+
+	@Override
+	public Number getUpper() {
+		throw new UnsupportedOperationException();
+	}
+
+	@Override
+	public @NonNull UnlimitedNaturalValue getUpperValue() {
+		throw new UnsupportedOperationException();
+	}
+
+	@Override
+	public String getValue() {
+		throw new UnsupportedOperationException();
+	}
+
+	@Override
+	public boolean isIsNullFree() {
+		throw new UnsupportedOperationException();
+	}
+
+	@Override
+	public void setElementType(Type value) {
+		throw new UnsupportedOperationException();
+	}
+
+	@Override
+	public void setIsNullFree(boolean value) {
+		throw new UnsupportedOperationException();
+	}
+
+	@Override
+	public void setLower(Number value) {
+		throw new UnsupportedOperationException();
+	}
+
+	@Override
+	public void setLowerValue(@NonNull IntegerValue lower) {
+		throw new UnsupportedOperationException();
+	}
+
+	@Override
+	public void setUpper(Number value) {
+		throw new UnsupportedOperationException();
+	}
+
+	@Override
+	public void setUpperValue(@NonNull UnlimitedNaturalValue upper) {
+		throw new UnsupportedOperationException();
+	}
+}
diff --git a/plugins/org.eclipse.ocl.pivot/src/org/eclipse/ocl/pivot/internal/library/ecore/EcoreExecutorInvalidType.java b/plugins/org.eclipse.ocl.pivot/src/org/eclipse/ocl/pivot/internal/library/ecore/EcoreExecutorInvalidType.java
index 728d7d1..428a196 100644
--- a/plugins/org.eclipse.ocl.pivot/src/org/eclipse/ocl/pivot/internal/library/ecore/EcoreExecutorInvalidType.java
+++ b/plugins/org.eclipse.ocl.pivot/src/org/eclipse/ocl/pivot/internal/library/ecore/EcoreExecutorInvalidType.java
@@ -11,13 +11,14 @@
 package org.eclipse.ocl.pivot.internal.library.ecore;
 
 import org.eclipse.jdt.annotation.NonNull;
+import org.eclipse.ocl.pivot.InvalidType;
 import org.eclipse.ocl.pivot.StandardLibrary;
 import org.eclipse.ocl.pivot.Type;
 import org.eclipse.ocl.pivot.ids.BuiltInTypeId;
 import org.eclipse.ocl.pivot.internal.library.executor.ExecutorPackage;
 import org.eclipse.ocl.pivot.internal.library.executor.ExecutorTypeParameter;
 
-public class EcoreExecutorInvalidType extends EcoreExecutorType
+public class EcoreExecutorInvalidType extends EcoreExecutorType implements InvalidType
 {
 	public EcoreExecutorInvalidType(@NonNull BuiltInTypeId typeId, @NonNull ExecutorPackage evaluationPackage, int flags, @NonNull ExecutorTypeParameter @NonNull ... typeParameters) {
 		super(typeId, evaluationPackage, flags | OCL_INVALID, typeParameters);
diff --git a/plugins/org.eclipse.ocl.pivot/src/org/eclipse/ocl/pivot/internal/library/ecore/EcoreExecutorOrderedSetType.java b/plugins/org.eclipse.ocl.pivot/src/org/eclipse/ocl/pivot/internal/library/ecore/EcoreExecutorOrderedSetType.java
new file mode 100644
index 0000000..2683403
--- /dev/null
+++ b/plugins/org.eclipse.ocl.pivot/src/org/eclipse/ocl/pivot/internal/library/ecore/EcoreExecutorOrderedSetType.java
@@ -0,0 +1,24 @@
+/*******************************************************************************
+ * Copyright (c) 2012, 2022 Willink Transformations and others.
+ * All rights reserved.   This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v2.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v20.html
+ *
+ * Contributors:
+ *   E.D.Willink - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.ocl.pivot.internal.library.ecore;
+
+import org.eclipse.jdt.annotation.NonNull;
+import org.eclipse.ocl.pivot.OrderedSetType;
+import org.eclipse.ocl.pivot.ids.BuiltInTypeId;
+import org.eclipse.ocl.pivot.internal.library.executor.ExecutorPackage;
+import org.eclipse.ocl.pivot.internal.library.executor.ExecutorTypeParameter;
+
+public class EcoreExecutorOrderedSetType extends EcoreExecutorCollectionType implements OrderedSetType
+{
+	public EcoreExecutorOrderedSetType(@NonNull BuiltInTypeId typeId, @NonNull ExecutorPackage evaluationPackage, int flags, @NonNull ExecutorTypeParameter @NonNull ... typeParameters) {
+		super(typeId, evaluationPackage, flags, typeParameters);
+	}
+}
diff --git a/plugins/org.eclipse.ocl.pivot/src/org/eclipse/ocl/pivot/internal/library/ecore/EcoreExecutorPrimitiveType.java b/plugins/org.eclipse.ocl.pivot/src/org/eclipse/ocl/pivot/internal/library/ecore/EcoreExecutorPrimitiveType.java
new file mode 100644
index 0000000..f178024
--- /dev/null
+++ b/plugins/org.eclipse.ocl.pivot/src/org/eclipse/ocl/pivot/internal/library/ecore/EcoreExecutorPrimitiveType.java
@@ -0,0 +1,37 @@
+/*******************************************************************************
+ * Copyright (c) 2012, 2022 Willink Transformations and others.
+ * All rights reserved.   This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v2.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v20.html
+ *
+ * Contributors:
+ *   E.D.Willink - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.ocl.pivot.internal.library.ecore;
+
+import java.util.List;
+
+import org.eclipse.jdt.annotation.NonNull;
+import org.eclipse.ocl.pivot.Operation;
+import org.eclipse.ocl.pivot.PrimitiveType;
+import org.eclipse.ocl.pivot.ids.BuiltInTypeId;
+import org.eclipse.ocl.pivot.internal.library.executor.ExecutorPackage;
+import org.eclipse.ocl.pivot.internal.library.executor.ExecutorTypeParameter;
+
+public class EcoreExecutorPrimitiveType extends EcoreExecutorType implements PrimitiveType
+{
+	public EcoreExecutorPrimitiveType(@NonNull BuiltInTypeId typeId, @NonNull ExecutorPackage evaluationPackage, int flags, @NonNull ExecutorTypeParameter @NonNull ... typeParameters) {
+		super(typeId, evaluationPackage, flags, typeParameters);
+	}
+
+	@Override
+	public List<Operation> getCoercions() {
+		throw new UnsupportedOperationException();
+	}
+
+	@Override
+	public String getValue() {
+		throw new UnsupportedOperationException();
+	}
+}
diff --git a/plugins/org.eclipse.ocl.pivot/src/org/eclipse/ocl/pivot/internal/library/ecore/EcoreExecutorSequenceType.java b/plugins/org.eclipse.ocl.pivot/src/org/eclipse/ocl/pivot/internal/library/ecore/EcoreExecutorSequenceType.java
new file mode 100644
index 0000000..63eb106
--- /dev/null
+++ b/plugins/org.eclipse.ocl.pivot/src/org/eclipse/ocl/pivot/internal/library/ecore/EcoreExecutorSequenceType.java
@@ -0,0 +1,24 @@
+/*******************************************************************************
+ * Copyright (c) 2012, 2022 Willink Transformations and others.
+ * All rights reserved.   This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v2.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v20.html
+ *
+ * Contributors:
+ *   E.D.Willink - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.ocl.pivot.internal.library.ecore;
+
+import org.eclipse.jdt.annotation.NonNull;
+import org.eclipse.ocl.pivot.SequenceType;
+import org.eclipse.ocl.pivot.ids.BuiltInTypeId;
+import org.eclipse.ocl.pivot.internal.library.executor.ExecutorPackage;
+import org.eclipse.ocl.pivot.internal.library.executor.ExecutorTypeParameter;
+
+public class EcoreExecutorSequenceType extends EcoreExecutorCollectionType implements SequenceType
+{
+	public EcoreExecutorSequenceType(@NonNull BuiltInTypeId typeId, @NonNull ExecutorPackage evaluationPackage, int flags, @NonNull ExecutorTypeParameter @NonNull ... typeParameters) {
+		super(typeId, evaluationPackage, flags, typeParameters);
+	}
+}
diff --git a/plugins/org.eclipse.ocl.pivot/src/org/eclipse/ocl/pivot/internal/library/ecore/EcoreExecutorSetType.java b/plugins/org.eclipse.ocl.pivot/src/org/eclipse/ocl/pivot/internal/library/ecore/EcoreExecutorSetType.java
new file mode 100644
index 0000000..056c4bb
--- /dev/null
+++ b/plugins/org.eclipse.ocl.pivot/src/org/eclipse/ocl/pivot/internal/library/ecore/EcoreExecutorSetType.java
@@ -0,0 +1,24 @@
+/*******************************************************************************
+ * Copyright (c) 2012, 2022 Willink Transformations and others.
+ * All rights reserved.   This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v2.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v20.html
+ *
+ * Contributors:
+ *   E.D.Willink - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.ocl.pivot.internal.library.ecore;
+
+import org.eclipse.jdt.annotation.NonNull;
+import org.eclipse.ocl.pivot.SetType;
+import org.eclipse.ocl.pivot.ids.BuiltInTypeId;
+import org.eclipse.ocl.pivot.internal.library.executor.ExecutorPackage;
+import org.eclipse.ocl.pivot.internal.library.executor.ExecutorTypeParameter;
+
+public class EcoreExecutorSetType extends EcoreExecutorCollectionType implements SetType
+{
+	public EcoreExecutorSetType(@NonNull BuiltInTypeId typeId, @NonNull ExecutorPackage evaluationPackage, int flags, @NonNull ExecutorTypeParameter @NonNull ... typeParameters) {
+		super(typeId, evaluationPackage, flags, typeParameters);
+	}
+}
diff --git a/plugins/org.eclipse.ocl.pivot/src/org/eclipse/ocl/pivot/internal/library/ecore/EcoreExecutorVoidType.java b/plugins/org.eclipse.ocl.pivot/src/org/eclipse/ocl/pivot/internal/library/ecore/EcoreExecutorVoidType.java
index b337939..adc7da9 100644
--- a/plugins/org.eclipse.ocl.pivot/src/org/eclipse/ocl/pivot/internal/library/ecore/EcoreExecutorVoidType.java
+++ b/plugins/org.eclipse.ocl.pivot/src/org/eclipse/ocl/pivot/internal/library/ecore/EcoreExecutorVoidType.java
@@ -13,11 +13,12 @@
 import org.eclipse.jdt.annotation.NonNull;
 import org.eclipse.ocl.pivot.StandardLibrary;
 import org.eclipse.ocl.pivot.Type;
+import org.eclipse.ocl.pivot.VoidType;
 import org.eclipse.ocl.pivot.ids.BuiltInTypeId;
 import org.eclipse.ocl.pivot.internal.library.executor.ExecutorPackage;
 import org.eclipse.ocl.pivot.internal.library.executor.ExecutorTypeParameter;
 
-public class EcoreExecutorVoidType extends EcoreExecutorType
+public class EcoreExecutorVoidType extends EcoreExecutorType implements VoidType
 {
 	public EcoreExecutorVoidType(@NonNull BuiltInTypeId typeId, @NonNull ExecutorPackage evaluationPackage, int flags, @NonNull ExecutorTypeParameter @NonNull ... typeParameters) {
 		super(typeId, evaluationPackage, flags | OCL_VOID, typeParameters);
diff --git a/plugins/org.eclipse.ocl.pivot/src/org/eclipse/ocl/pivot/internal/library/ecore/EcoreIdResolver.java b/plugins/org.eclipse.ocl.pivot/src/org/eclipse/ocl/pivot/internal/library/ecore/EcoreIdResolver.java
index 2b99160..6fe2781 100644
--- a/plugins/org.eclipse.ocl.pivot/src/org/eclipse/ocl/pivot/internal/library/ecore/EcoreIdResolver.java
+++ b/plugins/org.eclipse.ocl.pivot/src/org/eclipse/ocl/pivot/internal/library/ecore/EcoreIdResolver.java
@@ -113,7 +113,7 @@
 		if (value instanceof AbstractExecutorType) {	// The direct CGed Executor has no eClass() so use getMetaclass()
 			Type type = key2type.get(value);
 			if (type == null) {
-				type = standardLibrary.getMetaclass((AbstractExecutorType) value);
+				type = standardLibrary.getMetaclass((AbstractExecutorType)value);
 				assert type != null;
 				key2type.put(value, type);
 			}
diff --git a/plugins/org.eclipse.ocl.pivot/src/org/eclipse/ocl/pivot/internal/library/executor/ExecutableStandardLibrary.java b/plugins/org.eclipse.ocl.pivot/src/org/eclipse/ocl/pivot/internal/library/executor/ExecutableStandardLibrary.java
index 392368c..097f0c6 100644
--- a/plugins/org.eclipse.ocl.pivot/src/org/eclipse/ocl/pivot/internal/library/executor/ExecutableStandardLibrary.java
+++ b/plugins/org.eclipse.ocl.pivot/src/org/eclipse/ocl/pivot/internal/library/executor/ExecutableStandardLibrary.java
@@ -19,6 +19,7 @@
 
 import org.eclipse.jdt.annotation.NonNull;
 import org.eclipse.jdt.annotation.Nullable;
+import org.eclipse.ocl.pivot.BagType;
 import org.eclipse.ocl.pivot.Class;
 import org.eclipse.ocl.pivot.CollectionType;
 import org.eclipse.ocl.pivot.CompleteEnvironment;
@@ -28,6 +29,9 @@
 import org.eclipse.ocl.pivot.LambdaType;
 import org.eclipse.ocl.pivot.MapType;
 import org.eclipse.ocl.pivot.Operation;
+import org.eclipse.ocl.pivot.OrderedSetType;
+import org.eclipse.ocl.pivot.SequenceType;
+import org.eclipse.ocl.pivot.SetType;
 import org.eclipse.ocl.pivot.StandardLibrary;
 import org.eclipse.ocl.pivot.StandardLibrary.StandardLibraryExtension;
 import org.eclipse.ocl.pivot.TupleType;
@@ -36,10 +40,13 @@
 import org.eclipse.ocl.pivot.ids.PrimitiveTypeId;
 import org.eclipse.ocl.pivot.ids.TemplateParameterId;
 import org.eclipse.ocl.pivot.ids.TupleTypeId;
-import org.eclipse.ocl.pivot.ids.TypeId;
 import org.eclipse.ocl.pivot.internal.elements.AbstractExecutorElement;
+import org.eclipse.ocl.pivot.internal.executor.ExecutorBagType;
 import org.eclipse.ocl.pivot.internal.executor.ExecutorCollectionType;
 import org.eclipse.ocl.pivot.internal.executor.ExecutorMapType;
+import org.eclipse.ocl.pivot.internal.executor.ExecutorOrderedSetType;
+import org.eclipse.ocl.pivot.internal.executor.ExecutorSequenceType;
+import org.eclipse.ocl.pivot.internal.executor.ExecutorSetType;
 import org.eclipse.ocl.pivot.internal.executor.ExecutorTupleType;
 import org.eclipse.ocl.pivot.messages.StatusCodes;
 import org.eclipse.ocl.pivot.oclstdlib.OCLstdlibTables;
@@ -140,7 +147,22 @@
 			specializedType = weakGet(map, typeParameters);
 		}
 		if (specializedType == null) {
-			specializedType = new ExecutorCollectionType(ClassUtil.nonNullModel(genericType.getName()), genericType, elementType, isNullFree, lower, upper);
+			String name = ClassUtil.nonNullModel(genericType.getName());
+			if (genericType instanceof BagType) {
+				specializedType = new ExecutorBagType(name, genericType, elementType, isNullFree, lower, upper);
+			}
+			else if (genericType instanceof OrderedSetType) {
+				specializedType = new ExecutorOrderedSetType(name, genericType, elementType, isNullFree, lower, upper);
+			}
+			else if (genericType instanceof SequenceType) {
+				specializedType = new ExecutorSequenceType(name, genericType, elementType, isNullFree, lower, upper);
+			}
+			else if (genericType instanceof SetType) {
+				specializedType = new ExecutorSetType(name, genericType, elementType, isNullFree, lower, upper);
+			}
+			else {
+				specializedType = new ExecutorCollectionType(name, genericType, elementType, isNullFree, lower, upper);
+			}
 			map.put(typeParameters, new WeakReference<>(specializedType));
 		}
 		return specializedType;
@@ -205,42 +227,14 @@
 		return specializedType;
 	}
 
-	// FIXME cf MetamodelManager
 	@Override
-	public org.eclipse.ocl.pivot.@NonNull Class getMetaclass(@NonNull Type classType) {
-		org.eclipse.ocl.pivot.Class metaType = null;
-		if (classType instanceof CollectionType) {
-			CollectionType collectionType = (CollectionType)classType;
-			if (collectionType.isOrdered()) {
-				if (collectionType.isUnique()) {
-					metaType = getPivotType(TypeId.ORDERED_SET_TYPE_NAME);
-				}
-				else {
-					metaType =  getPivotType(TypeId.SEQUENCE_TYPE_NAME);
-				}
-			}
-			else {
-				if (collectionType.isUnique()) {
-					metaType =  getPivotType(TypeId.SET_TYPE_NAME);
-				}
-				else {
-					metaType =  getPivotType(TypeId.BAG_TYPE_NAME);
-				}
-			}
-
-		}
-		else if (classType instanceof MapType) {
-			metaType =  getPivotType(TypeId.MAP_TYPE_NAME);
-		}
-		if (metaType != null) {
-			return metaType;
-		}
-		//		return OCLstdlibTables.Types._OclType;
-		return getClassType();
+	public org.eclipse.ocl.pivot.@NonNull Class getMetaclass(@NonNull Type asInstanceType) {
+		String metaclassName = TypeUtil.getMetaclassName(asInstanceType);
+		return ClassUtil.nonNullState(getPivotType(metaclassName));
 	}
 
 	@Override
-	public Type getMetaType(@NonNull Type instanceType) {
+	public @NonNull Type getMetaType(@NonNull Type instanceType) {
 		throw new UnsupportedOperationException();
 	}
 
@@ -473,7 +467,7 @@
 	}
 
 	public synchronized @NonNull TupleType getTupleType(@NonNull TupleTypeId typeId) {
-		WeakReference<TupleType> ref = tupleTypeMap.get(typeId);
+		WeakReference<@NonNull TupleType> ref = tupleTypeMap.get(typeId);
 		if (ref != null) {
 			TupleType domainTupleType = ref.get();
 			if (domainTupleType != null) {
@@ -524,7 +518,7 @@
 	 * Return the map.get(key).get() entry if there is one or null if not, removing any stale
 	 * entry that may be encountered.
 	 */
-	protected <K, V> @Nullable V weakGet(@NonNull Map<K, WeakReference<V>> map, @NonNull K key) {
+	protected <K, V> @Nullable V weakGet(@NonNull Map<K, @NonNull WeakReference<V>> map, @NonNull K key) {
 		WeakReference<V> ref = map.get(key);
 		if (ref == null) {
 			return null;
diff --git a/plugins/org.eclipse.ocl.pivot/src/org/eclipse/ocl/pivot/internal/library/executor/ExecutorStandardLibrary.java b/plugins/org.eclipse.ocl.pivot/src/org/eclipse/ocl/pivot/internal/library/executor/ExecutorStandardLibrary.java
index 2930a35..90054aa 100644
--- a/plugins/org.eclipse.ocl.pivot/src/org/eclipse/ocl/pivot/internal/library/executor/ExecutorStandardLibrary.java
+++ b/plugins/org.eclipse.ocl.pivot/src/org/eclipse/ocl/pivot/internal/library/executor/ExecutorStandardLibrary.java
@@ -34,9 +34,9 @@
 
 public class ExecutorStandardLibrary extends ExecutableStandardLibrary
 {
-	private @NonNull Map<@NonNull String, WeakReference<EcoreExecutorPackage>> ePackageMap = new WeakHashMap<>();
-	private Map<org.eclipse.ocl.pivot.@NonNull Package, WeakReference<DomainReflectivePackage>> asPackageMap = null;
-	private /*@LazyNonNull*/ Map<EcoreExecutorPackage, List<EcoreExecutorPackage>> extensions = null;
+	private @NonNull Map<@NonNull String, WeakReference<@NonNull EcoreExecutorPackage>> ePackageMap = new WeakHashMap<>();
+	private Map<org.eclipse.ocl.pivot.@NonNull Package, @NonNull WeakReference<@NonNull DomainReflectivePackage>> asPackageMap = null;
+	private /*@LazyNonNull*/ Map<@NonNull EcoreExecutorPackage, @NonNull List<@NonNull EcoreExecutorPackage>> extensions = null;
 	private /*@LazyNonNull*/ org.eclipse.ocl.pivot.Class classType = null;
 	private /*@LazyNonNull*/ org.eclipse.ocl.pivot.Class enumerationType = null;
 
@@ -49,11 +49,11 @@
 	}
 
 	public void addExtension(@NonNull EcoreExecutorPackage basePackage, @NonNull EcoreExecutorPackage extensionPackage) {
-		Map<EcoreExecutorPackage, List<EcoreExecutorPackage>> extensions2 = extensions;
+		Map<@NonNull EcoreExecutorPackage, @NonNull List<@NonNull EcoreExecutorPackage>> extensions2 = extensions;
 		if (extensions2 == null) {
 			extensions = extensions2 = new HashMap<>();
 		}
-		List<EcoreExecutorPackage> list = extensions2.get(basePackage);
+		List<@NonNull EcoreExecutorPackage> list = extensions2.get(basePackage);
 		if (list == null) {
 			list = new ArrayList<>();
 			extensions2.put(basePackage, list);
@@ -65,7 +65,7 @@
 		String uri = execPackage.getURI();
 		assert uri != null;
 		@SuppressWarnings("unused")
-		WeakReference<EcoreExecutorPackage> oldExecPackage = ePackageMap.put(uri, new WeakReference<>(execPackage));
+		WeakReference<@NonNull EcoreExecutorPackage> oldExecPackage = ePackageMap.put(uri, new WeakReference<>(execPackage));
 		//		if ((oldExecPackage != null) && (oldExecPackage != execPackage)) {
 		//			Iterable<ExecutorType> newTypes = execPackage.getOwnedType();
 		//			for (DomainType oldType : oldExecPackage.getOwnedType()) {
@@ -76,7 +76,7 @@
 
 	@Override
 	public org.eclipse.ocl.pivot.@NonNull Class getClassType() {
-		Map<EcoreExecutorPackage, List<EcoreExecutorPackage>> extensions2 = extensions;
+		Map<@NonNull EcoreExecutorPackage, @NonNull List<@NonNull EcoreExecutorPackage>> extensions2 = extensions;
 		if (extensions2 == null) {
 			throw new IllegalStateException("No extension package registered to define Class type"); //$NON-NLS-1$
 		}
@@ -92,7 +92,7 @@
 
 	@Override
 	public org.eclipse.ocl.pivot.@NonNull Class getEnumerationType() {
-		Map<EcoreExecutorPackage, List<EcoreExecutorPackage>> extensions2 = extensions;
+		Map<@NonNull EcoreExecutorPackage, @NonNull List<@NonNull EcoreExecutorPackage>> extensions2 = extensions;
 		if (extensions2 == null) {
 			throw new IllegalStateException("No extension package registered to define Enumeration type"); //$NON-NLS-1$
 		}
@@ -130,7 +130,7 @@
 			}
 		}
 		org.eclipse.ocl.pivot.Package asPackage = asClass.getOwningPackage();
-		Map<org.eclipse.ocl.pivot.Package, WeakReference<DomainReflectivePackage>> asPackageMap2;
+		Map<org.eclipse.ocl.pivot.@NonNull Package, @NonNull WeakReference<@NonNull DomainReflectivePackage>> asPackageMap2;
 		synchronized (this) {
 			String nsURI = asPackage.getURI();
 			EcoreExecutorPackage ecoreExecutorPackage = nsURI != null ? weakGet(ePackageMap, nsURI) : null;
@@ -140,11 +140,11 @@
 				if (executorType != null) {
 					return executorType;
 				}
-				Map<EcoreExecutorPackage, List<EcoreExecutorPackage>> extensions2 = extensions;
+				Map<@NonNull EcoreExecutorPackage, @NonNull List<@NonNull EcoreExecutorPackage>> extensions2 = extensions;
 				if (extensions2 != null) {
-					List<EcoreExecutorPackage> packages = extensions2.get(ecoreExecutorPackage);
+					List<@NonNull EcoreExecutorPackage> packages = extensions2.get(ecoreExecutorPackage);
 					if (packages != null) {
-						for (@SuppressWarnings("null")@NonNull EcoreExecutorPackage extensionPackage : packages) {
+						for (@NonNull EcoreExecutorPackage extensionPackage : packages) {
 							executorType = extensionPackage.getOwnedClass(name);
 							if (executorType != null) {
 								break;
diff --git a/plugins/org.eclipse.ocl.pivot/src/org/eclipse/ocl/pivot/internal/manager/PivotMetamodelManager.java b/plugins/org.eclipse.ocl.pivot/src/org/eclipse/ocl/pivot/internal/manager/PivotMetamodelManager.java
index 8c6c910..ce72523 100644
--- a/plugins/org.eclipse.ocl.pivot/src/org/eclipse/ocl/pivot/internal/manager/PivotMetamodelManager.java
+++ b/plugins/org.eclipse.ocl.pivot/src/org/eclipse/ocl/pivot/internal/manager/PivotMetamodelManager.java
@@ -1438,32 +1438,9 @@
 		return new CompleteClassPropertiesIterable(getAllTypes(type), selectStatic);
 	}
 
-	public org.eclipse.ocl.pivot.@NonNull Class getMetaclass(@NonNull Type domainInstanceType) {
-		org.eclipse.ocl.pivot.Class metaType = null;
-		if (domainInstanceType instanceof CollectionType) {
-			CollectionType collectionType = (CollectionType)domainInstanceType;
-			if (collectionType.isOrdered()) {
-				if (collectionType.isUnique()) {
-					metaType = getASClass(TypeId.ORDERED_SET_TYPE_NAME);
-				}
-				else {
-					metaType = getASClass(TypeId.SEQUENCE_TYPE_NAME);
-				}
-			}
-			else {
-				if (collectionType.isUnique()) {
-					metaType = getASClass(TypeId.SET_TYPE_NAME);
-				}
-				else {
-					metaType = getASClass(TypeId.BAG_TYPE_NAME);
-				}
-			}
-
-		}
-		if (metaType != null) {
-			return metaType;
-		}
-		return standardLibrary.getClassType();
+	public org.eclipse.ocl.pivot.@NonNull Class getMetaclass(@NonNull Type asInstanceType) {
+		String metaclassName = TypeUtil.getMetaclassName(asInstanceType);
+		return ClassUtil.nonNullState(getASClass(metaclassName));
 	}
 
 	public @Nullable Type getOclType(@NonNull String typeName) {
diff --git a/plugins/org.eclipse.ocl.pivot/src/org/eclipse/ocl/pivot/internal/scoping/EnvironmentView.java b/plugins/org.eclipse.ocl.pivot/src/org/eclipse/ocl/pivot/internal/scoping/EnvironmentView.java
index a8e2e15..5655043 100644
--- a/plugins/org.eclipse.ocl.pivot/src/org/eclipse/ocl/pivot/internal/scoping/EnvironmentView.java
+++ b/plugins/org.eclipse.ocl.pivot/src/org/eclipse/ocl/pivot/internal/scoping/EnvironmentView.java
@@ -983,7 +983,7 @@
 	 */
 	public boolean hasFinalResult() {
 		if (contentsSize == 0) {
-			return false; // Not thing found is not a final result
+			return false; // Nothing found is not a final result
 		}
 		if (getName() == null) {
 			return false; // No name means search full hierarchy
diff --git a/plugins/org.eclipse.ocl.pivot/src/org/eclipse/ocl/pivot/utilities/PivotHelper.java b/plugins/org.eclipse.ocl.pivot/src/org/eclipse/ocl/pivot/utilities/PivotHelper.java
index 79cead4..448b506 100644
--- a/plugins/org.eclipse.ocl.pivot/src/org/eclipse/ocl/pivot/utilities/PivotHelper.java
+++ b/plugins/org.eclipse.ocl.pivot/src/org/eclipse/ocl/pivot/utilities/PivotHelper.java
@@ -65,7 +65,6 @@
 import org.eclipse.ocl.pivot.ShadowPart;
 import org.eclipse.ocl.pivot.StandardLibrary;
 import org.eclipse.ocl.pivot.StringLiteralExp;
-import org.eclipse.ocl.pivot.TemplateParameter;
 import org.eclipse.ocl.pivot.TupleLiteralExp;
 import org.eclipse.ocl.pivot.TupleLiteralPart;
 import org.eclipse.ocl.pivot.TupleType;
@@ -322,14 +321,14 @@
 				boolean gotOne = true;
 				for (int i = 0; i < argumentCount; i++) {
 					Type asParameterType = ClassUtil.nonNullState(asParameters.get(i).getType());
+					OCLExpression asArgument = asArguments[i];
+					Type asArgumentType = asArgument.getType();
 					if (asParameterType instanceof SelfType) {
-						Type asArgumentType = asArguments[i].getType();
 						if (asArgumentType.conformsTo(standardLibrary, asType) && asType.conformsTo(standardLibrary, asArgumentType)) {
 							exactMatches++;
 						}
 					}
 					else {
-						Type asArgumentType = asArguments[i].getType();
 						if (!asArgumentType.conformsTo(standardLibrary, asParameterType)) {
 							gotOne = false;
 							break;
@@ -488,12 +487,14 @@
 		return tupleLiteralPart;
 	}
 
-	public @NonNull TypeExp createTypeExp(@NonNull Type type) {
+	public @NonNull TypeExp createTypeExp(@NonNull Type type) {		// FIXME Class
+		assert type instanceof org.eclipse.ocl.pivot.Class;		// Not TemplateParameter
 		TypeExp asTypeExp = PivotFactory.eINSTANCE.createTypeExp();
 		asTypeExp.setIsRequired(true);
 		asTypeExp.setReferredType(type);
 		asTypeExp.setName(type.getName());
-		asTypeExp.setType(type instanceof TemplateParameter ? metamodelManager.getOclType("TemplateParameter") : standardLibrary.getClassType());
+		Type metaType = standardLibrary.getMetaclass(type);
+		asTypeExp.setType(metaType);
 		asTypeExp.setTypeValue(type);
 		return asTypeExp;
 	}
diff --git a/plugins/org.eclipse.ocl.pivot/src/org/eclipse/ocl/pivot/utilities/TypeUtil.java b/plugins/org.eclipse.ocl.pivot/src/org/eclipse/ocl/pivot/utilities/TypeUtil.java
index 929010c..6404293 100644
--- a/plugins/org.eclipse.ocl.pivot/src/org/eclipse/ocl/pivot/utilities/TypeUtil.java
+++ b/plugins/org.eclipse.ocl.pivot/src/org/eclipse/ocl/pivot/utilities/TypeUtil.java
@@ -14,25 +14,31 @@
 
 import org.eclipse.jdt.annotation.NonNull;
 import org.eclipse.jdt.annotation.Nullable;
+import org.eclipse.ocl.pivot.AnyType;
 import org.eclipse.ocl.pivot.BagType;
 import org.eclipse.ocl.pivot.CollectionKind;
 import org.eclipse.ocl.pivot.CollectionType;
 import org.eclipse.ocl.pivot.CompleteInheritance;
+import org.eclipse.ocl.pivot.Enumeration;
+import org.eclipse.ocl.pivot.InvalidType;
 import org.eclipse.ocl.pivot.Iteration;
 import org.eclipse.ocl.pivot.LambdaType;
 import org.eclipse.ocl.pivot.MapType;
 import org.eclipse.ocl.pivot.Operation;
 import org.eclipse.ocl.pivot.OrderedSetType;
 import org.eclipse.ocl.pivot.ParameterTypes;
+import org.eclipse.ocl.pivot.PrimitiveType;
 import org.eclipse.ocl.pivot.SequenceType;
 import org.eclipse.ocl.pivot.SetType;
 import org.eclipse.ocl.pivot.StandardLibrary;
 import org.eclipse.ocl.pivot.StandardLibrary.StandardLibraryExtension;
+import org.eclipse.ocl.pivot.Stereotype;
 import org.eclipse.ocl.pivot.TemplateParameter;
 import org.eclipse.ocl.pivot.TemplateParameters;
 import org.eclipse.ocl.pivot.TupleType;
 import org.eclipse.ocl.pivot.Type;
 import org.eclipse.ocl.pivot.TypedElement;
+import org.eclipse.ocl.pivot.VoidType;
 import org.eclipse.ocl.pivot.ids.PrimitiveTypeId;
 import org.eclipse.ocl.pivot.ids.TypeId;
 import org.eclipse.ocl.pivot.internal.values.CollectionTypeParametersImpl;
@@ -187,6 +193,54 @@
 		return parameterTypes;
 	}
 
+	public static @NonNull String getMetaclassName(@NonNull Type asInstanceType) {
+		if (asInstanceType instanceof CollectionType) {
+			if (asInstanceType instanceof BagType) {
+				return TypeId.BAG_TYPE_NAME;
+			}
+			else if (asInstanceType instanceof OrderedSetType) {
+				return TypeId.ORDERED_SET_TYPE_NAME;
+			}
+			else if (asInstanceType instanceof SequenceType) {
+				return TypeId.SEQUENCE_TYPE_NAME;
+			}
+			else if (asInstanceType instanceof SetType) {
+				return TypeId.SET_TYPE_NAME;
+			}
+			else {
+				return TypeId.COLLECTION_TYPE_NAME;
+			}
+		}
+		else if (asInstanceType instanceof AnyType) {
+			return TypeId.ANY_TYPE_NAME;
+		}
+		else if (asInstanceType instanceof Enumeration) {
+			return TypeId.ENUMERATION_NAME;
+		}
+		else if (asInstanceType instanceof InvalidType) {
+			return TypeId.INVALID_TYPE_NAME;
+		}
+		else if (asInstanceType instanceof MapType) {
+			return TypeId.MAP_TYPE_NAME;
+		}
+		else if (asInstanceType instanceof VoidType) {
+			return TypeId.VOID_TYPE_NAME;
+		}
+	//	else if (asInstanceType instanceof BooleanType) {
+	//		return TypeId.BOOLEAN_TYPE_NAME;
+	//	}
+		else if (asInstanceType instanceof PrimitiveType) {
+			return TypeId.PRIMITIVE_TYPE_NAME;
+		}
+		else if (asInstanceType instanceof Stereotype) {
+			return TypeId.STEREOTYPE_NAME;
+		}
+		else if (asInstanceType instanceof TupleType) {
+			return TypeId.TUPLE_TYPE_NAME;
+		}
+		return TypeId.CLASS_NAME;		// fallback for e.g. TemplateParameter
+	}
+
 	public static @NonNull Type @NonNull [] getOperationParameterTypes(@NonNull Operation anOperation) {
 		@NonNull Type @NonNull [] parameterTypes;
 		int iParameter = 0;
diff --git a/plugins/org.eclipse.ocl.pivot/src/org/eclipse/ocl/pivot/utilities/ValueUtil.java b/plugins/org.eclipse.ocl.pivot/src/org/eclipse/ocl/pivot/utilities/ValueUtil.java
index 6e2b7f6..d777405 100644
--- a/plugins/org.eclipse.ocl.pivot/src/org/eclipse/ocl/pivot/utilities/ValueUtil.java
+++ b/plugins/org.eclipse.ocl.pivot/src/org/eclipse/ocl/pivot/utilities/ValueUtil.java
@@ -352,7 +352,7 @@
 			return (Stereotype)value;
 		}
 		else {
-			throw new InvalidValueException(PivotMessages.TypedValueRequired, "Stereotype", getTypeName(value));
+			throw new InvalidValueException(PivotMessages.TypedValueRequired, TypeId.STEREOTYPE_NAME, getTypeName(value));
 		}
 	}
 
diff --git a/plugins/org.eclipse.ocl.xtext.essentialocl/src/org/eclipse/ocl/xtext/essentialocl/as2cs/EssentialOCLDeclarationVisitor.java b/plugins/org.eclipse.ocl.xtext.essentialocl/src/org/eclipse/ocl/xtext/essentialocl/as2cs/EssentialOCLDeclarationVisitor.java
index 336c9ff..9356eb9 100644
--- a/plugins/org.eclipse.ocl.xtext.essentialocl/src/org/eclipse/ocl/xtext/essentialocl/as2cs/EssentialOCLDeclarationVisitor.java
+++ b/plugins/org.eclipse.ocl.xtext.essentialocl/src/org/eclipse/ocl/xtext/essentialocl/as2cs/EssentialOCLDeclarationVisitor.java
@@ -862,7 +862,7 @@
 	@Override
 	public @Nullable ElementCS visitTypeExp(@NonNull TypeExp asTypeExp) {
 		Type asType = getNonNullType(asTypeExp.getReferredType());
-		if (asType instanceof TemplateParameter) {
+		if (asType instanceof TemplateParameter) {			// FIXME Never happens
 			NameExpCS csNameExp = EssentialOCLCSFactory.eINSTANCE.createNameExpCS();
 			PathNameCS csPathName = BaseCSFactory.eINSTANCE.createPathNameCS();
 			csNameExp.setOwnedPathName(csPathName);
diff --git a/plugins/org.eclipse.ocl.xtext.essentialocl/src/org/eclipse/ocl/xtext/essentialocl/cs2as/EssentialOCLCSLeft2RightVisitor.java b/plugins/org.eclipse.ocl.xtext.essentialocl/src/org/eclipse/ocl/xtext/essentialocl/cs2as/EssentialOCLCSLeft2RightVisitor.java
index 22127fc..a5fcd72 100644
--- a/plugins/org.eclipse.ocl.xtext.essentialocl/src/org/eclipse/ocl/xtext/essentialocl/cs2as/EssentialOCLCSLeft2RightVisitor.java
+++ b/plugins/org.eclipse.ocl.xtext.essentialocl/src/org/eclipse/ocl/xtext/essentialocl/cs2as/EssentialOCLCSLeft2RightVisitor.java
@@ -68,7 +68,6 @@
 import org.eclipse.ocl.pivot.ShadowPart;
 import org.eclipse.ocl.pivot.State;
 import org.eclipse.ocl.pivot.StateExp;
-import org.eclipse.ocl.pivot.Stereotype;
 import org.eclipse.ocl.pivot.StringLiteralExp;
 import org.eclipse.ocl.pivot.TemplateParameter;
 import org.eclipse.ocl.pivot.TupleLiteralExp;
@@ -1433,7 +1432,8 @@
 			actualType = formalType;
 		}
 		if (property.isIsStatic() && (actualType.isTemplateParameter() != null)) {
-			actualType = metamodelManager.getMetaclass(actualType);
+		//	actualType = metamodelManager.getMetaclass(actualType);
+			actualType = standardLibrary.getClassType();   //getASClass("TemplateParameter");	// BUG 496810#c8 review once static functionality fixed
 		}
 		return actualType;
 	}
@@ -1507,18 +1507,10 @@
 		return expression;
 	}
 
-	protected @NonNull TypeExp resolveTypeExp(@NonNull ExpCS csExp, @NonNull Type type) {
+	protected @NonNull TypeExp resolveTypeExp(@NonNull ExpCS csExp, @NonNull Type type) {		// FIXME Class
+		assert type instanceof org.eclipse.ocl.pivot.Class;		// Not TemplateParameter
 		TypeExp expression = context.refreshModelElement(TypeExp.class, PivotPackage.Literals.TYPE_EXP, csExp);
-		Type asType = null;
-		if (type instanceof TemplateParameter) {
-			asType = metamodelManager.getOclType("TemplateParameter");
-		}
-		else if (type instanceof Stereotype){
-			asType = metamodelManager.getOclType("Stereotype");
-		}
-		else {
-			asType = standardLibrary.getClassType();
-		}
+		Type asType = standardLibrary.getMetaclass(type);
 		helper.setType(expression, asType, true, type);
 		expression.setReferredType(type);
 		expression.setName(type.getName());
diff --git a/plugins/org.eclipse.ocl.xtext.essentialocl/src/org/eclipse/ocl/xtext/essentialocl/scoping/EssentialOCLScoping.java b/plugins/org.eclipse.ocl.xtext.essentialocl/src/org/eclipse/ocl/xtext/essentialocl/scoping/EssentialOCLScoping.java
index 1eb6f83..5359098 100644
--- a/plugins/org.eclipse.ocl.xtext.essentialocl/src/org/eclipse/ocl/xtext/essentialocl/scoping/EssentialOCLScoping.java
+++ b/plugins/org.eclipse.ocl.xtext.essentialocl/src/org/eclipse/ocl/xtext/essentialocl/scoping/EssentialOCLScoping.java
@@ -124,7 +124,7 @@
 					if ((arguments.size() > 0) && (arguments.get(0).getRole() == NavigationRole.ITERATOR)) {
 						messageTemplate = PivotMessagesInternal.UnresolvedIterationCall_ERROR_;
 					}
-					else {
+					else {		// FIXME If e.g. self.unresolved() for a Class-valued self, csNameExp.getSourceTypeValue() != null -- is the 'static' diagnosis valid / helpful ?
 						messageTemplate = csNameExp.getSourceTypeValue() != null ? PivotMessagesInternal.UnresolvedStaticOperationCall_ERROR_ : PivotMessagesInternal.UnresolvedOperationCall_ERROR_;
 					}
 				}
diff --git a/tests/org.eclipse.ocl.examples.xtext.tests/src/org/eclipse/ocl/examples/pivot/tests/EvaluateNameVisibilityTest4.java b/tests/org.eclipse.ocl.examples.xtext.tests/src/org/eclipse/ocl/examples/pivot/tests/EvaluateNameVisibilityTest4.java
index 0588fd3..bde71e4 100644
--- a/tests/org.eclipse.ocl.examples.xtext.tests/src/org/eclipse/ocl/examples/pivot/tests/EvaluateNameVisibilityTest4.java
+++ b/tests/org.eclipse.ocl.examples.xtext.tests/src/org/eclipse/ocl/examples/pivot/tests/EvaluateNameVisibilityTest4.java
@@ -132,8 +132,8 @@
 		ocl.assertSemanticErrorQuery(null, "let a : Set(Type) = null in a->Package()", PivotMessagesInternal.UnresolvedOperation_ERROR_, "Set(Type)", "Package");
 		ocl.assertSemanticErrorQuery(null, "Type->Package", PivotMessagesInternal.UnresolvedProperty_ERROR_, "Set(Class)", "Package");
 		ocl.assertSemanticErrorQuery(null, "Type->Package()", PivotMessagesInternal.UnresolvedOperation_ERROR_, "Set(Class)", "Package");
-		ocl.assertSemanticErrorQuery(null, "Set(Type)->Package", PivotMessagesInternal.UnresolvedProperty_ERROR_, "Set(Class)", "Package");
-		ocl.assertSemanticErrorQuery(null, "Set(Type)->Package()", PivotMessagesInternal.UnresolvedOperation_ERROR_, "Set(Class)", "Package");
+		ocl.assertSemanticErrorQuery(null, "Set(Type)->Package", PivotMessagesInternal.UnresolvedProperty_ERROR_, "Set(SetType)", "Package");
+		ocl.assertSemanticErrorQuery(null, "Set(Type)->Package()", PivotMessagesInternal.UnresolvedOperation_ERROR_, "Set(SetType)", "Package");
 		ocl.assertSemanticErrorQuery(null, "let a : Type = null in a.if", "no viable alternative following input ''if''");
 		ocl.assertSemanticErrorQuery(null, "let a : Type = null in a->if", "no viable alternative following input ''if''");
 		// oclAsSet()
diff --git a/tests/org.eclipse.ocl.examples.xtext.tests/src/org/eclipse/ocl/examples/pivot/tests/EvaluateOclAnyOperationsTest4.java b/tests/org.eclipse.ocl.examples.xtext.tests/src/org/eclipse/ocl/examples/pivot/tests/EvaluateOclAnyOperationsTest4.java
index 60b015b..70921aa 100644
--- a/tests/org.eclipse.ocl.examples.xtext.tests/src/org/eclipse/ocl/examples/pivot/tests/EvaluateOclAnyOperationsTest4.java
+++ b/tests/org.eclipse.ocl.examples.xtext.tests/src/org/eclipse/ocl/examples/pivot/tests/EvaluateOclAnyOperationsTest4.java
@@ -733,7 +733,7 @@
 		StandardLibrary standardLibrary = environmentFactory.getStandardLibrary();
 		org.eclipse.ocl.pivot.Class booleanType = standardLibrary.getBooleanType();
 		org.eclipse.ocl.pivot.Class classType = standardLibrary.getClassType();
-		org.eclipse.ocl.pivot.Class primitiveType = useCodeGen ? classType : environmentFactory.getASClass("PrimitiveType");
+		org.eclipse.ocl.pivot.Class primitiveType = environmentFactory.getASClass("PrimitiveType");
 		assert primitiveType != null;
 		ocl.assertQueryEquals(null, booleanType, "true.oclType()");
 		ocl.assertQueryEquals(null, "Boolean", "true.oclType().name");
@@ -802,7 +802,7 @@
 		EnvironmentFactoryInternalExtension environmentFactory = (EnvironmentFactoryInternalExtension) ocl.getEnvironmentFactory();
 		StandardLibrary standardLibrary = environmentFactory.getStandardLibrary();
 		@NonNull Type collectionKindType = ClassUtil.nonNullState(environmentFactory.getASClass("CollectionKind"));
-		org.eclipse.ocl.pivot.Class enumerationType = useCodeGen ? standardLibrary.getClassType() : standardLibrary.getEnumerationType();
+		org.eclipse.ocl.pivot.Class enumerationType = standardLibrary.getEnumerationType();
 		//    	ocl.assertQueryEquals(null, metamodelManager.getPivotType("EnumerationLiteral"), "CollectionKind::Set.oclType()");
 		// NB this is not EnumerationLiteral: cf. 4.oclType() is Integer not IntegerLiteral.
 		ocl.assertQueryEquals(null, environmentFactory.getASClass("CollectionKind"), "CollectionKind::Set.oclType()");
@@ -811,7 +811,7 @@
 		ocl.assertQueryEquals(null, "CollectionKind", "CollectionKind.name");
 		ocl.assertQueryEquals(null, enumerationType, "CollectionKind.oclType()");
 		ocl.assertQueryEquals(null, 5, "CollectionKind.allLiterals->size()");
-		ocl.assertSemanticErrorQuery(null, "CollectionKind.oclType().ownedLiteral", PivotMessagesInternal.UnresolvedStaticProperty_ERROR_, "Class", "ownedLiteral");
+		ocl.assertSemanticErrorQuery(null, "CollectionKind.oclType().ownedLiteral", PivotMessagesInternal.UnresolvedStaticProperty_ERROR_, "Enumeration", "ownedLiteral");
 		ocl.assertQueryResults(null, "Set{CollectionKind::Bag,CollectionKind::Collection,CollectionKind::_'OrderedSet',CollectionKind::_'Sequence',CollectionKind::_'Set'}", "CollectionKind.allInstances()");
 		ocl.assertQueryResults(null, "Set{CollectionKind::Bag,CollectionKind::Collection,CollectionKind::OrderedSet,CollectionKind::Sequence,CollectionKind::Set}", "CollectionKind::Set.oclType().allInstances()");
 		ocl.assertQueryResults(null, "Set{}", "CollectionKind.oclType().allInstances()");
@@ -825,8 +825,10 @@
 		MyOCL ocl = createOCL();
 		EnvironmentFactoryInternalExtension environmentFactory = (EnvironmentFactoryInternalExtension) ocl.getEnvironmentFactory();
 		StandardLibrary standardLibrary = environmentFactory.getStandardLibrary();
-		org.eclipse.ocl.pivot.Class primitiveType = useCodeGen ? standardLibrary.getClassType() : environmentFactory.getASClass("PrimitiveType");
+		org.eclipse.ocl.pivot.Class primitiveType = environmentFactory.getASClass("PrimitiveType");
 		org.eclipse.ocl.pivot.Class integerType = standardLibrary.getIntegerType();
+		ocl.assertQueryEquals(null, integerType, "Integer");
+//
 		ocl.assertQueryEquals(null, standardLibrary.getIntegerType(), "3.oclType()");
 		ocl.assertQueryEquals(null, standardLibrary.getRealType(), "3.0.oclType()");
 		ocl.assertQueryEquals(null, standardLibrary.getUnlimitedNaturalType(), "*.oclType()");
@@ -847,7 +849,7 @@
 		EnvironmentFactoryInternalExtension environmentFactory = (EnvironmentFactoryInternalExtension) ocl.getEnvironmentFactory();
 		StandardLibrary standardLibrary = environmentFactory.getStandardLibrary();
 		org.eclipse.ocl.pivot.Class anyType = standardLibrary.getOclAnyType();
-		org.eclipse.ocl.pivot.Class anyTypeClass = useCodeGen ? standardLibrary.getClassType() : environmentFactory.getASClass("AnyType");
+		org.eclipse.ocl.pivot.Class anyTypeClass = environmentFactory.getASClass("AnyType");
 		ocl.assertQueryEquals(null, standardLibrary.getOclVoidType(), "null.oclType()");
 		//    	ocl.assertQueryEquals(null, standardLibrary.getOclVoidType(), "null.oclAsType(OclAny).oclType()");		// Cast does not change the dynamic type
 		//    	ocl.assertQueryEquals(null, "OclAny", "null.oclAsType(OclAny).name");
@@ -868,7 +870,7 @@
 		EnvironmentFactoryInternalExtension environmentFactory = (EnvironmentFactoryInternalExtension) ocl.getEnvironmentFactory();
 		StandardLibrary standardLibrary = environmentFactory.getStandardLibrary();
 		org.eclipse.ocl.pivot.Class invalidType = standardLibrary.getOclInvalidType();
-		org.eclipse.ocl.pivot.Class invalidTypeClass = useCodeGen ? standardLibrary.getClassType() : environmentFactory.getASClass("InvalidType");
+		org.eclipse.ocl.pivot.Class invalidTypeClass = environmentFactory.getASClass("InvalidType");
 		ocl.assertQueryInvalid(null, "invalid.oclType()");
 		ocl.assertQueryInvalid(null, "invalid.oclType().name");
 		ocl.assertQueryEquals(null, invalidType, "OclInvalid");
@@ -888,7 +890,7 @@
 		MyOCL ocl = createOCL();
 		EnvironmentFactoryInternalExtension environmentFactory = (EnvironmentFactoryInternalExtension) ocl.getEnvironmentFactory();
 		StandardLibrary standardLibrary = environmentFactory.getStandardLibrary();
-		org.eclipse.ocl.pivot.Class voidTypeClass = useCodeGen ? standardLibrary.getClassType() : environmentFactory.getASClass("VoidType");
+		org.eclipse.ocl.pivot.Class voidTypeClass = environmentFactory.getASClass("VoidType");
 		org.eclipse.ocl.pivot.Class nullType = standardLibrary.getOclVoidType();
 		ocl.assertQueryEquals(null, nullType, "null.oclType()");
 		ocl.assertQueryEquals(null, "OclVoid", "null.oclType().name");
@@ -909,7 +911,7 @@
 		MyOCL ocl = createOCL();
 		EnvironmentFactoryInternalExtension environmentFactory = (EnvironmentFactoryInternalExtension) ocl.getEnvironmentFactory();
 		StandardLibrary standardLibrary = environmentFactory.getStandardLibrary();
-		org.eclipse.ocl.pivot.Class tupleTypeClass = useCodeGen ? standardLibrary.getClassType() : environmentFactory.getASClass("TupleType");
+		org.eclipse.ocl.pivot.Class tupleTypeClass = environmentFactory.getASClass("TupleType");
 		TuplePartId partId = IdManager.getTuplePartId(0, "a", TypeId.INTEGER);
 		TupleTypeId tupleId = IdManager.getTupleTypeId("Tuple", partId);
 		TupleType tupleType = ocl.getIdResolver().getTupleType(tupleId);
@@ -930,7 +932,7 @@
 		MyOCL ocl = createOCL();
 		EnvironmentFactoryInternalExtension environmentFactory = (EnvironmentFactoryInternalExtension) ocl.getEnvironmentFactory();
 		StandardLibrary standardLibrary = environmentFactory.getStandardLibrary();
-		org.eclipse.ocl.pivot.Class primitiveType = useCodeGen ? standardLibrary.getClassType() : environmentFactory.getASClass("PrimitiveType");
+		org.eclipse.ocl.pivot.Class primitiveType = environmentFactory.getASClass("PrimitiveType");
 		assert primitiveType != null;
 		ocl.assertQueryEquals(null, standardLibrary.getStringType(), "'string'.oclType()");
 		ocl.assertQueryEquals(null, standardLibrary.getOclVoidType(), "self.oclType()");
@@ -949,8 +951,8 @@
 		MyOCL ocl = createOCL();
 		EnvironmentFactoryInternalExtension environmentFactory = (EnvironmentFactoryInternalExtension) ocl.getEnvironmentFactory();
 		StandardLibrary standardLibrary = environmentFactory.getStandardLibrary();
-		org.eclipse.ocl.pivot.Class primitiveType = useCodeGen ? standardLibrary.getClassType() : environmentFactory.getASClass("PrimitiveType");
-		org.eclipse.ocl.pivot.Class classType = useCodeGen ? standardLibrary.getClassType() : environmentFactory.getASClass("Class");
+		org.eclipse.ocl.pivot.Class primitiveType = environmentFactory.getASClass("PrimitiveType");
+		org.eclipse.ocl.pivot.Class classType = environmentFactory.getASClass("Class");
 		assert primitiveType != null;
 		CollectionTypeId bagTypeId = TypeId.BAG.getSpecializedId(TypeId.OCL_ANY);
 		CollectionTypeId setTypeId = TypeId.SET.getSpecializedId(TypeId.OCL_ANY);
diff --git a/tests/org.eclipse.ocl.examples.xtext.tests/src/org/eclipse/ocl/examples/pivot/tests/StereotypesTest.java b/tests/org.eclipse.ocl.examples.xtext.tests/src/org/eclipse/ocl/examples/pivot/tests/StereotypesTest.java
index 335ca37..37b2557 100644
--- a/tests/org.eclipse.ocl.examples.xtext.tests/src/org/eclipse/ocl/examples/pivot/tests/StereotypesTest.java
+++ b/tests/org.eclipse.ocl.examples.xtext.tests/src/org/eclipse/ocl/examples/pivot/tests/StereotypesTest.java
@@ -485,8 +485,8 @@
 		ocl.assertSemanticErrorQuery(ocl.mm.asEnglishClass, "self.oclExtension(standard::Class_Focus)", PivotMessagesInternal.UnresolvedNamespace_ERROR_, "", "standard");
 		ocl.assertSemanticErrorQuery(ocl.mm.asEnglishClass, "self.oclExtension(Standard::NoSuchFocus::WhoCares)", PivotMessagesInternal.UnresolvedNamespace_ERROR_, "Standard", "NoSuchFocus");
 		ocl.assertSemanticErrorQuery(ocl.mm.asEnglishClass, "self.oclExtension(Standard::NoSuchFocus)", PivotMessagesInternal.UnresolvedElement_ERROR_, "Standard", "NoSuchFocus");
-		ocl.assertSemanticErrorQuery(ocl.mm.asEnglishClass, "self.oclExtension(Boolean)", PivotMessagesInternal.UnresolvedOperationCall_ERROR_, "Model::EnglishClass", "oclExtension", "Class");
-		ocl.assertSemanticErrorQuery(ocl.mm.asEnglishClass, "self.oclExtensions(Boolean)", PivotMessagesInternal.UnresolvedOperationCall_ERROR_, "Model::EnglishClass", "oclExtensions", "Class");
+		ocl.assertSemanticErrorQuery(ocl.mm.asEnglishClass, "self.oclExtension(Boolean)", PivotMessagesInternal.UnresolvedOperationCall_ERROR_, "Model::EnglishClass", "oclExtension", "PrimitiveType");
+		ocl.assertSemanticErrorQuery(ocl.mm.asEnglishClass, "self.oclExtensions(Boolean)", PivotMessagesInternal.UnresolvedOperationCall_ERROR_, "Model::EnglishClass", "oclExtensions", "PrimitiveType");
 		//
 		ocl.dispose();
 	}