[concurrency-interest] Re: AtomicInteger and AtomicLong should implement Number

Luke Blanshard blanshlu@netscape.net
Thu, 08 Jan 2004 21:39:42 -0600

dl@cs.oswego.edu wrote:

>... But the reasons at this point boil down to taste. We need a
>knockdown argument one way or the other about this to make a confident
>decision. Anyone got one?
Not I.  But I would point out that this entire thread is predicated on 
taste: the idea that AtomicInteger must be a kind of Integer because of 
its name.  I doubt that making it a Number would alleviate that 
particular confusion.

I don't think you will find a "knockdown argument" for this issue.  You 
could plausibly go either way with this.  However, I suspect that you 
have more support on this list than you have seen expressed for your 
collective inclination to not conflate AtomicInteger and AtomicLong with 
Number.  Just because it's possible doesn't mean it's a good API.

With autoboxing, converting an AtomicInteger to an Integer is trivial.  
And if someone really wanted a Number that was mutable, well, there's 
apparently nothing stopping him from making one.  Doesn't sound like a 
great idea to me.  But if you made AtomicInteger into a Number, you'd be 
putting your imprimatur on exactly that idea.

Luke Blanshard