On Tue, 27 Jan 2026 22:51:27 GMT, Phil Race <[email protected]> wrote:
> Update the specification of concrete SampleModel classes which over-ride
> getSampleSize(int band) to describe how the behave.
> It isn't entirely pretty because 2 of them ignore the band parameter and
> always have ..
Changes requested by aivanov (Reviewer).
src/java.desktop/share/classes/java/awt/image/MultiPixelPackedSampleModel.java
line 242:
> 240: * this method ignores the {@code band} parameter and returns
> 241: * the sample size of the single band.
> 242: * @param band the specified band (ignored).
Suggestion:
* @param band the specified band (ignored)
For consistency with other methods which don't have the full stop in
description of parameters.
test/jdk/java/awt/image/GetSampleSizeTest.java line 1:
> 1: /*
I suggest creating `test-` methods rather than using a code block inside the
`main` method and call the methods from main, it would make the code better
structured and convey the intent clearer.
test/jdk/java/awt/image/GetSampleSizeTest.java line 47:
> 45: ComponentSampleModel csm =
> 46: new ComponentSampleModel(DataBuffer.TYPE_BYTE,
> 47: width, height, 1, width, bandOffsets);
Suggestion:
ComponentSampleModel csm =
new ComponentSampleModel(DataBuffer.TYPE_BYTE,
width, height, 1, width, bandOffsets);
Indent the continuation lines by 8 spaces which is the standard indentation for
continuation lines.
test/jdk/java/awt/image/GetSampleSizeTest.java line 59:
> 57: MultiPixelPackedSampleModel mppsm =
> 58: new MultiPixelPackedSampleModel(DataBuffer.TYPE_BYTE,
> 59: width, height, 4);
Suggestion:
MultiPixelPackedSampleModel mppsm =
new MultiPixelPackedSampleModel(DataBuffer.TYPE_BYTE,
width, height, 4);
Indent the continuation lines by 8 spaces
test/jdk/java/awt/image/GetSampleSizeTest.java line 72:
> 70: new SinglePixelPackedSampleModel(DataBuffer.TYPE_BYTE,
> 71: width, height, bitMask);
> 72: int numBands = sppsm.getNumBands();
Suggestion:
SinglePixelPackedSampleModel sppsm =
new SinglePixelPackedSampleModel(DataBuffer.TYPE_BYTE,
width, height, bitMask);
int numBands = sppsm.getNumBands();
Indent the continuation lines by 8 spaces; `numBands` isn't a continuation
line, and it should align to `SinglePixelPackedSampleModel` declaration.
test/jdk/java/awt/image/GetSampleSizeTest.java line 76:
> 74: if (numBands != 4) {
> 75: throw new RuntimeException("Unexpected numBands");
> 76: }
Suggestion:
if (numBands != 4) {
throw new RuntimeException("Unexpected numBands");
}
Misaligned closing brace.
-------------
PR Review: https://git.openjdk.org/jdk/pull/29457#pullrequestreview-3724404777
PR Review Comment: https://git.openjdk.org/jdk/pull/29457#discussion_r2743009235
PR Review Comment: https://git.openjdk.org/jdk/pull/29457#discussion_r2743039318
PR Review Comment: https://git.openjdk.org/jdk/pull/29457#discussion_r2743019932
PR Review Comment: https://git.openjdk.org/jdk/pull/29457#discussion_r2743024796
PR Review Comment: https://git.openjdk.org/jdk/pull/29457#discussion_r2743029588
PR Review Comment: https://git.openjdk.org/jdk/pull/29457#discussion_r2743031578