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

@@ -22,14 +22,13 @@ import org.jetbrains.java.decompiler.struct.consts.ConstantPool;
import org.jetbrains.java.decompiler.util.DataInputFullStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.HashMap;
import java.util.Map;
public class LazyLoader {
private Map<String, Link> mapClassLinks = new HashMap<String, Link>();
private IBytecodeProvider provider;
private final Map<String, Link> mapClassLinks = new HashMap<String, Link>();
private final IBytecodeProvider provider;
public LazyLoader(IBytecodeProvider provider) {
this.provider = provider;
@@ -138,10 +137,9 @@ public class LazyLoader {
}
}
@SuppressWarnings("IOResourceOpenedButNotSafelyClosed")
public DataInputFullStream getClassStream(String externalPath, String internalPath) throws IOException {
InputStream stream = provider.getBytecodeStream(externalPath, internalPath);
return stream == null ? null : new DataInputFullStream(stream);
byte[] bytes = provider.getBytecode(externalPath, internalPath);
return new DataInputFullStream(bytes);
}
public DataInputFullStream getClassStream(String qualifiedClassName) throws IOException {