java-decompiler: print mapping table only in unit test mode
authorRoman Shevchenko <roman.shevchenko@jetbrains.com>
Fri, 17 Oct 2014 16:22:31 +0000 (18:22 +0200)
committerRoman Shevchenko <roman.shevchenko@jetbrains.com>
Fri, 17 Oct 2014 16:22:31 +0000 (18:22 +0200)
plugins/java-decompiler/engine/src/org/jetbrains/java/decompiler/main/ClassesProcessor.java
plugins/java-decompiler/engine/src/org/jetbrains/java/decompiler/main/extern/IFernflowerPreferences.java
plugins/java-decompiler/engine/test/org/jetbrains/java/decompiler/DecompilerTestFixture.java

index 3fe0e012554739dc914120473093dd3d71541148..66cfa630d6cc98b5c959b99c0777fb30ffbf4205 100644 (file)
@@ -282,12 +282,13 @@ 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);
-
-        buffer.append(lineSeparator);
-        mapper.dumpMapping(buffer, true);
+        if (DecompilerContext.getOption(IFernflowerPreferences.UNIT_TEST_MODE)) {
+          buffer.append(lineSeparator);
+          mapper.dumpMapping(buffer, true);
+        }
       }
     }
     finally {
index 677d05dc66d75bcf659663e339a8110dcaa4fc8c..9e8dc72e0c08d4eb914f2e8f6e475486ab105c9c 100644 (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");
   }});
 }
index 9508c611922747c80c683a870797cc7432e2b37a..d0d869c04400e25a9191dd6fdfee78b2ee64dd25 100644 (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);
     }});
   }