Configurate v4.0.0 Release Notes

Release Date: 2020-11-14 // over 3 years ago
  • ๐Ÿš€ Welcome to a new major release of Configurate! We've taken the time to review a lot of longstanding pain points, so there are a variety of breaking changes in this release. Some of the behaviour changes can be subtle, so please read the changelog carefully.

    ๐Ÿš€ To ease upgrading for IntelliJ users, a migration XML file has been attached to this release. This can be imported as IDE settings, or placed in your $INTELLIJ_HOME/migration folder (in %APPDATA%/Roaming/JetBrains on Windows).

    ๐Ÿ†• New features

    • โž• Added TypeSerializers for Path and File
    • โž• Added new registerExact method to TypeSerializerCollection.Builder to register serializers for only a single type and not its subtypes.
    • โž• Added Java 14+ record support and many other features to the object mapper (see below for more details).
    • โž• Added new submodules to integrate with Mojang's DataFixerUpper library (versions 2-4), with a DynamicOps implementation, DataFix-using transformations, and conversions between Codecs and TypeSerializers.
    • ๐Ÿ‘‰ Make more extensive use of a unified NodePath across the whole API, for operations like resolving nodes and specifying transformation paths.
    • ๐Ÿ“‡ Redesigned the exception structure of the project, so all configuration operations throw exceptions that extend from ConfigurateException, which provide more machine-readable metadata. ConfigurateException extends IOException, so existing error handling may not break.
    • โž• Add new NodeFactory interface to provide a common view for creating configuration nodes.
    • ๐Ÿ‘ Limited support for reading YAML files indented with tabs.
    • โž• Added a new "representation hints" system for attaching arbitrary metadata to nodes.
    • โž• Added support for "implicit initialization" in TypeSerializers. This will, for collection types, resolve null node values as empty collections. Implicit initialization is enabled by default.

    ๐Ÿ’ฅ Breaking changes

    • ๐Ÿ“ฆ Moved from ninja.leaping to org.spongepowered package.
    • ๐Ÿ“ฆ Moved type serializers from objectmapping.serialize to serialize package.
    • ๐Ÿ“ฆ Made node implementation classes package-private, and moved the attributed and commented node subtypes out of their own packages.
    • โฌ‡๏ธ Dropped the get and set prefixes from method names across the API.
    • No longer depends on the Guava library. This has resulted in a lot of code that formerly used the Guava TypeToken moving to use either java.lang.reflect.Type or the GeAnTyRef TypeToken.
    • ๐Ÿ”ง Renamed configurate-json implementation to configurate-jackson.
    • ๐Ÿ”ง Renamed configurate-ext-kotlin to configurate-extra-kotlin.
    • ๐Ÿ”ง Moved Guice support out of core into configurate-extra-guice.
    • ๐Ÿ”ง When loading a configuration file, empty lists and maps are represented as such in nodes in all loaders. In the past, some loaders have provided null values instead.
    • ๐Ÿš€ YamlConfigurationLoader now returns CommentedConfigurationNode instances, in preparation for full comment support coming in a future release.
    • ๐Ÿ”ง In the YAML and HOCON loaders, the underlying libraries used are now to be treated as an implementation detail. All API that directly referenced them has been replaced with equivalents that use Configurate types.
    • ๐Ÿ”ง The default ConfigurationOptions values for shouldCopyDefaults has been set to true.
    • ๐Ÿšš The deprecated node walker has been removed.

    Object Mapper

    The object mapper has changed quite a bit, so most users will need to change their use in some way.

    • ๐Ÿ”จ Refactored TypeSerializerCollection to be immutable. A new child collection must be created to add custom type serializers.
    • ๐Ÿ— Redesigned the object mapper to be more extensible. Rather than subclassing the object mapper as some people did before, there are now defined extension points where additional annotations and behaviours can be registered. See the methods in ObjectMapper.Factory.Builder for a more thorough overview.
    • โž• Added support for Java 14+ records and, in combination with the configurate-extra-kotlin module, Kotlin data classes.
      The @Setting annotation is now optional. By default, all non-transient fields will be included in objects, and names will be converted to the kebab-case naming scheme. Both of these can be customized with a custom ObjectMapper.Factory
    • 0๏ธโƒฃ The shouldCopyDefaults option is now respected for mapped object fields.
    • ๐Ÿ— The ObjectMapperFactory field has been removed from ConfigurationOptions. Instead, the object mapper can be registered like any other type serializer, using the TypeSerializerCollection.Builder#registerAnnotatedObjects method.

    ๐Ÿ› Bugs fixed

    • ๐Ÿšš Create the parent directory of files being written, to remove a common 'gotcha'.
    • Try to group together events in the watch service listener, to reduce duplicate reloads.
    • ๐Ÿ›  Fix merging values into a virtual node not correctly attaching the node (#181)

Previous changes from v3.7.2

  • ๐Ÿ›  This is a bugfix release for the Configurate 3.7 series, coming with a few minor fixes:

    • ๐Ÿ”ง Work around null values appearing when visiting configuration nodes
    • Be more defensive when potentially returning null lists

    Compiled jars are available from Maven Central