Commit 4e4b4975 authored by Skylot's avatar Skylot

core: fix method redecompilation (issue #6)

parent 93fafcf8
...@@ -110,17 +110,14 @@ public final class Decompiler { ...@@ -110,17 +110,14 @@ public final class Decompiler {
int threadsCount = args.getThreadsCount(); int threadsCount = args.getThreadsCount();
LOG.debug("processing threads count: {}", threadsCount); LOG.debug("processing threads count: {}", threadsCount);
final List<IDexTreeVisitor> passList = new ArrayList<IDexTreeVisitor>(passes);
SaveCode savePass = new SaveCode(outDir, args);
passList.add(savePass);
LOG.info("processing ..."); LOG.info("processing ...");
ThreadPoolExecutor executor = (ThreadPoolExecutor) Executors.newFixedThreadPool(threadsCount); ThreadPoolExecutor executor = (ThreadPoolExecutor) Executors.newFixedThreadPool(threadsCount);
for (final ClassNode cls : root.getClasses(false)) { for (final JavaClass cls : getClasses()) {
executor.execute(new Runnable() { executor.execute(new Runnable() {
@Override @Override
public void run() { public void run() {
ProcessClass.process(cls, passList); cls.decompile();
SaveCode.save(outDir, args, cls.getClassNode());
} }
}); });
} }
......
...@@ -118,6 +118,7 @@ public class MethodNode extends LineAttrNode implements ILoadable { ...@@ -118,6 +118,7 @@ public class MethodNode extends LineAttrNode implements ILoadable {
noCode = true; noCode = true;
// load without code // load without code
load(); load();
noCode = false;
} }
throw new DecodeException(this, "Load method exception", e); throw new DecodeException(this, "Load method exception", e);
} }
...@@ -141,7 +142,6 @@ public class MethodNode extends LineAttrNode implements ILoadable { ...@@ -141,7 +142,6 @@ public class MethodNode extends LineAttrNode implements ILoadable {
blocks = null; blocks = null;
exitBlocks = null; exitBlocks = null;
exceptionHandlers.clear(); exceptionHandlers.clear();
noCode = true;
} }
private boolean parseSignature() { private boolean parseSignature() {
......
...@@ -18,13 +18,16 @@ public class SaveCode extends AbstractVisitor { ...@@ -18,13 +18,16 @@ public class SaveCode extends AbstractVisitor {
@Override @Override
public boolean visit(ClassNode cls) throws CodegenException { public boolean visit(ClassNode cls) throws CodegenException {
CodeWriter clsCode = cls.getCode(); save(dir, args, cls);
return false;
}
public static void save(File dir, IJadxArgs args, ClassNode cls) {
CodeWriter clsCode = cls.getCode();
String fileName = cls.getClassInfo().getFullPath() + ".java"; String fileName = cls.getClassInfo().getFullPath() + ".java";
if (args.isFallbackMode()) { if (args.isFallbackMode()) {
fileName += ".jadx"; fileName += ".jadx";
} }
clsCode.save(dir, fileName); clsCode.save(dir, fileName);
return false;
} }
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment