On Tue, 24 Jan 2023 16:25:46 GMT, Sergey Bylokhov <s...@openjdk.org> wrote:
>> No need to fill elements of array with default values if it was just >> created. Java guarantees that all elements of numeric array have default >> values after allocations - 0. > > 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" I'm not really fan of commented out code. What if I add a comment to the array declaration itself? int[] bandOffsets = new int[bands]; // by default have 0 values ------------- PR: https://git.openjdk.org/jdk/pull/12147