[concurrency-interest] ReentrantReadWriteLock backport non-matching signature

Dhanji R. Prasanna dhanji at gmail.com
Thu Jul 13 19:03:19 EDT 2006

Somewhat off topic--does anyone know if covariant return types support
boxing for primitives?
For instance can I return Serializable on an overriden int method?
(eclipse complains, but I know eclipse has plenty of bugs with its
"intelligent" sensing features)

On 7/11/06, David Holmes <dcholmes at optusnet.com.au> wrote:
> Holger Hoffstatte writes:
> > Maybe it was just an oversight. Still, the whole point of having
> > interfaces is to decouple from the concrete class. I remember when I
> tried
> > to make the backport run (at least partly) on native j.u.c. this was one
> > of the primary showstoppers, at least for me.
> co-variant return types means we can get the best of both worlds. The
> class
> can declare that it returns a more specific type that the client may
> choose
> to use, if there is something more specific that the client wants to use.
> But the client is free to declare their variables as the less specific ie
> interface, type.
> This is no different to doing:
> ReentrantLock l = new ReentrantLock();
> rather than:
> Lock l = new ReentrantLock();
> You get to choose the type of your variables.
> > Regarding the incompatibility it seems Moran has found a good solution
> by
> > just referring to the interface in client code. (phew!)
> That's good.
> Cheers,
> David
> _______________________________________________
> Concurrency-interest mailing list
> Concurrency-interest at altair.cs.oswego.edu
> http://altair.cs.oswego.edu/mailman/listinfo/concurrency-interest
-------------- next part --------------
An HTML attachment was scrubbed...
URL: /pipermail/attachments/20060714/91f0205d/attachment.html 

More information about the Concurrency-interest mailing list