private static void appendDeprecation(TextBuffer buffer, int indent) { buffer.appendIndent(indent).append("/** @deprecated */").appendLineSeparator(); }
private static void appendComment(TextBuffer buffer, String comment, int indent) { buffer.appendIndent(indent).append("// $FF: ").append(comment).appendLineSeparator(); }
buffer.appendIndent(1).append("method '" + method_entry.getKey() + "' {" + lineSeparator); buffer.appendIndent(2).append(strOffset).appendIndent(2).append((line + offset_total) + lineSeparator); buffer.appendIndent(1).append("}").appendLineSeparator();
@Override public TextBuffer toJava(int indent, BytecodeMappingTracer tracer) { TextBuffer buf = new TextBuffer(); if (isLabeled()) { buf.appendIndent(indent).append("label").append(this.id.toString()).append(":").appendLineSeparator(); } buf.appendIndent(indent).append("abstract statement {").appendLineSeparator(); for (Statement stat : stats) { buf.append(stat.toJava(indent + 1, tracer)); } buf.appendIndent(indent).append("}"); return buf; } }
@Override public TextBuffer toJava(int indent, BytecodeMappingTracer tracer) { TextBuffer buffer = new TextBuffer(); buffer.appendIndent(indent); buffer.append('@'); buffer.append(DecompilerContext.getImportCollector().getShortName(ExprProcessor.buildJavaClassName(className))); int type = getAnnotationType(); if (type != ANNOTATION_MARKER) { buffer.append('('); boolean oneLiner = type == ANNOTATION_SINGLE_ELEMENT || indent < 0; for (int i = 0; i < parNames.size(); i++) { if (!oneLiner) { buffer.appendLineSeparator().appendIndent(indent + 1); } if (type != ANNOTATION_SINGLE_ELEMENT) { buffer.append(parNames.get(i)); buffer.append(" = "); } buffer.append(parValues.get(i).toJava(0, tracer)); if (i < parNames.size() - 1) { buffer.append(','); } } if (!oneLiner) { buffer.appendLineSeparator().appendIndent(indent); } buffer.append(')'); } return buffer; }
@Override public TextBuffer toJava(int indent, BytecodeMappingTracer tracer) { TextBuffer buf = new TextBuffer(); buf.append(ExprProcessor.listToJava(varDefinitions, indent, tracer)); buf.append(first.toJava(indent, tracer)); if (isLabeled()) { buf.appendIndent(indent).append("label").append(this.id.toString()).append(":").appendLineSeparator(); tracer.incrementCurrentSourceLine(); } buf.appendIndent(indent).append(headexprent.get(0).toJava(indent, tracer)).append(" {").appendLineSeparator(); tracer.incrementCurrentSourceLine(); buf.append(ExprProcessor.jmpWrapper(body, indent + 1, true, tracer)); buf.appendIndent(indent).append("}").appendLineSeparator(); mapMonitorExitInstr(tracer); tracer.incrementCurrentSourceLine(); return buf; }
buf.appendIndent(indent).append("label").append(this.id.toString()).append(":").appendLineSeparator(); tracer.incrementCurrentSourceLine(); buf.appendIndent(indent).append(headexprent.get(0).toJava(indent, tracer)).append(" {").appendLineSeparator(); tracer.incrementCurrentSourceLine(); buf.appendIndent(indent).append("default:").appendLineSeparator(); tracer.incrementCurrentSourceLine(); buf.appendIndent(indent).append("case "); Exprent value = values.get(j); if (value instanceof ConstExprent) { buf.appendIndent(indent).append("}").appendLineSeparator(); tracer.incrementCurrentSourceLine();
buf.appendIndent(indent).append("label").append(this.id.toString()).append(":").appendLineSeparator(); tracer.incrementCurrentSourceLine(); buf.appendIndent(indent).append("while(true) {").appendLineSeparator(); tracer.incrementCurrentSourceLine(); buf.append(ExprProcessor.jmpWrapper(first, indent + 1, false, tracer)); buf.appendIndent(indent).append("}").appendLineSeparator(); tracer.incrementCurrentSourceLine(); break; case LOOP_DOWHILE: buf.appendIndent(indent).append("do {").appendLineSeparator(); tracer.incrementCurrentSourceLine(); buf.append(ExprProcessor.jmpWrapper(first, indent + 1, false, tracer)); buf.appendIndent(indent).append("} while(").append(conditionExprent.get(0).toJava(indent, tracer)).append(");").appendLineSeparator(); tracer.incrementCurrentSourceLine(); break; case LOOP_WHILE: buf.appendIndent(indent).append("while(").append(conditionExprent.get(0).toJava(indent, tracer)).append(") {").appendLineSeparator(); tracer.incrementCurrentSourceLine(); buf.append(ExprProcessor.jmpWrapper(first, indent + 1, false, tracer)); buf.appendIndent(indent).append("}").appendLineSeparator(); tracer.incrementCurrentSourceLine(); break; case LOOP_FOR: buf.appendIndent(indent).append("for("); if (initExprent.get(0) != null) { buf.append(initExprent.get(0).toJava(indent, tracer)); tracer.incrementCurrentSourceLine();
buf.appendIndent(indent).append("label").append(this.id.toString()).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("}"); buf.appendIndent(indent+1).append("if (").append(monitor.toJava(indent, tracer)).append(") {").appendLineSeparator(); tracer.incrementCurrentSourceLine(); buf.appendIndent(indent + 1).append("}").appendLineSeparator(); tracer.incrementCurrentSourceLine(); buf.appendIndent(indent).append("}").appendLineSeparator(); tracer.incrementCurrentSourceLine();
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; }
buf.appendIndent(indent).append("label").append(this.id.toString()).append(":").appendLineSeparator(); tracer.incrementCurrentSourceLine(); buf.appendIndent(indent).append(headexprent.get(0).toJava(indent, tracer)).append(" {").appendLineSeparator(); tracer.incrementCurrentSourceLine(); if (ifedge.getType() == StatEdge.TYPE_BREAK) { buf.appendIndent(indent + 1).append("break"); buf.appendIndent(indent + 1).append("continue"); (elsestat.getSuccessorEdges(STATEDGE_DIRECT_ALL).isEmpty() || !elsestat.getSuccessorEdges(STATEDGE_DIRECT_ALL).get(0).explicit)) { // else if buf.appendIndent(indent).append("} else "); buf.appendIndent(indent).append("} else {").appendLineSeparator(); buf.appendIndent(indent).append("}").appendLineSeparator(); tracer.incrementCurrentSourceLine();
buf.appendIndent(indent).append("label").append(this.id.toString()).append(":").appendLineSeparator(); tracer.incrementCurrentSourceLine(); buf.appendIndent(indent).append("try {").appendLineSeparator(); tracer.incrementCurrentSourceLine(); buf.appendIndent(indent).append("}"); buf.append(") {").appendLineSeparator(); tracer.incrementCurrentSourceLine(); buf.append(ExprProcessor.jmpWrapper(stat, indent + 1, false, tracer)).appendIndent(indent) .append("}");
@Override public TextBuffer toJava(int indent, BytecodeMappingTracer tracer) { TextBuffer buf = new TextBuffer(); boolean islabeled = isLabeled(); buf.append(ExprProcessor.listToJava(varDefinitions, indent, tracer)); if (islabeled) { buf.appendIndent(indent++).append("label").append(this.id.toString()).append(": {").appendLineSeparator(); tracer.incrementCurrentSourceLine(); } boolean notempty = false; for (int i = 0; i < stats.size(); i++) { Statement st = stats.get(i); if (i > 0 && notempty) { buf.appendLineSeparator(); tracer.incrementCurrentSourceLine(); } TextBuffer str = ExprProcessor.jmpWrapper(st, indent, false, tracer); buf.append(str); notempty = !str.containsOnlyWhitespaces(); } if (islabeled) { buf.appendIndent(indent-1).append("}").appendLineSeparator(); tracer.incrementCurrentSourceLine(); } return buf; }
private static void appendRenameComment(TextBuffer buffer, String oldName, MType type, int indent) { if (oldName == null) return; buffer.appendIndent(indent); buffer.append("// $FF: renamed from: ");
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; }
buffer.appendIndent(indent); buffer.append("public "); buffer.append(method_name); buffer.appendIndent(indent); buffer.append("// $FF: Couldn't be decompiled"); buffer.appendLineSeparator(); buffer.appendIndent(indent).append('}').appendLineSeparator();
buffer.appendIndent(indent).append("}");
buffer.appendIndent(indent);
buffer.appendIndent(indent).append('}');
buffer.appendIndent(indent);