On Wed, 10 Feb 2021 18:30:18 GMT, Phil Race <p...@openjdk.org> wrote:

>> 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..
>
> From what I can tell, if clip is null, then calling clip(null) has no effect.
> And it won't throw an NPE in that case. So the proposed documentation is less 
> accurate than no documentation at all.
> And I would shy away from changing the implementation on this without LOTS of 
> VERY careful testing.  
> Oh the javadoc clause you propose is split by many lines of comments. I see 
> you have the rider "and clip is already set via {@code setClip}".
> Well I am not sure why it has to be set by setClip for this to be true but 
> just having to say this sounds weird.

> usrClip is set to null if "sh" is null so clip is cleared...I will update the 
> setClip doc too..

Huh ? Not understanding you. If the userClip is non-null then we enter this
        if (usrClip != null) {
            s = intersectShapes(usrClip, s, true, true);
        }
which i where you get the NPE from you are proposing to document.

-------------

PR: https://git.openjdk.java.net/jdk/pull/2476

Reply via email to