Fix @NotNull annotations

This commit is contained in:
Peter Lawrey
2020-09-25 13:32:02 +01:00
parent 90bd3c527a
commit 87f7820407
28 changed files with 61 additions and 17 deletions
@@ -56,6 +56,7 @@ public interface HashSplitting extends Marshallable {
return hash;
}
@NotNull
@Override
public ForSingleSegment readResolve() {
return INSTANCE;
@@ -59,6 +59,7 @@ public final class BooleanMarshaller
out.writeByte((byte) (toWrite ? 'Y' : 0));
}
@NotNull
@Override
public BooleanMarshaller readResolve() {
return INSTANCE;
@@ -44,6 +44,7 @@ public final class ByteArraySizedReader
return using;
}
@NotNull
@Override
public ByteArraySizedReader readResolve() {
return INSTANCE;
@@ -48,6 +48,7 @@ public final class ByteBufferSizedReader
return using;
}
@NotNull
@Override
public ByteBufferSizedReader readResolve() {
return INSTANCE;
@@ -60,6 +60,7 @@ public final class CharSequenceBytesReader implements BytesReader<CharSequence>,
return INSTANCE;
}
@NotNull
@Override
public CharSequenceBytesReader readResolve() {
return INSTANCE;
@@ -44,6 +44,7 @@ public final class CharSequenceBytesWriter
out.writeUtf8(toWrite);
}
@NotNull
@Override
public CharSequenceBytesWriter readResolve() {
return INSTANCE;
@@ -73,6 +73,7 @@ public class CharSequenceSizedReader implements SizedReader<CharSequence>,
// no fields to write
}
@NotNull
@Override
public CharSequenceSizedReader readResolve() {
return INSTANCE;
@@ -46,6 +46,7 @@ public final class CharSequenceSizedWriter
BytesUtil.appendUtf8(out, toWrite);
}
@NotNull
@Override
public CharSequenceSizedWriter readResolve() {
return INSTANCE;
@@ -61,6 +61,7 @@ public final class DoubleMarshaller
out.writeDouble(toWrite);
}
@NotNull
@Override
public DoubleMarshaller readResolve() {
return INSTANCE;
@@ -61,6 +61,7 @@ public final class IntegerMarshaller
out.writeInt(toWrite);
}
@NotNull
@Override
public IntegerMarshaller readResolve() {
return INSTANCE;
@@ -61,6 +61,7 @@ public final class LongMarshaller
out.writeLong(toWrite);
}
@NotNull
@Override
public LongMarshaller readResolve() {
return INSTANCE;
@@ -19,6 +19,7 @@ package net.openhft.chronicle.hash.serialization.impl;
import net.openhft.chronicle.bytes.Bytes;
import net.openhft.chronicle.bytes.BytesUtil;
import net.openhft.chronicle.hash.serialization.SizeMarshaller;
import org.jetbrains.annotations.NotNull;
import static java.lang.Math.max;
import static java.lang.Math.min;
@@ -78,6 +79,7 @@ public final class StopBitSizeMarshaller
return BytesUtil.readStopBit(in);
}
@NotNull
@Override
public StopBitSizeMarshaller readResolve() {
return INSTANCE;
@@ -45,6 +45,7 @@ public final class StringBuilderSizedReader
return using;
}
@NotNull
@Override
public StringBuilderSizedReader readResolve() {
return INSTANCE;
@@ -90,6 +90,7 @@ interface AbstractChronicleMap<K, V> extends ChronicleMap<K, V> {
default Collection<V> values() {
// todo cache view object
return new AbstractCollection<V>() {
@NotNull
@Override
public Iterator<V> iterator() {
return new Iterator<V>() {
@@ -144,6 +145,7 @@ interface AbstractChronicleMap<K, V> extends ChronicleMap<K, V> {
default Set<K> keySet() {
// todo cache view object
return new AbstractSet<K>() {
@NotNull
@Override
public Iterator<K> iterator() {
return new ChronicleMapIterator.OfKeys<>(AbstractChronicleMap.this);
@@ -194,7 +194,7 @@ public class ReplicatedChronicleMap<K, V, R> extends VanillaChronicleMap<K, V, R
}
@Override
void initTransientsFromBuilder(ChronicleMapBuilder<K, V> builder) {
void initTransientsFromBuilder(@NotNull ChronicleMapBuilder<K, V> builder) {
super.initTransientsFromBuilder(builder);
this.localIdentifier = builder.replicationIdentifier;
//noinspection unchecked
@@ -16,6 +16,8 @@
package net.openhft.chronicle.map;
import org.jetbrains.annotations.NotNull;
import java.nio.channels.SelectionKey;
import java.util.AbstractSet;
import java.util.Iterator;
@@ -103,6 +105,7 @@ final class SelectedSelectionKeySet extends AbstractSet<SelectionKey> {
return false;
}
@NotNull
@Override
public Iterator<SelectionKey> iterator() {
throw new UnsupportedOperationException();
@@ -22,14 +22,12 @@ import net.openhft.chronicle.bytes.Bytes;
import net.openhft.chronicle.bytes.BytesStore;
import net.openhft.chronicle.bytes.PointerBytesStore;
import net.openhft.chronicle.core.Jvm;
import net.openhft.chronicle.hash.Beta;
import net.openhft.chronicle.hash.ChronicleHashClosedException;
import net.openhft.chronicle.hash.ChronicleHashCorruption;
import net.openhft.chronicle.hash.Data;
import net.openhft.chronicle.hash.impl.*;
import net.openhft.chronicle.hash.impl.stage.entry.LocksInterface;
import net.openhft.chronicle.hash.impl.stage.hash.ChainingInterface;
import net.openhft.chronicle.hash.impl.util.Objects;
import net.openhft.chronicle.hash.impl.util.Throwables;
import net.openhft.chronicle.hash.serialization.DataAccess;
import net.openhft.chronicle.hash.serialization.SizeMarshaller;
@@ -347,6 +345,7 @@ public class VanillaChronicleMap<K, V, R>
return name;
}
@NotNull
@Override
public String toIdentityString() {
throwExceptionIfClosed();
@@ -20,6 +20,7 @@ import net.openhft.chronicle.bytes.BytesStore;
import net.openhft.chronicle.bytes.RandomDataInput;
import net.openhft.chronicle.core.OS;
import net.openhft.chronicle.core.io.ReferenceOwner;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import java.nio.BufferOverflowException;
@@ -183,66 +184,79 @@ public enum ZeroBytesStore implements BytesStore<ZeroBytesStore, Void> {
return 0;
}
@NotNull
@Override
public ZeroBytesStore writeByte(long l, byte b) {
throw new UnsupportedOperationException();
}
@NotNull
@Override
public ZeroBytesStore writeShort(long l, short i) {
throw new UnsupportedOperationException();
}
@NotNull
@Override
public ZeroBytesStore writeInt(long l, int i) {
throw new UnsupportedOperationException();
}
@NotNull
@Override
public ZeroBytesStore writeOrderedInt(long l, int i) {
throw new UnsupportedOperationException();
}
@NotNull
@Override
public ZeroBytesStore writeLong(long l, long l1) {
throw new UnsupportedOperationException();
}
@NotNull
@Override
public ZeroBytesStore writeOrderedLong(long l, long l1) {
throw new UnsupportedOperationException();
}
@NotNull
@Override
public ZeroBytesStore writeFloat(long l, float v) {
throw new UnsupportedOperationException();
}
@NotNull
@Override
public ZeroBytesStore writeDouble(long l, double v) {
throw new UnsupportedOperationException();
}
@NotNull
@Override
public ZeroBytesStore writeVolatileByte(long l, byte b) {
throw new UnsupportedOperationException();
}
@NotNull
@Override
public ZeroBytesStore writeVolatileShort(long l, short i) {
throw new UnsupportedOperationException();
}
@NotNull
@Override
public ZeroBytesStore writeVolatileInt(long l, int i) {
throw new UnsupportedOperationException();
}
@NotNull
@Override
public ZeroBytesStore writeVolatileLong(long l, long l1) {
throw new UnsupportedOperationException();
}
@NotNull
@Override
public ZeroBytesStore write(long l, byte[] bytes, int i, int i1) {
throw new UnsupportedOperationException();
@@ -253,6 +267,7 @@ public enum ZeroBytesStore implements BytesStore<ZeroBytesStore, Void> {
throw new UnsupportedOperationException();
}
@NotNull
@Override
public ZeroBytesStore write(long l, RandomDataInput randomDataInput, long l1, long l2) {
throw new UnsupportedOperationException();
@@ -52,6 +52,7 @@ final class DummyValueMarshaller implements DataAccess<DummyValue>, SizedReader<
return DummyValue.DUMMY_VALUE;
}
@NotNull
@Override
public DummyValueMarshaller readResolve() {
return INSTANCE;
@@ -86,10 +86,11 @@ class SetFromMap<E> extends AbstractSet<E> implements ChronicleSet<E> {
return m.putIfAbsent(e, DUMMY_VALUE) == null;
}
@NotNull
public Iterator<E> iterator() {
throwExceptionIfClosed();
return s.iterator();
return s.iterator();
}
public Object[] toArray() {
@@ -106,11 +107,12 @@ class SetFromMap<E> extends AbstractSet<E> implements ChronicleSet<E> {
return s.toString();
}
@NotNull
@Override
public String toIdentityString() {
throwExceptionIfClosed();
return "ChronicleSet{" +
return "ChronicleSet{" +
"name=" + name() +
", file=" + file() +
", identityHashCode=" + System.identityHashCode(this) +
@@ -129,22 +131,22 @@ class SetFromMap<E> extends AbstractSet<E> implements ChronicleSet<E> {
return o == this || s.equals(o);
}
public boolean containsAll(Collection<?> c) {
public boolean containsAll(@NotNull Collection<?> c) {
throwExceptionIfClosed();
return s.containsAll(c);
return s.containsAll(c);
}
public boolean removeAll(Collection<?> c) {
public boolean removeAll(@NotNull Collection<?> c) {
throwExceptionIfClosed();
return s.removeAll(c);
return s.removeAll(c);
}
public boolean retainAll(Collection<?> c) {
public boolean retainAll(@NotNull Collection<?> c) {
throwExceptionIfClosed();
return s.retainAll(c);
return s.retainAll(c);
}
// addAll is the only inherited implementation