From 7f77cc91c6780df34a33bf9a6d810c932562d07d Mon Sep 17 00:00:00 2001 From: "slav.babanin" Date: Tue, 29 Apr 2025 17:02:56 -0700 Subject: [PATCH 1/2] Fix static check warnings. JAVA-5800 --- bson/src/main/org/bson/ByteBuf.java | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/bson/src/main/org/bson/ByteBuf.java b/bson/src/main/org/bson/ByteBuf.java index 13dfa1f95a8..82f80fa5633 100644 --- a/bson/src/main/org/bson/ByteBuf.java +++ b/bson/src/main/org/bson/ByteBuf.java @@ -42,12 +42,12 @@ public interface ByteBuf { *

Writes the given byte into this buffer at the given index.

* * @param index The index at which the byte will be written - * @param b The byte value to be written + * @param value The byte value to be written * @return This buffer * @throws IndexOutOfBoundsException If {@code index} is negative or not smaller than the buffer's limit * @throws java.nio.ReadOnlyBufferException If this buffer is read-only */ - ByteBuf put(int index, byte b); + ByteBuf put(int index, byte value); /** * Returns the number of elements between the current position and the limit. @@ -99,30 +99,31 @@ public interface ByteBuf { * *

Writes the given byte into this buffer at the current position, and then increments the position.

* - * @param b The byte to be written + * @param value The byte to be written * @return This buffer * @throws java.nio.BufferOverflowException If this buffer's current position is not smaller than its limit * @throws java.nio.ReadOnlyBufferException If this buffer is read-only */ - ByteBuf put(byte b); + ByteBuf put(byte value); /** * Writes the given int value into this buffer at the current position, * using the current byte order, and increments the position by 4. * - * @param b the int value to be written + * @param value the int value to be written * @return this buffer * @throws java.nio.BufferOverflowException if there are fewer than 4 bytes remaining in this buffer * @throws java.nio.ReadOnlyBufferException if this buffer is read-only * @since 5.4 */ - ByteBuf putInt(int b); + ByteBuf putInt(int value); /** * Writes the given int value into this buffer at the current position, * using the current byte order, and increments the position by 4. * * @param b the int value to be written + * @param index the index at which the int will be written * @return this buffer * @throws java.nio.BufferOverflowException if there are fewer than 4 bytes remaining in this buffer * @throws java.nio.ReadOnlyBufferException if this buffer is read-only @@ -134,25 +135,25 @@ public interface ByteBuf { * Writes the given double value into this buffer at the current position, * using the current byte order, and increments the position by 8. * - * @param b the double value to be written + * @param value the double value to be written * @return this buffer * @throws java.nio.BufferOverflowException if there are fewer than 8 bytes remaining in this buffer * @throws java.nio.ReadOnlyBufferException if this buffer is read-only * @since 5.4 */ - ByteBuf putDouble(double b); + ByteBuf putDouble(double value); /** * Writes the given long value into this buffer at the current position, * using the current byte order, and increments the position by 8. * - * @param b the long value to be written + * @param value the long value to be written * @return this buffer * @throws java.nio.BufferOverflowException if there are fewer than 8 bytes remaining in this buffer * @throws java.nio.ReadOnlyBufferException if this buffer is read-only * @since 5.4 */ - ByteBuf putLong(long b); + ByteBuf putLong(long value); /** *

Flips this buffer. The limit is set to the current position and then the position is set to zero. If the mark is defined then it @@ -198,6 +199,7 @@ public interface ByteBuf { * Returns the offset of the first byte within the backing byte array of * this buffer. * + * @return the offset within this buffer's array. * @throws java.nio.ReadOnlyBufferException If this buffer is backed by an array but is read-only * @throws UnsupportedOperationException if this buffer is not backed by an accessible array * @since 5.5 From d8133ad8e8a1212a7dab8217daf09f182f023f92 Mon Sep 17 00:00:00 2001 From: "slav.babanin" Date: Tue, 29 Apr 2025 17:07:20 -0700 Subject: [PATCH 2/2] Rename value in putInt. JAVA-5800 --- bson/src/main/org/bson/ByteBuf.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bson/src/main/org/bson/ByteBuf.java b/bson/src/main/org/bson/ByteBuf.java index 82f80fa5633..cd14d2f93df 100644 --- a/bson/src/main/org/bson/ByteBuf.java +++ b/bson/src/main/org/bson/ByteBuf.java @@ -122,14 +122,14 @@ public interface ByteBuf { * Writes the given int value into this buffer at the current position, * using the current byte order, and increments the position by 4. * - * @param b the int value to be written + * @param value the int value to be written * @param index the index at which the int will be written * @return this buffer * @throws java.nio.BufferOverflowException if there are fewer than 4 bytes remaining in this buffer * @throws java.nio.ReadOnlyBufferException if this buffer is read-only * @since 5.4 */ - ByteBuf putInt(int index, int b); + ByteBuf putInt(int index, int value); /** * Writes the given double value into this buffer at the current position,