com.sun.source.tree.IntersectionTypeTree Java Examples

The following examples show how to use com.sun.source.tree.IntersectionTypeTree. 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: IntersectionTypeLocationCriterion.java    From annotation-tools with MIT License 6 votes vote down vote up
@Override
public boolean isSatisfiedBy(TreePath path) {
  TreePath parentPath = path.getParentPath();
  if (parentPath != null) {
    Tree parent = parentPath.getLeaf();
    if (parent.getKind() == Tree.Kind.INTERSECTION_TYPE) {
      IntersectionTypeTree itt = (IntersectionTypeTree) parent;
      List<? extends Tree> bounds = itt.getBounds();
      Tree leaf = path.getLeaf();
      if (typeIndex < bounds.size()
          && leaf == bounds.get(typeIndex)) {
        return true;
      }
    }
  }
  Tree.Kind kind = path.getLeaf().getKind();
  if (ASTPath.isTypeKind(kind) || kind == Tree.Kind.MEMBER_SELECT) {
    return isSatisfiedBy(path.getParentPath());
  }
  return false;
}
 
Example #2
Source File: JavaInputAstVisitor.java    From google-java-format with Apache License 2.0 6 votes vote down vote up
@Override
public Void visitIntersectionType(IntersectionTypeTree node, Void unused) {
  sync(node);
  builder.open(plusFour);
  boolean first = true;
  for (Tree type : node.getBounds()) {
    if (!first) {
      builder.breakToFill(" ");
      token("&");
      builder.space();
    }
    scan(type, null);
    first = false;
  }
  builder.close();
  return null;
}
 
Example #3
Source File: TreeDuplicator.java    From netbeans with Apache License 2.0 5 votes vote down vote up
@Override
public Tree visitIntersectionType(IntersectionTypeTree tree, Void p) {
    IntersectionTypeTree n = make.IntersectionType(tree.getBounds());
    model.setType(n, model.getType(tree));
    comments.copyComments(tree, n);
    model.setPos(n, model.getPos(tree));
    return n;
}
 
Example #4
Source File: DependencyCollector.java    From netbeans with Apache License 2.0 5 votes vote down vote up
@Override
public Object visitIntersectionType(IntersectionTypeTree node, Object p) {
    for (Tree t : node.getBounds()) {
        addDependency(info.getTrees().getTypeMirror(new TreePath(getCurrentPath(), t)));
    }
    return super.visitIntersectionType(node, p);
}
 
Example #5
Source File: TreeNode.java    From netbeans with Apache License 2.0 5 votes vote down vote up
@Override
public Void visitIntersectionType(IntersectionTypeTree tree, List<Node> d) {
    List<Node> below = new ArrayList<Node>();
    
    addCorrespondingType(below);
    addCorrespondingComments(below);
    super.visitIntersectionType(tree, below);
    
    d.add(new TreeNode(info, getCurrentPath(), below));
    return null;
}
 
Example #6
Source File: ExpectedTypeResolver.java    From netbeans with Apache License 2.0 4 votes vote down vote up
@Override
public List<? extends TypeMirror> visitIntersectionType(IntersectionTypeTree node, Object p) {
    return null;
}