[OpenJDK 2D-Dev] RFR: 6206189: Graphics2D.clip specifies incorrectly that a 'null' is a valid value for this method
Prasanta Sadhukhan
psadhukhan at openjdk.java.net
Tue Feb 9 12:57:32 UTC 2021
On Tue, 9 Feb 2021 12:52:55 GMT, Prasanta Sadhukhan <psadhukhan at openjdk.org> wrote:
>> src/java.desktop/share/classes/java/awt/Graphics2D.java line 1206:
>>
>>> 1204: * @param s the {@code Shape} to be intersected with the current
>>> 1205: * {@code Clip}.
>>> 1206: * @throws NullPointerException if {@code s} is {@code null}
>>
>> Actually it is not always true, you can check it by commenting `setClip()` call in the test.
>
> The spec says "s - the Shape to be intersected with the current Clip" so I assume it means there should be a current clip set, so that is why I have used setClip to "set" a clip. So, setClip() should be there as far I see.
Also, if there is no clip set, then the spec statement " If s is null, this method clears the current Clip" does not carry any meaning, so in both regard, setClip() should be there, I presume.
-------------
PR: https://git.openjdk.java.net/jdk/pull/2476
More information about the 2d-dev
mailing list