Skip to content

AutoValue Release 1.4 RC3

Pre-release
Pre-release
Compare
Choose a tag to compare
@eamonnmcmanus eamonnmcmanus released this 07 Mar 16:39
· 1163 commits to main since this release

Functional changes since 1.4 RC2

  • Builder setters now reject a null parameter immediately unless the corresponding property is @Nullable. Previously this check happened at build() time, and in some cases didn't happen at all.

  • If a property foo() or getFoo() has a builder method fooBuilder() then the property can not now be @Nullable. An ImmutableList, for example, started off empty, not null, in this case, so @Nullable was misleading.

  • Relatedly, the case where foo() is a nested @AutoValue class is now more similar to the case where it is an immutable collection. If you never add anything to fooBuilder() then you get an "empty" foo() at build() time, meaning whatever fooBuilder().build() returns.

  • Access modifiers like protected are copied from builder methods to their implementations, instead of the implementations always being public. Change by @torquestomp.

  • AutoAnnotation now precomputes parts of the hashCode that are constant because they come from defaulted members. This avoids warnings about integer overflow from tools that check that.

Extension API changes since 1.4 RC2

  • Extensions can now return null rather than generated code. In that case the extension does not generate a class in the AutoValue hierarchy, but it can still do other things like error checking or generating side files.

Bugs fixed since 1.4 RC2

  • GWT serialization tests are now run in prod mode. Change by @tbroyer.

  • If @AutoValue Foo has a builder, we always generated two constructors, Builder() and Builder(Foo), but we only used the second one if Foo had a toBuilder() method. Now we only generate that constructor if it is needed. That avoids warnings about unused code.

  • @AutoAnnotation now works when the annotation and the factory method are in the default (unnamed) package.

  • In the hack to work around spurious exceptions when reading resource files, we now handle NullPointerException in addition to IOException.

  • If a property has a name that is a Java keyword, for example getPackage() which defines a property called package, the Memoize extension will no longer generate code that doesn't compile.