Return-Path: Delivered-To: apmail-commons-issues-archive@minotaur.apache.org Received: (qmail 65248 invoked from network); 1 Mar 2010 08:21:29 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 1 Mar 2010 08:21:29 -0000 Received: (qmail 52345 invoked by uid 500); 28 Feb 2010 16:21:29 -0000 Delivered-To: apmail-commons-issues-archive@commons.apache.org Received: (qmail 52276 invoked by uid 500); 28 Feb 2010 16:21:29 -0000 Mailing-List: contact issues-help@commons.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: issues@commons.apache.org Delivered-To: mailing list issues@commons.apache.org Received: (qmail 52268 invoked by uid 99); 28 Feb 2010 16:21:29 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 28 Feb 2010 16:21:29 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.140] (HELO brutus.apache.org) (140.211.11.140) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 28 Feb 2010 16:21:27 +0000 Received: from brutus.apache.org (localhost [127.0.0.1]) by brutus.apache.org (Postfix) with ESMTP id 0BDA1234C48D for ; Sun, 28 Feb 2010 16:21:06 +0000 (UTC) Message-ID: <108222804.20971267374066047.JavaMail.jira@brutus.apache.org> Date: Sun, 28 Feb 2010 16:21:06 +0000 (UTC) From: "Matt Benson (JIRA)" To: issues@commons.apache.org Subject: [jira] Updated: (JXPATH-129) MethodLookupUtils#matchType uses TypeUtils#canConvert which causes "Ambiguous method call" exception. In-Reply-To: <776619154.1235685541978.JavaMail.jira@brutus> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 X-Virus-Checked: Checked by ClamAV on apache.org [ https://issues.apache.org/jira/browse/JXPATH-129?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Matt Benson updated JXPATH-129: ------------------------------- Description: MethodLookupUtils#matchParameterTypes calls MethodUtils#matchType. MethodLookupUtils#matchType includes this: if (TypeUtils.canConvert(object, expected)) { return APPROXIMATE_MATCH; } This goes through a whole process of attempting to convert types using JXPath-specific conversion routines. However, this is not valid logic when attempting to find matching Methods since overloaded functions with "convertable" parameters would still have different function signatures. An example: abstract class ExampleClass { static final String formatISO(Calendar calendar) { return ""}; static final String formatISO(Date date) { return ""}; } If referenced from JXPath with "ExampleClass.formatISO(pathToDateObject)", these two functions would trigger JXPathException("lookupMethod() Ambiguous method call: " + name) because apparently TypeUtils is able to convert a Calendar to a Date and vice-versa. When attempting to retrieve a function via signature, is it not irrelevant whether JXPath is able to convert a parameter's type or not? Is there a way to change this behavior or provide a way to toggle this behavior similar to the setLenient() method. Also, the word "Ambiguous" is spelled incorrectly as "Ambigous" three times in MethodLookupUtils. was: MethodUtils#matchParameterTypes calls MethodUtils#matchType. MethodUtils#matchType includes this: if (TypeUtils.canConvert(object, expected)) { return APPROXIMATE_MATCH; } This goes through a whole process of attempting to convert types using JXPath-specific conversion routines. However, this is not valid logic when attempting to find matching Methods since overloaded functions with "convertable" parameters would still have different function signatures. An example: abstract class ExampleClass { static final String formatISO(Calendar calendar) { return ""}; static final String formatISO(Date date) { return ""}; } If referenced from JXPath with "ExampleClass.formatISO(pathToDateObject)", these two functions would trigger JXPathException("lookupMethod() Ambiguous method call: " + name) because apparently TypeUtils is able to convert a Calendar to a Date and vice-versa. When attempting to retrieve a function via signature, is it not irrelevant whether JXPath is able to convert a parameter's type or not? Is there a way to change this behavior or provide a way to toggle this behavior similar to the setLenient() method. Also, the word "Ambiguous" is spelled incorrectly as "Ambigous" three times in MethodLookupUtils. Summary: MethodLookupUtils#matchType uses TypeUtils#canConvert which causes "Ambiguous method call" exception. (was: MethodUtils#matchType uses TypeUtils#canConvert which causes "Ambiguous method call" exception.) > MethodLookupUtils#matchType uses TypeUtils#canConvert which causes "Ambiguous method call" exception. > ----------------------------------------------------------------------------------------------------- > > Key: JXPATH-129 > URL: https://issues.apache.org/jira/browse/JXPATH-129 > Project: Commons JXPath > Issue Type: Bug > Environment: Not relevant. > Reporter: Robert Ross > Fix For: 1.4 > > > MethodLookupUtils#matchParameterTypes calls MethodUtils#matchType. > MethodLookupUtils#matchType includes this: > if (TypeUtils.canConvert(object, expected)) { > return APPROXIMATE_MATCH; > } > This goes through a whole process of attempting to convert types using JXPath-specific conversion routines. However, this is not valid logic when attempting to find matching Methods since overloaded functions with "convertable" parameters would still have different function signatures. > An example: > abstract class ExampleClass > { > static final String formatISO(Calendar calendar) { return ""}; > static final String formatISO(Date date) { return ""}; > } > If referenced from JXPath with "ExampleClass.formatISO(pathToDateObject)", these two functions would trigger JXPathException("lookupMethod() Ambiguous method call: " + name) because apparently TypeUtils is able to convert a Calendar to a Date and vice-versa. > When attempting to retrieve a function via signature, is it not irrelevant whether JXPath is able to convert a parameter's type or not? Is there a way to change this behavior or provide a way to toggle this behavior similar to the setLenient() method. > Also, the word "Ambiguous" is spelled incorrectly as "Ambigous" three times in MethodLookupUtils. -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.