|
|
@ -76,6 +76,7 @@ public class MethodAnalyzer implements Analyzer, Scope, ClassDeclarer { |
|
|
|
StructuredBlock insertBlock = null; |
|
|
|
StructuredBlock insertBlock = null; |
|
|
|
|
|
|
|
|
|
|
|
boolean isJikesConstructor; |
|
|
|
boolean isJikesConstructor; |
|
|
|
|
|
|
|
boolean hasJikesOuterValue; |
|
|
|
boolean isImplicitAnonymousConstructor; |
|
|
|
boolean isImplicitAnonymousConstructor; |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
@ -193,6 +194,10 @@ public class MethodAnalyzer implements Analyzer, Scope, ClassDeclarer { |
|
|
|
isJikesConstructor = value; |
|
|
|
isJikesConstructor = value; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public final void setHasOuterValue(boolean value) { |
|
|
|
|
|
|
|
hasJikesOuterValue = value; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public final void setAnonymousConstructor(boolean value) { |
|
|
|
public final void setAnonymousConstructor(boolean value) { |
|
|
|
isImplicitAnonymousConstructor = value; |
|
|
|
isImplicitAnonymousConstructor = value; |
|
|
|
} |
|
|
|
} |
|
|
@ -379,13 +384,18 @@ public class MethodAnalyzer implements Analyzer, Scope, ClassDeclarer { |
|
|
|
|
|
|
|
|
|
|
|
public void makeDeclaration() { |
|
|
|
public void makeDeclaration() { |
|
|
|
if (isConstructor() && !isStatic() |
|
|
|
if (isConstructor() && !isStatic() |
|
|
|
&& classAnalyzer.outerValues != null) { |
|
|
|
&& classAnalyzer.outerValues != null |
|
|
|
|
|
|
|
&& (Decompiler.options & Decompiler.OPTION_CONTRAFO) != 0) { |
|
|
|
Expression[] outerValues = classAnalyzer.outerValues; |
|
|
|
Expression[] outerValues = classAnalyzer.outerValues; |
|
|
|
for (int i=0; i< outerValues.length; i++) { |
|
|
|
for (int i=0; i< outerValues.length; i++) { |
|
|
|
LocalInfo local = getParamInfo(1+i); |
|
|
|
LocalInfo local = getParamInfo(1+i); |
|
|
|
local.setExpression(outerValues[i]); |
|
|
|
local.setExpression(outerValues[i]); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
if (isJikesConstructor && hasJikesOuterValue |
|
|
|
|
|
|
|
&& classAnalyzer.outerValues != null |
|
|
|
|
|
|
|
&& classAnalyzer.outerValues.length > 0) |
|
|
|
|
|
|
|
getParamInfo(1).setExpression(classAnalyzer.outerValues[0]); |
|
|
|
|
|
|
|
|
|
|
|
for (Enumeration enum = allLocals.elements(); |
|
|
|
for (Enumeration enum = allLocals.elements(); |
|
|
|
enum.hasMoreElements(); ) { |
|
|
|
enum.hasMoreElements(); ) { |
|
|
@ -393,19 +403,21 @@ public class MethodAnalyzer implements Analyzer, Scope, ClassDeclarer { |
|
|
|
if (!li.isShadow()) |
|
|
|
if (!li.isShadow()) |
|
|
|
imports.useType(li.getType()); |
|
|
|
imports.useType(li.getType()); |
|
|
|
} |
|
|
|
} |
|
|
|
for (int i=0; i < param.length; i++) { |
|
|
|
if (code != null) { |
|
|
|
param[i].guessName(); |
|
|
|
for (int i=0; i < param.length; i++) { |
|
|
|
for (int j=0; j < i; j++) { |
|
|
|
param[i].guessName(); |
|
|
|
if (param[j].getName().equals(param[i].getName())) { |
|
|
|
for (int j=0; j < i; j++) { |
|
|
|
/* A name conflict happened. */ |
|
|
|
if (param[j].getName().equals(param[i].getName())) { |
|
|
|
param[i].makeNameUnique(); |
|
|
|
/* A name conflict happened. */ |
|
|
|
break; /* j */ |
|
|
|
param[i].makeNameUnique(); |
|
|
|
|
|
|
|
break; /* j */ |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
methodHeader.makeDeclaration(param); |
|
|
|
|
|
|
|
methodHeader.simplify(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
methodHeader.makeDeclaration(param); |
|
|
|
|
|
|
|
methodHeader.simplify(); |
|
|
|
|
|
|
|
if (innerAnalyzers != null) { |
|
|
|
if (innerAnalyzers != null) { |
|
|
|
for (Enumeration enum = innerAnalyzers.elements(); |
|
|
|
for (Enumeration enum = innerAnalyzers.elements(); |
|
|
|
enum.hasMoreElements(); ) { |
|
|
|
enum.hasMoreElements(); ) { |
|
|
@ -452,7 +464,8 @@ public class MethodAnalyzer implements Analyzer, Scope, ClassDeclarer { |
|
|
|
if (isJikesConstructor) { |
|
|
|
if (isJikesConstructor) { |
|
|
|
// This is the real part of a jikes constructor
|
|
|
|
// This is the real part of a jikes constructor
|
|
|
|
declareAsConstructor = true; |
|
|
|
declareAsConstructor = true; |
|
|
|
skipParams = 1; |
|
|
|
skipParams = hasJikesOuterValue |
|
|
|
|
|
|
|
&& classAnalyzer.outerValues.length > 0 ? 1 : 0; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (declareAsConstructor |
|
|
|
if (declareAsConstructor |
|
|
@ -488,12 +501,13 @@ public class MethodAnalyzer implements Analyzer, Scope, ClassDeclarer { |
|
|
|
if (isJikesConstructor) { |
|
|
|
if (isJikesConstructor) { |
|
|
|
// This is the real part of a jikes constructor
|
|
|
|
// This is the real part of a jikes constructor
|
|
|
|
declareAsConstructor = true; |
|
|
|
declareAsConstructor = true; |
|
|
|
skipParams = 1; |
|
|
|
skipParams = hasJikesOuterValue |
|
|
|
|
|
|
|
&& classAnalyzer.outerValues.length > 0 ? 1 : 0; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if ((Decompiler.options & Decompiler.OPTION_IMMEDIATE) != 0 |
|
|
|
if ((Decompiler.options & Decompiler.OPTION_IMMEDIATE) != 0 |
|
|
|
&& code != null) { |
|
|
|
&& code != null) { |
|
|
|
// We do the code.analyze() here, to get
|
|
|
|
// We do the analyzeCode() here, to get
|
|
|
|
// immediate output.
|
|
|
|
// immediate output.
|
|
|
|
|
|
|
|
|
|
|
|
analyzeCode(); |
|
|
|
analyzeCode(); |
|
|
@ -730,7 +744,7 @@ public class MethodAnalyzer implements Analyzer, Scope, ClassDeclarer { |
|
|
|
|
|
|
|
|
|
|
|
class ShrinkOnShrink implements OuterValueListener { |
|
|
|
class ShrinkOnShrink implements OuterValueListener { |
|
|
|
Dictionary limits = new SimpleDictionary(); |
|
|
|
Dictionary limits = new SimpleDictionary(); |
|
|
|
|
|
|
|
|
|
|
|
public void setLimit(ClassAnalyzer other, |
|
|
|
public void setLimit(ClassAnalyzer other, |
|
|
|
int newLimit) { |
|
|
|
int newLimit) { |
|
|
|
limits.put(other, new Integer(newLimit)); |
|
|
|
limits.put(other, new Integer(newLimit)); |
|
|
@ -738,12 +752,12 @@ public class MethodAnalyzer implements Analyzer, Scope, ClassDeclarer { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public void done() { |
|
|
|
public void done() { |
|
|
|
shrinkTo = -1; |
|
|
|
limits = null; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public void shrinkingOuterValues |
|
|
|
public void shrinkingOuterValues |
|
|
|
(ClassAnalyzer other, int newCount) { |
|
|
|
(ClassAnalyzer other, int newCount) { |
|
|
|
if (shrinkTo != -1) { |
|
|
|
if (limits != null) { |
|
|
|
int limit = ((Integer) limits.get(other) |
|
|
|
int limit = ((Integer) limits.get(other) |
|
|
|
).intValue(); |
|
|
|
).intValue(); |
|
|
|
if (newCount <= limit) { |
|
|
|
if (newCount <= limit) { |
|
|
@ -768,7 +782,7 @@ public class MethodAnalyzer implements Analyzer, Scope, ClassDeclarer { |
|
|
|
return false; |
|
|
|
return false; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
ClassAnalyzer ca1 = method2.classAnalyzer; |
|
|
|
ClassAnalyzer ca1 = method1.classAnalyzer; |
|
|
|
int slot = li1.getSlot(); |
|
|
|
int slot = li1.getSlot(); |
|
|
|
Expression[] ov = ca1.getOuterValues(); |
|
|
|
Expression[] ov = ca1.getOuterValues(); |
|
|
|
if (ov == null) { |
|
|
|
if (ov == null) { |
|
|
|