Index: build.xml =================================================================== --- src/main/org/codehaus/groovy/ast/ClassNode.java (revision 12640) +++ src/main/org/codehaus/groovy/ast/ClassNode.java Thu May 29 14:44:24 EST 2008 @@ -514,11 +514,16 @@ return node; } - public boolean hasMethod(String name, Parameter[] parameters) { + public boolean hasDeclaredMethod(String name, Parameter[] parameters) { MethodNode other = getDeclaredMethod(name, parameters); return other != null; } + public boolean hasMethod(String name, Parameter[] parameters) { + MethodNode other = getMethod(name, parameters); + return other != null; + } + /** * Adds a synthetic method as part of the compilation process */ @@ -670,6 +675,8 @@ } /** + * Finds a method matching the given name and parameters in this class. + * * @return the method matching the given name and parameters or null */ public MethodNode getDeclaredMethod(String name, Parameter[] parameters) { @@ -684,6 +691,23 @@ } /** + * Finds a method matching the given name and parameters in this class + * or any parent class. + * + * @return the method matching the given name and parameters or null + */ + public MethodNode getMethod(String name, Parameter[] parameters) { + List list = getMethods(name); + for (Iterator iter = list.iterator(); iter.hasNext();) { + MethodNode method = (MethodNode) iter.next(); + if (parametersEqual(method.getParameters(), parameters)) { + return method; + } + } + return null; + } + + /** * @return true if this node is derived from the given class node */ public boolean isDerivedFrom(ClassNode type) {