public Void visitMethod(MethodTree node, Set<TypeMirror> p) { Set<TypeMirror> s = new LinkedHashSet<TypeMirror>(); scan(node.getBody(), s); for (ExpressionTree et : node.getThrows()) { TypeMirror t = info.getTrees().getTypeMirror(new TreePath(getCurrentPath(), et)); if (t != null && t.getKind() != TypeKind.ERROR) { for (Iterator<TypeMirror> it = s.iterator(); it.hasNext();) if (info.getTypes().isSubtype(it.next(), t)) it.remove(); } } p.addAll(s); return null; }
public Void visitThrow(ThrowTree node, Set<TypeMirror> p) { super.visitThrow(node, p); TypeMirror tm = info.getTrees().getTypeMirror(new TreePath(getCurrentPath(), node.getExpression())); if (tm != null) { if (tm.getKind() == TypeKind.DECLARED) p.add(tm); else if (tm.getKind() == TypeKind.UNION) p.addAll(((UnionType)tm).getAlternatives()); } return null; }
public Void visitNewClass(NewClassTree node, Set<TypeMirror> p) { super.visitNewClass(node, p); Element el = info.getTrees().getElement(getCurrentPath()); if (el != null && el.getKind() == ElementKind.CONSTRUCTOR) p.addAll(((ExecutableElement)el).getThrownTypes()); return null; }
Elements elements = info.getElements(); for (Tree res : node.getResources()) { TypeMirror resType = trees.getTypeMirror(new TreePath(getCurrentPath(), res)); if (resType != null && resType.getKind() == TypeKind.DECLARED) { for (ExecutableElement method : ElementFilter.methodsIn(elements.getAllMembers((TypeElement)((DeclaredType)resType).asElement()))) { Set<TypeMirror> c = new LinkedHashSet<TypeMirror>(); for (CatchTree ct : node.getCatches()) { TypeMirror t = trees.getTypeMirror(new TreePath(getCurrentPath(), ct.getParameter().getType())); if (t != null) { if (t.getKind() == TypeKind.UNION) {
public Void visitMethodInvocation(MethodInvocationTree node, Set<TypeMirror> p) { super.visitMethodInvocation(node, p); Element el = info.getTrees().getElement(getCurrentPath()); if (el != null && el.getKind() == ElementKind.METHOD) p.addAll(((ExecutableElement)el).getThrownTypes()); return null; }