@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; }
@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; }
@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); }
@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; }
@Override public Mirror visitIntersectionType(IntersectionTypeTree node, EvaluationContext p) { // intersection type in a cast expression List<? extends Tree> bounds = node.getBounds(); List<ReferenceType> typeList = new ArrayList<ReferenceType>(); for (Tree type : bounds) { Mirror typeMirror = type.accept(this, p); if (typeMirror instanceof ReferenceType) { typeList.add((ReferenceType) typeMirror); } } Type intersectionType = new IntersectionType(typeList.toArray(new ReferenceType[] {})); subExpressionTypes.put(node, intersectionType); return intersectionType; }
@Override public Void visitIntersectionType(IntersectionTypeTree tree, VisitorState visitorState) { VisitorState state = visitorState.withPath(getCurrentPath()); for (IntersectionTypeTreeMatcher matcher : intersectionTypeMatchers) { if (!isSuppressed(matcher, state)) { try { reportMatch(matcher.matchIntersectionType(tree, state), tree, state); } catch (Throwable t) { handleError(matcher, t); } } } return super.visitIntersectionType(tree, state); }
@Override public List<? extends TypeMirror> visitIntersectionType(IntersectionTypeTree node, Object p) { return null; }
@Override public R visitIntersectionType(IntersectionTypeTree itt, P p) { return null; }
@Override public List<T> visitIntersectionType(IntersectionTypeTree node, T p) { return checkForCriteria(node); }
@Override public UIntersectionType visitIntersectionType(IntersectionTypeTree tree, Void v) { return UIntersectionType.create(templateTypeExpressions(tree.getBounds())); }
@Override public Choice<Unifier> visitIntersectionType(IntersectionTypeTree node, Unifier unifier) { return unifyList(unifier, getBounds(), node.getBounds()); }
@Override public PurityResult visitIntersectionType(IntersectionTypeTree node, PurityResult p) { assert false : "this type of tree is unexpected here"; return null; }
Description matchIntersectionType(IntersectionTypeTree tree, VisitorState state);