Skip to content

Commit 1a6da44

Browse files
committed
8374467: Incorrect ranges in jdk.internal.util.ByteArray JavaDoc
Reviewed-by: rriggs
1 parent e6abf98 commit 1a6da44

File tree

2 files changed

+14
-14
lines changed

2 files changed

+14
-14
lines changed

src/java.base/share/classes/jdk/internal/util/ByteArray.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2023, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2023, 2026, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -241,7 +241,7 @@ public static double getDoubleRaw(byte[] array, int offset) {
241241
* @param offset where setting (writing) in the array should begin
242242
* @param value value to set in the array
243243
* @throws IndexOutOfBoundsException if the provided {@code offset} is outside
244-
* the range [0, array.length]
244+
* the range [0, array.length - 1]
245245
* @see #getBoolean(byte[], int)
246246
*/
247247
public static void setBoolean(byte[] array, int offset, boolean value) {
@@ -328,7 +328,7 @@ public static void setInt(byte[] array, int offset, int value) {
328328
* @param offset where setting (writing) in the array should begin
329329
* @param value value to set in the array
330330
* @throws IndexOutOfBoundsException if the provided {@code offset} is outside
331-
* the range [0, array.length - 2]
331+
* the range [0, array.length - 4]
332332
* @see #getFloat(byte[], int)
333333
*/
334334
public static void setFloat(byte[] array, int offset, float value) {
@@ -350,7 +350,7 @@ public static void setFloat(byte[] array, int offset, float value) {
350350
* @param offset where setting (writing) in the array should begin
351351
* @param value value to set in the array
352352
* @throws IndexOutOfBoundsException if the provided {@code offset} is outside
353-
* the range [0, array.length - 2]
353+
* the range [0, array.length - 4]
354354
* @see #getFloatRaw(byte[], int)
355355
*/
356356
public static void setFloatRaw(byte[] array, int offset, float value) {
@@ -368,7 +368,7 @@ public static void setFloatRaw(byte[] array, int offset, float value) {
368368
* @param offset where setting (writing) in the array should begin
369369
* @param value value to set in the array
370370
* @throws IndexOutOfBoundsException if the provided {@code offset} is outside
371-
* the range [0, array.length - 4]
371+
* the range [0, array.length - 8]
372372
* @see #getLong(byte[], int)
373373
*/
374374
public static void setLong(byte[] array, int offset, long value) {
@@ -387,7 +387,7 @@ public static void setLong(byte[] array, int offset, long value) {
387387
* @param offset where setting (writing) in the array should begin
388388
* @param value value to set in the array
389389
* @throws IndexOutOfBoundsException if the provided {@code offset} is outside
390-
* the range [0, array.length - 2]
390+
* the range [0, array.length - 8]
391391
* @see #getDouble(byte[], int)
392392
*/
393393
public static void setDouble(byte[] array, int offset, double value) {
@@ -409,7 +409,7 @@ public static void setDouble(byte[] array, int offset, double value) {
409409
* @param offset where setting (writing) in the array should begin
410410
* @param value value to set in the array
411411
* @throws IndexOutOfBoundsException if the provided {@code offset} is outside
412-
* the range [0, array.length - 2]
412+
* the range [0, array.length - 8]
413413
* @see #getDoubleRaw(byte[], int)
414414
*/
415415
public static void setDoubleRaw(byte[] array, int offset, double value) {

src/java.base/share/classes/jdk/internal/util/ByteArrayLittleEndian.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2023, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2023, 2026, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -241,7 +241,7 @@ public static double getDoubleRaw(byte[] array, int offset) {
241241
* @param offset where setting (writing) in the array should begin
242242
* @param value value to set in the array
243243
* @throws IndexOutOfBoundsException if the provided {@code offset} is outside
244-
* the range [0, array.length]
244+
* the range [0, array.length - 1]
245245
* @see #getBoolean(byte[], int)
246246
*/
247247
public static void setBoolean(byte[] array, int offset, boolean value) {
@@ -328,7 +328,7 @@ public static void setInt(byte[] array, int offset, int value) {
328328
* @param offset where setting (writing) in the array should begin
329329
* @param value value to set in the array
330330
* @throws IndexOutOfBoundsException if the provided {@code offset} is outside
331-
* the range [0, array.length - 2]
331+
* the range [0, array.length - 4]
332332
* @see #getFloat(byte[], int)
333333
*/
334334
public static void setFloat(byte[] array, int offset, float value) {
@@ -350,7 +350,7 @@ public static void setFloat(byte[] array, int offset, float value) {
350350
* @param offset where setting (writing) in the array should begin
351351
* @param value value to set in the array
352352
* @throws IndexOutOfBoundsException if the provided {@code offset} is outside
353-
* the range [0, array.length - 2]
353+
* the range [0, array.length - 4]
354354
* @see #getFloatRaw(byte[], int)
355355
*/
356356
public static void setFloatRaw(byte[] array, int offset, float value) {
@@ -368,7 +368,7 @@ public static void setFloatRaw(byte[] array, int offset, float value) {
368368
* @param offset where setting (writing) in the array should begin
369369
* @param value value to set in the array
370370
* @throws IndexOutOfBoundsException if the provided {@code offset} is outside
371-
* the range [0, array.length - 4]
371+
* the range [0, array.length - 8]
372372
* @see #getLong(byte[], int)
373373
*/
374374
public static void setLong(byte[] array, int offset, long value) {
@@ -387,7 +387,7 @@ public static void setLong(byte[] array, int offset, long value) {
387387
* @param offset where setting (writing) in the array should begin
388388
* @param value value to set in the array
389389
* @throws IndexOutOfBoundsException if the provided {@code offset} is outside
390-
* the range [0, array.length - 2]
390+
* the range [0, array.length - 8]
391391
* @see #getDouble(byte[], int)
392392
*/
393393
public static void setDouble(byte[] array, int offset, double value) {
@@ -409,7 +409,7 @@ public static void setDouble(byte[] array, int offset, double value) {
409409
* @param offset where setting (writing) in the array should begin
410410
* @param value value to set in the array
411411
* @throws IndexOutOfBoundsException if the provided {@code offset} is outside
412-
* the range [0, array.length - 2]
412+
* the range [0, array.length - 8]
413413
* @see #getDoubleRaw(byte[], int)
414414
*/
415415
public static void setDoubleRaw(byte[] array, int offset, double value) {

0 commit comments

Comments
 (0)