ref.getClazz() is now type sig

git-svn-id: https://svn.code.sf.net/p/jode/code/trunk@578 379699f6-c40d-0410-875b-85095c16579e
stable
jochen 26 years ago
parent 1cc3e8d6b7
commit 8bdb47b625
  1. 26
      jode/jode/expr/InvokeOperator.java

@ -36,7 +36,7 @@ public final class InvokeOperator extends Operator
boolean specialFlag; boolean specialFlag;
MethodType methodType; MethodType methodType;
String methodName; String methodName;
ClassInfo clazz; Type clazz;
public InvokeOperator(CodeAnalyzer codeAnalyzer, public InvokeOperator(CodeAnalyzer codeAnalyzer,
boolean staticFlag, boolean specialFlag, boolean staticFlag, boolean specialFlag,
@ -44,13 +44,13 @@ public final class InvokeOperator extends Operator
super(Type.tUnknown, 0); super(Type.tUnknown, 0);
this.methodType = (MethodType) Type.tType(reference.getType()); this.methodType = (MethodType) Type.tType(reference.getType());
this.methodName = reference.getName(); this.methodName = reference.getName();
this.clazz = ClassInfo.forName(reference.getClazz()); this.clazz = Type.tType(reference.getClazz());
this.type = methodType.getReturnType(); this.type = methodType.getReturnType();
this.codeAnalyzer = codeAnalyzer; this.codeAnalyzer = codeAnalyzer;
this.staticFlag = staticFlag; this.staticFlag = staticFlag;
this.specialFlag = specialFlag; this.specialFlag = specialFlag;
if (staticFlag) if (staticFlag)
Type.tClass(clazz.getName()).useType(); clazz.useType();
} }
/** /**
@ -85,7 +85,7 @@ public final class InvokeOperator extends Operator
} }
public Type getClassType() { public Type getClassType() {
return Type.tClass(clazz.getName()); return clazz;
} }
public int getPriority() { public int getPriority() {
@ -125,7 +125,11 @@ public final class InvokeOperator extends Operator
* allow super class * allow super class
*/ */
public boolean isThis() { public boolean isThis() {
return (clazz == codeAnalyzer.getClazz()); if (clazz instanceof ClassInterfacesType) {
return ((ClassInterfacesType) clazz).getClassInfo()
== codeAnalyzer.getClazz();
}
return false;
} }
/** /**
@ -133,7 +137,11 @@ public final class InvokeOperator extends Operator
* @XXX check, if its the first super class that implements the method. * @XXX check, if its the first super class that implements the method.
*/ */
public boolean isSuperOrThis() { public boolean isSuperOrThis() {
return clazz.superClassOf(codeAnalyzer.getClazz()); if (clazz instanceof ClassInterfacesType) {
return ((ClassInterfacesType) clazz).getClassInfo()
.superClassOf(codeAnalyzer.getClazz());
}
return false;
} }
public String toString(String[] operands) { public String toString(String[] operands) {
@ -147,7 +155,7 @@ public final class InvokeOperator extends Operator
? (isThis() ? "" : clazz.toString()) ? (isThis() ? "" : clazz.toString())
: (operands[0].equals("this") ? "" : (operands[0].equals("this") ? ""
: operands[0].equals("null") : operands[0].equals("null")
? "((" + clazz.getName() + ") null)" ? "((" + clazz.toString() + ") null)"
: operands[0])); : operands[0]));
int arg = isStatic() ? 0 : 1; int arg = isStatic() ? 0 : 1;
@ -179,8 +187,8 @@ public final class InvokeOperator extends Operator
public Object invokeMethod(Reference ref, boolean isVirtual, public Object invokeMethod(Reference ref, boolean isVirtual,
Object cls, Object[] params) Object cls, Object[] params)
throws InterpreterException, InvocationTargetException { throws InterpreterException, InvocationTargetException {
if (ref.getClazz().equals(codeAnalyzer.getClazz().getName())) { if (ref.getClazz().equals
("L"+codeAnalyzer.getClazz().getName().replace('.','/')+";")) {
MethodType mt = (MethodType) Type.tType(ref.getType()); MethodType mt = (MethodType) Type.tType(ref.getType());
BytecodeInfo info = codeAnalyzer.getClassAnalyzer() BytecodeInfo info = codeAnalyzer.getClassAnalyzer()
.getMethod(ref.getName(), mt).getCode().getBytecodeInfo(); .getMethod(ref.getName(), mt).getCode().getBytecodeInfo();

Loading…
Cancel
Save