From e48604525140c746404a637282cb7b1dd97c18c4 Mon Sep 17 00:00:00 2001 From: chiba Date: Tue, 6 May 2008 05:34:36 +0000 Subject: [PATCH] fixed JIRA JASSIST-61 git-svn-id: http://anonsvn.jboss.org/repos/javassist/trunk@436 30ef5769-5b8d-40dd-aea6-55b5d6557bb3 --- .../javassist/compiler/MemberResolver.java | 29 +++++++++++-------- 1 file changed, 17 insertions(+), 12 deletions(-) diff --git a/src/main/javassist/compiler/MemberResolver.java b/src/main/javassist/compiler/MemberResolver.java index 858a235c..ee692c61 100644 --- a/src/main/javassist/compiler/MemberResolver.java +++ b/src/main/javassist/compiler/MemberResolver.java @@ -107,19 +107,24 @@ public class MemberResolver implements TokenId { throws CompileError { Method maybe = null; - List list = clazz.getClassFile2().getMethods(); - int n = list.size(); - for (int i = 0; i < n; ++i) { - MethodInfo minfo = (MethodInfo)list.get(i); - if (minfo.getName().equals(methodName)) { - int res = compareSignature(minfo.getDescriptor(), + ClassFile cf = clazz.getClassFile2(); + // If the class is an array type, the class file is null. + // If so, search the super class java.lang.Object for clone() etc. + if (cf != null) { + List list = cf.getMethods(); + int n = list.size(); + for (int i = 0; i < n; ++i) { + MethodInfo minfo = (MethodInfo)list.get(i); + if (minfo.getName().equals(methodName)) { + int res = compareSignature(minfo.getDescriptor(), argTypes, argDims, argClassNames); - if (res != NO) { - Method r = new Method(clazz, minfo, res); - if (res == YES) - return r; - else if (maybe == null || maybe.notmatch > res) - maybe = r; + if (res != NO) { + Method r = new Method(clazz, minfo, res); + if (res == YES) + return r; + else if (maybe == null || maybe.notmatch > res) + maybe = r; + } } } } -- 2.39.5