code: protected int getDeclarationIndex(TypeVariable<?> typeVariable) {
  
      GenericDeclaration genericDeclaration = typeVariable.getGenericDeclaration();
      TypeVariable<?>[] variables = genericDeclaration.getTypeParameters();
      for (int variableIndex = 0; variableIndex < variables.length; variableIndex++) {
        if (variables[variableIndex] == typeVariable) {
          return variableIndex;
        }
      }
      return -1;
    }
docs: This method gets the declaration-index of the given {@code typeVariable}.
  
  @param typeVariable is the {@link TypeVariable}.
  @return the index of the given {@code typeVariable} in its {@link TypeVariable#getGenericDeclaration()
  declaration} .