[errorprone] Suppress ByteBufferBackingArray

The byte buffers used here are created by wrapping a byte[].

See https://errorprone.info/bugpattern/ByteBufferBackingArray

Change-Id: Idbc16d5ae4ff9f64b97be07a3cdf190716da191f
This commit is contained in:
Matthias Sohn 2023-09-20 15:03:53 +02:00
parent ac3794bf01
commit 4cfe27dd06
3 changed files with 6 additions and 0 deletions

View File

@ -63,6 +63,7 @@ public BasicAuthentication(InetSocketAddress proxy, String initialUser,
this.password = convert(initialPassword);
}
@SuppressWarnings("ByteBufferBackingArray")
private byte[] convert(char[] pass) {
if (pass == null) {
return new byte[0];

View File

@ -460,6 +460,7 @@ private void copyPackThroughCache(PackOutputStream out, DfsReader ctx,
}
}
@SuppressWarnings("ByteBufferBackingArray")
private long copyPackBypassCache(PackOutputStream out, ReadableChannel rc)
throws IOException {
ByteBuffer buf = newCopyBuffer(out, rc);

View File

@ -863,6 +863,7 @@ private static class ContentStreamLoader {
}
}
@SuppressWarnings("ByteBufferBackingArray")
private @Nullable ContentStreamLoader applyText(RawText rt, FileHeader fh, Result result)
throws IOException {
List<ByteBuffer> oldLines = new ArrayList<>(rt.size());
@ -1023,6 +1024,7 @@ && canApplyAt(hunkLines, newLines, 0)) {
}
}
@SuppressWarnings("ByteBufferBackingArray")
private boolean canApplyAt(List<ByteBuffer> hunkLines,
List<ByteBuffer> newLines, int line) {
int sz = hunkLines.size();
@ -1054,11 +1056,13 @@ private boolean canApplyAt(List<ByteBuffer> hunkLines,
return true;
}
@SuppressWarnings("ByteBufferBackingArray")
private ByteBuffer slice(ByteBuffer b, int off) {
int newOffset = b.position() + off;
return ByteBuffer.wrap(b.array(), newOffset, b.limit() - newOffset);
}
@SuppressWarnings("ByteBufferBackingArray")
private boolean isNoNewlineAtEnd(ByteBuffer hunkLine) {
return Arrays.equals(NO_EOL, 0, NO_EOL.length, hunkLine.array(),
hunkLine.position(), hunkLine.limit());