Return-Path: Delivered-To: apmail-geronimo-activemq-dev-archive@www.apache.org Received: (qmail 2418 invoked from network); 28 Dec 2006 14:25:29 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 28 Dec 2006 14:25:29 -0000 Received: (qmail 69539 invoked by uid 500); 28 Dec 2006 14:25:35 -0000 Delivered-To: apmail-geronimo-activemq-dev-archive@geronimo.apache.org Received: (qmail 69524 invoked by uid 500); 28 Dec 2006 14:25:35 -0000 Mailing-List: contact activemq-dev-help@geronimo.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: activemq-dev@geronimo.apache.org Delivered-To: mailing list activemq-dev@geronimo.apache.org Received: (qmail 69515 invoked by uid 99); 28 Dec 2006 14:25:35 -0000 Received: from herse.apache.org (HELO herse.apache.org) (140.211.11.133) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 28 Dec 2006 06:25:35 -0800 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests= X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO brutus.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 28 Dec 2006 06:25:28 -0800 Received: from brutus (localhost [127.0.0.1]) by brutus.apache.org (Postfix) with ESMTP id 197287142B8 for ; Thu, 28 Dec 2006 06:25:05 -0800 (PST) Message-ID: <17851441.1167315905100.JavaMail.root@brutus> Date: Thu, 28 Dec 2006 06:25:05 -0800 (PST) From: "Timothy Bish (JIRA)" To: activemq-dev@geronimo.apache.org Subject: [jira] Resolved: (AMQCPP-34) Use covariant return type for clone() In-Reply-To: <8150139.1166998622816.JavaMail.root@brutus> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org [ https://issues.apache.org/activemq/browse/AMQCPP-34?page=all ] Timothy Bish resolved AMQCPP-34. -------------------------------- Resolution: Fixed Patches applied and tested > Use covariant return type for clone() > ------------------------------------- > > Key: AMQCPP-34 > URL: https://issues.apache.org/activemq/browse/AMQCPP-34 > Project: ActiveMQ C++ Client > Issue Type: Improvement > Components: CMS Impl > Affects Versions: 1.1 > Reporter: Albert Strasheim > Assigned To: Timothy Bish > Attachments: covariant-clones-cms.diff, covariant-clones.diff > > > The cms::Message type has a pure virtual clone() method that returns a cms::Message*. cms::BytesMessage doesn't have a clone method. So it continues down the inheritance chain until we get to classes like activemq::connector::stomp::commands::TextMessageCommand which implement clone() and define it to return cms::Message*. > This means that in my message listener I have to cast the result of a BytesMessage->clone() (which I already know is a BytesMessage) to BytesMessage before I can use it as such. > Instead, BytesMessage should override clone() with another pure virtual that returns cms::BytesMessage. I think this is called a covariant return type. After that, TextMessageCommand's clone should probably be modified to return TextMessageCommand*. I don't know if there's anything in between that warrants a clone with a covariant return type. > Fixing this will make the library slightly easier to use. > Basic patch attached. There's probably more places to fix. Patch also has a few typo fixes. -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: https://issues.apache.org/activemq/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira