com.sun.tools.javac.code.Types.adaptRecursive()方法的使用及代码示例

x33g5p2x  于2022-01-30 转载在 其他  
字(3.6k)|赞(0)|评价(0)|浏览(75)

本文整理了Java中com.sun.tools.javac.code.Types.adaptRecursive()方法的一些代码示例,展示了Types.adaptRecursive()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Types.adaptRecursive()方法的具体详情如下:
包路径:com.sun.tools.javac.code.Types
类名称:Types
方法名:adaptRecursive

Types.adaptRecursive介绍

暂无

代码示例

代码示例来源:origin: sc.fiji/javac

/**
 * Adapt a type by computing a substitution which maps a source
 * type to a target type.
 *
 * @param source    the source type
 * @param target    the target type
 * @param from      the type variables of the computed substitution
 * @param to        the types of the computed substitution.
 */
public void adapt(Type source,
          Type target,
          ListBuffer<Type> from,
          ListBuffer<Type> to) throws AdaptFailure {
  Map<Symbol,Type> mapping = new HashMap<Symbol,Type>();
  adaptRecursive(source, target, from, to, mapping);
  List<Type> fromList = from.toList();
  List<Type> toList = to.toList();
  while (!fromList.isEmpty()) {
    Type val = mapping.get(fromList.head.tsym);
    if (toList.head != val)
      toList.head = val;
    fromList = fromList.tail;
    toList = toList.tail;
  }
}
// where

代码示例来源:origin: org.jvnet.sorcerer/sorcerer-javac

/**
 * Adapt a type by computing a substitution which maps a source
 * type to a target type.
 *
 * @param source    the source type
 * @param target    the target type
 * @param from      the type variables of the computed substitution
 * @param to        the types of the computed substitution.
 */
public void adapt(Type source,
          Type target,
          ListBuffer<Type> from,
          ListBuffer<Type> to) throws AdaptFailure {
  Map<Symbol,Type> mapping = new HashMap<Symbol,Type>();
  adaptRecursive(source, target, from, to, mapping);
  List<Type> fromList = from.toList();
  List<Type> toList = to.toList();
  while (!fromList.isEmpty()) {
    Type val = mapping.get(fromList.head.tsym);
    if (toList.head != val)
      toList.head = val;
    fromList = fromList.tail;
    toList = toList.tail;
  }
}
// where

代码示例来源:origin: org.jvnet.sorcerer/sorcerer-javac

/**
 * Adapt a type by computing a substitution which maps a list of
 * source types to a list of target types.
 *
 * @param source    the source type
 * @param target    the target type
 * @param from      the type variables of the computed substitution
 * @param to        the types of the computed substitution.
 */
private void adapt(List<Type> source,
          List<Type> target,
          ListBuffer<Type> from,
          ListBuffer<Type> to,
          Map<Symbol,Type> mapping) throws AdaptFailure {
  if (source.length() == target.length()) {
    while (source.nonEmpty()) {
      adaptRecursive(source.head, target.head, from, to, mapping);
      source = source.tail;
      target = target.tail;
    }
  }
}

代码示例来源:origin: sc.fiji/javac

/**
 * Adapt a type by computing a substitution which maps a list of
 * source types to a list of target types.
 *
 * @param source    the source type
 * @param target    the target type
 * @param from      the type variables of the computed substitution
 * @param to        the types of the computed substitution.
 */
private void adapt(List<Type> source,
          List<Type> target,
          ListBuffer<Type> from,
          ListBuffer<Type> to,
          Map<Symbol,Type> mapping) throws AdaptFailure {
  if (source.length() == target.length()) {
    while (source.nonEmpty()) {
      adaptRecursive(source.head, target.head, from, to, mapping);
      source = source.tail;
      target = target.tail;
    }
  }
}

代码示例来源:origin: org.jvnet.sorcerer/sorcerer-javac

break;
case ARRAY:
  adaptRecursive(elemtype(source), elemtype(target),
          from, to, mapping);
  break;
case WILDCARD:
  if (source.isExtendsBound()) {
    adaptRecursive(upperBound(source), upperBound(target),
            from, to, mapping);
  } else if (source.isSuperBound()) {
    adaptRecursive(lowerBound(source), lowerBound(target),
            from, to, mapping);

代码示例来源:origin: sc.fiji/javac

break;
case ARRAY:
  adaptRecursive(elemtype(source), elemtype(target),
          from, to, mapping);
  break;
case WILDCARD:
  if (source.isExtendsBound()) {
    adaptRecursive(upperBound(source), upperBound(target),
            from, to, mapping);
  } else if (source.isSuperBound()) {
    adaptRecursive(lowerBound(source), lowerBound(target),
            from, to, mapping);

相关文章

微信公众号

最新文章

更多

Types类方法