@Override public void visitCatchClause(GrCatchClause catchClause) { final GrParameter parameter = catchClause.getParameter(); builder.append("catch ("); writeVariableWithoutSemicolonAndInitializer(builder, parameter, context); builder.append(") "); final GrOpenBlock body = catchClause.getBody(); if (body != null) { body.accept(this); } }
@Nullable private ExceptionInfo findCatch(PsiType thrownType) { final Iterator<ExceptionInfo> iterator = myCaughtExceptionInfos.descendingIterator(); while (iterator.hasNext()) { final ExceptionInfo info = iterator.next(); final GrCatchClause clause = info.myClause; final GrParameter parameter = clause.getParameter(); if (parameter != null) { final PsiType type = parameter.getType(); if (type.isAssignableFrom(thrownType)) return info; } } return null; }
private static boolean catchClausesAreEquivalent(GrCatchClause clause1, GrCatchClause clause2) { return parametersAreEquivalent(clause1.getParameter(), clause2.getParameter()) && openBlocksAreEquivalent(clause1.getBody(), clause2.getBody()); }