Skip to content

Fix static check warnings. #1696

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
May 1, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 14 additions & 12 deletions bson/src/main/org/bson/ByteBuf.java
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,12 @@ public interface ByteBuf {
* <p>Writes the given byte into this buffer at the given index. </p>
*
* @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.
Expand Down Expand Up @@ -99,60 +99,61 @@ public interface ByteBuf {
*
* <p>Writes the given byte into this buffer at the current position, and then increments the position. </p>
*
* @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 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,
* 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);

/**
* <p>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
Expand Down Expand Up @@ -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
Expand Down