RFR: 8300929: Avoid unnecessary array fill after creation in java.awt.image
Sergey Bylokhov
serb at openjdk.org
Tue Jan 24 22:53:11 UTC 2023
On Tue, 24 Jan 2023 19:39:38 GMT, Attila Szegedi <attila at openjdk.org> wrote:
>> src/java.desktop/share/classes/java/awt/image/Raster.java line 372:
>>
>>> 370: for (int i = 0; i < bands; i++) {
>>> 371: bankIndices[i] = i;
>>> 372: bandOffsets[i] = 0;
>>
>> I suggest to comment this line and adding a comment like "0 zero is the default value not need to be set"
>
> Yeah, please, no commented-out code. I'd be fine with the code as it was, I don't think it needs much clarification. If @mrserb insists on a comment then I agree that a comment on the array declaration should be sufficient.
That is not about the default values in the array but about missing initialization of `bandOffsets`, which we will skip intentionally. So it won't raise the question later why we initiated the Indices and not offsets.
-------------
PR: https://git.openjdk.org/jdk/pull/12147
More information about the client-libs-dev
mailing list