IDEA-127182 (passing line number map to debugger)

master
Roman Shevchenko 10 years ago
parent ce721c7acd
commit a721490f62
  1. 2
      src/org/jetbrains/java/decompiler/main/decompiler/ConsoleDecompiler.java
  2. 2
      src/org/jetbrains/java/decompiler/main/extern/IResultSaver.java
  3. 8
      src/org/jetbrains/java/decompiler/struct/ContextUnit.java

@ -181,7 +181,7 @@ public class ConsoleDecompiler implements IBytecodeProvider, IResultSaver {
} }
@Override @Override
public void saveClassFile(String path, String qualifiedName, String entryName, String content) { public void saveClassFile(String path, String qualifiedName, String entryName, String content, int[] mapping) {
File file = new File(getAbsolutePath(path), entryName); File file = new File(getAbsolutePath(path), entryName);
try { try {
Writer out = new OutputStreamWriter(new FileOutputStream(file), "UTF8"); Writer out = new OutputStreamWriter(new FileOutputStream(file), "UTF8");

@ -22,7 +22,7 @@ public interface IResultSaver {
void copyFile(String source, String path, String entryName); void copyFile(String source, String path, String entryName);
void saveClassFile(String path, String qualifiedName, String entryName, String content); void saveClassFile(String path, String qualifiedName, String entryName, String content, int[] mapping);
void createArchive(String path, String archiveName, Manifest manifest); void createArchive(String path, String archiveName, Manifest manifest);

@ -15,6 +15,8 @@
*/ */
package org.jetbrains.java.decompiler.struct; package org.jetbrains.java.decompiler.struct;
import org.jetbrains.java.decompiler.main.DecompilerContext;
import org.jetbrains.java.decompiler.main.extern.IFernflowerPreferences;
import org.jetbrains.java.decompiler.main.extern.IResultSaver; import org.jetbrains.java.decompiler.main.extern.IResultSaver;
import org.jetbrains.java.decompiler.struct.lazy.LazyLoader; import org.jetbrains.java.decompiler.struct.lazy.LazyLoader;
import org.jetbrains.java.decompiler.struct.lazy.LazyLoader.Link; import org.jetbrains.java.decompiler.struct.lazy.LazyLoader.Link;
@ -112,7 +114,11 @@ public class ContextUnit {
if (entryName != null) { if (entryName != null) {
String content = decompiledData.getClassContent(cl); String content = decompiledData.getClassContent(cl);
if (content != null) { if (content != null) {
resultSaver.saveClassFile(filename, cl.qualifiedName, entryName, content); int[] mapping = null;
if (DecompilerContext.getOption(IFernflowerPreferences.BYTECODE_SOURCE_MAPPING)) {
mapping = DecompilerContext.getBytecodeSourceMapper().getOriginalLinesMapping();
}
resultSaver.saveClassFile(filename, cl.qualifiedName, entryName, content, mapping);
} }
} }
} }

Loading…
Cancel
Save