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. 22
      jode/jode/expr/GetFieldOperator.java

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

Loading…
Cancel
Save