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

Curt Cox ccox@tripos.com
Fri, 9 Jan 2004 10:07:34 -0600

"We need a knockdown argument one way or the other about this
to make a confident decision. Anyone got one?"

I'll bite.

Making AtomicInteger extend Number violate wouldn't violate
any method contracts.  It wouldn't introduce any methods that
would be prone to misuse.  In short, extending Number
doesn't make AtomicInteger error-prone.

Failing to make AtomicInteger extend Number seems to be
claiming that AtomicIntegerS can't be treated as numbers.
It complicates code that could otherwise be generically
written to Number.  If AtomicIntegers can't be treated as
numbers, then the documentation of both Number and
AtomicInteger need to explain why that is.

Of course the same arguments can be made for AtomicIntegerS
being Comparable.  Why aren't AtomicIntegerS comparable?