if (catches.size() != 1) {
// TODO(user): this could be supported - only the last catch would need
// to be checked - it would either be Throwable or Error.
return false;
}
CatchTree catchTree = catches.get(0);
VariableTree catchType = catchTree.getParameter();
if (!javaLangThrowable.matches(catchType, state)) {
// TODO(user): Error could be supported
return false;
}
// Verify that the catch block is empty or contains only comments.
List<? extends StatementTree> catchStatements = catchTree.getBlock().getStatements();
for (StatementTree catchStatement : catchStatements) {
// Comments are not a part of the AST. Therefore, we should either get
// an empty list of statements (regardless of the number of comments),
// or a list of empty statements.
if (!Matchers.<Tree>kindIs(EMPTY_STATEMENT).matches(catchStatement, state)) {