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

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

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

Types.notSoftSubtype介绍

[英]This relation answers the question: is impossible that something of type t' can be a subtype ofs'? This is different from the question "is t' not a subtype ofs'?" when type variables are involved: Integer is not a subtype of T where but it is not true that Integer cannot possibly be a subtype of T.
[中]这个关系回答了一个问题:“t”型的东西不可能是“s”的子类型吗?这与问题“t不是s的一个子类型吗?”当涉及类型变量时:Integer不是T的子类型,但Integer不可能是T的子类型。

代码示例

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

private boolean notSoftSubtypeRecursive(Type t, Type s) {
  TypePair pair = new TypePair(t, s);
  if (cache.add(pair)) {
    try {
      return Types.this.notSoftSubtype(t, s);
    } finally {
      cache.remove(pair);
    }
  } else {
    return false;
  }
}

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

private boolean notSoftSubtypeRecursive(Type t, Type s) {
  TypePair pair = new TypePair(t, s);
  if (cache.add(pair)) {
    try {
      return Types.this.notSoftSubtype(t, s);
    } finally {
      cache.remove(pair);
    }
  } else {
    return false;
  }
}

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

private boolean notSoftSubtypeRecursive(Type t, Type s) {
  TypePair pair = new TypePair(t, s);
  if (cache.add(pair)) {
    try {
      return Types.this.notSoftSubtype(t, s);
    } finally {
      cache.remove(pair);
    }
  } else {
    return false;
  }
}

代码示例来源:origin: konsoletyper/teavm-javac

private boolean notSoftSubtypeRecursive(Type t, Type s) {
  TypePair pair = new TypePair(t, s);
  if (cache.add(pair)) {
    try {
      return Types.this.notSoftSubtype(t, s);
    } finally {
      cache.remove(pair);
    }
  } else {
    return false;
  }
}

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

/** Check that a type is within some bounds.
 *
 *  Used in TypeApply to verify that, e.g., X in {@code V<X>} is a valid
 *  type argument.
 *  @param a             The type that should be bounded by bs.
 *  @param bound         The bound.
 */
private boolean checkExtends(Type a, Type bound) {
   if (a.isUnbound()) {
     return true;
   } else if (!a.hasTag(WILDCARD)) {
     a = types.upperBound(a);
     return types.isSubtype(a, bound);
   } else if (a.isExtendsBound()) {
     return types.isCastable(bound, types.upperBound(a), types.noWarnings);
   } else if (a.isSuperBound()) {
     return !types.notSoftSubtype(types.lowerBound(a), bound);
   }
   return true;
 }

代码示例来源:origin: konsoletyper/teavm-javac

/** Check that a type is within some bounds.
 *
 *  Used in TypeApply to verify that, e.g., X in {@code V<X>} is a valid
 *  type argument.
 *  @param a             The type that should be bounded by bs.
 *  @param bound         The bound.
 */
private boolean checkExtends(Type a, Type bound) {
   if (a.isUnbound()) {
     return true;
   } else if (!a.hasTag(WILDCARD)) {
     a = types.cvarUpperBound(a);
     return types.isSubtype(a, bound);
   } else if (a.isExtendsBound()) {
     return types.isCastable(bound, types.wildUpperBound(a), types.noWarnings);
   } else if (a.isSuperBound()) {
     return !types.notSoftSubtype(types.wildLowerBound(a), bound);
   }
   return true;
 }

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

/** Check that a type is within some bounds.
 *
 *  Used in TypeApply to verify that, e.g., X in V<X> is a valid
 *  type argument.
 *  @param pos           Position to be used for error reporting.
 *  @param a             The type that should be bounded by bs.
 *  @param bs            The bound.
 */
private void checkExtends(DiagnosticPosition pos, Type a, TypeVar bs) {
  if (a.isUnbound()) {
    return;
  } else if (a.tag != WILDCARD) {
    a = types.upperBound(a);
    for (List<Type> l = types.getBounds(bs); l.nonEmpty(); l = l.tail) {
      if (!types.isSubtype(a, l.head)) {
        log.error(pos, "not.within.bounds", a);
        return;
      }
    }
  } else if (a.isExtendsBound()) {
    if (!types.isCastable(bs.getUpperBound(), types.upperBound(a), Warner.noWarnings))
      log.error(pos, "not.within.bounds", a);
  } else if (a.isSuperBound()) {
    if (types.notSoftSubtype(types.lowerBound(a), bs.getUpperBound()))
      log.error(pos, "not.within.bounds", a);
  }
}

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

/** Check that a type is within some bounds.
 *
 *  Used in TypeApply to verify that, e.g., X in V<X> is a valid
 *  type argument.
 *  @param pos           Position to be used for error reporting.
 *  @param a             The type that should be bounded by bs.
 *  @param bs            The bound.
 */
private void checkExtends(DiagnosticPosition pos, Type a, TypeVar bs) {
if (a.isUnbound()) {
  return;
} else if (a.tag != WILDCARD) {
  a = types.upperBound(a);
  for (List<Type> l = types.getBounds(bs); l.nonEmpty(); l = l.tail) {
  if (!types.isSubtype(a, l.head)) {
    log.error(pos, "not.within.bounds", a);
    return;
  }
  }
} else if (a.isExtendsBound()) {
  if (!types.isCastable(bs.getUpperBound(), types.upperBound(a), Warner.noWarnings))
  log.error(pos, "not.within.bounds", a);
} else if (a.isSuperBound()) {
  if (types.notSoftSubtype(types.lowerBound(a), bs.getUpperBound()))
  log.error(pos, "not.within.bounds", a);
}
}

相关文章

Types类方法