Release 4.10.0
This update contains BREAKING CHANGES to how @Default<type> annotations are handled internally! This does not affect the annotations themselves or their usages, but it does affect anyone who previously relied on DefaultValue, DefaultDecoder, DefaultCoder, or MultiFieldEncoder.FieldStrategy.
More specifically, DefaultValue now handles all the encoding and decoding logic, and DefaultDecoder simply delegates to it. A new class, DefaultEncoder, also delegates to it. DefaultCoder has been REMOVED. The type hierarchy of DefaultValue was expanded to support the new @DefaultObject annotation, and was split into PrimitiveDefaultValue and ObjectDefaultValue. Several methods that applied to primitives did not apply to objects, and were REMOVED from DefaultValue. DefaultValue.forType() still exists, but takes additional arguments now. MultiFieldEncoder.FieldStrategy also no longer contains a defaultValue field, and will check for emptyness of the encoded value instead.
Other changes:
- Removed the
@Nullableannotation fromAutoCodec.decode()andDecodeContext.decodeWith(), since if you have anAutoDecoder<@NotNull T>, then it makes no sense for it to return a null value when decoding.@Nullabledoes however remain onAutoDecoder.decode(). - Added the
@Aliasannotation, to allow a decoded field to match more than one encoded field. - AutoCodec (the library, not the class) is now backwards-compatible with old versions of DFU where
DataResult.error()took aStringinstead of aSupplier<String>. - Deprecated exception constructors which take a
Stringwhen another constructor which taks aSupplier<String>also exists. these deprecated constructors aren't going anywhere, they're just deprecated to issue a compile-time warning that you might have used a different constructor than you intended to. - Added
KeyDispatchCoderandLookupCoder, for anyone who wants those. - Added better logging to factories which query fields or methods in the decoded type, however this logging will only be visible if the
MemberCollectorthrows an exception and triggers error logging OR if the logger just prints everything.