[OpenJDK 2D-Dev] RFR: 6206189: Graphics2D.clip specifies incorrectly that a 'null' is a valid value for this method [v5]
Alexey Ivanov
aivanov at openjdk.java.net
Fri Feb 12 14:51:42 UTC 2021
On Thu, 11 Feb 2021 15:44:57 GMT, Prasanta Sadhukhan <psadhukhan at openjdk.org> wrote:
>> The API doc for Graphics2D.clip(shape s) claims that passing a null argument would actually clear the existing clipping area, which is incorrect.
>> This statement is applicable only to G2D.setClip() and not for the clip() method. G2D.clip() would throw a NullPointerException when it encounters a null argument.
>> Updated spec to rectify this.
>
> Prasanta Sadhukhan has updated the pull request incrementally with one additional commit since the last revision:
>
> Review comment fix. Test updated
src/java.desktop/share/classes/java/awt/Graphics2D.java line 1204:
> 1202: * argument, the specified {@code Shape} becomes the new
> 1203: * user clip. Since this method intersects the specified shape
> 1204: * with the current clip, it will throw NPE for a null shape
Shall NPE be spelled out as `{@code NullPointerException}`?
Also should it rather be, “…it <del>will</del> throws NPE…”?
-------------
PR: https://git.openjdk.java.net/jdk/pull/2476
More information about the 2d-dev
mailing list