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

master
Roman Shevchenko 10 years ago
parent 2d36ea60eb
commit 08c4c683a1
  1. 5
      src/org/jetbrains/java/decompiler/main/ClassesProcessor.java
  2. 9
      src/org/jetbrains/java/decompiler/main/extern/IFernflowerPreferences.java
  3. 1
      test/org/jetbrains/java/decompiler/DecompilerTestFixture.java

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

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

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

Loading…
Cancel
Save