On Jul 31, 2013, at 12:57 AM, Mike Duigou <mike.dui...@oracle.com> wrote:
>> 
>> 
>> -     * @throws NullPointerException if a specified key or value is null,
>> +     * @throws NullPointerException if a specified key or newValue is null,
>>     *         and this map does not permit null keys or values
>> +     * @throws NullPointerException if oldValue is null and this map does 
>> not
>> +     *         permit null values
>> +     *         (<a 
>> href="Collection.html#optional-restrictions">optional</a>)
>> 
>> 
>> More curious than anything else, is it fine to have two declarations of NPE 
>> here?
> 
> 
> Throwing NPE isn't optional if either key or newValue is null and the map 
> does not permit null values.
> 
> This restriction has to be softened for oldValue because the default 
> implementation doesn't test whether oldValue could be added to the map and 
> doesn't know if the map allows null values. 
> 

Since that restriction is softened by @implSpec does it need to be propagated 
to the exception? the implication is that overriding implementations could do 
the same?


> The multiple @throws approach is used as an alternative to a complicated 
> legalistic description in a single throws declaration. It's used uncommonly 
> elsewhere in the JDK. 


OK.

Paul.

Reply via email to