activemq-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Timothy Bish (JIRA)" <>
Subject [jira] Commented: (AMQCPP-34) Use covariant return type for clone()
Date Mon, 25 Dec 2006 02:46:02 GMT
    [ ] 
Timothy Bish commented on AMQCPP-34:

Patch applied, had to make changes in the openwire classes as well to support this.  This
change may upset some older compilers.

> Use covariant return type for clone()
> -------------------------------------
>                 Key: AMQCPP-34
>                 URL:
>             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

This message is automatically generated by JIRA.
If you think it was sent incorrectly contact one of the administrators:
For more information on JIRA, see:


View raw message