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

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

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

Types.asSub介绍

[英]Return the least specific subtype of t that starts with symbol sym. If none exists, return null. The least specific subtype is determined as follows:

If there is exactly one parameterized instance of sym that is a subtype of t, that parameterized instance is returned.
Otherwise, if the plain type or raw type sym' is a subtype of type t, the typesym' itself is returned. Otherwise, null is returned.
[中]返回以sym符号开头的t的最不特定的子类型。如果不存在,则返回null。最不特定的子类型确定如下:
如果只有一个sym的参数化实例是t的子类型,则返回该参数化实例。
否则,如果普通类型或原始类型“sym”是类型t的子类型,则返回类型“sym”本身。否则,返回null。

代码示例

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

private boolean giveWarning(Type from, Type to) {
  List<Type> bounds = to.isCompound() ?
      ((IntersectionClassType)to.unannotatedType()).getComponents() : List.of(to);
  for (Type b : bounds) {
    Type subFrom = asSub(from, b.tsym);
    if (b.isParameterized() &&
        (!(isUnbounded(b) ||
        isSubtype(from, b) ||
        ((subFrom != null) && containsType(b.allparams(), subFrom.allparams()))))) {
      return true;
    }
  }
  return false;
}

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

private boolean giveWarning(Type from, Type to) {
  List<Type> bounds = to.isCompound() ?
      ((IntersectionClassType)to.unannotatedType()).getComponents() : List.of(to);
  for (Type b : bounds) {
    Type subFrom = asSub(from, b.tsym);
    if (b.isParameterized() &&
        (!(isUnbounded(b) ||
        isSubtype(from, b) ||
        ((subFrom != null) && containsType(b.allparams(), subFrom.allparams()))))) {
      return true;
    }
  }
  return false;
}

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

Type bHigh = rewriteQuantifiers(b, HIGH, DONT_REWRITE_TYPEVARS);
Type bLow  = rewriteQuantifiers(b, LOW,  DONT_REWRITE_TYPEVARS);
Type lowSub = asSub(bLow, aLow.tsym);
Type highSub = (lowSub == null) ? null : asSub(bHigh, aHigh.tsym);
if (highSub == null) {
  final boolean REWRITE_TYPEVARS = true;
  bHigh = rewriteQuantifiers(b, HIGH, REWRITE_TYPEVARS);
  bLow  = rewriteQuantifiers(b, LOW,  REWRITE_TYPEVARS);
  lowSub = asSub(bLow, aLow.tsym);
  highSub = (lowSub == null) ? null : asSub(bHigh, aHigh.tsym);

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

Type bHigh = rewriteQuantifiers(b, HIGH, DONT_REWRITE_TYPEVARS);
Type bLow  = rewriteQuantifiers(b, LOW,  DONT_REWRITE_TYPEVARS);
Type lowSub = asSub(bLow, aLow.tsym);
Type highSub = (lowSub == null) ? null : asSub(bHigh, aHigh.tsym);
if (highSub == null) {
  final boolean REWRITE_TYPEVARS = true;
  bHigh = rewriteQuantifiers(b, HIGH, REWRITE_TYPEVARS);
  bLow  = rewriteQuantifiers(b, LOW,  REWRITE_TYPEVARS);
  lowSub = asSub(bLow, aLow.tsym);
  highSub = (lowSub == null) ? null : asSub(bHigh, aHigh.tsym);

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

Type bHigh = rewriteQuantifiers(b, HIGH, DONT_REWRITE_TYPEVARS);
Type bLow  = rewriteQuantifiers(b, LOW,  DONT_REWRITE_TYPEVARS);
Type lowSub = asSub(bLow, aLow.tsym);
Type highSub = (lowSub == null) ? null : asSub(bHigh, aHigh.tsym);
if (highSub == null) {
  final boolean REWRITE_TYPEVARS = true;
  bHigh = rewriteQuantifiers(b, HIGH, REWRITE_TYPEVARS);
  bLow  = rewriteQuantifiers(b, LOW,  REWRITE_TYPEVARS);
  lowSub = asSub(bLow, aLow.tsym);
  highSub = (lowSub == null) ? null : asSub(bHigh, aHigh.tsym);

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

Type bHigh = rewriteQuantifiers(b, HIGH, DONT_REWRITE_TYPEVARS);
Type bLow  = rewriteQuantifiers(b, LOW,  DONT_REWRITE_TYPEVARS);
Type lowSub = asSub(bLow, aLow.tsym);
Type highSub = (lowSub == null) ? null : asSub(bHigh, aHigh.tsym);
if (highSub == null) {
  final boolean REWRITE_TYPEVARS = true;
  bHigh = rewriteQuantifiers(b, HIGH, REWRITE_TYPEVARS);
  bLow  = rewriteQuantifiers(b, LOW,  REWRITE_TYPEVARS);
  lowSub = asSub(bLow, aLow.tsym);
  highSub = (lowSub == null) ? null : asSub(bHigh, aHigh.tsym);

相关文章

Types类方法