TextBuffer (int indent, BytecodeMappingTracer tracer) { TextBuffer buf = new TextBuffer(); buf.append(ExprProcessor.listToJava(varDefinitions, indent, tracer)); if (isLabeled()) { buf.appendIndent(indent).append("label").append(Integer.toString(id)).append(":").appendLineSeparator(); tracer.incrementCurrentSourceLine(); } buf.appendIndent(indent).append("try {").appendLineSeparator(); tracer.incrementCurrentSourceLine(); buf.append(ExprProcessor.jmpWrapper(first, indent + 1, true, tracer)); buf.appendIndent(indent).append("}"); for (int i = 1; i < stats.size(); i++) { Statement stat = stats.get(i); // map first instruction storing the exception to the catch statement BasicBlock block = stat.getBasichead().getBlock(); if (!block.getSeq().isEmpty() && block.getInstruction(0).opcode == CodeConstants.opc_astore) { Integer offset = block.getOriginalOffset(0); if (offset > -1) tracer.addMapping(offset); } buf.append(" catch ("); List<String> exception_types = exctstrings.get(i - 1); if (exception_types.size() > 1) { // multi-catch, Java 7 style for (int exc_index = 1; exc_index < exception_types.size(); ++exc_index) { VarType exc_type = new VarType(CodeConstants.TYPE_OBJECT, 0, exception_types.get(exc_index)); String exc_type_name = ExprProcessor.getCastTypeName(exc_type, Collections.emptyList()); buf.append(exc_type_name).append(" | "); } } buf.append(vars.get(i - 1).toJava(indent, tracer)); buf.append(") {").appendLineSeparator(); tracer.incrementCurrentSourceLine(); buf.append(ExprProcessor.jmpWrapper(stat, indent + 1, false, tracer)).appendIndent(indent) .append("}"); } buf.appendLineSeparator(); tracer.incrementCurrentSourceLine(); return buf; }