public void load(SymbolTable table, List<TypeParameter> typeParams, SymbolType thisType) {
    if (typeParams != null && !typeParams.isEmpty()) {

      List<SymbolType> parameterizedTypes = new LinkedList<SymbolType>();
      for (TypeParameter tp : typeParams) {
        List<ClassOrInterfaceType> typeBounds = tp.getTypeBound();
        List<SymbolType> bounds = new LinkedList<SymbolType>();
        SymbolType st = null;
        if (typeBounds != null) {
          for (ClassOrInterfaceType type : typeBounds) {
            SymbolType paramType = ASTSymbolTypeResolver.getInstance().valueOf(type);
            if (paramType == null) {
              paramType = new SymbolType(Object.class);
            }
            bounds.add(paramType);
          }
          st = new SymbolType(bounds);

        } else {
          st = new SymbolType(Object.class);
        }
        st.setTemplateVariable(tp.getName());
        table.pushSymbol(tp.getName(), ReferenceType.TYPE_PARAM, st, tp);

        parameterizedTypes.add(st);
      }
      Map<String, SymbolType> typeParamsMap = table.getTypeParams();

      for (String key : typeParamsMap.keySet()) {
        SymbolType st = typeParamsMap.get(key);
        recursiveTemplateSubstitution(st, typeParamsMap);
      }

      if (thisType != null && !parameterizedTypes.isEmpty()) {
        thisType.setParameterizedTypes(parameterizedTypes);
      }
    }
  }
  @Override
  public Map<String, SymbolType> build(Map<String, SymbolType> obj) {
    if (obj == null) {
      obj = new HashMap<String, SymbolType>();
    }
    TypeVariable<?>[] typeParams = clazz.getTypeParameters();

    if (typeParams != null) {

      for (int i = 0; i < typeParams.length; i++) {
        if (parameterizedTypes != null) {
          if (i >= parameterizedTypes.size()) {
            SymbolType st = new SymbolType("java.lang.Object");
            st.setTemplateVariable(typeParams[i].getName());
            obj.put(typeParams[i].getName(), st);
          } else {
            if (parameterizedTypes.get(i).getName() == null
                && parameterizedTypes.get(i).hasBounds()) {
              obj.put(typeParams[i].getName(), parameterizedTypes.get(i));
            } else {
              if (!"java.lang.Object".equals(parameterizedTypes.get(i).getName())) {
                obj.put(typeParams[i].getName(), parameterizedTypes.get(i));
              } else {
                SymbolType st = new SymbolType("java.lang.Object");
                st.setTemplateVariable(typeParams[i].getName());
                obj.put(typeParams[i].getName(), st);
              }
            }
          }

        } else {
          Type[] bounds = typeParams[i].getBounds();
          SymbolType resultType = null;
          if (bounds.length == 0) {
            resultType = new SymbolType("java.lang.Object");

          } else {
            try {
              SymbolType auxSt = null;
              for (int j = 0; j < bounds.length; j++) {

                auxSt = SymbolType.valueOf(bounds[j], obj);
                if (resultType == null) {
                  resultType = auxSt;
                } else {
                  resultType = (SymbolType) resultType.merge(auxSt);
                }
              }

            } catch (InvalidTypeException e) {
              throw new RuntimeException("Error processing bounds of  type ", e);
            }
          }
          if (resultType != null) {
            obj.put(typeParams[i].getName(), resultType);
          }
        }
      }
    }
    return obj;
  }