activemq-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Albert Strasheim (JIRA)" <>
Subject [jira] Updated: (AMQCPP-34) Use covariant return type for clone()
Date Sun, 24 Dec 2006 22:19:02 GMT
     [ ]

Albert Strasheim updated AMQCPP-34:

    Attachment: covariant-clones-cms.diff

Second part of patch.

> 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: Nathan Mittler
>         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