private void initTypeKind() {
    boolean ensureTypeIntrospected = false;
    boolean applyMaybeEnumContainedType = false;

    if (instantiation != null) {
      typeKind = AttributeTypeKind.ENCODING;
    } else if (isGenerateDerived) {
      typeKind = AttributeTypeKind.REGULAR;
      ensureTypeIntrospected = true;
    } else if (returnType.getKind() == TypeKind.ARRAY) {
      typeKind = AttributeTypeKind.ARRAY;
      ensureTypeIntrospected = true;
    } else {
      typeKind = AttributeTypeKind.forRawType(rawTypeName);
      ensureTypeIntrospected = true;
      if (!typeKind.isRegular()) {
        applyMaybeEnumContainedType = true;
      }
    }

    if (!typeKind.isRegular() && !supportBuiltinContainerTypes()) {
      if (typeKind.isOptionalKind()) {
        isSuppressedOptional = true;
      }
      applyMaybeEnumContainedType = false;
      typeKind = AttributeTypeKind.REGULAR;
    }

    // This (boolean vars and check here) is an artifact of rearranging things,
    // so that some logic happening after that will be correct,
    // in particular, call to initAttributeValueType() should work on the outer type
    // stored in containedTypeElement,
    // not inner element type of container, which would be no longer a container due to
    // supportBuiltinContainerTypes() logic above, which makes it not a container,
    // overall it's dumb, but it's too late to make it correct and not break too much of
    // functionality.
    if (ensureTypeIntrospected) {
      ensureTypeIntrospected();
      if (applyMaybeEnumContainedType) {
        typeKind = typeKind.havingEnumFirstTypeParameter(hasEnumContainedElementType());
      }
    }

    // this is another attempt to establish isSuppressedOptional in case it was somehow
    // skipped the logic above
    if (!isSuppressedOptional
        //&& typeKind == AttributeTypeKind.REGULAR
        && AttributeTypeKind.forRawType(rawTypeName).isOptionalKind()) {
      isSuppressedOptional = true;
    }
  }
Initialized Validates things that were not validated otherwise
@param instantiationCreator can instantiate encodings
value-processor/src/org/immutables/value/processor/meta/ValueAttribute.java