Immutables v2.0 Release Notes

Release Date: 2015-03-24 // about 9 years ago
  • Many thanks to all contributors who helped to make it happen. Thanks to the community for making feature requests, bug reports, questions and suggestions.

    ๐Ÿ‘ Note versions 1.1.x are still supported, there's no rush to switch to 2.0 if you are not ready.

    • Thanks to @augustotravillio for implementing JDK-only code generation. Useful on Android or when Guava is not available.
    • Thanks to @ivysharev for a lot more precise imports post-processor.

    ๐Ÿ”‹ Features

    • ๐Ÿ‘Œ Support for java 8, including new Optional* classes, default methods. But type annotation support is rudimentary (works only in some cases). Java 7 is still required for compilation
    • ๐Ÿ‘ Multiset, Multimap, SetMultimap, ListMultimap are now supported.
    • ๐Ÿ‘ Full-featured Gson support with generated TypeAdapters which use no reflection during serialization/deserialization.
    • ๐Ÿ’… Builder now can be generated as "strict" (Style#strictBuilder). Strict builders prevents initialization errors: addition only collection initializer and regular initializers could be called only once.
    • ๐Ÿ‘ Now, there's no required dependencies, plain JDK will suffice. Guava still has first class support.
    • ๐Ÿ”Œ Processor now enjoy improved repackaging (using forked and patched maven-shade-plugin)
    • โž• Added @Builder.Switch annotation
    • Numerous API and behavior refinements, resulting in lot less WTF.

    ๐Ÿ”„ Changes

    • Main annotation and processor artifact changed to be org.immutables:value. There's no confusing value-standalone or whatsoever.
    • ๐Ÿšš common artifact was removed, all compile and runtime dependencies have been modularized. While annotation processor itself is pretty monolithic, now compile and optional runtime dependencies are externalized to dedicated artifacts. Some notable modules:
      • gson Gson support module
      • mongo MongoDB support module
      • builder Module with annotations for generating builder from static factory methods
      • ordinal Module to generate more exotic enum-like values and efficiently handle them, etc
    • ๐Ÿ‘€ JSON infrastructure underwent overhaul. See guide at http://immutables.org/json.html
    • JAX-RS support switched to Gson, for Jackson integration there's no need to integrate anything, its own provider will fully work.
    • ๐Ÿ‘€ MongoDB repository generation was refined and adjusted following JSON changes. See guide at http://immutables.org/mongo.html
    • ๐Ÿšš Temporarily removed JDBI integration. It may be resurrected later.
    • Direct inheritance of @Value.Immutable from another @Value.Immutable is discouraged.
    • Limited (and constrained to same level) inheritance of @Value.Parameter attributes.
    • ๐Ÿ— Builder now has method to set/reset collection content (in non-strict mode)
    • ๐Ÿ’… Package style now also applies to all classes in sub-packages unless overridden
    • Constructor parameters for collections now accept more liberal input. List<T> parameter accepts Iterable<? extends T> etc.
    • โœ‚ Removed sample style annotation like @BeanStyle.Accessors in favor of documentation and samples
    • @Value.Nested was renamed to @Value.Enclosing
    • ๐Ÿ’… @Value.Immutable#visibility was moved to style @Value.Style#visibility
    • ๐Ÿšš @Value.Immutable.Include was moved to @Value.Include
    • ๐Ÿ— Moved @Value.Builder to builder module where it is called @Builder.Factory. Added @Builder.Parameter and @Builder.Switch to fine-tune generation of builders for factory methods.