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

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

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

Types.resultSubtype介绍

[英]Does t have a result that is a subtype of the result type of s, suitable for covariant returns? It is assumed that both types are (possibly polymorphic) method types. Monomorphic method types are handled in the obvious way. Polymorphic method types require renaming all type variables of one to corresponding type variables in the other, where correspondence is by position in the type parameter list.
[中]t是否有一个结果是s的结果类型的子类型,适合协变返回?假设这两种类型都是(可能是多态的)方法类型。单态方法类型以明显的方式处理。多态方法类型需要将一个方法的所有类型变量重命名为另一个方法的对应类型变量,其中对应关系是按类型参数列表中的位置进行的。

代码示例

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

/**
 * Return-Type-Substitutable.
 * @jls section 8.4.5
 */
public boolean returnTypeSubstitutable(Type r1, Type r2) {
  if (hasSameArgs(r1, r2))
    return resultSubtype(r1, r2, noWarnings);
  else
    return covariantReturnType(r1.getReturnType(),
                  erasure(r2.getReturnType()),
                  noWarnings);
}

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

/**
 * Return-Type-Substitutable.
 * @jls section 8.4.5
 */
public boolean returnTypeSubstitutable(Type r1, Type r2) {
  if (hasSameArgs(r1, r2))
    return resultSubtype(r1, r2, noWarnings);
  else
    return covariantReturnType(r1.getReturnType(),
                  erasure(r2.getReturnType()),
                  noWarnings);
}

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

/**
 * Return-Type-Substitutable.
 * @see <a href="http://java.sun.com/docs/books/jls/">The Java
 * Language Specification, Third Ed. (8.4.5)</a>
 */
public boolean returnTypeSubstitutable(Type r1, Type r2) {
  if (hasSameArgs(r1, r2))
    return resultSubtype(r1, r2, Warner.noWarnings);
  else
    return covariantReturnType(r1.getReturnType(),
                  erasure(r2.getReturnType()),
                  Warner.noWarnings);
}

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

/**
 * Return-Type-Substitutable.
 * @see <a href="http://java.sun.com/docs/books/jls/">The Java
 * Language Specification, Third Ed. (8.4.5)</a>
 */
public boolean returnTypeSubstitutable(Type r1, Type r2) {
  if (hasSameArgs(r1, r2))
    return resultSubtype(r1, r2, Warner.noWarnings);
  else
    return covariantReturnType(r1.getReturnType(),
                  erasure(r2.getReturnType()),
                  Warner.noWarnings);
}

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

return
  types.isSubSignature(mt, ot) &&
  (!checkResult || types.resultSubtype(mt, ot, Warner.noWarnings));

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

return
  types.isSubSignature(mt, ot) &&
  (!checkResult || types.resultSubtype(mt, ot, Warner.noWarnings));

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

return
  types.isSubSignature(mt, ot) &&
  (!checkResult || types.resultSubtype(mt, ot, types.noWarnings));

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

return
  types.isSubSignature(mt, ot) &&
  (!checkResult || types.resultSubtype(mt, ot, types.noWarnings));

相关文章

Types类方法