/**
  * Creates a type annotation appender for type annotations of a method's exception type.
  *
  * @param annotationAppender The annotation appender to write any type annotation to.
  * @param annotationValueFilter The annotation value filter to apply.
  * @param index The exception type's index.
  * @return A visitor for appending type annotations of a method's exception type.
  */
 public static TypeDescription.Generic.Visitor<AnnotationAppender> ofExceptionType(
     AnnotationAppender annotationAppender,
     AnnotationValueFilter annotationValueFilter,
     int index) {
   return new ForTypeAnnotations(
       annotationAppender, annotationValueFilter, TypeReference.newExceptionReference(index));
 }
 /**
  * Creates a type annotation appender for type annotations of a method's receiver type.
  *
  * @param annotationAppender The annotation appender to write any type annotation to.
  * @param annotationValueFilter The annotation value filter to apply.
  * @return A visitor for appending type annotations of a method's receiver type.
  */
 public static TypeDescription.Generic.Visitor<AnnotationAppender> ofReceiverType(
     AnnotationAppender annotationAppender, AnnotationValueFilter annotationValueFilter) {
   return new ForTypeAnnotations(
       annotationAppender,
       annotationValueFilter,
       TypeReference.newTypeReference(TypeReference.METHOD_RECEIVER));
 }
 /**
  * Creates a type annotation appender for type annotations of a method's return type.
  *
  * @param annotationAppender The annotation appender to write any type annotation to.
  * @param annotationValueFilter The annotation value filter to apply.
  * @return A visitor for appending type annotations of a method's return type.
  */
 public static TypeDescription.Generic.Visitor<AnnotationAppender> ofMethodReturnType(
     AnnotationAppender annotationAppender, AnnotationValueFilter annotationValueFilter) {
   return new ForTypeAnnotations(
       annotationAppender,
       annotationValueFilter,
       TypeReference.newTypeReference(TypeReference.METHOD_RETURN));
 }
 /**
  * Creates a type annotation appender for type annotations of a field's type.
  *
  * @param annotationAppender The annotation appender to write any type annotation to.
  * @param annotationValueFilter The annotation value filter to apply.
  * @return A visitor for appending type annotations of a field's type.
  */
 public static TypeDescription.Generic.Visitor<AnnotationAppender> ofFieldType(
     AnnotationAppender annotationAppender, AnnotationValueFilter annotationValueFilter) {
   return new ForTypeAnnotations(
       annotationAppender,
       annotationValueFilter,
       TypeReference.newTypeReference(TypeReference.FIELD));
 }
 /**
  * Creates a type annotation appender for a type annotations of a super class type.
  *
  * @param annotationAppender The annotation appender to write any type annotation to.
  * @param annotationValueFilter The annotation value filter to apply.
  * @return A visitor for appending type annotations of a super class.
  */
 public static TypeDescription.Generic.Visitor<AnnotationAppender> ofSuperClass(
     AnnotationAppender annotationAppender, AnnotationValueFilter annotationValueFilter) {
   return new ForTypeAnnotations(
       annotationAppender,
       annotationValueFilter,
       TypeReference.newSuperTypeReference(SUPER_CLASS_INDEX));
 }
 /**
  * Creates a type annotation appender for type annotations of a method's parameter type.
  *
  * @param annotationAppender The annotation appender to write any type annotation to.
  * @param annotationValueFilter The annotation value filter to apply.
  * @param index The parameter index.
  * @return A visitor for appending type annotations of a method's parameter type.
  */
 public static TypeDescription.Generic.Visitor<AnnotationAppender> ofMethodParameterType(
     AnnotationAppender annotationAppender,
     AnnotationValueFilter annotationValueFilter,
     int index) {
   return new ForTypeAnnotations(
       annotationAppender,
       annotationValueFilter,
       TypeReference.newFormalParameterReference(index));
 }
 /**
  * Appends all supplied type variables to the supplied method appender.
  *
  * @param annotationAppender The annotation appender to write any type annotation to.
  * @param annotationValueFilter The annotation value filter to apply.
  * @param variableOnType {@code true} if the type variables are declared by a type, {@code
  *     false} if they are declared by a method.
  * @param subListIndex The index of the first type variable to append. All previous type
  *     variables are ignored.
  * @param typeVariables The type variables to append.
  * @return The resulting annotation appender.
  */
 public static AnnotationAppender ofTypeVariable(
     AnnotationAppender annotationAppender,
     AnnotationValueFilter annotationValueFilter,
     boolean variableOnType,
     int subListIndex,
     List<? extends TypeDescription.Generic> typeVariables) {
   int typeVariableIndex = subListIndex, variableBaseReference, variableBoundBaseBase;
   if (variableOnType) {
     variableBaseReference = TypeReference.CLASS_TYPE_PARAMETER;
     variableBoundBaseBase = TypeReference.CLASS_TYPE_PARAMETER_BOUND;
   } else {
     variableBaseReference = TypeReference.METHOD_TYPE_PARAMETER;
     variableBoundBaseBase = TypeReference.METHOD_TYPE_PARAMETER_BOUND;
   }
   for (TypeDescription.Generic typeVariable :
       typeVariables.subList(subListIndex, typeVariables.size())) {
     int typeReference =
         TypeReference.newTypeParameterReference(variableBaseReference, typeVariableIndex)
             .getValue();
     for (AnnotationDescription annotationDescription : typeVariable.getDeclaredAnnotations()) {
       annotationAppender =
           annotationAppender.append(
               annotationDescription, annotationValueFilter, typeReference, EMPTY_TYPE_PATH);
     }
     int boundIndex =
         !typeVariable.getUpperBounds().get(0).getSort().isTypeVariable()
                 && typeVariable.getUpperBounds().get(0).asErasure().isInterface()
             ? 1
             : 0;
     for (TypeDescription.Generic typeBound : typeVariable.getUpperBounds()) {
       annotationAppender =
           typeBound.accept(
               new ForTypeAnnotations(
                   annotationAppender,
                   annotationValueFilter,
                   TypeReference.newTypeParameterBoundReference(
                       variableBoundBaseBase, typeVariableIndex, boundIndex++)));
     }
     typeVariableIndex++;
   }
   return annotationAppender;
 }
 /**
  * Creates a new type annotation appending visitor for an empty type path.
  *
  * @param annotationAppender The annotation appender to use.
  * @param annotationValueFilter The annotation value filter to use.
  * @param typeReference The type reference to use.
  */
 protected ForTypeAnnotations(
     AnnotationAppender annotationAppender,
     AnnotationValueFilter annotationValueFilter,
     TypeReference typeReference) {
   this(annotationAppender, annotationValueFilter, typeReference.getValue(), EMPTY_TYPE_PATH);
 }