chore: fix a few typos

This commit is contained in:
Riley Park 2021-05-28 02:15:09 -07:00
parent d7d0c0fa93
commit e1a983fcb6
No known key found for this signature in database
GPG Key ID: D831AF236C834E45
8 changed files with 23 additions and 23 deletions

View File

@ -28,8 +28,8 @@ public interface BufferAllocator extends AutoCloseable {
* Check that the given {@code size} argument is a valid buffer size, or throw an {@link IllegalArgumentException}. * Check that the given {@code size} argument is a valid buffer size, or throw an {@link IllegalArgumentException}.
* *
* @param size The size to check. * @param size The size to check.
* @throws IllegalArgumentException if the size is not possitive, or if the size is too big (over ~2 GB) for a * @throws IllegalArgumentException if the size is not positive, or if the size is too big (over ~2 GB) for a
* buffer to accomodate. * buffer to accommodate.
*/ */
static void checkSize(long size) { static void checkSize(long size) {
if (size < 1) { if (size < 1) {

View File

@ -145,7 +145,7 @@ public final class CompositeBuffer extends ResourceSupport<Buffer, CompositeBuff
* @throws IllegalArgumentException if the given buffers have an inconsistent * @throws IllegalArgumentException if the given buffers have an inconsistent
* {@linkplain Buffer#order() byte order}. * {@linkplain Buffer#order() byte order}.
* @throws IllegalStateException if one of the sends have already been received. The remaining buffers and sends * @throws IllegalStateException if one of the sends have already been received. The remaining buffers and sends
* will be closed and descarded, respectively. * will be closed and discarded, respectively.
*/ */
@SafeVarargs @SafeVarargs
public static CompositeBuffer compose(BufferAllocator allocator, Send<Buffer>... sends) { public static CompositeBuffer compose(BufferAllocator allocator, Send<Buffer>... sends) {
@ -321,7 +321,7 @@ public final class CompositeBuffer extends ResourceSupport<Buffer, CompositeBuff
if (cap > MAX_CAPACITY) { if (cap > MAX_CAPACITY) {
throw new IllegalArgumentException( throw new IllegalArgumentException(
"Combined size of the constituent buffers is too big. " + "Combined size of the constituent buffers is too big. " +
"The maximum buffer capacity is " + MAX_CAPACITY + " (Interger.MAX_VALUE - 8), " + "The maximum buffer capacity is " + MAX_CAPACITY + " (Integer.MAX_VALUE - 8), " +
"but the sum of the constituent buffer capacities was " + cap + '.'); "but the sum of the constituent buffer capacities was " + cap + '.');
} }
capacity = (int) cap; capacity = (int) cap;

View File

@ -52,7 +52,7 @@ class NioBuffer extends ResourceSupport<Buffer, NioBuffer> implements Buffer, Re
private boolean constBuffer; private boolean constBuffer;
NioBuffer(ByteBuffer base, ByteBuffer memory, AllocatorControl control, Drop<NioBuffer> drop) { NioBuffer(ByteBuffer base, ByteBuffer memory, AllocatorControl control, Drop<NioBuffer> drop) {
super(new MakeInaccisbleOnDrop(ArcDrop.wrap(drop))); super(new MakeInaccessibleOnDrop(ArcDrop.wrap(drop)));
this.base = base; this.base = base;
rmem = memory; rmem = memory;
wmem = memory; wmem = memory;
@ -63,7 +63,7 @@ class NioBuffer extends ResourceSupport<Buffer, NioBuffer> implements Buffer, Re
* Constructor for {@linkplain BufferAllocator#constBufferSupplier(byte[]) const buffers}. * Constructor for {@linkplain BufferAllocator#constBufferSupplier(byte[]) const buffers}.
*/ */
NioBuffer(NioBuffer parent) { NioBuffer(NioBuffer parent) {
super(new MakeInaccisbleOnDrop(new ArcDrop<>(ArcDrop.acquire(parent.unsafeGetDrop())))); super(new MakeInaccessibleOnDrop(new ArcDrop<>(ArcDrop.acquire(parent.unsafeGetDrop()))));
control = parent.control; control = parent.control;
base = parent.base; base = parent.base;
rmem = bbslice(parent.rmem, 0, parent.rmem.capacity()); // Need to slice to get independent byte orders. rmem = bbslice(parent.rmem, 0, parent.rmem.capacity()); // Need to slice to get independent byte orders.
@ -75,10 +75,10 @@ class NioBuffer extends ResourceSupport<Buffer, NioBuffer> implements Buffer, Re
constBuffer = true; constBuffer = true;
} }
private static final class MakeInaccisbleOnDrop implements Drop<NioBuffer> { private static final class MakeInaccessibleOnDrop implements Drop<NioBuffer> {
final Drop<NioBuffer> delegate; final Drop<NioBuffer> delegate;
private MakeInaccisbleOnDrop(Drop<NioBuffer> delegate) { private MakeInaccessibleOnDrop(Drop<NioBuffer> delegate) {
this.delegate = delegate; this.delegate = delegate;
} }
@ -98,19 +98,19 @@ class NioBuffer extends ResourceSupport<Buffer, NioBuffer> implements Buffer, Re
@Override @Override
public String toString() { public String toString() {
return "MemSegDrop(" + delegate + ')'; return "MakeInaccessibleOnDrop(" + delegate + ')';
} }
} }
@Override @Override
protected Drop<NioBuffer> unsafeGetDrop() { protected Drop<NioBuffer> unsafeGetDrop() {
MakeInaccisbleOnDrop drop = (MakeInaccisbleOnDrop) super.unsafeGetDrop(); MakeInaccessibleOnDrop drop = (MakeInaccessibleOnDrop) super.unsafeGetDrop();
return drop.delegate; return drop.delegate;
} }
@Override @Override
protected void unsafeSetDrop(Drop<NioBuffer> replacement) { protected void unsafeSetDrop(Drop<NioBuffer> replacement) {
super.unsafeSetDrop(new MakeInaccisbleOnDrop(replacement)); super.unsafeSetDrop(new MakeInaccessibleOnDrop(replacement));
} }
@Override @Override

View File

@ -163,7 +163,7 @@ public abstract class LifecycleTracer {
public <E extends Throwable> void attach(E throwable, long timestamp) { public <E extends Throwable> void attach(E throwable, long timestamp) {
Trace recv = received; Trace recv = received;
String message = sent && recv == null? name + " (sent but not received)" : name; String message = sent && recv == null ? name + " (sent but not received)" : name;
message += " (current acquires = " + acquires + ") T" + (this.timestamp - timestamp) / 1000 + "µs."; message += " (current acquires = " + acquires + ") T" + (this.timestamp - timestamp) / 1000 + "µs.";
Traceback exception = new Traceback(message); Traceback exception = new Traceback(message);
StackTraceElement[] stackTrace = new StackTraceElement[frames.length]; StackTraceElement[] stackTrace = new StackTraceElement[frames.length];

View File

@ -59,7 +59,7 @@ class UnsafeBuffer extends ResourceSupport<Buffer, UnsafeBuffer> implements Buff
UnsafeBuffer(UnsafeMemory memory, long offset, int size, AllocatorControl allocatorControl, UnsafeBuffer(UnsafeMemory memory, long offset, int size, AllocatorControl allocatorControl,
Drop<UnsafeBuffer> drop) { Drop<UnsafeBuffer> drop) {
super(new MakeInaccisbleOnDrop(ArcDrop.wrap(drop))); super(new MakeInaccessibleOnDrop(ArcDrop.wrap(drop)));
this.memory = memory; this.memory = memory;
base = memory.base; base = memory.base;
baseOffset = offset; baseOffset = offset;
@ -71,7 +71,7 @@ class UnsafeBuffer extends ResourceSupport<Buffer, UnsafeBuffer> implements Buff
} }
UnsafeBuffer(UnsafeBuffer parent) { UnsafeBuffer(UnsafeBuffer parent) {
super(new MakeInaccisbleOnDrop(new ArcDrop<>(ArcDrop.acquire(parent.unsafeGetDrop())))); super(new MakeInaccessibleOnDrop(new ArcDrop<>(ArcDrop.acquire(parent.unsafeGetDrop()))));
control = parent.control; control = parent.control;
memory = parent.memory; memory = parent.memory;
base = parent.base; base = parent.base;
@ -1254,19 +1254,19 @@ class UnsafeBuffer extends ResourceSupport<Buffer, UnsafeBuffer> implements Buff
@Override @Override
protected Drop<UnsafeBuffer> unsafeGetDrop() { protected Drop<UnsafeBuffer> unsafeGetDrop() {
MakeInaccisbleOnDrop drop = (MakeInaccisbleOnDrop) super.unsafeGetDrop(); MakeInaccessibleOnDrop drop = (MakeInaccessibleOnDrop) super.unsafeGetDrop();
return drop.delegate; return drop.delegate;
} }
@Override @Override
protected void unsafeSetDrop(Drop<UnsafeBuffer> replacement) { protected void unsafeSetDrop(Drop<UnsafeBuffer> replacement) {
super.unsafeSetDrop(new MakeInaccisbleOnDrop(replacement)); super.unsafeSetDrop(new MakeInaccessibleOnDrop(replacement));
} }
private static final class MakeInaccisbleOnDrop implements Drop<UnsafeBuffer> { private static final class MakeInaccessibleOnDrop implements Drop<UnsafeBuffer> {
final Drop<UnsafeBuffer> delegate; final Drop<UnsafeBuffer> delegate;
private MakeInaccisbleOnDrop(Drop<UnsafeBuffer> delegate) { private MakeInaccessibleOnDrop(Drop<UnsafeBuffer> delegate) {
this.delegate = delegate; this.delegate = delegate;
} }
@ -1286,7 +1286,7 @@ class UnsafeBuffer extends ResourceSupport<Buffer, UnsafeBuffer> implements Buff
@Override @Override
public String toString() { public String toString() {
return "UnsafeDrop(" + delegate + ')'; return "MakeInaccessibleOnDrop(" + delegate + ')';
} }
} }

View File

@ -550,7 +550,7 @@ public class BufferCompositionTest extends BufferTestSupport {
} }
@Test @Test
public void splitComponentsCeilMustGiveBufferWithFirstComponenForOffsetInFirstComponent() { public void splitComponentsCeilMustGiveBufferWithFirstComponentForOffsetInFirstComponent() {
try (BufferAllocator allocator = BufferAllocator.heap(); try (BufferAllocator allocator = BufferAllocator.heap();
CompositeBuffer composite = CompositeBuffer.compose(allocator, CompositeBuffer composite = CompositeBuffer.compose(allocator,
allocator.allocate(8).send(), allocator.allocate(8).send(),

View File

@ -1194,7 +1194,7 @@ public class BufferPrimitiveRelativeAccessorsTest extends BufferTestSupport {
@ParameterizedTest @ParameterizedTest
@MethodSource("allocators") @MethodSource("allocators")
void relativeReadOfDoubleReadOnllyMustBoundsCheckWhenReadOffsetAndSizeIsBeyondWriteOffset(Fixture fixture) { void relativeReadOfDoubleReadOnlyMustBoundsCheckWhenReadOffsetAndSizeIsBeyondWriteOffset(Fixture fixture) {
try (BufferAllocator allocator = fixture.createAllocator(); try (BufferAllocator allocator = fixture.createAllocator();
Buffer buf = allocator.allocate(8)) { Buffer buf = allocator.allocate(8)) {
assertEquals(0, buf.readableBytes()); assertEquals(0, buf.readableBytes());

View File

@ -2119,7 +2119,7 @@ public abstract class AbstractByteBufTest {
public void testSWARIndexOf() { public void testSWARIndexOf() {
ByteBuf buffer = newBuffer(16); ByteBuf buffer = newBuffer(16);
buffer.clear(); buffer.clear();
// Ensure the buffer is completely zero'ed. // Ensure the buffer is completely zeroed.
buffer.setZero(0, buffer.capacity()); buffer.setZero(0, buffer.capacity());
buffer.writeByte((byte) 0); // 0 buffer.writeByte((byte) 0); // 0
buffer.writeByte((byte) 0); buffer.writeByte((byte) 0);
@ -2148,7 +2148,7 @@ public abstract class AbstractByteBufTest {
@Test @Test
public void testIndexOf() { public void testIndexOf() {
buffer.clear(); buffer.clear();
// Ensure the buffer is completely zero'ed. // Ensure the buffer is completely zeroed.
buffer.setZero(0, buffer.capacity()); buffer.setZero(0, buffer.capacity());
buffer.writeByte((byte) 1); buffer.writeByte((byte) 1);