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

Boehm, Hans hans_boehm@hp.com
Tue, 6 Jan 2004 13:16:35 -0800


If I understand this correctly, it seems to me that the real question here
is whether inheritance from java.lang.Number was intended to imply immutability.
The spec doesn't currently say so.  According to the spec, it implies only
convertibility to numeric types, a condition that should clearly be satisfied by
AtomicInteger and AtomicLong.

Thus it seems to me that either:

1) AtomicInteger and AtomicLong should inherit from Number, or

2) The description of java.lang.Number should specify that subclasses of Number
should be immutable.

In either case, it appears to me that a change is required to keep this from getting ugly.

Hans