Return-Path: Delivered-To: apmail-harmony-commits-archive@www.apache.org Received: (qmail 78491 invoked from network); 2 Jun 2008 10:24:08 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 2 Jun 2008 10:24:08 -0000 Received: (qmail 65763 invoked by uid 500); 2 Jun 2008 10:24:11 -0000 Delivered-To: apmail-harmony-commits-archive@harmony.apache.org Received: (qmail 65740 invoked by uid 500); 2 Jun 2008 10:24:11 -0000 Mailing-List: contact commits-help@harmony.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@harmony.apache.org Delivered-To: mailing list commits@harmony.apache.org Received: (qmail 65731 invoked by uid 99); 2 Jun 2008 10:24:10 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 02 Jun 2008 03:24:10 -0700 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; Mon, 02 Jun 2008 10:23:23 +0000 Received: from brutus (localhost [127.0.0.1]) by brutus.apache.org (Postfix) with ESMTP id 179AC234C12C for ; Mon, 2 Jun 2008 03:23:45 -0700 (PDT) Message-ID: <1457746484.1212402225095.JavaMail.jira@brutus> Date: Mon, 2 Jun 2008 03:23:45 -0700 (PDT) From: "Kevin Zhou (JIRA)" To: commits@harmony.apache.org Subject: [jira] Created: (HARMONY-5854) [classlib][beans] java.beans.Statement.findMethod() throw java.lang.NoSuchMethodException: Cannot decide which method to call MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org [classlib][beans] java.beans.Statement.findMethod() throw java.lang.NoSuchMethodException: Cannot decide which method to call ----------------------------------------------------------------------------------------------------------------------------- Key: HARMONY-5854 URL: https://issues.apache.org/jira/browse/HARMONY-5854 Project: Harmony Issue Type: Bug Components: Classlib Affects Versions: 5.0M6 Reporter: Kevin Zhou Fix For: 5.0M6 Given the following scenario, public class TInspectorCluster { public interface Ancestor { } public interface Offspring extends Ancestor { } public interface Visitor { public T visit(Ancestor o); } public static class StringInspector implements Visitor { public String visit(Ancestor o) { System.out.println("Got the ancestor method") return null; } public String visit(Offspring o) { System.out.println("Got the offspring method") return null; } } } define the test as: public static void main(String[] args) throws Exception { Ancestor ancestor = new Ancestor() { }; new Statement(new StringInspector(), "visit", new Object[] { cat }) .execute(); } then it throws java.lang.NoSuchMethodException: Cannot decide which method to call to match visit at java.beans.Statement.findMethod(Statement.java:376) at java.beans.Statement.invokeMethod(Statement.java:218) at java.beans.Statement.execute(Statement.java:18) I think the problem is caused by the java.beans.Statement.findMethod(). If the target class has two candidate methods which have the identical signature (difference equals to zero) but different return type, it will throws this kind of exception. Thus, I think the cure is to insert a routine check of their return types. If they have the same return type, then throw the NoSuchMethodException. If not, check whether they are assignable to each other and reflect the specific one. -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.