本文整理了Java中com.sun.tools.javac.code.Types.intersect()
方法的一些代码示例,展示了Types.intersect()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Types.intersect()
方法的具体详情如下:
包路径:com.sun.tools.javac.code.Types
类名称:Types
方法名:intersect
[英]Intersect two closures
[中]两个闭包相交
代码示例来源:origin: org.jvnet.sorcerer/sorcerer-javac
/**
* Intersect two closures
*/
public List<Type> intersect(List<Type> cl1, List<Type> cl2) {
if (cl1 == cl2)
return cl1;
if (cl1.isEmpty() || cl2.isEmpty())
return List.nil();
if (cl1.head.tsym.precedes(cl2.head.tsym, this))
return intersect(cl1.tail, cl2);
if (cl2.head.tsym.precedes(cl1.head.tsym, this))
return intersect(cl1, cl2.tail);
if (isSameType(cl1.head, cl2.head))
return intersect(cl1.tail, cl2.tail).prepend(cl1.head);
if (cl1.head.tsym == cl2.head.tsym &&
cl1.head.tag == CLASS && cl2.head.tag == CLASS) {
if (cl1.head.isParameterized() && cl2.head.isParameterized()) {
Type merge = merge(cl1.head,cl2.head);
return intersect(cl1.tail, cl2.tail).prepend(merge);
}
if (cl1.head.isRaw() || cl2.head.isRaw())
return intersect(cl1.tail, cl2.tail).prepend(erasure(cl1.head));
}
return intersect(cl1.tail, cl2.tail);
}
// where
代码示例来源:origin: sc.fiji/javac
/**
* Intersect two closures
*/
public List<Type> intersect(List<Type> cl1, List<Type> cl2) {
if (cl1 == cl2)
return cl1;
if (cl1.isEmpty() || cl2.isEmpty())
return List.nil();
if (cl1.head.tsym.precedes(cl2.head.tsym, this))
return intersect(cl1.tail, cl2);
if (cl2.head.tsym.precedes(cl1.head.tsym, this))
return intersect(cl1, cl2.tail);
if (isSameType(cl1.head, cl2.head))
return intersect(cl1.tail, cl2.tail).prepend(cl1.head);
if (cl1.head.tsym == cl2.head.tsym &&
cl1.head.tag == CLASS && cl2.head.tag == CLASS) {
if (cl1.head.isParameterized() && cl2.head.isParameterized()) {
Type merge = merge(cl1.head,cl2.head);
return intersect(cl1.tail, cl2.tail).prepend(merge);
}
if (cl1.head.isRaw() || cl2.head.isRaw())
return intersect(cl1.tail, cl2.tail).prepend(erasure(cl1.head));
}
return intersect(cl1.tail, cl2.tail);
}
// where
代码示例来源:origin: org.kohsuke.sorcerer/sorcerer-javac
/**
* Intersect two closures
*/
public List<Type> intersect(List<Type> cl1, List<Type> cl2) {
if (cl1 == cl2)
return cl1;
if (cl1.isEmpty() || cl2.isEmpty())
return List.nil();
if (cl1.head.tsym.precedes(cl2.head.tsym, this))
return intersect(cl1.tail, cl2);
if (cl2.head.tsym.precedes(cl1.head.tsym, this))
return intersect(cl1, cl2.tail);
if (isSameType(cl1.head, cl2.head))
return intersect(cl1.tail, cl2.tail).prepend(cl1.head);
if (cl1.head.tsym == cl2.head.tsym &&
cl1.head.hasTag(CLASS) && cl2.head.hasTag(CLASS)) {
if (cl1.head.isParameterized() && cl2.head.isParameterized()) {
Type merge = merge(cl1.head,cl2.head);
return intersect(cl1.tail, cl2.tail).prepend(merge);
}
if (cl1.head.isRaw() || cl2.head.isRaw())
return intersect(cl1.tail, cl2.tail).prepend(erasure(cl1.head));
}
return intersect(cl1.tail, cl2.tail);
}
// where
代码示例来源:origin: konsoletyper/teavm-javac
/**
* Intersect two closures
*/
public List<Type> intersect(List<Type> cl1, List<Type> cl2) {
if (cl1 == cl2)
return cl1;
if (cl1.isEmpty() || cl2.isEmpty())
return List.nil();
if (cl1.head.tsym.precedes(cl2.head.tsym, this))
return intersect(cl1.tail, cl2);
if (cl2.head.tsym.precedes(cl1.head.tsym, this))
return intersect(cl1, cl2.tail);
if (isSameType(cl1.head, cl2.head))
return intersect(cl1.tail, cl2.tail).prepend(cl1.head);
if (cl1.head.tsym == cl2.head.tsym &&
cl1.head.hasTag(CLASS) && cl2.head.hasTag(CLASS)) {
if (cl1.head.isParameterized() && cl2.head.isParameterized()) {
Type merge = merge(cl1.head,cl2.head);
return intersect(cl1.tail, cl2.tail).prepend(merge);
}
if (cl1.head.isRaw() || cl2.head.isRaw())
return intersect(cl1.tail, cl2.tail).prepend(erasure(cl1.head));
}
return intersect(cl1.tail, cl2.tail);
}
// where
代码示例来源:origin: sc.fiji/javac
for (Type t : ts.tail) {
if (t.tag == CLASS || t.tag == TYPEVAR)
cl = intersect(cl, closure(t));
代码示例来源:origin: org.jvnet.sorcerer/sorcerer-javac
for (Type t : ts.tail) {
if (t.tag == CLASS || t.tag == TYPEVAR)
cl = intersect(cl, closure(t));
代码示例来源:origin: org.kohsuke.sorcerer/sorcerer-javac
for (Type t : ts.tail) {
if (t.hasTag(CLASS) || t.hasTag(TYPEVAR))
cl = intersect(cl, erasedSupertypes(t));
List<Type> lci = List.of(asSuper(ts.head, erasedSupertype.tsym));
for (Type t : ts) {
lci = intersect(lci, List.of(asSuper(t, erasedSupertype.tsym)));
代码示例来源:origin: konsoletyper/teavm-javac
Type t = ts[i];
if (t.hasTag(CLASS) || t.hasTag(TYPEVAR))
cl = intersect(cl, erasedSupertypes(t));
for (int i = startIdx + 1 ; i < ts.length ; i++) {
Type superType = asSuper(ts[i], erasedSupertype.tsym);
lci = intersect(lci, superType != null ? List.of(superType) : List.<Type>nil());
内容来源于网络,如有侵权,请联系作者删除!