On Thu, 11 Feb 2021 04:14:54 GMT, Prasanta Sadhukhan <psadhuk...@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: > > Fix as per Phil's comment test/jdk/java/awt/Graphics2D/TestNullClip.java line 41: > 39: > 40: g2d.setClip(0, 0, 100, 100); > 41: Shape clip = g2d.getClip(); Looks like the `clip` variable is not used. Also I've just noticed that the years are not updated in copyright headers of Graphics and Graphics2d. test/jdk/java/awt/Graphics2D/TestNullClip.java line 46: > 44: if (clip1 != null) { > 45: throw new RuntimeException("Clip is not cleared"); > 46: } There is no check that `g2d.clip(null);` call does not throw NPE when no user clip is set. ------------- PR: https://git.openjdk.java.net/jdk/pull/2476