I recently moved to JDK 17 from JDK 11 which triggered an update to the Chronicle Wire library. We used to use version 2.17.50 with JDK 11 and now we have moved to chronicle-wire version 2.22.17 and chronicle-bytes version 2.22.21.
Following code used to work fine with JDK 11 but not with JDK 17. It seems the release
method is deprecated.
public static Object deserializeFromBinary(final byte[] rawBytes, final Class<?> classVal, final String bookmark)
{
Bytes<?> bytesDeserialize = Bytes.allocateDirect(rawBytes);
Wire wire = new BinaryWire(bytesDeserialize);
try {
return wire.read(() -> bookmark).object(classVal);
} finally {
bytesDeserialize.release();
}
}
How can we release native bytes now? Anyone has come across the same situation?