git-svn-id: https://svn.code.sf.net/p/jode/code/trunk@134 379699f6-c40d-0410-875b-85095c16579e
stable
jochen 26 years ago
parent 6892546ccd
commit 284dfa7582
  1. 54
      jode/jode/expr/InvokeOperator.java

@ -89,52 +89,40 @@ public final class InvokeOperator extends Operator {
return methodName.equals("<init>"); return methodName.equals("<init>");
} }
/**
* Checks, whether this is a call of a method from this class.
* @XXX check, if this class implements the method and if not
* allow super class
*/
public boolean isThis() { public boolean isThis() {
return (classType.equals(Type.tClass(codeAnalyzer.method. return (classType.equals(Type.tClass(codeAnalyzer.getClazz().
classAnalyzer.getClazz().
getName()))); getName())));
} }
/**
* Checks, whether this is a call of a method from the super class.
* @XXX check, if its the first super class that implements the method.
*/
public boolean isSuperOrThis() { public boolean isSuperOrThis() {
return ((ClassInterfacesType)classType).getClazz().superClassOf return ((ClassInterfacesType)classType).getClazz().superClassOf
(codeAnalyzer.method.classAnalyzer.getClazz()); (codeAnalyzer.getClazz());
} }
public String toString(String[] operands) { public String toString(String[] operands) {
String object = null; String object = specialFlag
if (specialFlag) { ? (operands[0].equals("this")
ClassHierarchy clazz = codeAnalyzer.getClazz(); ? (/* XXX check if this is a private or final method. */
if (operands[0].equals("this")) { isThis() ? "" : "super")
object = ""; : (/* XXX check if this is a private or final method. */
while (clazz != null isThis() ? operands[0] : "NON VIRTUAL " + operands[0]))
&& !classType.equals(Type.tClass(clazz.getName()))) { : (methodType.isStatic()
object = "super"; ? (isThis() ? "" : classType.toString())
clazz = clazz.getSuperclass(); : (operands[0].equals("this") ? "" : operands[0]));
}
if (clazz == null)
object = "NON VIRTUAL this";
} else if (classType.equals(Type.tClass(clazz.getName())))
object = operands[0];
else
object = "NON VIRTUAL "+operands[0];
}
object = (object != null) ? object
: methodType.isStatic()
? (classType.equals(Type.tClass(codeAnalyzer.getClazz().getName()))
? ""
: classType.toString())
: (operands[0].equals("this")
? (specialFlag && isSuperOrThis()
? "super"
: "")
: operands[0]);
int arg = methodType.isStatic() ? 0 : 1; int arg = methodType.isStatic() ? 0 : 1;
String method = isConstructor() String method = isConstructor()
? (object.length() == 0 ? "this" : object) ? (object.length() == 0 ? "this" : object)
: (object.length() == 0 ? "" : object + ".") + methodName; : (object.length() == 0 ? methodName : object + "." + methodName);
StringBuffer params = new StringBuffer(); StringBuffer params = new StringBuffer();
for (int i=0; i < methodType.getParameterTypes().length; i++) { for (int i=0; i < methodType.getParameterTypes().length; i++) {

Loading…
Cancel
Save