[threeten-dev] [threeten-develop] Public Eras changes
Stephen Colebourne
scolebourne at joda.org
Fri Feb 22 10:27:28 PST 2013
On 22 February 2013 17:14, Stephen Colebourne <scolebourne at joda.org> wrote:
> On 22 February 2013 16:48, roger riggs <roger.riggs at oracle.com> wrote:
>> One ugly spot is are the return type from Chronology.eras; List<Era>;
>> the subclasses would prefer to use List<JapaneseEra> but it is not
>> compatible.
>> Changing the signature to return List<? extends Era> is a possibility
>> but propagates the ugliness to application code.
>>
>> Converting the return type to Era[] works also. Its not clear the use of
>> List
>> adds much value to these short and static values.
>
> I'm opposed to further use of arrays on public APIs unless absolutely
> necessary. That Java made generics harder than necessary is just a
> general Java problem. So it should be List<? extends Era> with
> suitable overrides in each chronology.
Actually, this doesn't matter so much, as users that know the specific
type can use the value() method on the era itself, and users that
don't know the specific type will just want an Era anyway. So, maybe
no change is the best answer, with a little Javadoc.
Stephen
More information about the threeten-dev
mailing list