On Fri, 10 Oct 2025 22:30:53 GMT, Phil Race <[email protected]> wrote:
> The only significant change here is to ensure that all SampleModel types
> throw a specified exception if a client
> calls any of the following methods with a negative width or height.
> getPixels(..)
> setPixels(..)
> getSamples(..)
> setSamples(..)
>
> The rest is fixing the javadoc to properly describe what happens and some
> minor cleanup.
> I use {@inheritDoc} to avoid repeating the super-class doc. And no one now
> has to tediously compare them.
> I could just delete the javadoc but that would cause no javadoc to be
> generated for an overridden method.
> There were a couple of surprises with {@inheritDoc} and the one I had to deal
> with is that declared RuntimeExceptions
> are not inherited. You need to explicitly re-add them. This because if it
> isn't an exception in the method signature (as in foo() throws
> BarException), and instead you only have "@throws BarException" it will not
> be inherited.
>
> I added a test which verifies the behaviour for illegal arguments.
>
> CSR is here https://bugs.openjdk.org/browse/JDK-8369623
I have relooked at this and have some comments..
src/java.desktop/share/classes/java/awt/image/BandedSampleModel.java line 603:
> 601: * @param data The DataBuffer containing the image data
> 602: * @see #getDataElements(int, int, Object, DataBuffer)
> 603: * @throws NullPointerException if {@code data} is null.
I guess we will get NPE if (@code obj] is also null...Shouldn't we specify that
too?
src/java.desktop/share/classes/java/awt/image/ComponentSampleModel.java line
901:
> 899: * @param data the DataBuffer containing the image data
> 900: * @see #getDataElements(int, int, Object, DataBuffer)
> 901: * @throws NullPointerException if {@code data} is null.
same here
src/java.desktop/share/classes/java/awt/image/MultiPixelPackedSampleModel.java
line 597:
> 595: * @param data the {@code DataBuffer} containing the image data
> 596: * @see #getDataElements(int, int, Object, DataBuffer)
> 597: * @throws NullPointerException if {@code data} is null.
here too
src/java.desktop/share/classes/java/awt/image/MultiPixelPackedSampleModel.java
line 650:
> 648: * @param data the {@code DataBuffer} containing the image data
> 649: * @see #getPixel(int, int, int[], DataBuffer)
> 650: * @throws NullPointerException if {@code data} is null.
here NPE can be thrown if iArray is null...maybe we should mention that in spec
too..
src/java.desktop/share/classes/java/awt/image/SinglePixelPackedSampleModel.java
line 571:
> 569: * @param data The DataBuffer containing the image data.
> 570: * @see #getDataElements(int, int, Object, DataBuffer)
> 571: * @throws NullPointerException if {@code data} is null.
same...NPE for null obj?
-------------
Changes requested by psadhukhan (Reviewer).
PR Review: https://git.openjdk.org/jdk/pull/27754#pullrequestreview-3409716566
PR Review Comment: https://git.openjdk.org/jdk/pull/27754#discussion_r2485532857
PR Review Comment: https://git.openjdk.org/jdk/pull/27754#discussion_r2485535771
PR Review Comment: https://git.openjdk.org/jdk/pull/27754#discussion_r2485538234
PR Review Comment: https://git.openjdk.org/jdk/pull/27754#discussion_r2485552416
PR Review Comment: https://git.openjdk.org/jdk/pull/27754#discussion_r2485648028