From edea0fb960e9ae23558b1c182afdd169bd8a8ccc Mon Sep 17 00:00:00 2001 From: jochen Date: Thu, 11 Mar 1999 22:49:52 +0000 Subject: [PATCH] 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 --- jode/jode/decompiler/FieldAnalyzer.java | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/jode/jode/decompiler/FieldAnalyzer.java b/jode/jode/decompiler/FieldAnalyzer.java index a0b3d15..9e04b43 100644 --- a/jode/jode/decompiler/FieldAnalyzer.java +++ b/jode/jode/decompiler/FieldAnalyzer.java @@ -23,6 +23,7 @@ import jode.*; import jode.bytecode.FieldInfo; import jode.bytecode.AttributeInfo; import jode.bytecode.ClassFormatException; +import jode.bytecode.ConstantPool; import jode.expr.Expression; import jode.expr.ConstOperator; @@ -34,6 +35,7 @@ public class FieldAnalyzer implements Analyzer { String fieldName; Expression constant; boolean isSynthetic; + boolean analyzedSynthetic = false; public FieldAnalyzer(ClassAnalyzer cla, FieldInfo fd, JodeEnvironment e) @@ -56,10 +58,14 @@ public class FieldAnalyzer implements Analyzer { throw new AssertError("ConstantValue attribute" + " has wrong length"); int index = (contents[0] & 0xff) << 8 | (contents[1] & 0xff); - constant = new ConstOperator - (type.intersection(cla.getConstantPool() - .getConstantType(index)), - cla.getConstantPool().getConstantString(index)); + ConstantPool cpool = cla.getConstantPool(); + if (cpool.getConstantType(index).equals(Type.tInt)) + constant = new ConstOperator(cpool.getConstantInt(index)); + else + constant = new ConstOperator + (cpool.getConstantType(index), + cpool.getConstantString(index)); + constant.setType(type); constant.makeInitializer(); } catch (ClassFormatException ex) { ex.printStackTrace(Decompiler.err); @@ -80,6 +86,10 @@ public class FieldAnalyzer implements Analyzer { return isSynthetic; } + public void analyzedSynthetic() { + analyzedSynthetic = true; + } + public boolean setInitializer(Expression expr) { expr.makeInitializer(); if (constant != null) @@ -95,7 +105,7 @@ public class FieldAnalyzer implements Analyzer { public void dumpSource(TabbedPrintWriter writer) throws java.io.IOException { - if (isSynthetic) + if (analyzedSynthetic) return; /*XXX*/ String modif = Modifier.toString(modifiers); if (modif.length() > 0)