only skip analyzed synthetic fields

new type concept of const operator


git-svn-id: https://svn.code.sf.net/p/jode/code/trunk@363 379699f6-c40d-0410-875b-85095c16579e
stable
jochen 26 years ago
parent 3d80930c42
commit edea0fb960
  1. 20
      jode/jode/decompiler/FieldAnalyzer.java

@ -23,6 +23,7 @@ import jode.*;
import jode.bytecode.FieldInfo; import jode.bytecode.FieldInfo;
import jode.bytecode.AttributeInfo; import jode.bytecode.AttributeInfo;
import jode.bytecode.ClassFormatException; import jode.bytecode.ClassFormatException;
import jode.bytecode.ConstantPool;
import jode.expr.Expression; import jode.expr.Expression;
import jode.expr.ConstOperator; import jode.expr.ConstOperator;
@ -34,6 +35,7 @@ public class FieldAnalyzer implements Analyzer {
String fieldName; String fieldName;
Expression constant; Expression constant;
boolean isSynthetic; boolean isSynthetic;
boolean analyzedSynthetic = false;
public FieldAnalyzer(ClassAnalyzer cla, FieldInfo fd, public FieldAnalyzer(ClassAnalyzer cla, FieldInfo fd,
JodeEnvironment e) JodeEnvironment e)
@ -56,10 +58,14 @@ public class FieldAnalyzer implements Analyzer {
throw new AssertError("ConstantValue attribute" throw new AssertError("ConstantValue attribute"
+ " has wrong length"); + " has wrong length");
int index = (contents[0] & 0xff) << 8 | (contents[1] & 0xff); int index = (contents[0] & 0xff) << 8 | (contents[1] & 0xff);
constant = new ConstOperator ConstantPool cpool = cla.getConstantPool();
(type.intersection(cla.getConstantPool() if (cpool.getConstantType(index).equals(Type.tInt))
.getConstantType(index)), constant = new ConstOperator(cpool.getConstantInt(index));
cla.getConstantPool().getConstantString(index)); else
constant = new ConstOperator
(cpool.getConstantType(index),
cpool.getConstantString(index));
constant.setType(type);
constant.makeInitializer(); constant.makeInitializer();
} catch (ClassFormatException ex) { } catch (ClassFormatException ex) {
ex.printStackTrace(Decompiler.err); ex.printStackTrace(Decompiler.err);
@ -80,6 +86,10 @@ public class FieldAnalyzer implements Analyzer {
return isSynthetic; return isSynthetic;
} }
public void analyzedSynthetic() {
analyzedSynthetic = true;
}
public boolean setInitializer(Expression expr) { public boolean setInitializer(Expression expr) {
expr.makeInitializer(); expr.makeInitializer();
if (constant != null) if (constant != null)
@ -95,7 +105,7 @@ public class FieldAnalyzer implements Analyzer {
public void dumpSource(TabbedPrintWriter writer) public void dumpSource(TabbedPrintWriter writer)
throws java.io.IOException throws java.io.IOException
{ {
if (isSynthetic) if (analyzedSynthetic)
return; /*XXX*/ return; /*XXX*/
String modif = Modifier.toString(modifiers); String modif = Modifier.toString(modifiers);
if (modif.length() > 0) if (modif.length() > 0)

Loading…
Cancel
Save