[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
Wed Feb 10 04:54:38 UTC 2021
On Wed, 10 Feb 2021 04:47:05 GMT, Sergey Bylokhov <serb at openjdk.org> wrote:
>> I am not sure if it's implementation bug. As Jim Graham has mentioned in thebug,
>>
>>> clip(null) is not legal.
>>>
>>> It is *setClip*(null) that clears the clip.
>> I could rephrase the doc to specify NPE willbe thrrown for null Shape if a clip is already set.
>
> If "*setClip*(null)" has to clear the clip then it should be specified, currently, that method said nothing about the null parameter.
As per code
public void setClip(Shape sh) {
usrClip = transformShape(sh);
usrClip is set to null if "sh" is null so clip is cleared...I will update the setClip doc too..
-------------
PR: https://git.openjdk.java.net/jdk/pull/2476
More information about the 2d-dev
mailing list