Commit 4e4b4975 authored by Skylot's avatar Skylot

core: fix method redecompilation (issue #6)

parent 93fafcf8
......@@ -110,17 +110,14 @@ public final class Decompiler {
int threadsCount = args.getThreadsCount();
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 ...");
ThreadPoolExecutor executor = (ThreadPoolExecutor) Executors.newFixedThreadPool(threadsCount);
for (final ClassNode cls : root.getClasses(false)) {
for (final JavaClass cls : getClasses()) {
executor.execute(new Runnable() {
@Override
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 {
noCode = true;
// load without code
load();
noCode = false;
}
throw new DecodeException(this, "Load method exception", e);
}
......@@ -141,7 +142,6 @@ public class MethodNode extends LineAttrNode implements ILoadable {
blocks = null;
exitBlocks = null;
exceptionHandlers.clear();
noCode = true;
}
private boolean parseSignature() {
......
......@@ -18,13 +18,16 @@ public class SaveCode extends AbstractVisitor {
@Override
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";
if (args.isFallbackMode()) {
fileName += ".jadx";
}
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