[concurrency-interest] Minor generics nit in AtomicReferenceArray
Dhanji R. Prasanna
dhanji at gmail.com
Thu Mar 26 22:01:17 EDT 2009
On Fri, Mar 27, 2009 at 12:33 PM, David M. Lloyd <david.lloyd at redhat.com>wrote:
> AtomicReferenceArray's type parameter is V. What can I do? I *know* that
> the expression will only ever be true if "value" is a V, but I have no way
> to test for it. I can cast the "value" parameter to V and suppress the
> warning, which will work (the cast is erased), but it's ugly.
> It's a matter of debate whether ConcurrentMap is too lax or
> AtomicReferenceArray is too strict, but of those two choices,
> AtomicReferenceArray is the only one that can be fixed in a
> backwards-compatible fashion.
I don't know. I think the balance between an erased cast in this
(admittedly) rare case and weakening the type signature of
AtomicReferenceArray tips in the former's direction, don't you?
At the very least for the sake of clarity and tools...
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Concurrency-interest