diff --git a/src/main/java/net/openhft/chronicle/hash/serialization/impl/DefaultElasticBytes.java b/src/main/java/net/openhft/chronicle/hash/serialization/impl/DefaultElasticBytes.java index 8c4ef2371..b6d8e5ba8 100644 --- a/src/main/java/net/openhft/chronicle/hash/serialization/impl/DefaultElasticBytes.java +++ b/src/main/java/net/openhft/chronicle/hash/serialization/impl/DefaultElasticBytes.java @@ -26,7 +26,7 @@ final class DefaultElasticBytes { } static Bytes allocateDefaultElasticBytes(long bytesCapacity) { - if (bytesCapacity <= Bytes.MAX_BYTE_BUFFER_CAPACITY) { + if (bytesCapacity <= 0x7FFFFFF0) { return Bytes.elasticHeapByteBuffer((int) bytesCapacity); } else { return Bytes.allocateElasticDirect(bytesCapacity); diff --git a/src/main/java/net/openhft/chronicle/hash/serialization/impl/ValueDataAccess.java b/src/main/java/net/openhft/chronicle/hash/serialization/impl/ValueDataAccess.java index 279dee0d5..bea18bde5 100644 --- a/src/main/java/net/openhft/chronicle/hash/serialization/impl/ValueDataAccess.java +++ b/src/main/java/net/openhft/chronicle/hash/serialization/impl/ValueDataAccess.java @@ -16,7 +16,9 @@ package net.openhft.chronicle.hash.serialization.impl; -import net.openhft.chronicle.bytes.*; +import net.openhft.chronicle.bytes.Byteable; +import net.openhft.chronicle.bytes.BytesStore; +import net.openhft.chronicle.bytes.RandomDataInput; import net.openhft.chronicle.core.Maths; import net.openhft.chronicle.hash.AbstractData; import net.openhft.chronicle.hash.Data; @@ -78,8 +80,8 @@ public class ValueDataAccess extends AbstractData implements DataAccess private BytesStore allocateBytesStoreForInstance() { long instanceSize = nativeInstance.maxSize(); - if (instanceSize > Bytes.MAX_BYTE_BUFFER_CAPACITY) { - return NativeBytesStore.nativeStoreWithFixedCapacity(instanceSize); + if (instanceSize > 0x7FFFFFF0) { + return BytesStore.nativeStoreWithFixedCapacity(instanceSize); } else { return BytesStore.wrap(ByteBuffer.allocate(Maths.toUInt31(instanceSize))); } @@ -144,12 +146,12 @@ public class ValueDataAccess extends AbstractData implements DataAccess @Override public void readMarshallable(@NotNull WireIn wireIn) { - valueType = wireIn.read(() -> "valueType").typeLiteral(); + valueType = wireIn.read("valueType").typeLiteral(); initTransients(); } @Override public void writeMarshallable(@NotNull WireOut wireOut) { - wireOut.write(() -> "valueType").typeLiteral(valueType); + wireOut.write("valueType").typeLiteral(valueType); } } diff --git a/src/main/java/net/openhft/chronicle/map/impl/NullReturnValue.java b/src/main/java/net/openhft/chronicle/map/impl/NullReturnValue.java index 8c34f19b0..fe651b004 100644 --- a/src/main/java/net/openhft/chronicle/map/impl/NullReturnValue.java +++ b/src/main/java/net/openhft/chronicle/map/impl/NullReturnValue.java @@ -20,23 +20,25 @@ import net.openhft.chronicle.hash.Data; import net.openhft.chronicle.map.impl.ret.InstanceReturnValue; import org.jetbrains.annotations.NotNull; -public final class NullReturnValue implements InstanceReturnValue { - private static final NullReturnValue NULL_RETURN_VALUE = new NullReturnValue(); +public final class NullReturnValue implements InstanceReturnValue { + + private static final NullReturnValue NULL_RETURN_VALUE = new NullReturnValue<>(); private NullReturnValue() { } + @SuppressWarnings("unchecked") public static InstanceReturnValue get() { - return NULL_RETURN_VALUE; + return (InstanceReturnValue) NULL_RETURN_VALUE; } @Override - public Object returnValue() { + public V returnValue() { return null; } @Override - public void returnValue(@NotNull Data value) { + public void returnValue(@NotNull Data value) { // ignore } }