public static TextBuffer listToJava(List<? extends Exprent> lst, int indent, BytecodeMappingTracer tracer) { if (lst == null || lst.isEmpty()) { return new TextBuffer(); } TextBuffer buf = new TextBuffer(); for (Exprent expr : lst) { if (buf.length() > 0 && expr.type == Exprent.EXPRENT_VAR && ((VarExprent)expr).isClassDef()) { // separates local class definition from previous statements buf.appendLineSeparator(); tracer.incrementCurrentSourceLine(); } TextBuffer content = expr.toJava(indent, tracer); if (content.length() > 0) { if (expr.type != Exprent.EXPRENT_VAR || !((VarExprent)expr).isClassDef()) { buf.appendIndent(indent); } buf.append(content); if (expr.type == Exprent.EXPRENT_MONITOR && ((MonitorExprent)expr).getMonType() == MonitorExprent.MONITOR_ENTER) { buf.append("{}"); // empty synchronized block } if (endsWithSemicolon(expr)) { buf.append(";"); } buf.appendLineSeparator(); tracer.incrementCurrentSourceLine(); } } return buf; }
public static TextBuffer jmpWrapper(Statement stat, int indent, boolean semicolon, BytecodeMappingTracer tracer) { TextBuffer buf = stat.toJava(indent, tracer); List<StatEdge> lstSuccs = stat.getSuccessorEdges(Statement.STATEDGE_DIRECT_ALL); if (lstSuccs.size() == 1) { StatEdge edge = lstSuccs.get(0); if (edge.getType() != StatEdge.TYPE_REGULAR && edge.explicit && edge.getDestination().type != Statement.TYPE_DUMMYEXIT) { buf.appendIndent(indent); switch (edge.getType()) { case StatEdge.TYPE_BREAK: addDeletedGotoInstructionMapping(stat, tracer); buf.append("break"); break; case StatEdge.TYPE_CONTINUE: addDeletedGotoInstructionMapping(stat, tracer); buf.append("continue"); } if (edge.labeled) { buf.append(" label").append(edge.closure.id.toString()); } buf.append(";").appendLineSeparator(); tracer.incrementCurrentSourceLine(); } } if (buf.length() == 0 && semicolon) { buf.appendIndent(indent).append(";").appendLineSeparator(); tracer.incrementCurrentSourceLine(); } return buf; }
if (enumConst && buf.length() == 2) { buf.setLength(0);
!labeled && !first.isLabeled() && (lstSuccs.isEmpty() || !lstSuccs.get(0).explicit)) { TextBuffer content = ExprProcessor.jmpWrapper(first, indent, true, tracer); content.setLength(content.length() - new_line_separator.length()); tracer.incrementCurrentSourceLine(-1); buf.append(content);
TextBuffer content = ExprProcessor.jmpWrapper(elsestat, indent + 1, false, else_tracer); if (content.length() > 0) { buf.appendIndent(indent).append("} else {").appendLineSeparator();
private void fieldToJava(ClassWrapper wrapper, StructClass cl, StructField fd, TextBuffer buffer, int indent, BytecodeMappingTracer tracer) { int start = buffer.length(); boolean isInterface = cl.hasModifier(CodeConstants.ACC_INTERFACE); boolean isDeprecated = fd.hasAttribute(StructGeneralAttribute.ATTRIBUTE_DEPRECATED);