标签:lis already bounds maker any check pre family arp
此方法的实现如下:
public void validate(JCTree tree, Env<AttrContext> env, boolean checkRaw) {
Validator vr = new Validator(env,Check.this);
vr.validateTree(tree, checkRaw, true);
}
这个方法在Attr中有两处调用,如下:
checkRaw为false表示不用检查是否为Raw类型。这样就不会出现这样的警告 ”找到原始类型: {0} 缺少泛型类{1}的类型参数“
关于Raw类型参见:https://www.cnblogs.com/extjs4/p/9209276.html
另外还有一个方法调用如上方法进行实现,代码如下:
public void validate(JCTree tree, Env<AttrContext> env) {
validate(tree, env, true);
}
Validate a type expression. That is,check that all type arguments of a parametric type are within
their bounds. This must be done in a second phase after type attribution
since a class might have a subclass as type parameter bound. E.g:
class B<A extends C> { ... }
class C extends B<C> { ... }
and we can‘t treeMaker sure that the bound is already attributed because of possible cycles.
AttrVisitor method: Validate a type expression, if it is not null, catching and reporting any completion failures.
调用这个方法的地方如下截图。
还有另外的地方调用这个方法,代码如下:
/** AttrVisitor method: Validate a list of type expressions. */ public void validate(List<? extends JCTree> trees, Env<AttrContext> env) { for (List<? extends JCTree> l = trees; l.nonEmpty(); l = l.tail) { validate(l.head, env); } }
这个方法调用地方的截图如下:
标签:lis already bounds maker any check pre family arp
原文地址:https://www.cnblogs.com/extjs4/p/9209313.html