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

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

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

Types.isUnbounded介绍

[英]Checks that all the arguments to a class are unbounded wildcards or something else that doesn't make any restrictions on the arguments. If a class isUnbounded, a raw super- or subclass can be cast to it without a warning.
[中]检查类的所有参数是否都是无界通配符或其他对参数没有任何限制的参数。如果一个类是无界的,一个原始的超类或子类可以在没有警告的情况下被强制转换到它。

代码示例

代码示例来源: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

return true;
} else if (t.isRaw()) {
  if (!isUnbounded(s))
    warnStack.head.warnUnchecked();
  return true;

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

return true;
} else if (t.isRaw()) {
  if (!isUnbounded(s))
    warnStack.head.warnUnchecked();
  return true;

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

return true;
} else if (t.isRaw()) {
  if (!isUnbounded(s))
    warnStack.head.warn(LintCategory.UNCHECKED);
  return true;

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

return true;
} else if (t.isRaw()) {
  if (!isUnbounded(s))
    warnStack.head.warn(LintCategory.UNCHECKED);
  return true;

相关文章

Types类方法