dumpExpression


git-svn-id: https://svn.code.sf.net/p/jode/code/trunk@703 379699f6-c40d-0410-875b-85095c16579e
stable
jochen 26 years ago
parent 537ab3e2b2
commit 87da45e279
  1. 13
      jode/jode/decompiler/FieldAnalyzer.java

@ -32,6 +32,7 @@ public class FieldAnalyzer implements Analyzer {
String fieldName; String fieldName;
Expression constant; Expression constant;
boolean isSynthetic; boolean isSynthetic;
boolean isDeprecated;
boolean analyzedSynthetic = false; boolean analyzedSynthetic = false;
public FieldAnalyzer(ClassAnalyzer cla, FieldInfo fd, public FieldAnalyzer(ClassAnalyzer cla, FieldInfo fd,
@ -45,6 +46,7 @@ public class FieldAnalyzer implements Analyzer {
fieldName = fd.getName(); fieldName = fd.getName();
constant = null; constant = null;
this.isSynthetic = fd.isSynthetic(); this.isSynthetic = fd.isSynthetic();
this.isDeprecated = fd.isDeprecated();
if (fd.getConstant() != null) { if (fd.getConstant() != null) {
constant = new ConstOperator(fd.getConstant()); constant = new ConstOperator(fd.getConstant());
constant.setType(type); constant.setType(type);
@ -78,6 +80,8 @@ public class FieldAnalyzer implements Analyzer {
public void analyze() { public void analyze() {
imports.useType(type); imports.useType(type);
if (constant != null)
constant = constant.simplify();
} }
public void dumpSource(TabbedPrintWriter writer) public void dumpSource(TabbedPrintWriter writer)
@ -85,6 +89,11 @@ public class FieldAnalyzer implements Analyzer {
{ {
if (analyzedSynthetic) if (analyzedSynthetic)
return; /*XXX*/ return; /*XXX*/
if (isDeprecated) {
writer.println("/**");
writer.println(" * @deprecated");
writer.println(" */");
}
if (isSynthetic) if (isSynthetic)
writer.print("/*synthetic*/ "); writer.print("/*synthetic*/ ");
String modif = Modifier.toString(modifiers); String modif = Modifier.toString(modifiers);
@ -94,8 +103,10 @@ public class FieldAnalyzer implements Analyzer {
writer.printType(type); writer.printType(type);
writer.print(" " + fieldName); writer.print(" " + fieldName);
if (constant != null) { if (constant != null) {
writer.print(" = " + constant.simplify().toString()); writer.print(" = ");
constant.dumpExpression(writer);
} }
writer.println(";"); writer.println(";");
} }
} }

Loading…
Cancel
Save