docs: @SuppressWarnings({"checkstyle:cyclomaticcomplexity"})
  	protected int checkSuperTypes(
  			XtendTypeDeclaration element,
  			EReference feature,
  			List<? extends JvmTypeReference> superTypes,
  			Class<?> expectedType,
  			boolean onlySubTypes) {
  		int nbSuperTypes = 0;
  		final JvmDeclaredType inferredType = this.associations.getInferredType(element);
  		if (inferredType instanceof JvmGenericType) {
  			final LinkedList<JvmTypeReference> inferredSuperTypes = CollectionLiterals.newLinkedList();
  			inferredSuperTypes.addAll(inferredType.getSuperTypes());
  			final boolean isExpectingInterface = expectedType.isInterface();
  			int superTypeIndex = 0;
  			for (final JvmTypeReference superType : superTypes) {
  				boolean success = true;
  				final JvmType jvmSuperType = (superType == null) ? null : superType.getType();
  				if (jvmSuperType != null) {
  					final JvmTypeReference inferredSuperType =
  							(inferredSuperTypes.isEmpty()) ? null : inferredSuperTypes.removeFirst();
  					final LightweightTypeReference lighweightSuperType = toLightweightTypeReference(superType);
  					if (!(jvmSuperType instanceof JvmGenericType)
  							|| (isExpectingInterface != ((JvmGenericType) jvmSuperType).isInterface())) {
  						if (isExpectingInterface) {
  							error(
  									MessageFormat.format(Messages.SARLValidator_63, Messages.SARLValidator_64),
  									feature,
  									superTypeIndex,
  									INTERFACE_EXPECTED,
  									jvmSuperType.getIdentifier());
  						} else {
  							error(
  									MessageFormat.format(Messages.SARLValidator_63, Messages.SARLValidator_66),
  									feature,
  									superTypeIndex,
  									CLASS_EXPECTED,
  									jvmSuperType.getIdentifier());
  						}
  						success = false;
  					} else if (isFinal(lighweightSuperType)) {
  						error(Messages.SARLValidator_67,
  								feature,
  								superTypeIndex,
  								OVERRIDDEN_FINAL,
  								inferredType.getIdentifier(),
  								jvmSuperType.getIdentifier());
  						success = false;
  					} else if (!lighweightSuperType.isSubtypeOf(expectedType)
  							|| (onlySubTypes && lighweightSuperType.isType(expectedType))) {
  						if (onlySubTypes) {
  							error(MessageFormat.format(Messages.SARLValidator_68, expectedType.getName()),
  									feature,
  									superTypeIndex,
  									INVALID_EXTENDED_TYPE,
  									jvmSuperType.getIdentifier());
  						} else {
  							error(MessageFormat.format(Messages.SARLValidator_69, expectedType.getName()),
  									feature,
  									superTypeIndex,
  									INVALID_EXTENDED_TYPE,
  									jvmSuperType.getIdentifier());
  						}
  						success = false;
  					} else if (inferredSuperType == null
  							|| !Objects.equal(inferredSuperType.getIdentifier(), jvmSuperType.getIdentifier())
  							|| Objects.equal(inferredType.getIdentifier(), jvmSuperType.getIdentifier())
  							|| hasCycleInHierarchy((JvmGenericType) inferredType, Sets.<JvmGenericType>newHashSet())) {
  						error(MessageFormat.format(Messages.SARLValidator_70,
  								inferredType.getQualifiedName()),
  								feature,
  								superTypeIndex,
  								CYCLIC_INHERITANCE,
  								jvmSuperType.getIdentifier());
  						success = false;
  					}
  				} else if (superType != null) {
  					error(MessageFormat.format(Messages.SARLValidator_70,
  							inferredType.getQualifiedName()),
  							feature,
  							superTypeIndex,
  							CYCLIC_INHERITANCE,
  							superType.getIdentifier());
  					success = false;
  				}
  				checkWildcardSupertype(element, superType, feature, superTypeIndex);
  				++superTypeIndex;
  				if (success) {
  					++nbSuperTypes;
  				}
  			}
  		}
  		return nbSuperTypes;
  	}