/**
  * Validates that a type is extendable, i.e. is not an array, a primitive type or a {@code final}
  * type.
  *
  * @param typeDescription The type to validate.
  * @param <T> The actual type of the validated instance.
  * @return The input value.
  */
 public static <T extends GenericTypeDescription> T isExtendable(T typeDescription) {
   if (!EXTENDABLE_TYPES.contains(typeDescription.getSort())) {
     throw new IllegalArgumentException("Cannot extend generic type: " + typeDescription);
   } else if (isDefineable(typeDescription.asErasure()).isFinal()) {
     throw new IllegalArgumentException("Cannot extend a final type: " + typeDescription);
   }
   return typeDescription;
 }
 /**
  * Validates that a type represents an actual type or {@code void}, i.e. not a wildcard.
  *
  * @param typeDescription The type to validate.
  * @param <T> The actual type of the argument.
  * @return The input value.
  */
 public static <T extends GenericTypeDescription> T isActualTypeOrVoid(T typeDescription) {
   if (typeDescription.getSort().isWildcard()) {
     throw new IllegalArgumentException("Not a top-level type: " + typeDescription);
   }
   return typeDescription;
 }