本文整理了Java中com.sun.tools.javac.code.Types.returnTypeSubstitutable()
方法的一些代码示例,展示了Types.returnTypeSubstitutable()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Types.returnTypeSubstitutable()
方法的具体详情如下:
包路径:com.sun.tools.javac.code.Types
类名称:Types
方法名:returnTypeSubstitutable
[英]Return-Type-Substitutable.
[中]返回类型可替换。
代码示例来源:origin: org.kohsuke.sorcerer/sorcerer-javac
boolean checkCommonOverriderIn(Symbol s1, Symbol s2, Type site) {
Map<TypeSymbol,Type> supertypes = new HashMap<TypeSymbol,Type>();
Type st1 = types.memberType(site, s1);
Type st2 = types.memberType(site, s2);
closure(site, supertypes);
for (Type t : supertypes.values()) {
for (Scope.Entry e = t.tsym.members().lookup(s1.name); e.scope != null; e = e.next()) {
Symbol s3 = e.sym;
if (s3 == s1 || s3 == s2 || s3.kind != MTH || (s3.flags() & (BRIDGE|SYNTHETIC)) != 0) continue;
Type st3 = types.memberType(site,s3);
if (types.overrideEquivalent(st3, st1) &&
types.overrideEquivalent(st3, st2) &&
types.returnTypeSubstitutable(st3, st1) &&
types.returnTypeSubstitutable(st3, st2)) {
return true;
}
}
}
return false;
}
代码示例来源:origin: konsoletyper/teavm-javac
boolean checkCommonOverriderIn(Symbol s1, Symbol s2, Type site) {
Map<TypeSymbol,Type> supertypes = new HashMap<TypeSymbol,Type>();
Type st1 = types.memberType(site, s1);
Type st2 = types.memberType(site, s2);
closure(site, supertypes);
for (Type t : supertypes.values()) {
for (Scope.Entry e = t.tsym.members().lookup(s1.name); e.scope != null; e = e.next()) {
Symbol s3 = e.sym;
if (s3 == s1 || s3 == s2 || s3.kind != MTH || (s3.flags() & (BRIDGE|SYNTHETIC)) != 0) continue;
Type st3 = types.memberType(site,s3);
if (types.overrideEquivalent(st3, st1) &&
types.overrideEquivalent(st3, st2) &&
types.returnTypeSubstitutable(st3, st1) &&
types.returnTypeSubstitutable(st3, st2)) {
return true;
}
}
}
return false;
}
代码示例来源:origin: org.kohsuke.sorcerer/sorcerer-javac
Type mostSpecificReturnType(Type mt1, Type mt2) {
Type rt1 = mt1.getReturnType();
Type rt2 = mt2.getReturnType();
if (mt1.hasTag(FORALL) && mt2.hasTag(FORALL)) {
//if both are generic methods, adjust return type ahead of subtyping check
rt1 = types.subst(rt1, mt1.getTypeArguments(), mt2.getTypeArguments());
}
//first use subtyping, then return type substitutability
if (types.isSubtype(rt1, rt2)) {
return mt1;
} else if (types.isSubtype(rt2, rt1)) {
return mt2;
} else if (types.returnTypeSubstitutable(mt1, mt2)) {
return mt1;
} else if (types.returnTypeSubstitutable(mt2, mt1)) {
return mt2;
} else {
return null;
}
}
//where
代码示例来源:origin: konsoletyper/teavm-javac
Type mostSpecificReturnType(Type mt1, Type mt2) {
Type rt1 = mt1.getReturnType();
Type rt2 = mt2.getReturnType();
if (mt1.hasTag(FORALL) && mt2.hasTag(FORALL)) {
//if both are generic methods, adjust return type ahead of subtyping check
rt1 = types.subst(rt1, mt1.getTypeArguments(), mt2.getTypeArguments());
}
//first use subtyping, then return type substitutability
if (types.isSubtype(rt1, rt2)) {
return mt1;
} else if (types.isSubtype(rt2, rt1)) {
return mt2;
} else if (types.returnTypeSubstitutable(mt1, mt2)) {
return mt1;
} else if (types.returnTypeSubstitutable(mt2, mt1)) {
return mt2;
} else {
return null;
}
}
//where
代码示例来源:origin: sc.fiji/javac
if (!checkResult)
return true;
if (types.returnTypeSubstitutable(mt, ot))
return true;
代码示例来源:origin: org.jvnet.sorcerer/sorcerer-javac
if (!checkResult)
return true;
if (types.returnTypeSubstitutable(mt, ot))
return true;
代码示例来源:origin: org.kohsuke.sorcerer/sorcerer-javac
if (!checkResult)
return true;
if (types.returnTypeSubstitutable(mt, ot))
return true;
代码示例来源:origin: konsoletyper/teavm-javac
if (!checkResult)
return true;
if (types.returnTypeSubstitutable(mt, ot))
return true;
代码示例来源:origin: org.kohsuke.sorcerer/sorcerer-javac
Type mt2 = memberType(origin.type, msym2);
if (phase2 ?
!returnTypeSubstitutable(mt1, mt2) :
!isSubtypeInternal(mt1.getReturnType(), mt2.getReturnType())) {
continue outer;
代码示例来源:origin: konsoletyper/teavm-javac
Type mt2 = memberType(origin.type, msym2);
if (phase2 ?
!returnTypeSubstitutable(mt1, mt2) :
!isSubtypeInternal(mt1.getReturnType(), mt2.getReturnType())) {
continue outer;
代码示例来源:origin: sc.fiji/javac
types.returnTypeSubstitutable(mt, ot, otres, overrideWarner);
if (!resultTypesOK) {
if (!source.allowCovariantReturns() &&
代码示例来源:origin: org.jvnet.sorcerer/sorcerer-javac
types.returnTypeSubstitutable(mt, ot, otres, overrideWarner);
if (!resultTypesOK) {
if (!source.allowCovariantReturns() &&
代码示例来源:origin: org.kohsuke.sorcerer/sorcerer-javac
types.returnTypeSubstitutable(mt, ot, otres, overrideWarner);
if (!resultTypesOK) {
if (!allowCovariantReturns &&
代码示例来源:origin: konsoletyper/teavm-javac
types.returnTypeSubstitutable(mt, ot, otres, overrideWarner);
if (!resultTypesOK) {
if (!allowCovariantReturns &&
内容来源于网络,如有侵权,请联系作者删除!