abdera-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Martin Cooper" <mart...@apache.org>
Subject Re: Base.clone() vs Object.clone()
Date Wed, 21 Jun 2006 17:17:24 GMT
On 6/21/06, Garrett Rooney <rooneg@electricjellyfish.net> wrote:
>
> Is there a reason that Abdera's Base interface defines clone as
> returning something other than Object?


This is not good. Unless something changed in the JLS and I missed it, it is
not legal to have two methods on a class or interface whose signatures
differ only in the return type.

--
Martin Cooper


public interface Base extends Cloneable {
>
>   /**
>    * Serializes the model component out to the specified stream
>    */
>   void writeTo(OutputStream out) throws IOException;
>
>   /**
>    * Serializes the model component out to the specified writer
>    */
>   void writeTo(Writer writer) throws IOException;
>
>   <T extends Base>T clone();
>
>   Factory getFactory();
>
> }
>
> This seems to be contrary to the way I've always seen clone defined,
> and it certainly throws IDEA for a loop, resulting in complaints about
> errors in every single class in the model package due to that clash
> between Base.clone and Object.clone.
>
> -garrett
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message