handle anonymous classes correctly

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

@ -125,25 +125,24 @@ public final class InvokeOperator extends Operator
*/ */
public boolean isOuter() { public boolean isOuter() {
if (classType instanceof ClassInterfacesType) { if (classType instanceof ClassInterfacesType) {
ClassInfo clazz = ((ClassInterfacesType) classType).getClassInfo();
ClassAnalyzer ana = codeAnalyzer.getClassAnalyzer(); ClassAnalyzer ana = codeAnalyzer.getClassAnalyzer();
while (true) { while (true) {
if (((ClassInterfacesType) classType).getClassInfo() if (clazz == ana.getClazz())
== ana.getClazz())
return true; return true;
if (ana.getParent() == null)
break;
if (ana.getParent() instanceof CodeAnalyzer if (ana.getParent() instanceof CodeAnalyzer
&& (Decompiler.options & Decompiler.OPTION_ANON) != 0) && (Decompiler.options & Decompiler.OPTION_ANON) != 0)
ana = ((CodeAnalyzer) ana.getParent()) ana = ((CodeAnalyzer) ana.getParent())
.getClassAnalyzer(); .getClassAnalyzer();
else if (ana.getParent() instanceof ConstructorOperator
&& (Decompiler.options & Decompiler.OPTION_ANON) != 0)
ana = ((ConstructorOperator) ana.getParent())
.getCodeAnalyzer().getClassAnalyzer();
else if (ana.getParent() instanceof ClassAnalyzer else if (ana.getParent() instanceof ClassAnalyzer
&& (Decompiler.options && (Decompiler.options
& Decompiler.OPTION_INNER) != 0) & Decompiler.OPTION_INNER) != 0)
ana = (ClassAnalyzer) ana.getParent(); ana = (ClassAnalyzer) ana.getParent();
else else
return false; throw new jode.AssertError
("Unknown parent: "+ana+": "+ana.getParent());
} }
} }
return false; return false;
@ -157,13 +156,15 @@ public final class InvokeOperator extends Operator
== ana.getClazz()) { == ana.getClazz()) {
return ana.getMethod(methodName, methodType); return ana.getMethod(methodName, methodType);
} }
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;
@ -340,7 +341,7 @@ public final class InvokeOperator extends Operator
} }
public Expression simplifyAccess() { public Expression simplifyAccess() {
if (isOuter() && getMethodAnalyzer() != null) { if (getMethodAnalyzer() != null) {
SyntheticAnalyzer synth = getMethodAnalyzer().getSynthetic(); SyntheticAnalyzer synth = getMethodAnalyzer().getSynthetic();
if (synth != null) { if (synth != null) {
Operator op = null; Operator op = null;
@ -408,7 +409,7 @@ public final class InvokeOperator extends Operator
if (isConstructor()) { if (isConstructor()) {
InnerClassInfo outer = getOuterClassInfo(); InnerClassInfo outer = getOuterClassInfo();
if (outer != null && outer.outer != null if (outer != null && outer.outer != null && outer.name != null
&& !Modifier.isStatic(outer.modifiers) && !Modifier.isStatic(outer.modifiers)
&& (Decompiler.options & Decompiler.OPTION_INNER) != 0) { && (Decompiler.options & Decompiler.OPTION_INNER) != 0) {
Expression outerInstance = subExpressions[arg++]; Expression outerInstance = subExpressions[arg++];

Loading…
Cancel
Save