From 861edb2456654ee81a57106fb0f080acd8840aa3 Mon Sep 17 00:00:00 2001 From: jochen Date: Fri, 12 Feb 1999 15:51:05 +0000 Subject: [PATCH] Handle null Objects git-svn-id: https://svn.code.sf.net/p/jode/code/trunk@276 379699f6-c40d-0410-875b-85095c16579e --- jode/jode/expr/InvokeOperator.java | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/jode/jode/expr/InvokeOperator.java b/jode/jode/expr/InvokeOperator.java index 53ec70c..bc2ff54 100644 --- a/jode/jode/expr/InvokeOperator.java +++ b/jode/jode/expr/InvokeOperator.java @@ -139,7 +139,9 @@ public final class InvokeOperator extends Operator isThis() ? operands[0] : "NON VIRTUAL " + operands[0])) : (methodType.isStatic() ? (isThis() ? "" : classType.toString()) - : (operands[0].equals("this") ? "" : operands[0])); + : (operands[0].equals("this") ? "" + : operands[0].equals("null") ? "((" + classType + ") null)" + : operands[0])); int arg = methodType.isStatic() ? 0 : 1; String method = isConstructor() @@ -155,6 +157,17 @@ public final class InvokeOperator extends Operator return method+"("+params+")"; } + /** + * Checks if the method is the magic class$ method. + * @return true if this is the magic class$ method, false otherwise. + */ + public boolean isGetClass() { + if (!classType.equals(Type.tClass(codeAnalyzer.getClazz().getName()))) + return false; + return codeAnalyzer.getClassAnalyzer() + .getMethod(methodName, methodType).isGetClass(); + } + /* Invokes never equals: they may return different values even if * they have the same parameters. */