Analyze synthetics on demand

git-svn-id: https://svn.code.sf.net/p/jode/code/trunk@660 379699f6-c40d-0410-875b-85095c16579e
stable
jochen 26 years ago
parent 63024882bf
commit 62747d9f22
  1. 21
      jode/jode/decompiler/MethodAnalyzer.java

@ -19,7 +19,6 @@
package jode.decompiler; package jode.decompiler;
import jode.bytecode.MethodInfo; import jode.bytecode.MethodInfo;
import jode.type.Type;
import jode.type.*; import jode.type.*;
import jode.AssertError; import jode.AssertError;
import jode.Decompiler; import jode.Decompiler;
@ -35,11 +34,13 @@ public class MethodAnalyzer implements Analyzer {
boolean isStatic; boolean isStatic;
boolean isSynthetic; boolean isSynthetic;
boolean isDeprecated; boolean isDeprecated;
SyntheticAnalyzer synth;
int modifiers; int modifiers;
String methodName; String methodName;
MethodType methodType; MethodType methodType;
Type[] exceptions; Type[] exceptions;
boolean analyzed = false;
SyntheticAnalyzer synth;
public MethodAnalyzer(ClassAnalyzer cla, MethodInfo minfo, public MethodAnalyzer(ClassAnalyzer cla, MethodInfo minfo,
ImportHandler imports) { ImportHandler imports) {
@ -54,7 +55,8 @@ public class MethodAnalyzer implements Analyzer {
this.isSynthetic = minfo.isSynthetic(); this.isSynthetic = minfo.isSynthetic();
this.isDeprecated = minfo.isDeprecated(); this.isDeprecated = minfo.isDeprecated();
code = new CodeAnalyzer(this, minfo, imports); if (minfo.getBytecode() != null)
code = new CodeAnalyzer(this, minfo, imports);
String[] excattr = minfo.getExceptions(); String[] excattr = minfo.getExceptions();
if (excattr == null) { if (excattr == null) {
exceptions = new Type[0]; exceptions = new Type[0];
@ -95,6 +97,8 @@ public class MethodAnalyzer implements Analyzer {
} }
public final boolean isGetClass() { public final boolean isGetClass() {
if (synth == null)
analyzeSynthetic();
return synth.type == SyntheticAnalyzer.GETCLASS; return synth.type == SyntheticAnalyzer.GETCLASS;
} }
@ -108,6 +112,7 @@ public class MethodAnalyzer implements Analyzer {
if (code == null) if (code == null)
return; return;
analyzed = true;
int offset = 0; int offset = 0;
if (!isStatic()) { if (!isStatic()) {
LocalInfo clazz = code.getParamInfo(0); LocalInfo clazz = code.getParamInfo(0);
@ -129,17 +134,21 @@ public class MethodAnalyzer implements Analyzer {
if (!isConstructor) if (!isConstructor)
imports.useType(methodType.getReturnType()); imports.useType(methodType.getReturnType());
if (!Decompiler.immediateOutput || isSynthetic) { if (!Decompiler.immediateOutput) {
if (Decompiler.isVerbose) if (Decompiler.isVerbose)
Decompiler.err.print(methodName+": "); Decompiler.err.print(methodName+": ");
code.analyze(); code.analyze();
if (isSynthetic)
synth = new SyntheticAnalyzer(this);
if (Decompiler.isVerbose) if (Decompiler.isVerbose)
Decompiler.err.println(""); Decompiler.err.println("");
} }
} }
public void analyzeSynthetic() {
if (!analyzed)
analyze();
synth = new SyntheticAnalyzer(this);
}
public void dumpSource(TabbedPrintWriter writer) public void dumpSource(TabbedPrintWriter writer)
throws IOException throws IOException
{ {

Loading…
Cancel
Save