new attribute handling in bytecode

git-svn-id: https://svn.code.sf.net/p/jode/code/trunk@628 379699f6-c40d-0410-875b-85095c16579e
stable
jochen 26 years ago
parent 8d40790946
commit 0e8d0b4f3e
  1. 29
      jode/jode/decompiler/CodeAnalyzer.java

@ -46,24 +46,12 @@ public class CodeAnalyzer implements Analyzer {
LocalVariableTable lvt; LocalVariableTable lvt;
public CodeAnalyzer(MethodAnalyzer ma, MethodInfo minfo, public CodeAnalyzer(MethodAnalyzer ma, MethodInfo minfo,
AttributeInfo codeattr, ImportHandler i) ImportHandler i)
{ {
method = ma; method = ma;
imports = i; imports = i;
DataInputStream stream = new DataInputStream code = minfo.getBytecode();
(new ByteArrayInputStream(codeattr.getContents())); CodeVerifier verifier = new CodeVerifier(getClazz(), minfo, code);
ConstantPool cpool = ma.classAnalyzer.getConstantPool();
code = new BytecodeInfo();
try {
code.read(cpool, stream);
} catch (IOException ex) {
ex.printStackTrace(Decompiler.err);
code = null;
return;
}
CodeVerifier verifier
= new CodeVerifier(getClazz(), minfo, code);
try { try {
verifier.verify(); verifier.verify();
} catch (VerifyException ex) { } catch (VerifyException ex) {
@ -72,12 +60,10 @@ public class CodeAnalyzer implements Analyzer {
} }
if (Decompiler.useLVT) { if (Decompiler.useLVT) {
AttributeInfo attr = code.findAttribute("LocalVariableTable"); LocalVariableInfo[] localvars = code.getLocalVariableTable();
if (attr != null) { if (localvars != null)
if (Decompiler.showLVT) lvt = new LocalVariableTable(code.getMaxLocals(),
Decompiler.err.println("Method: "+ma.getName()); localvars);
lvt = new LocalVariableTable(code.getMaxLocals(), cpool, attr);
}
} }
initParams(); initParams();
} }
@ -236,6 +222,7 @@ public class CodeAnalyzer implements Analyzer {
} }
} }
methodHeader.makeDeclaration(new jode.flow.VariableSet(param)); methodHeader.makeDeclaration(new jode.flow.VariableSet(param));
methodHeader.simplify();
} }
public void dumpSource(TabbedPrintWriter writer) public void dumpSource(TabbedPrintWriter writer)

Loading…
Cancel
Save