code: public static Type resolveRefType(Type type) {
          if (type == null)
              return null;
  
          if (type instanceof RefType)
              return resolveRefType(((RefType) type).getRefType());
          else
              return type;
      }
docs: Recursively resolve referenced type if {@code type} is of type RefType
  
  @param type type to resolve
  @return referenced type