[concurrency-interest] More on: AtomicInteger and AtomicLong should implement Numbe

Doug Lea dl@cs.oswego.edu
Fri, 9 Jan 2004 15:07:06 -0500


Thanks for all the comments. We've so far established (among other
things) that:

  1. AtomicInteger etc should each have a toString method that returns
     stringified current value. (As implied by Darron Shaffer.) And
     they now do have them.  We can act quickly when something is
     obviously right.

  2. AtomicInteger etc should NOT implement Comparable
     (Thanks to Dawid Kurzyniec.)

  3. If there exists code that tests for "instanceof Number" to make
     assumptions about immutability, equals, or hashCode , then it
     would be a disservice to subclass Number here. If there is any
     JDK code that does this, it would be a big disservice. (But I don't
     think there is.)

Costin asks:

> And I don't know why this discussion is important,

Well, probably not too important, but we're taking it seriously anyway
because it is probably representative of reactions we might expect
from casual users. The expert users can clearly cope either way.


-Doug