Kryo Changelog

What's new in Kryo 5.6.0

Jan 8, 2024
  • Avoid creating GenericsHierarchy when generics optimization is disabled
  • BigDecimal serializer memory and throughput optimizations (thanks @gdela)
  • Avoid allocation in BigDecimal serializer with new methods for bytes in Input/Output (thanks @gdela)

New in Kryo 5.5.0 (Apr 20, 2023)

  • #944 Avoid slow Class.forName when serializing lambdas
  • #946 Make the ImmutableCollections serializers public and final
  • #948 Ensure that record constructors are always accessible
  • #951 Fix serialization of Kotlin lambdas
  • #955 Fix type resolution for generic arrays
  • #956 Performance improvements for Kryo.isClosure()

New in Kryo 5.4.0 (Dec 30, 2022)

  • This is a maintenance release coming with bug fixes and performance improvements.
  • The most notable change is performance improvements for record serialization (#927) by caching access to components, getters and constructors. The new implementation is roughly 20x faster.
  • Several PRs improve Kryo's compatibility with JDK 17+ (#930, #932, #933).
  • #923 Add helper method to register serializers for java.util.ImmutableCollections (#933)
  • #885 Delay access to constructor and methods for DirectBuffers until first use (#932)
  • #885 Add additional safe serializers for commonly used JDK classes (#930)
  • #884 Cache components, getters and constructors in RecordSerializer (#927)
  • #922 Fall back to default class resolution if class cannot be loaded with provided class loader (#926)
  • #920 Align ByteBufferOutput.writeAscii with implementation in Output (#921)
  • #889 Serializer for java.sql.Timestamp which preserves nanoseconds (#890)
  • #884 Fix eclipse project setup: Add JUnit 5, ByteBuddy (#887)
  • Other Tasks:
  • Improve tests for JDK 17 (#886)
  • Upgrade GitHub actions (#925)
  • Upgrade Objenesis to 3.3

New in Kryo 5.3.0 (Feb 11, 2022)

  • This is a maintenance release coming with bug fixes and performance improvements:
  • #872 Custom exception for buffer over/underflow (#874)
  • #873 Set record component getter (#875)
  • #845 Performance improvements for maps (#876)
  • #845 Use IdentityMap instead of CuckooObjectMap in class resolver (#877)
  • #882 Catch LinkageError in addition to RTE when accessing fields via ASM (#883)

New in Kryo 5.2.1 (Dec 11, 2021)

  • This is a maintenance release coming with bug fixes and improvements:
  • Support skipping input chunks after a buffer underflow (#850)
  • Ensure empty PriorityQueue can be deserialized (#866)
  • Shade contents of source jar for versioned artifact

New in Kryo 5.2.0 (Jul 31, 2021)

  • This is a maintenance release coming with bug fixes and improvements:
  • Fall back to getDeclaredConstructor for non-public records
  • Fix #847 Ensure that RecordSerializer can deal with subtypes
  • Fix #840 Ensure primitive types are assignable to Comparable/Serializables fields
  • Fix #838 Avoid flush repeatedly when has finished flushing
  • OSS-Fuzz Integration

New in Kryo 5.1.1 (May 3, 2021)

  • In Kryo 5.1.0, a direct dependency on the unversioned JAR accidentally made it into the POM for the versioned artifact (see #825). If you are using the versioned artifact, upgrading to 5.1.1 is recommended.
  • 822: Fix #821 Support closures when validating types in CompatibleFieldSerializer
  • 824: Fix #823 Fix ArrayIndexOutOfBoundsException in binary search logic
  • 825: Remove direct dependency from versioned artifact

New in Kryo 5.1.0 (Apr 8, 2021)

  • Fix:
  • Support for java.util.Record
  • Bump Objenesis to 3.2
  • OSGI support for versioned artifact

New in Kryo 5.0.4 (Mar 13, 2021)

  • This is a maintenance release coming with a bugfix for Pool with soft references.
  • #805 : Fix #804 Prevent IllegalStateException: Queue full

New in Kryo 5.0.3 (Dec 15, 2020)

  • Fix:
  • Use equals to compare type variables.

New in Kryo 5.0.2 (Dec 4, 2020)

  • This is a maintenance release coming with a bugfix for CompatibleFieldSerializer
  • Validate read types against field type instead of valueClass

New in Kryo 5.0.1 (Nov 22, 2020)

  • Fix #776 Automatic module name
  • Fix #774, #784 Do not re-use serializers for CompatibleFieldSerializer and TaggedFieldSerializer
  • Dependency Upgrades
  • Fix #778 Use canonical class name for registration hint if available
  • Fix #786 Ensure field serializers balance pushGenericType and popGenericType calls
  • Fix #789 Catch StackOverflowError and add hint for enabling references

New in Kryo 5.0.0 RC6 (May 17, 2020)

  • Add simplified test-cases
  • Do not attempt to push types if generics hierarchy is empty
  • Support resolving generic array types
  • Return first type if no matching type can be found on superclasses
  • Merge pull request #717 from theigl/generics-tests
  • Merge pull request #718 from theigl/generics-fixes
  • [maven-release-plugin] prepare release kryo-parent-5.0.0-RC6

New in Kryo 5.0.0 RC4 (Apr 15, 2019)

  • This is a hotfix release over RC3, just removing a forgotten println. For the rest see the release notes for RC3

New in Kryo 5.0.0 RC3 (Apr 9, 2019)

  • Compatibility of 5.0.0-RC3 to RC2:
  • Serialization compatible
  • Standard IO: Yes
  • Unsafe-based IO: Yes
  • Binary compatible - No (Details)
  • Source compatible - No (Details)

New in Kryo 5.0.0 RC2 (Feb 6, 2019)

  • Compatibility of 5.0.0-RC2 to RC1:
  • Serialization compatible
  • Standard IO: Yes
  • Unsafe-based IO: Yes
  • Binary compatible - Yes (Details)
  • Source compatible - Yes (Details)

New in Kryo 5.0.0 RC1 (Jun 19, 2018)

  • This is the first release candidate of the new major version of Kryo, which fixes many issues and makes many long awaited improvements.
  • Major changes:
  • Generics has been redone to support all scenarios. GenericsUtil thoroughly discovers the generic types that are known at compile time (tests), which avoids as much work as possible during serialization. The generic types known only at serialization time are tracked by Kryo's instance of Generics, which maintains a stack of GenericType instances (lots of nice javadocs in those classes).
  • How does using the new generics API look? For a simple example with just one type parameter, see CollectionSerializer. To get the class, call kryo.getGenerics().nextGenericClass() then after reading the child objects call kryo.getGenerics().popGenericType(). Simple!
  • nextGenericClass() is a shortcut for the common case of a class with a single type parameter. When there are multiple type parameters, like Map, use nextGenericTypes() instead, then call resolve() to get each class. Also, the last parameter is made current automatically (meaning it is pushed by Generics#nextGenericTypes()), so the other parameter(s) have to be pushed and popped manually. Somewhat less simple!
  • It's a little tricky, but these two patterns are all serializers need to worry about. It provides full support for nested generic types, eg HashMap<ArrayList<Integer>, ArrayList<String>>, which wasn't possible before.
  • Feedback on all this is welcome, but the core of it is relatively complex and may induce a headache (it certainly did when writing it!). The important bits are 1) to handle all generics scenarios, and 2) to minimize work at serialization time. Digging through just the calls for generics made from serializers, you'll find minimal work is done and without allocations. Given this, generics are always enabled.
  • Serializer method signatures have changed for issue #146 in this commit. All Serializer classes need to be changed from Class<T> to Class<? extends T>.
  • Various serialization improvements. Eg, TaggedFieldSerializer now has acceptsNull=true, which saves 1 byte for all non-null objects.
  • Unsafe had permeated the API. IMO it should be sandboxed as much as possible. I began refactoring by removing Unsafe support completely, made everything nice, then put back the input/output streams. I haven't yet looked into what serializers would need to make use of all of the Unsafe features. With Java 9 dropping Unsafe, maybe it is not worth the considerable effort to support it. FWIW, I personally don't use Unsafe but I know others do. I assume some even choosing Kryo specifically for Unsafe. I don't know how those people feel about Java 9.
  • I have not looked at Java 9 at all yet. I don't know if it provides APIs that Kryo can use to be more efficient.
  • FieldSerializer had gotten messy internally. It did a lot more work than necessary to build the cached fields. It did things with generics that were suspect and did expensive computations that were not even used. It had a lot of Unsafe logic.
  • Various API improvements. The Kryo class must not become a junk drawer for serializer settings. The SerializerFactory classes can be used, eg FieldSerializerFactory, which can create new, configured serializers (example). Having Input/Output varint and varlong be a hint was odd. If this ends up being needed again, maybe depending on what happens with Unsafe, it could be done in Input/Output subclasses without affecting the base class API. Javadocs are much improved.
  • Logging is improved. Some useless junk was logged, some important junk was not logged, and the formatting of log messages was not consistent.
  • Deserialization still temporarily modifies the input buffer. While in many cases this is fine, it can be quite an unexpected gotcha in some cases. I'd like to remedy this but string writing is important and any changes here need extensive benchmarks.

New in Kryo 4.0.2 (Mar 21, 2018)

  • This is a maintenance release coming with fixes and improvements.
  • #567: Use public member instead of private field to resolve immutability for serializer (bceef26)
  • Fix #558, #549: IdentityObjectIntMap.clear taking more time - Realloc instead of clearing large maps (77935c6)
  • Fix #539, #554: Fix crash when removing multiple fields with CompatibleFieldSerializer (56fb1a1)
  • #530: Fix #529 Support serializing the Enum class object (033d659)
  • Many thanks to all contributors!
  • Compatibility
  • Serialization compatible
  • Standard IO: Yes
  • Unsafe-based IO: Yes
  • Binary compatible - Yes (Details)
  • Source compatible - Yes (Details)

New in Kryo 4.0.1 (Mar 19, 2018)

  • #527: Add documentation on very large object graphs (67a3499)
  • #516: Use relatively safe max size of java array (389d33a)
  • #521: Use chunked encoding for TaggedFieldSerializer forward compatibility (fixes #442), replaces ignoreUnknownTags with skipUnknownTags, use chunked encoding (6dc6aa5)
  • Fix #500: Push java source/target version to 1.7 (c1ff83c)
  • Deprecate Util.isAndroid, superseded by the final Util.IS_ANDROID (64d7784)
  • #514: Fix warning on instantiate object on Android N+ - update Objenesis to the latest version 2.5.1 (4050fc9, 6040efd)
  • #520: Correctly deserialize objects when fields are added to a Class with enough fields to trigger binary search in CompatibleFieldSerializer (d31e2bf)
  • #518: error message for problems with anonymous classes (0eb7b71)
  • #509: Clarify default used registrations (75a41a6)
  • #441: Check for overlapping tags. (763ce88)
  • Fix #503: writeAscii_slow should be able to write at least one byte into the output buffer. (c3ed14c)
  • #486: Fix IdentityMap constructor (968c240)
  • #483: Override ObjectInputStream ClassLoader (19a6b5e)
  • #465: Fix growing ByteBufferOutput while writing varint (e721a44)
  • Fix #450: Update to the latest clirr-maven-plugin (6b8cb36)

New in Kryo 2.24 (May 5, 2014)

  • Fixed #213. Now CompatibleFieldSerializer should work properly with classes having generic type parameters. (1e9b23f)
  • Fixed #211. Integer overflows should be fixed now. (8d7d0b5)
  • Speed up the rebuildCachedFields method, which is very often used for generic types. (219d4a7)
  • Fix #198 by removing defaultStrategy for instantiators. (acf4dfe)
  • Fixed a generics-related bug reported in #207, hopefully without introducing a new one. (6ebf7bb)
  • Do not invoke updateBufferAddress from a default constructor, because a buffer is not set yet. (cef85c5)
  • Fixed IntMap. (2d398bc)
  • Fixed map iterator remove failing rarely. (b02a589)
  • Remove fields by reference, not name. (5d9917d)
  • ObjectMap updated to latest. (440a7a6)
  • Fixed #192 (90fd4c4)
  • Formatting, changed exception type. (2adc6ed)
  • Fix #189 Don't embed minlog Logger in jar (cfd0ff9)
  • Fix a condition for proper filtering of transient/non-transient fields. (81fda1d)
  • Add assembly execution so that the zip is uploaded during release:perform. (001a420)
  • Update assembly descriptor to include all jars (also the original-kryo*) (3371d4f)
  • Add plugin to build release zip (run mvn assembly:assembly ) (0594e5c)
  • ByteBufferInput/Output refactoring. (1c44a0e)
  • Fixed EOS being returned when 0 bytes should be read. (bd01d4b)
  • Changed registration of a different class with the same ID to a debug message. (7c8bc3b)
  • Update to reflectasm-1.09-shaded. (ac41721)
  • Fixed #180. Added support for field annotations. (c8b6367)
  • Pull Request #167: Add an externalizable serializer that uses ObjectInput and ObjectOutput adapters but has the ability to switch when fancy serialization stuff is tried. (4a93030)