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
TypeAdapter
s 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 confusingvalue-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 modulemongo
MongoDB support modulebuilder
Module with annotations for generating builder from static factory methodsordinal
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 acceptsIterable<? 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
tobuilder
module where it is called@Builder.Factory
. Added@Builder.Parameter
and@Builder.Switch
to fine-tune generation of builders for factory methods.