Re: [OpenJDK 2D-Dev] RFR: 6211257: BasicStroke.createStrokedShape(Shape): NPE is not specified [v2]
On Thu, 4 Feb 2021 04:15:03 GMT, Prasanta Sadhukhan wrote: >> Method createStrokedShape(Shape) for java.awt.BasicStroke class throws >> NullPointerException when passed a null object reference for a input >> parameter but it's not specified in the spec. >> Updated spec to illustrate this. > > Prasanta Sadhukhan has updated the pull request incrementally with one > additional commit since the last revision: > > Doc change to @throws Changes requested by serb (Reviewer). src/java.desktop/share/classes/java/awt/BasicStroke.java line 297: > 295: * @param s the {@code Shape} boundary be stroked > 296: * @return the {@code Shape} of the stroked outline. > 297: * @throws NullPointerException if {@code Shape} is {@code null} I think that you mean the parameter {@code s}, not a type Shape. test/jdk/java/awt/BasicStroke/TestNullShape.java line 40: > 38: System.out.println("result: false"); > 39: } > 40: catch(NullPointerException ne) { You can add a space after catch and move it to one line above. - PR: https://git.openjdk.java.net/jdk/pull/2377
Re: [OpenJDK 2D-Dev] RFR: 6211257: BasicStroke.createStrokedShape(Shape): NPE is not specified [v2]
On Thu, 4 Feb 2021 04:15:03 GMT, Prasanta Sadhukhan wrote: >> Method createStrokedShape(Shape) for java.awt.BasicStroke class throws >> NullPointerException when passed a null object reference for a input >> parameter but it's not specified in the spec. >> Updated spec to illustrate this. > > Prasanta Sadhukhan has updated the pull request incrementally with one > additional commit since the last revision: > > Doc change to @throws test/jdk/java/awt/BasicStroke/TestNullShape.java line 44: > 42: return; > 43: } > 44: throw new RuntimeException("NPE is expected"); I would suggest moving this into the try-block as it would make the intention clearer: if NPE is not thrown, it's a failure. Also catch should be on the same line as the closing brace of try. - PR: https://git.openjdk.java.net/jdk/pull/2377
Re: [OpenJDK 2D-Dev] RFR: 6211257: BasicStroke.createStrokedShape(Shape): NPE is not specified [v2]
On Wed, 3 Feb 2021 23:34:01 GMT, Sergey Bylokhov wrote: >> Prasanta Sadhukhan has updated the pull request incrementally with one >> additional commit since the last revision: >> >> Doc change to @throws > > src/java.desktop/share/classes/java/awt/BasicStroke.java line 297: > >> 295: * @param s the {@code Shape} boundary be stroked >> 296: * @return the {@code Shape} of the stroked outline. >> 297: * @exception NullPointerException if {@code Shape} is {@code null} > > We use "@throws" in the new code. any feedback on this? - PR: https://git.openjdk.java.net/jdk/pull/2377
Re: [OpenJDK 2D-Dev] RFR: 6211257: BasicStroke.createStrokedShape(Shape): NPE is not specified [v2]
> Method createStrokedShape(Shape) for java.awt.BasicStroke class throws > NullPointerException when passed a null object reference for a input > parameter but it's not specified in the spec. > Updated spec to illustrate this. Prasanta Sadhukhan has updated the pull request incrementally with one additional commit since the last revision: Doc change to @throws - Changes: - all: https://git.openjdk.java.net/jdk/pull/2377/files - new: https://git.openjdk.java.net/jdk/pull/2377/files/899868c0..f7d6e8fe Webrevs: - full: https://webrevs.openjdk.java.net/?repo=jdk=2377=01 - incr: https://webrevs.openjdk.java.net/?repo=jdk=2377=00-01 Stats: 1 line in 1 file changed: 0 ins; 0 del; 1 mod Patch: https://git.openjdk.java.net/jdk/pull/2377.diff Fetch: git fetch https://git.openjdk.java.net/jdk pull/2377/head:pull/2377 PR: https://git.openjdk.java.net/jdk/pull/2377