java-decompiler: fixes and cleanups

- console decompiler: resource closing, lookup instead of scan, error reporting
- logger interface reworked
- saver interface renamed
- bytecode provider returns byte array (to reduce stream leakage)
- extra level of context unit avoided
- unneeded exceptions, dead code, formatting
This commit is contained in:
Roman Shevchenko
2014-09-05 13:12:40 +04:00
parent 4e79d160ca
commit ff382a6fdf
28 changed files with 494 additions and 684 deletions

View File

@@ -213,7 +213,7 @@ public class DomHelper {
RootStatement root = graphToStatement(graph);
if (!processStatement(root, new HashMap<Integer, Set<Integer>>())) {
DecompilerContext.getLogger().writeMessage("parsing failure!", IFernflowerLogger.ERROR);
DecompilerContext.getLogger().writeMessage("parsing failure!", IFernflowerLogger.Severity.ERROR);
// try {
// DotExporter.toDotFile(root.getFirst().getStats().get(13), new File("c:\\Temp\\stat1.dot"));
@@ -348,13 +348,14 @@ public class DomHelper {
// take care of irreducible control flow graphs
if (IrreducibleCFGDeobfuscator.isStatementIrreducible(general)) {
if (!IrreducibleCFGDeobfuscator.splitIrreducibleNode(general)) {
DecompilerContext.getLogger().writeMessage("Irreducible statement cannot be decomposed!", IFernflowerLogger.ERROR);
DecompilerContext.getLogger().writeMessage("Irreducible statement cannot be decomposed!", IFernflowerLogger.Severity.ERROR);
break;
}
}
else {
if (mapstage == 2 || mapRefreshed) { // last chance lost
DecompilerContext.getLogger().writeMessage("Statement cannot be decomposed although reducible!", IFernflowerLogger.ERROR);
DecompilerContext.getLogger().writeMessage("Statement cannot be decomposed although reducible!",
IFernflowerLogger.Severity.ERROR);
}
break;
}

View File

@@ -463,7 +463,7 @@ public class Statement {
}
if (res.size() != stats.size()) {
DecompilerContext.getLogger().writeMessage("computing post reverse post order failed!", IFernflowerLogger.ERROR);
DecompilerContext.getLogger().writeMessage("computing post reverse post order failed!", IFernflowerLogger.Severity.ERROR);
throw new RuntimeException("parsing failure!");
}

View File

@@ -387,8 +387,8 @@ public class IdentifierConverter {
private void buildInheritanceTree() {
HashMap<String, ClassWrapperNode> nodes = new HashMap<String, ClassWrapperNode>();
HashMap<String, StructClass> classes = context.getClasses();
Map<String, ClassWrapperNode> nodes = new HashMap<String, ClassWrapperNode>();
Map<String, StructClass> classes = context.getClasses();
List<ClassWrapperNode> rootClasses = new ArrayList<ClassWrapperNode>();
List<ClassWrapperNode> rootInterfaces = new ArrayList<ClassWrapperNode>();