下面列出了com.sun.source.tree.TypeParameterTree#getBounds ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。
@Override
public Void visitTypeParameter(TypeParameterTree node, Void unused) {
sync(node);
builder.open(ZERO);
// TODO: 22-Jul-17 missing method java8
// visitAnnotations(node.getAnnotations(), BreakOrNot.NO, BreakOrNot.YES);
visit(node.getName());
if (!node.getBounds().isEmpty()) {
builder.space();
token("extends");
builder.open(plusFour);
builder.breakOp(" ");
builder.open(plusFour);
boolean first = true;
for (Tree typeBound : node.getBounds()) {
if (!first) {
builder.breakToFill(" ");
token("&");
builder.space();
}
scan(typeBound, null);
first = false;
}
builder.close();
builder.close();
}
builder.close();
return null;
}
private static List<? extends TypeMirror> computeTypeParameter(Set<ElementKind> types, CompilationInfo info, TreePath parent, Tree error, int offset) {
TypeParameterTree tpt = (TypeParameterTree) parent.getLeaf();
for (Tree t : tpt.getBounds()) {
if (t == error) {
types.add(ElementKind.CLASS); //XXX: class/interface/enum/annotation?
return null;
}
}
return null;
}
private static List<? extends TypeMirror> computeTypeParameter(Set<ElementKind> types, CompilationInfo info, TreePath parent, Tree error, int offset) {
TypeParameterTree tpt = (TypeParameterTree) parent.getLeaf();
for (Tree t : tpt.getBounds()) {
if (t == error) {
types.add(ElementKind.CLASS); //XXX: class/interface/enum/annotation?
return null;
}
}
return null;
}
@Override
public Void visitTypeParameter(TypeParameterTree node, Void unused) {
sync(node);
builder.open(ZERO);
// TODO: 22-Jul-17 missing method java8
// visitAnnotations(node.getAnnotations(), BreakOrNot.NO, BreakOrNot.YES);
visit(node.getName());
if (!node.getBounds().isEmpty()) {
builder.space();
token("extends");
builder.open(plusFour);
builder.breakOp(" ");
builder.open(plusFour);
boolean first = true;
for (Tree typeBound : node.getBounds()) {
if (!first) {
builder.breakToFill(" ");
token("&");
builder.space();
}
scan(typeBound, null);
first = false;
}
builder.close();
builder.close();
}
builder.close();
return null;
}
@Override
public Void visitTypeParameter(TypeParameterTree node, Void unused) {
sync(node);
builder.open(ZERO);
visitAnnotations(node.getAnnotations(), BreakOrNot.NO, BreakOrNot.YES);
visit(node.getName());
if (!node.getBounds().isEmpty()) {
builder.space();
token("extends");
builder.open(plusFour);
builder.breakOp(" ");
builder.open(plusFour);
boolean first = true;
for (Tree typeBound : node.getBounds()) {
if (!first) {
builder.breakToFill(" ");
token("&");
builder.space();
}
scan(typeBound, null);
first = false;
}
builder.close();
builder.close();
}
builder.close();
return null;
}