summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRoman Shevchenko <roman.shevchenko@jetbrains.com>2014-10-08 08:18:26 +0200
committerRoman Shevchenko <roman.shevchenko@jetbrains.com>2014-10-08 08:18:26 +0200
commit1e3d5276a84d33a495b14da1977b7a47acbe2116 (patch)
treedf990fbe844e38151848cbb71cea78a43396430a
parentd96104bdec9bb0a15247aad537d0df315374c710 (diff)
downloadfernflower-1e3d5276a84d33a495b14da1977b7a47acbe2116.tar
fernflower-1e3d5276a84d33a495b14da1977b7a47acbe2116.tar.gz
fernflower-1e3d5276a84d33a495b14da1977b7a47acbe2116.tar.lz
fernflower-1e3d5276a84d33a495b14da1977b7a47acbe2116.tar.xz
fernflower-1e3d5276a84d33a495b14da1977b7a47acbe2116.zip
java-decompiler: class name logging on non-fatal errors
-rw-r--r--src/org/jetbrains/java/decompiler/main/ClassesProcessor.java2
-rw-r--r--src/org/jetbrains/java/decompiler/main/decompiler/PrintStreamLogger.java36
-rw-r--r--src/org/jetbrains/java/decompiler/main/extern/IFernflowerLogger.java20
3 files changed, 42 insertions, 16 deletions
diff --git a/src/org/jetbrains/java/decompiler/main/ClassesProcessor.java b/src/org/jetbrains/java/decompiler/main/ClassesProcessor.java
index bcb1d04..987c1a5 100644
--- a/src/org/jetbrains/java/decompiler/main/ClassesProcessor.java
+++ b/src/org/jetbrains/java/decompiler/main/ClassesProcessor.java
@@ -236,6 +236,7 @@ public class ClassesProcessor {
return;
}
+ DecompilerContext.getLogger().startReadingClass(cl.qualifiedName);
try {
ImportCollector importCollector = new ImportCollector(root);
DecompilerContext.setImportCollector(importCollector);
@@ -291,6 +292,7 @@ public class ClassesProcessor {
}
finally {
destroyWrappers(root);
+ DecompilerContext.getLogger().endReadingClass();
}
}
diff --git a/src/org/jetbrains/java/decompiler/main/decompiler/PrintStreamLogger.java b/src/org/jetbrains/java/decompiler/main/decompiler/PrintStreamLogger.java
index 7bbcc19..27a2c56 100644
--- a/src/org/jetbrains/java/decompiler/main/decompiler/PrintStreamLogger.java
+++ b/src/org/jetbrains/java/decompiler/main/decompiler/PrintStreamLogger.java
@@ -33,7 +33,7 @@ public class PrintStreamLogger extends IFernflowerLogger {
@Override
public void writeMessage(String message, Severity severity) {
if (accepts(severity)) {
- stream.println(InterpreterUtil.getIndentString(indent) + severity.name() + ": " + message);
+ stream.println(severity.prefix + InterpreterUtil.getIndentString(indent) + message);
}
}
@@ -46,35 +46,49 @@ public class PrintStreamLogger extends IFernflowerLogger {
}
@Override
- public void startClass(String className) {
- writeMessage("Processing class " + className + " ...", Severity.INFO);
+ public void startReadingClass(String className) {
+ writeMessage("Decompiling class " + className, Severity.INFO);
++indent;
}
@Override
- public void endClass() {
+ public void endReadingClass() {
--indent;
- writeMessage("... proceeded.", Severity.INFO);
+ writeMessage("... done", Severity.INFO);
}
@Override
- public void startWriteClass(String className) {
- writeMessage("Writing class " + className + " ...", Severity.INFO);
+ public void startClass(String className) {
+ writeMessage("Processing class " + className, Severity.TRACE);
++indent;
}
@Override
- public void endWriteClass() {
+ public void endClass() {
--indent;
- writeMessage("... written.", Severity.INFO);
+ writeMessage("... proceeded", Severity.TRACE);
}
@Override
public void startMethod(String methodName) {
- writeMessage("Processing method " + methodName + " ...", Severity.INFO);
+ writeMessage("Processing method " + methodName, Severity.TRACE);
+ ++indent;
}
public void endMethod() {
- writeMessage("... proceeded.", Severity.INFO);
+ --indent;
+ writeMessage("... proceeded", Severity.TRACE);
+ }
+
+ @Override
+ public void startWriteClass(String className) {
+ writeMessage("Writing class " + className, Severity.TRACE);
+ ++indent;
+ }
+
+ @Override
+ public void endWriteClass() {
+ --indent;
+ writeMessage("... written", Severity.TRACE);
}
}
diff --git a/src/org/jetbrains/java/decompiler/main/extern/IFernflowerLogger.java b/src/org/jetbrains/java/decompiler/main/extern/IFernflowerLogger.java
index 65b2c6d..db76c77 100644
--- a/src/org/jetbrains/java/decompiler/main/extern/IFernflowerLogger.java
+++ b/src/org/jetbrains/java/decompiler/main/extern/IFernflowerLogger.java
@@ -18,7 +18,13 @@ package org.jetbrains.java.decompiler.main.extern;
public abstract class IFernflowerLogger {
public enum Severity {
- TRACE, INFO, WARN, ERROR
+ TRACE("TRACE: "), INFO("INFO: "), WARN("WARN: "), ERROR("ERROR: ");
+
+ public final String prefix;
+
+ Severity(String prefix) {
+ this.prefix = prefix;
+ }
}
private Severity severity = Severity.INFO;
@@ -35,15 +41,19 @@ public abstract class IFernflowerLogger {
public abstract void writeMessage(String message, Throwable t);
- public void startClass(String className) { }
+ public void startReadingClass(String className) { }
- public void endClass() { }
+ public void endReadingClass() { }
- public void startWriteClass(String className) { }
+ public void startClass(String className) { }
- public void endWriteClass() { }
+ public void endClass() { }
public void startMethod(String methodName) { }
public void endMethod() { }
+
+ public void startWriteClass(String className) { }
+
+ public void endWriteClass() { }
}