RFR(2nd): 8023275: Wrapping collections should override default methods
Henry Jen
henry.jen at oracle.com
Wed Aug 21 23:19:11 UTC 2013
On 08/20/2013 02:21 AM, Paul Sandoz wrote:
> [resending unsigned, sorry if a dup arrives later on]
>
> On Aug 19, 2013, at 9:18 PM, Henry Jen <henry.jen at oracle.com> wrote:
>
>> Hi,
>>
>> Please review the webrev at
>> http://cr.openjdk.java.net/~henryjen/tl/8023275/0/webrev/
>>
>> The patch adds override on default methods for a couple wrapping classed
>> and delegate those to underlying class.
>>
>> There is a minor revise on synchronizedCollection javadoc to cover Stream.
>>
>
> Looks good.
>
>
>> A sanity check on wrapper classes to ensure default methods are override.
>>
>
> You might want to additionally use an ArrayList instance for unmodifiableList/synchronizedList/checkedList, so as to check both unmod list impls:
>
> public static <T> List<T> unmodifiableList(List<? extends T> list) {
> return (list instanceof RandomAccess ?
> new UnmodifiableRandomAccessList<>(list) :
> new UnmodifiableList<>(list));
> }
>
Good point, I also added Navigable into the test.
http://cr.openjdk.java.net/~henryjen/tl/8023275/2/webrev/
Cheers,
Henry
More information about the core-libs-dev
mailing list