java-decompiler: print mapping table only in unit test mode

This commit is contained in:
Roman Shevchenko 2014-10-17 18:22:31 +02:00
parent 2d36ea60eb
commit 08c4c683a1
3 changed files with 10 additions and 9 deletions

View File

@ -282,14 +282,15 @@ public class ClassesProcessor {
buffer.append(classBuffer);
if(DecompilerContext.getOption(IFernflowerPreferences.BYTECODE_SOURCE_MAPPING)) {
if (DecompilerContext.getOption(IFernflowerPreferences.BYTECODE_SOURCE_MAPPING)) {
BytecodeSourceMapper mapper = DecompilerContext.getBytecodeSourceMapper();
mapper.addTotalOffset(total_offset_lines);
if (DecompilerContext.getOption(IFernflowerPreferences.UNIT_TEST_MODE)) {
buffer.append(lineSeparator);
mapper.dumpMapping(buffer, true);
}
}
}
finally {
destroyWrappers(root);
DecompilerContext.getLogger().endReadingClass();

View File

@ -43,7 +43,6 @@ public interface IFernflowerPreferences {
String FINALLY_DEINLINE = "fdi";
String IDEA_NOT_NULL_ANNOTATION = "inn";
String LAMBDA_TO_ANONYMOUS_CLASS = "lac";
String BYTECODE_SOURCE_MAPPING = "bsm";
String USE_DEBUG_LINE_NUMBERS = "udl";
@ -53,9 +52,10 @@ public interface IFernflowerPreferences {
String USER_RENAMER_CLASS = "urc";
String NEW_LINE_SEPARATOR = "nls";
String INDENT_STRING = "ind";
String BANNER = "ban";
String UNIT_TEST_MODE = "__unit_test_mode__";
String LINE_SEPARATOR_WIN = "\r\n";
String LINE_SEPARATOR_LIN = "\n";
@ -81,16 +81,15 @@ public interface IFernflowerPreferences {
put(FINALLY_DEINLINE, "1");
put(IDEA_NOT_NULL_ANNOTATION, "1");
put(LAMBDA_TO_ANONYMOUS_CLASS, "0");
put(BYTECODE_SOURCE_MAPPING, "0");
put(USE_DEBUG_LINE_NUMBERS, "0");
put(BANNER, "");
put(LOG_LEVEL, IFernflowerLogger.Severity.INFO.name());
put(MAX_PROCESSING_METHOD, "0");
put(RENAME_ENTITIES, "0");
put(NEW_LINE_SEPARATOR, (InterpreterUtil.IS_WINDOWS ? "0" : "1"));
put(INDENT_STRING, " ");
put(BANNER, "");
put(UNIT_TEST_MODE, "0");
}});
}

View File

@ -56,6 +56,7 @@ public class DecompilerTestFixture {
put(IFernflowerPreferences.REMOVE_SYNTHETIC, "1");
put(IFernflowerPreferences.REMOVE_BRIDGE, "1");
put(IFernflowerPreferences.LITERALS_AS_IS, "1");
put(IFernflowerPreferences.UNIT_TEST_MODE, "1");
putAll(options);
}});
}