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

@@ -106,7 +106,7 @@ public class ClassWrapper {
if (System.currentTimeMillis() >= stopAt) {
String message = "Processing time limit exceeded for method " + mt.getName() + ", execution interrupted.";
DecompilerContext.getLogger().writeMessage(message, IFernflowerLogger.ERROR);
DecompilerContext.getLogger().writeMessage(message, IFernflowerLogger.Severity.ERROR);
killThread(mtthread);
isError = true;
break;

View File

@@ -130,7 +130,7 @@ public class MethodProcessorThread implements Runnable {
//System.out.println(graph.toString());
if (ExceptionDeobfuscator.hasObfuscatedExceptions(graph)) {
DecompilerContext.getLogger().writeMessage("Heavily obfuscated exception ranges found!", IFernflowerLogger.WARNING);
DecompilerContext.getLogger().writeMessage("Heavily obfuscated exception ranges found!", IFernflowerLogger.Severity.WARN);
}
RootStatement root = DomHelper.parseGraph(graph);

View File

@@ -75,7 +75,8 @@ public class NestedClassProcessor {
child.simpleName = "SyntheticClass_" + (++synthetics);
}
else {
DecompilerContext.getLogger().writeMessage("Nameless local or member class " + cl.qualifiedName + "!", IFernflowerLogger.WARNING);
DecompilerContext.getLogger().writeMessage("Nameless local or member class " + cl.qualifiedName + "!",
IFernflowerLogger.Severity.WARN);
child.simpleName = "NamelessClass_" + (++nameless);
}
}
@@ -221,11 +222,11 @@ public class NestedClassProcessor {
if (!hasEnclosing) {
if (child.type == ClassNode.CLASS_ANONYMOUS) {
DecompilerContext.getLogger()
.writeMessage("Unreferenced anonymous class " + child.classStruct.qualifiedName + "!", IFernflowerLogger.WARNING);
.writeMessage("Unreferenced anonymous class " + child.classStruct.qualifiedName + "!", IFernflowerLogger.Severity.WARN);
}
else if (child.type == ClassNode.CLASS_LOCAL) {
DecompilerContext.getLogger()
.writeMessage("Unreferenced local class " + child.classStruct.qualifiedName + "!", IFernflowerLogger.WARNING);
.writeMessage("Unreferenced local class " + child.classStruct.qualifiedName + "!", IFernflowerLogger.Severity.WARN);
}
}
}
@@ -275,7 +276,7 @@ public class NestedClassProcessor {
HashMap<String, List<VarFieldPair>> mask = getMaskLocalVars(nd.wrapper);
if (mask.isEmpty()) {
DecompilerContext.getLogger()
.writeMessage("Nested class " + nd.classStruct.qualifiedName + " has no constructor!", IFernflowerLogger.WARNING);
.writeMessage("Nested class " + nd.classStruct.qualifiedName + " has no constructor!", IFernflowerLogger.Severity.WARN);
}
else {
mapVarMasks.put(nd.classStruct.qualifiedName, mask);