本文整理了Java中com.sun.tools.javac.code.Types.isSubSignature()
方法的一些代码示例,展示了Types.isSubSignature()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Types.isSubSignature()
方法的具体详情如下:
包路径:com.sun.tools.javac.code.Types
类名称:Types
方法名:isSubSignature
[英]Returns true iff the first signature is a sub signature of the other. This is not an equivalence relation.
[中]
代码示例来源:origin: google/error-prone
clash.removeIf(m -> types.isSubSignature(msym.type, m.type));
if (clash.isEmpty()) {
continue;
代码示例来源:origin: org.kohsuke.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.
*
* @jls section 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 isSubSignature(t, s, true);
}
代码示例来源:origin: konsoletyper/teavm-javac
/**
* Returns true iff the first signature is a <em>sub
* signature</em> of the other. This is <b>not</b> an equivalence
* relation.
*
* @jls section 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 isSubSignature(t, s, true);
}
代码示例来源:origin: konsoletyper/teavm-javac
public boolean isSubsignature(ExecutableType m1, ExecutableType m2) {
return types.isSubSignature((Type) m1, (Type) m2);
}
代码示例来源:origin: org.jvnet.sorcerer/sorcerer-javac
public boolean isSubsignature(ExecutableType m1, ExecutableType m2) {
return types.isSubSignature((Type) m1, (Type) m2);
}
代码示例来源:origin: org.kohsuke.sorcerer/sorcerer-javac
public boolean isSubsignature(ExecutableType m1, ExecutableType m2) {
return types.isSubSignature((Type) m1, (Type) m2);
}
代码示例来源:origin: sc.fiji/javac
public boolean isSubsignature(ExecutableType m1, ExecutableType m2) {
return types.isSubSignature((Type) m1, (Type) m2);
}
代码示例来源:origin: org.kohsuke.sorcerer/sorcerer-javac
private boolean notOverriddenIn(Type site, Symbol sym) {
if (sym.kind != MTH || sym.isConstructor() || sym.isStatic())
return true;
else {
Symbol s2 = ((MethodSymbol)sym).implementation(site.tsym, types, true);
return (s2 == null || s2 == sym || sym.owner == s2.owner ||
!types.isSubSignature(types.memberType(site, s2), types.memberType(site, sym)));
}
}
//where
代码示例来源:origin: konsoletyper/teavm-javac
private boolean notOverriddenIn(Type site, Symbol sym) {
if (sym.kind != MTH || sym.isConstructor() || sym.isStatic())
return true;
else {
Symbol s2 = ((MethodSymbol)sym).implementation(site.tsym, types, true);
return (s2 == null || s2 == sym || sym.owner == s2.owner ||
!types.isSubSignature(types.memberType(site, s2), types.memberType(site, sym)));
}
}
//where
代码示例来源:origin: org.jvnet.sorcerer/sorcerer-javac
/** Check for hiding. Note that this doesn't handle multiple
* (interface) inheritance. */
private boolean hiddenIn(ClassSymbol clazz, Types types) {
if (kind == MTH && (flags() & STATIC) == 0) return false;
while (true) {
if (owner == clazz) return false;
Scope.Entry e = clazz.members().lookup(name);
while (e.scope != null) {
if (e.sym == this) return false;
if (e.sym.kind == kind &&
(kind != MTH ||
(e.sym.flags() & STATIC) != 0 &&
types.isSubSignature(e.sym.type, type)))
return true;
e = e.next();
}
Type superType = types.supertype(clazz.type);
if (superType.tag != TypeTags.CLASS) return false;
clazz = (ClassSymbol)superType.tsym;
}
}
代码示例来源:origin: sc.fiji/javac
/** Check for hiding. Note that this doesn't handle multiple
* (interface) inheritance. */
private boolean hiddenIn(ClassSymbol clazz, Types types) {
if (kind == MTH && (flags() & STATIC) == 0) return false;
while (true) {
if (owner == clazz) return false;
Scope.Entry e = clazz.members().lookup(name);
while (e.scope != null) {
if (e.sym == this) return false;
if (e.sym.kind == kind &&
(kind != MTH ||
(e.sym.flags() & STATIC) != 0 &&
types.isSubSignature(e.sym.type, type)))
return true;
e = e.next();
}
Type superType = types.supertype(clazz.type);
if (superType.tag != TypeTags.CLASS) return false;
clazz = (ClassSymbol)superType.tsym;
}
}
代码示例来源:origin: org.jvnet.sorcerer/sorcerer-javac
!types.isSubSignature(hider.type, hidee.type)) {
return false;
代码示例来源:origin: sc.fiji/javac
!types.isSubSignature(hider.type, hidee.type)) {
return false;
代码示例来源:origin: org.kohsuke.sorcerer/sorcerer-javac
!types.isSubSignature(hider.type, hidee.type)) {
return false;
代码示例来源:origin: konsoletyper/teavm-javac
!types.isSubSignature(hider.type, hidee.type)) {
return false;
代码示例来源:origin: org.kohsuke.sorcerer/sorcerer-javac
/** Check that all static methods accessible from 'site' are
* mutually compatible (JLS 8.4.8).
*
* @param pos Position to be used for error reporting.
* @param site The class whose methods are checked.
* @param sym The method symbol to be checked.
*/
void checkHideClashes(DiagnosticPosition pos, Type site, MethodSymbol sym) {
ClashFilter cf = new ClashFilter(site);
//for each method m1 that is a member of 'site'...
for (Symbol s : types.membersClosure(site, true).getElementsByName(sym.name, cf)) {
//if (i) the signature of 'sym' is not a subsignature of m1 (seen as
//a member of 'site') and (ii) 'sym' has the same erasure as m1, issue an error
if (!types.isSubSignature(sym.type, types.memberType(site, s), allowStrictMethodClashCheck)) {
if (types.hasSameArgs(s.erasure(types), sym.erasure(types))) {
log.error(pos,
"name.clash.same.erasure.no.hide",
sym, sym.location(),
s, s.location());
return;
} else {
checkPotentiallyAmbiguousOverloads(pos, site, sym, (MethodSymbol)s);
}
}
}
}
代码示例来源:origin: konsoletyper/teavm-javac
/** Check that all static methods accessible from 'site' are
* mutually compatible (JLS 8.4.8).
*
* @param pos Position to be used for error reporting.
* @param site The class whose methods are checked.
* @param sym The method symbol to be checked.
*/
void checkHideClashes(DiagnosticPosition pos, Type site, MethodSymbol sym) {
ClashFilter cf = new ClashFilter(site);
//for each method m1 that is a member of 'site'...
for (Symbol s : types.membersClosure(site, true).getElementsByName(sym.name, cf)) {
//if (i) the signature of 'sym' is not a subsignature of m1 (seen as
//a member of 'site') and (ii) 'sym' has the same erasure as m1, issue an error
if (!types.isSubSignature(sym.type, types.memberType(site, s), allowStrictMethodClashCheck)) {
if (types.hasSameArgs(s.erasure(types), sym.erasure(types))) {
log.error(pos,
"name.clash.same.erasure.no.hide",
sym, sym.location(),
s, s.location());
return;
} else {
checkPotentiallyAmbiguousOverloads(pos, site, sym, (MethodSymbol)s);
}
}
}
}
代码示例来源:origin: org.kohsuke.sorcerer/sorcerer-javac
class LookupFilter implements Filter<Symbol> {
boolean abstractOk;
LookupFilter(boolean abstractOk) {
this.abstractOk = abstractOk;
}
public boolean accepts(Symbol s) {
long flags = s.flags();
return s.kind == MTH &&
(flags & SYNTHETIC) == 0 &&
(abstractOk ||
(flags & DEFAULT) != 0 ||
(flags & ABSTRACT) == 0);
}
};
代码示例来源:origin: konsoletyper/teavm-javac
class LookupFilter implements Filter<Symbol> {
boolean abstractOk;
LookupFilter(boolean abstractOk) {
this.abstractOk = abstractOk;
}
public boolean accepts(Symbol s) {
long flags = s.flags();
return s.kind == MTH &&
(flags & SYNTHETIC) == 0 &&
(abstractOk ||
(flags & DEFAULT) != 0 ||
(flags & ABSTRACT) == 0);
}
};
代码示例来源:origin: org.kohsuke.sorcerer/sorcerer-javac
private Symbol hiddenInInternal(ClassSymbol c, Types types) {
Scope.Entry e = c.members().lookup(name);
while (e.scope != null) {
if (e.sym.kind == kind &&
(kind != MTH ||
(e.sym.flags() & STATIC) != 0 &&
types.isSubSignature(e.sym.type, type))) {
return e.sym;
}
e = e.next();
}
List<Symbol> hiddenSyms = List.nil();
for (Type st : types.interfaces(c.type).prepend(types.supertype(c.type))) {
if (st != null && (st.hasTag(CLASS))) {
Symbol sym = hiddenInInternal((ClassSymbol)st.tsym, types);
if (sym != null) {
hiddenSyms = hiddenSyms.prepend(hiddenInInternal((ClassSymbol)st.tsym, types));
}
}
}
return hiddenSyms.contains(this) ?
this :
(hiddenSyms.isEmpty() ? null : hiddenSyms.head);
}
内容来源于网络,如有侵权,请联系作者删除!