本文整理了Java中com.sun.tools.javac.code.Types.hasSameArgs()
方法的一些代码示例,展示了Types.hasSameArgs()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Types.hasSameArgs()
方法的具体详情如下:
包路径:com.sun.tools.javac.code.Types
类名称:Types
方法名:hasSameArgs
[英]Does t have the same arguments as s? It is assumed that both types are (possibly polymorphic) method types. Monomorphic method types "have the same arguments", if their argument lists are equal. Polymorphic method types "have the same arguments", if they have the same arguments after renaming all type variables of one to corresponding type variables in the other, where correspondence is by position in the type parameter list.
[中]没有与s相同的参数吗?假设这两种类型都是(可能是多态的)方法类型。如果单态方法类型的参数列表相等,则它们“具有相同的参数”。多态方法类型“具有相同的参数”,如果它们在将一个方法的所有类型变量重命名为另一个方法的相应类型变量后具有相同的参数,其中对应关系是按类型参数列表中的位置进行的。
代码示例来源:origin: org.kohsuke.sorcerer/sorcerer-javac
/**
* Does t have the same arguments as s? It is assumed that both
* types are (possibly polymorphic) method types. Monomorphic
* method types "have the same arguments", if their argument lists
* are equal. Polymorphic method types "have the same arguments",
* if they have the same arguments after renaming all type
* variables of one to corresponding type variables in the other,
* where correspondence is by position in the type parameter list.
*/
public boolean hasSameArgs(Type t, Type s) {
return hasSameArgs(t, s, true);
}
代码示例来源:origin: konsoletyper/teavm-javac
/**
* Does t have the same arguments as s? It is assumed that both
* types are (possibly polymorphic) method types. Monomorphic
* method types "have the same arguments", if their argument lists
* are equal. Polymorphic method types "have the same arguments",
* if they have the same arguments after renaming all type
* variables of one to corresponding type variables in the other,
* where correspondence is by position in the type parameter list.
*/
public boolean hasSameArgs(Type t, Type s) {
return hasSameArgs(t, s, true);
}
代码示例来源:origin: org.kohsuke.sorcerer/sorcerer-javac
public boolean hasSameArgs(Type t, Type s, boolean strict) {
return hasSameArgs(t, s, strict ? hasSameArgs_strict : hasSameArgs_nonstrict);
}
代码示例来源:origin: konsoletyper/teavm-javac
public boolean hasSameArgs(Type t, Type s, boolean strict) {
return hasSameArgs(t, s, strict ? hasSameArgs_strict : hasSameArgs_nonstrict);
}
代码示例来源:origin: sc.fiji/javac
/**
* Returns true iff the first signature is a <em>sub
* signature</em> of the other. This is <b>not</b> an equivalence
* relation.
*
* @see "The Java Language Specification, Third Ed. (8.4.2)."
* @see #overrideEquivalent(Type t, Type s)
* @param t first signature (possibly raw).
* @param s second signature (could be subjected to erasure).
* @return true if t is a sub signature of s.
*/
public boolean isSubSignature(Type t, Type s) {
return hasSameArgs(t, s) || hasSameArgs(t, erasure(s));
}
代码示例来源:origin: org.jvnet.sorcerer/sorcerer-javac
/**
* Returns true iff the first signature is a <em>sub
* signature</em> of the other. This is <b>not</b> an equivalence
* relation.
*
* @see "The Java Language Specification, Third Ed. (8.4.2)."
* @see #overrideEquivalent(Type t, Type s)
* @param t first signature (possibly raw).
* @param s second signature (could be subjected to erasure).
* @return true if t is a sub signature of s.
*/
public boolean isSubSignature(Type t, Type s) {
return hasSameArgs(t, s) || hasSameArgs(t, erasure(s));
}
代码示例来源:origin: org.kohsuke.sorcerer/sorcerer-javac
public boolean isSubSignature(Type t, Type s, boolean strict) {
return hasSameArgs(t, s, strict) || hasSameArgs(t, erasure(s), strict);
}
代码示例来源:origin: konsoletyper/teavm-javac
public boolean isSubSignature(Type t, Type s, boolean strict) {
return hasSameArgs(t, s, strict) || hasSameArgs(t, erasure(s), strict);
}
代码示例来源:origin: org.jvnet.sorcerer/sorcerer-javac
/**
* Returns true iff these signatures are related by <em>override
* equivalence</em>. This is the natural extension of
* isSubSignature to an equivalence relation.
*
* @see "The Java Language Specification, Third Ed. (8.4.2)."
* @see #isSubSignature(Type t, Type s)
* @param t a signature (possible raw, could be subjected to
* erasure).
* @param s a signature (possible raw, could be subjected to
* erasure).
* @return true if either argument is a sub signature of the other.
*/
public boolean overrideEquivalent(Type t, Type s) {
return hasSameArgs(t, s) ||
hasSameArgs(t, erasure(s)) || hasSameArgs(erasure(t), s);
}
代码示例来源:origin: sc.fiji/javac
/**
* Returns true iff these signatures are related by <em>override
* equivalence</em>. This is the natural extension of
* isSubSignature to an equivalence relation.
*
* @see "The Java Language Specification, Third Ed. (8.4.2)."
* @see #isSubSignature(Type t, Type s)
* @param t a signature (possible raw, could be subjected to
* erasure).
* @param s a signature (possible raw, could be subjected to
* erasure).
* @return true if either argument is a sub signature of the other.
*/
public boolean overrideEquivalent(Type t, Type s) {
return hasSameArgs(t, s) ||
hasSameArgs(t, erasure(s)) || hasSameArgs(erasure(t), s);
}
代码示例来源:origin: sc.fiji/javac
@Override
public Boolean visitMethodType(MethodType t, Type s) {
// isSameType for methods does not take thrown
// exceptions into account!
return hasSameArgs(t, s) && visit(t.getReturnType(), s.getReturnType());
}
代码示例来源:origin: org.kohsuke.sorcerer/sorcerer-javac
@Override
public Boolean visitMethodType(MethodType t, Type s) {
// isSameType for methods does not take thrown
// exceptions into account!
return hasSameArgs(t, s) && visit(t.getReturnType(), s.getReturnType());
}
代码示例来源:origin: org.jvnet.sorcerer/sorcerer-javac
@Override
public Boolean visitMethodType(MethodType t, Type s) {
// isSameType for methods does not take thrown
// exceptions into account!
return hasSameArgs(t, s) && visit(t.getReturnType(), s.getReturnType());
}
代码示例来源:origin: konsoletyper/teavm-javac
@Override
public Boolean visitMethodType(MethodType t, Type s) {
// isSameType for methods does not take thrown
// exceptions into account!
return hasSameArgs(t, s) && visit(t.getReturnType(), s.getReturnType());
}
代码示例来源:origin: org.kohsuke.sorcerer/sorcerer-javac
private boolean checkNameClash(ClassSymbol origin, Symbol s1, Symbol s2) {
ClashFilter cf = new ClashFilter(origin.type);
return (cf.accepts(s1) &&
cf.accepts(s2) &&
types.hasSameArgs(s1.erasure(types), s2.erasure(types)));
}
代码示例来源: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: 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: konsoletyper/teavm-javac
private boolean checkNameClash(ClassSymbol origin, Symbol s1, Symbol s2) {
ClashFilter cf = new ClashFilter(origin.type);
return (cf.accepts(s1) &&
cf.accepts(s2) &&
types.hasSameArgs(s1.erasure(types), s2.erasure(types)));
}
代码示例来源: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);
}
内容来源于网络,如有侵权,请联系作者删除!