本文整理了Java中com.sun.tools.javac.code.Types.glb()
方法的一些代码示例,展示了Types.glb()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Types.glb()
方法的具体详情如下:
包路径:com.sun.tools.javac.code.Types
类名称:Types
方法名:glb
[英]Perform glb for a list of non-primitive, non-error, non-compound types; redundant elements are removed. Bounds should be ordered according to Symbol#precedes(TypeSymbol,Types).
[中]对非原始、非错误、非复合类型的列表执行glb;多余的元素被移除。边界应根据符号#前置(TypeSymbol,Types)排序。
代码示例来源:origin: org.kohsuke.sorcerer/sorcerer-javac
public Type glb(List<Type> ts) {
Type t1 = ts.head;
for (Type t2 : ts.tail) {
if (t1.isErroneous())
return t1;
t1 = glb(t1, t2);
}
return t1;
}
//where
代码示例来源:origin: konsoletyper/teavm-javac
public Type glb(List<Type> ts) {
Type t1 = ts.head;
for (Type t2 : ts.tail) {
if (t1.isErroneous())
return t1;
t1 = glb(t1, t2);
}
return t1;
}
//where
代码示例来源:origin: org.kohsuke.sorcerer/sorcerer-javac
@Override
Type solve(UndetVar uv, InferenceContext inferenceContext) {
Infer infer = inferenceContext.infer();
List<Type> hibounds = filterBounds(uv, inferenceContext);
//note: lobounds should have at least one element
Type owntype = hibounds.tail.tail == null ? hibounds.head : infer.types.glb(hibounds);
if (owntype.isPrimitive() || owntype.hasTag(ERROR)) {
throw infer.inferenceException
.setMessage("no.unique.maximal.instance.exists",
uv.qtype, hibounds);
} else {
return owntype;
}
}
},
代码示例来源:origin: konsoletyper/teavm-javac
@Override
Type solve(UndetVar uv, InferenceContext inferenceContext) {
Infer infer = inferenceContext.infer();
List<Type> hibounds = filterBounds(uv, inferenceContext);
//note: hibounds should have at least one element
Type owntype = hibounds.tail.tail == null ? hibounds.head : infer.types.glb(hibounds);
if (owntype.isPrimitive() || owntype.hasTag(ERROR)) {
throw infer.inferenceException
.setMessage("no.unique.maximal.instance.exists",
uv.qtype, hibounds);
} else {
return owntype;
}
}
},
代码示例来源:origin: org.jvnet.sorcerer/sorcerer-javac
public boolean containedBy(Type t, Type s) {
switch (t.tag) {
case UNDETVAR:
if (s.tag == WILDCARD) {
UndetVar undetvar = (UndetVar)t;
// Because of wildcard capture, s must be on the left
// hand side of an assignment. Furthermore, t is an
// underconstrained type variable, for example, one
// that is only used in the return type of a method.
// If the type variable is truly underconstrained, it
// cannot have any low bounds:
assert undetvar.lobounds.isEmpty() : undetvar;
undetvar.inst = glb(upperBound(s), undetvar.inst);
return true;
} else {
return isSameType(t, s);
}
case ERROR:
return true;
default:
return containsType(s, t);
}
}
代码示例来源:origin: sc.fiji/javac
public boolean containedBy(Type t, Type s) {
switch (t.tag) {
case UNDETVAR:
if (s.tag == WILDCARD) {
UndetVar undetvar = (UndetVar)t;
// Because of wildcard capture, s must be on the left
// hand side of an assignment. Furthermore, t is an
// underconstrained type variable, for example, one
// that is only used in the return type of a method.
// If the type variable is truly underconstrained, it
// cannot have any low bounds:
assert undetvar.lobounds.isEmpty() : undetvar;
undetvar.inst = glb(upperBound(s), undetvar.inst);
return true;
} else {
return isSameType(t, s);
}
case ERROR:
return true;
default:
return containsType(s, t);
}
}
代码示例来源:origin: org.kohsuke.sorcerer/sorcerer-javac
/**
* Make sure that the upper bounds we got so far lead to a solvable inference
* variable by making sure that a glb exists.
*/
void checkCompatibleUpperBounds(UndetVar uv, InferenceContext inferenceContext) {
List<Type> hibounds =
Type.filter(uv.getBounds(InferenceBound.UPPER), new BoundFilter(inferenceContext));
Type hb = null;
if (hibounds.isEmpty())
hb = syms.objectType;
else if (hibounds.tail.isEmpty())
hb = hibounds.head;
else
hb = types.glb(hibounds);
if (hb == null || hb.isErroneous())
reportBoundError(uv, BoundErrorKind.BAD_UPPER);
}
//where
代码示例来源:origin: konsoletyper/teavm-javac
/**
* Make sure that the upper bounds we got so far lead to a solvable inference
* variable by making sure that a glb exists.
*/
void checkCompatibleUpperBounds(UndetVar uv, InferenceContext inferenceContext) {
List<Type> hibounds =
Type.filter(uv.getBounds(InferenceBound.UPPER), new BoundFilter(inferenceContext));
Type hb = null;
if (hibounds.isEmpty())
hb = syms.objectType;
else if (hibounds.tail.isEmpty())
hb = hibounds.head;
else
hb = types.glb(hibounds);
if (hb == null || hb.isErroneous())
reportBoundError(uv, BoundErrorKind.BAD_UPPER);
}
//where
代码示例来源:origin: org.kohsuke.sorcerer/sorcerer-javac
uv.inst = fresh_tvar.type;
} else if (upperBounds.nonEmpty()) {
uv.inst = types.glb(upperBounds);
} else {
uv.inst = syms.objectType;
UndetVar uv = (UndetVar)t;
TypeVar ct = (TypeVar)uv.inst;
ct.bound = types.glb(inferenceContext.asInstTypes(types.getBounds(ct)));
if (ct.bound.isErroneous()) {
代码示例来源:origin: konsoletyper/teavm-javac
uv.inst = fresh_tvar.type;
} else if (upperBounds.nonEmpty()) {
uv.inst = types.glb(upperBounds);
} else {
uv.inst = syms.objectType;
UndetVar uv = (UndetVar)t;
TypeVar ct = (TypeVar)uv.inst;
ct.bound = types.glb(inferenceContext.asInstTypes(types.getBounds(ct)));
if (ct.bound.isErroneous()) {
代码示例来源:origin: sc.fiji/javac
break;
case EXTENDS:
Si.bound = glb(Ti.getExtendsBound(), subst(Ui, A, S));
Si.lower = syms.botType;
break;
代码示例来源:origin: org.jvnet.sorcerer/sorcerer-javac
break;
case EXTENDS:
Si.bound = glb(Ti.getExtendsBound(), subst(Ui, A, S));
Si.lower = syms.botType;
break;
代码示例来源:origin: org.kohsuke.sorcerer/sorcerer-javac
break;
case EXTENDS:
Si.bound = glb(Ti.getExtendsBound(), subst(Ui, A, S));
Si.lower = syms.botType;
break;
代码示例来源:origin: konsoletyper/teavm-javac
break;
case EXTENDS:
Si.bound = glb(Ti.getExtendsBound(), subst(Ui, A, S));
Si.lower = syms.botType;
break;
内容来源于网络,如有侵权,请联系作者删除!