New features
- SerializableAutoValue extension. This can be used to serialize
@AutoValue
classes with properties of typejava.util.Optional
, even thoughjava.util.Optional
is not serializable, and it can also be configured to serialize other arbitrary types. Thanks to @alvinlao for this contribution! (f91d2fe) - The logic for determining if we can make a BarBuilder out of a Bar has been generalized. For example, if your
@AutoValue
classFoo
has a propertyIntList ints()
, then your builder can haveIntListBuilder intsBuilder()
. Previously this worked if there was noFoo.toBuilder()
method, or ifIntList
had its owntoBuilder()
method. Now it also works if it is possible to callIntListBuilder.addAll(IntList)
. (6aeb44f) - AutoValue now allows boxed properties to be set from the corresponding primitive type, for example
Integer
fromint
. (2bbe506)
Behaviour changes
- AutoValue now gives a warning if the static builder() method is inside the
@AutoValue.Builder
class instead of directly in the@AutoValue
class. (fcccded) - AutoValue doesn't generate code or invoke extensions if it detects a problem, for example a mismatch between getters and setters. (ecb6032)
- AutoOneOf factory methods for void values now have type parameters if the
@AutoOneOf
class does. (4ab1b53) - It is now a compilation error if a setter method in a builder has a parameter marked
@Nullable
when the corresponding property is not in fact@Nullable
. Calling such a method with a null parameter already generated a NullPointerException at runtime. (bd7bed2) - The
@Memoized
annotation now has class-level retention, rather than source-level. (107694b)
Bug fixes
- We fixed an issue with type checking of setter parameters in the presence of inheritance and generics. (e97d1f0)
- We now generate a better
toString()
for arrays in AutoOneOf (0a7c049)
Miscellaneous
- We added CompileWithEclipseTest, which checks that AutoValue works with ecj, the Eclipse compiler. (05e983c)