From 284dfa758228d60e429a512d7d0d56db1069d392 Mon Sep 17 00:00:00 2001 From: jochen Date: Tue, 24 Nov 1998 23:10:29 +0000 Subject: [PATCH] Clean up git-svn-id: https://svn.code.sf.net/p/jode/code/trunk@134 379699f6-c40d-0410-875b-85095c16579e --- jode/jode/expr/InvokeOperator.java | 54 ++++++++++++------------------ 1 file changed, 21 insertions(+), 33 deletions(-) diff --git a/jode/jode/expr/InvokeOperator.java b/jode/jode/expr/InvokeOperator.java index 36f4f27..658b668 100644 --- a/jode/jode/expr/InvokeOperator.java +++ b/jode/jode/expr/InvokeOperator.java @@ -89,52 +89,40 @@ public final class InvokeOperator extends Operator { return methodName.equals(""); } + /** + * 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() { - return (classType.equals(Type.tClass(codeAnalyzer.method. - classAnalyzer.getClazz(). + return (classType.equals(Type.tClass(codeAnalyzer.getClazz(). 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() { return ((ClassInterfacesType)classType).getClazz().superClassOf - (codeAnalyzer.method.classAnalyzer.getClazz()); + (codeAnalyzer.getClazz()); } public String toString(String[] operands) { - String object = null; - if (specialFlag) { - ClassHierarchy clazz = codeAnalyzer.getClazz(); - if (operands[0].equals("this")) { - object = ""; - while (clazz != null - && !classType.equals(Type.tClass(clazz.getName()))) { - object = "super"; - clazz = clazz.getSuperclass(); - } - - 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]); + String object = specialFlag + ? (operands[0].equals("this") + ? (/* XXX check if this is a private or final method. */ + isThis() ? "" : "super") + : (/* XXX check if this is a private or final method. */ + isThis() ? operands[0] : "NON VIRTUAL " + operands[0])) + : (methodType.isStatic() + ? (isThis() ? "" : classType.toString()) + : (operands[0].equals("this") ? "" : operands[0])); int arg = methodType.isStatic() ? 0 : 1; String method = isConstructor() ? (object.length() == 0 ? "this" : object) - : (object.length() == 0 ? "" : object + ".") + methodName; + : (object.length() == 0 ? methodName : object + "." + methodName); StringBuffer params = new StringBuffer(); for (int i=0; i < methodType.getParameterTypes().length; i++) {