@Override public void visit(TryCatchStatement statement) { super.visit(statement); if (statement.getExceptionType() != null) { consumer.consume(statement.getExceptionType()); } }
private void wieldTryCatch(List<Statement> statements) { for (int i = 0; i < statements.size() - 1; ++i) { if (statements.get(i) instanceof TryCatchStatement && statements.get(i + 1) instanceof TryCatchStatement) { TryCatchStatement first = (TryCatchStatement) statements.get(i); TryCatchStatement second = (TryCatchStatement) statements.get(i + 1); if (Objects.equals(first.getExceptionType(), second.getExceptionType()) && Objects.equals(first.getExceptionVariable(), second.getExceptionVariable()) && briefStatementComparison(first.getHandler(), second.getHandler())) { first.getProtectedBody().addAll(second.getProtectedBody()); statements.remove(i + 1); wieldTryCatch(first.getProtectedBody()); --i; } } } }
@Override public void visit(TryCatchStatement statement) { try { output.writeByte(16); writeSequence(statement.getProtectedBody()); output.writeInt(statement.getExceptionType() != null ? symbolTable.lookup(statement.getExceptionType()) : -1); output.writeShort(statement.getExceptionVariable() != null ? statement.getExceptionVariable() : -1); writeSequence(statement.getHandler()); } catch (IOException e) { throw new IOExceptionWrapper(e); } }
writer.ws().append("else"); if (catchClause.getExceptionType() != null) { if (!first) { writer.append(" "); writer.append("if").ws().append("($$je instanceof ").appendClass(catchClause.getExceptionType()); writer.append(")").ws(); } else { if (catchClause.getExceptionType() != null || !first) { writer.append("{").indent().softNewLine(); if (catchClause.getExceptionType() != null || !first) { writer.outdent().append("}");
@Override public void visit(TryCatchStatement statement) { super.visit(statement); if (statement.getExceptionType() != null) { consumer.consume(statement.getExceptionType()); } }
private void wieldTryCatch(List<Statement> statements) { for (int i = 0; i < statements.size() - 1; ++i) { if (statements.get(i) instanceof TryCatchStatement && statements.get(i + 1) instanceof TryCatchStatement) { TryCatchStatement first = (TryCatchStatement) statements.get(i); TryCatchStatement second = (TryCatchStatement) statements.get(i + 1); if (Objects.equals(first.getExceptionType(), second.getExceptionType()) && Objects.equals(first.getExceptionVariable(), second.getExceptionVariable()) && briefStatementComparison(first.getHandler(), second.getHandler())) { first.getProtectedBody().addAll(second.getProtectedBody()); statements.remove(i + 1); wieldTryCatch(first.getProtectedBody()); --i; } } } }
@Override public void visit(TryCatchStatement statement) { try { output.writeByte(16); writeSequence(statement.getProtectedBody()); output.writeInt(statement.getExceptionType() != null ? symbolTable.lookup(statement.getExceptionType()) : -1); output.writeShort(statement.getExceptionVariable() != null ? statement.getExceptionVariable() : -1); writeSequence(statement.getHandler()); } catch (IOException e) { throw new IOExceptionWrapper(e); } }
for (TryCatchStatement catchClause : sequence) { writer.append("if").ws().append("($$je"); if (catchClause.getExceptionType() != null) { writer.ws().append("&&").ws().append("$$je instanceof ") .appendClass(catchClause.getExceptionType());