fix for anonymous classes

git-svn-id: https://svn.code.sf.net/p/jode/code/trunk@850 379699f6-c40d-0410-875b-85095c16579e
stable
jochen 26 years ago
parent c0ea5b7956
commit 0add46b1ab
  1. 20
      jode/jode/expr/GetFieldOperator.java

@ -97,13 +97,15 @@ public class GetFieldOperator extends Operator {
return ana.getField(ref.getName(),
Type.tType(ref.getType()));
}
if (ana.getParent() instanceof MethodAnalyzer)
ana = ((MethodAnalyzer) ana.getParent())
if (ana.getParent() == null)
return null;
if (ana.getParent() instanceof CodeAnalyzer)
ana = ((CodeAnalyzer) ana.getParent())
.getClassAnalyzer();
else if (ana.getParent() instanceof ClassAnalyzer)
ana = (ClassAnalyzer) ana.getParent();
else
return null;
throw new jode.AssertError("Unknown parent");
}
}
return null;
@ -160,13 +162,17 @@ public class GetFieldOperator extends Operator {
if (!staticFlag) {
subExpressions[0] = subExpressions[0].simplify();
subExpressions[0].parent = this;
if (subExpressions[0] instanceof ThisOperator
&& getField() != null) {
Expression constant = getField().getConstant();
if (constant instanceof ThisOperator)
if (subExpressions[0] instanceof ThisOperator) {
FieldAnalyzer field = getField();
if (field != null
&& field.isSynthetic() && field.isFinal()) {
Expression constant = field.getConstant();
if (constant instanceof ThisOperator
|| constant instanceof OuterLocalOperator)
return constant;
}
}
}
return this;
}

Loading…
Cancel
Save