Java Code Examples for com.sun.source.tree.TypeParameterTree#getBounds()

The following examples show how to use com.sun.source.tree.TypeParameterTree#getBounds() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: JavaInputAstVisitor.java    From java-n-IDE-for-Android with Apache License 2.0 5 votes vote down vote up
@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;
    }
 
Example 2
Source File: CreateElementUtilities.java    From netbeans with Apache License 2.0 5 votes vote down vote up
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;
}
 
Example 3
Source File: CreateElementUtilities.java    From netbeans with Apache License 2.0 5 votes vote down vote up
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;
}
 
Example 4
Source File: JavaInputAstVisitor.java    From javaide with GNU General Public License v3.0 5 votes vote down vote up
@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;
    }
 
Example 5
Source File: JavaInputAstVisitor.java    From google-java-format with Apache License 2.0 5 votes vote down vote up
@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;
}