[java decompiler] adds an empty line before local classes

This commit is contained in:
Roman Shevchenko
2017-12-07 10:43:23 +01:00
parent a3332a5f31
commit 45486cd4d4
3 changed files with 34 additions and 26 deletions

View File

@@ -10,6 +10,7 @@ import java.util.*;
*
* @author egor
*/
@SuppressWarnings("UnusedReturnValue")
public class TextBuffer {
private final String myLineSeparator = DecompilerContext.getNewLineSeparator();
private final String myIndent = (String)DecompilerContext.getProperty(IFernflowerPreferences.INDENT_STRING);

View File

@@ -731,8 +731,7 @@ public class ExprProcessor implements CodeConstants {
return !(type == Exprent.EXPRENT_SWITCH ||
type == Exprent.EXPRENT_MONITOR ||
type == Exprent.EXPRENT_IF ||
(type == Exprent.EXPRENT_VAR && ((VarExprent)expr)
.isClassDef()));
(type == Exprent.EXPRENT_VAR && ((VarExprent)expr).isClassDef()));
}
private static void addDeletedGotoInstructionMapping(Statement stat, BytecodeMappingTracer tracer) {
@@ -803,7 +802,14 @@ public class ExprProcessor implements CodeConstants {
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);