Migrated some classes from finalize() to PhantomReference in preparation for the removal of finalization. (786b619dd6, 7c6b17c, aeef90988d)
cache: Deprecated CacheBuilder APIs that use TimeUnit in favor of those that use Duration. (73f8b0bb84)
collect: Added toImmutableSortedMap collectors that use the natural comparator. (64d70b9f94)
collect: Changed ConcurrentHashMultiset, ImmutableMap and TreeMultiset deserialization to avoid mutating final fields. In extremely unlikely scenarios in which an instance of that type contains an object that refers back to that instance, this could lead to a broken instance that throws NullPointerException when used. (8240c7e596, 046468055f)
graph: Removed @Beta from all APIs in the package. (dae9566b73)
graph: Added support to Graphs.transitiveClosure() for different strategies for adding self-loops. (2e13df25b2)
graph: Added an asNetwork() view to Graph and ValueGraph. (909c593c61)
Migrated some classes from finalize() to PhantomReference in preparation for the removal of finalization. (786b619dd6, 7c6b17c, aeef90988d)
cache: Deprecated CacheBuilder APIs that use TimeUnit in favor of those that use Duration. (73f8b0bb84)
collect: Added toImmutableSortedMap collectors that use the natural comparator. (64d70b9f94)
collect: Changed ConcurrentHashMultiset, ImmutableMap and TreeMultiset deserialization to avoid mutating final fields. In extremely unlikely scenarios in which an instance of that type contains an object that refers back to that instance, this could lead to a broken instance that throws NullPointerException when used. (8240c7e596, 046468055f)
graph: Removed @Beta from all APIs in the package. (dae9566b73)
graph: Added support to Graphs.transitiveClosure() for different strategies for adding self-loops. (2e13df25b2)
graph: Added an asNetwork() view to Graph and ValueGraph. (909c593c61)
PreferTestParameter: suggests using @TestParameter instead of @TestParameters for exhaustive boolean and enum parameters on single-element parameterized tests
Removed variableType(Matcher) API. Matchers.variableType(Matcher) uses VariableTree#getType to match variable types, which own't work for lambda parameters with inferred types after JDK-8268850. The recommended replacement is variableType(TypePredicate).
Make enclosingPackage return an optional. Module elements are not enclosed by a package, checks using enclosingPackage shouldn't assume an enclosing package exists when processing arbitrary elements.
PreferTestParameter: suggests using @TestParameter instead of @TestParameters for exhaustive boolean and enum parameters on single-element parameterized tests
Removed variableType(Matcher) API. Matchers.variableType(Matcher) uses VariableTree#getType to match variable types, which own't work for lambda parameters with inferred types after JDK-8268850. The recommended replacement is variableType(TypePredicate).
Make enclosingPackage return an optional. Module elements are not enclosed by a package, checks using enclosingPackage shouldn't assume an enclosing package exists when processing arbitrary elements.
Fixed a crash with @AutoValue.CopyAnnotations(exclude=Missing.class), where Missing is a class that does not exist.
Type-use annotations such as @Nullable are now better preserved in generated builder setter method parameters. Previously they could be lost in some circumstances, for example with @Nullable T.
An issue with @Nullable type-use annotations in AutoBuilder has been fixed.
Report a diagnostic for setters with boxed primitive types for primitive properties.
A bug with AutoBuilder and Kotlin data classes has been fixed. If there was a mix of required and optional parameters in a data class with a large number of properties, sometimes the generated code would not compile.
AutoValue 1.11.0
What's Changed
AutoValue (including AutoBuilder) no longer bundles the Kotlin metadata API. This may require adding an explicit dependency on org.jetbrains.kotlinx:kotlinx-metadata-jvm:0.9.0 or org.jetbrains.kotlin:kotlin-metadata-jvm:2.0.0 to client code that uses AutoBuilder to build Kotlin classes. The metadata API has changed from kotlinx.metadata to kotlin.metadata, but AutoBuilder uses reflection to function with either. (260b61ec7)
Support for generating Java 7 code has been removed from AutoValue, AutoAnnotation, and AutoBuilder. You must be on at least Java 8, or an Android version with desugaring that allows it to pass for Java 8. 1.10.4 is the last AutoValue version with support for Java 7. (b9142b7cd)
AutoBuilder now reports an error if it encounters a @Nullable primitive parameter. Primitive types cannot be null, and should not be annotated for nullness. (7cbdeb43b)
Annotations on type parameters, like abstract @Nullable T foo(), are now better propagated to fields and constructor parameters. (92d881ed9)
The generated toBuilder() method now says new AutoValue_Foo.Builder(this) rather than just new Builder(this), to do the right thing if an extension generates its own subclass of Builder. (324470ba2)
The "copy constructor" in a generated Builder is no longer private. (6730615c9)
Added support for extending AutoValue.Builder with abstract methods. (7d4b020dd)
The annotation processors now support all kinds of resource URLs when loading template resources. This change only affects the case where the AutoValue (etc) processors are being invoked in an unusual environment, for example from a GraalVM app. It does not affect code that is merely being compiled for such an environment. (80b0ada75)
A workaround for a JDK bug with reading jar resources has been extended so it always applies, rather than just as a fallback. See #1572. (3f69cd255)
If an AutoValue property method is @Nullable, the corresponding field in the generated class will be too. This was already the case for TYPE_USE@Nullable or if the method had @CopyAnnotations, but now @Nullable will be copied in other cases too. (4506804f1)
AutoValue 1.10.3
An "incompatible version" issue with Kotlin compilation has been fixed. See #1574. (b21c7f4fb)
A warning is now produced if a setX method in a Builder or its return type is marked @Nullable. Those methods always return the Builder instance, which is never null. (e5b4b5484)
AutoValue 1.10.2
The constructor parameter names in the class generated by @Memoized no longer add a $. This may require changes to code that was depending on the old names, for example using Error Prone's /* param= */ comments. (4f8dbea8a)
An AutoValue or AutoBuilder property is now allowed to be null if its type is a type variable with a @Nullable bound, like <T extends @Nullable Object>. (1b58cff5e)
Better error message when AutoValue, AutoBuilder, etc give up because of missing types. We now say what the first missing type was. (2e734f605)
AutoBuilder copy-constructors no longer require an exact match between a property and the corresponding constructor parameter. (1440a25e4)
A property of type List<T> can be built by a property builder whose build() method returns List<? extends T>. (8ba4531b8)
Fixed a crash with @AutoValue.CopyAnnotations(exclude=Missing.class), where Missing is a class that does not exist.
Type-use annotations such as @Nullable are now better preserved in generated builder setter method parameters. Previously they could be lost in some circumstances, for example with @Nullable T.
An issue with @Nullable type-use annotations in AutoBuilder has been fixed.
Report a diagnostic for setters with boxed primitive types for primitive properties.
A bug with AutoBuilder and Kotlin data classes has been fixed. If there was a mix of required and optional parameters in a data class with a large number of properties, sometimes the generated code would not compile.
AutoValue 1.11.0
What's Changed
AutoValue (including AutoBuilder) no longer bundles the Kotlin metadata API. This may require adding an explicit dependency on org.jetbrains.kotlinx:kotlinx-metadata-jvm:0.9.0 or org.jetbrains.kotlin:kotlin-metadata-jvm:2.0.0 to client code that uses AutoBuilder to build Kotlin classes. The metadata API has changed from kotlinx.metadata to kotlin.metadata, but AutoBuilder uses reflection to function with either. (260b61ec7)
Support for generating Java 7 code has been removed from AutoValue, AutoAnnotation, and AutoBuilder. You must be on at least Java 8, or an Android version with desugaring that allows it to pass for Java 8. 1.10.4 is the last AutoValue version with support for Java 7. (b9142b7cd)
AutoBuilder now reports an error if it encounters a @Nullable primitive parameter. Primitive types cannot be null, and should not be annotated for nullness. (7cbdeb43b)
Annotations on type parameters, like abstract @Nullable T foo(), are now better propagated to fields and constructor parameters. (92d881ed9)
The generated toBuilder() method now says new AutoValue_Foo.Builder(this) rather than just new Builder(this), to do the right thing if an extension generates its own subclass of Builder. (324470ba2)
The "copy constructor" in a generated Builder is no longer private. (6730615c9)
Added support for extending AutoValue.Builder with abstract methods. (7d4b020dd)
The annotation processors now support all kinds of resource URLs when loading template resources. This change only affects the case where the AutoValue (etc) processors are being invoked in an unusual environment, for example from a GraalVM app. It does not affect code that is merely being compiled for such an environment. (80b0ada75)
A workaround for a JDK bug with reading jar resources has been extended so it always applies, rather than just as a fallback. See #1572. (3f69cd255)
If an AutoValue property method is @Nullable, the corresponding field in the generated class will be too. This was already the case for TYPE_USE@Nullable or if the method had @CopyAnnotations, but now @Nullable will be copied in other cases too. (4506804f1)
AutoValue 1.10.3
An "incompatible version" issue with Kotlin compilation has been fixed. See #1574. (b21c7f4fb)
A warning is now produced if a setX method in a Builder or its return type is marked @Nullable. Those methods always return the Builder instance, which is never null. (e5b4b5484)
AutoValue 1.10.2
The constructor parameter names in the class generated by @Memoized no longer add a $. This may require changes to code that was depending on the old names, for example using Error Prone's /* param= */ comments. (4f8dbea8a)
An AutoValue or AutoBuilder property is now allowed to be null if its type is a type variable with a @Nullable bound, like <T extends @Nullable Object>. (1b58cff5e)
Better error message when AutoValue, AutoBuilder, etc give up because of missing types. We now say what the first missing type was. (2e734f605)
AutoBuilder copy-constructors no longer require an exact match between a property and the corresponding constructor parameter. (1440a25e4)
A property of type List<T> can be built by a property builder whose build() method returns List<? extends T>. (8ba4531b8)
com.google.auto.common is annotated for null-safety. (9d79ce1e)
Add String and TypeElement versions of auto-common APIs that currently take in Class. (dec3bf0e)
AutoService 1.1.0
AutoService now verifies by default that the annotated class does indeed implement the interface in @AutoServce. Previously this only happened when compiling with -Averify=true. The verification can be disabled either by compiling with -Averify=false or by adding @SuppressWarnings("AutoService") to the annotated class. (965e89328)
The @AutoService annotation can no longer be applied to an interface or abstract class. This new verification can also be disabled in the same way. (591731c32)
AutoFactory 1.1.0
AutoFactory now recognizes and generates both javax.inject and jakarta.inject. If jakarta.inject is on the classpath then it will be used, and otherwise javax.inject. A new compiler option -Acom.google.auto.factory.InjectApi can be set to either javax or jakarta to force the use of one or the other. (67772b26d)
There is now a way to add annotations to generated AutoFactory classes. See the javadoc for @AutoFactory.AnnotationsToApply. (b2a1c0885)
The exception message for a null value now indicates not only which number argument it is but also how many arguments there are in total. This may lead to a small increase in code size. (ab6c7bfb6)
AutoFactory now correctly handles the case where a parameter annotation has @Target with both PARAMETER and TYPE_USE. (9d455fa17)
When a requested supertype of the generated factory class has a type parameter, the generated class now always has the same parameter. (206b67396)
Better error message when detecting duplicate parameters (59ec5e659)
AutoService 1.0.2
Updating Maven dependencies only. No functional changes.
Commits
b890639 Set version number for auto-service-aggregator
com.google.auto.common is annotated for null-safety. (9d79ce1e)
Add String and TypeElement versions of auto-common APIs that currently take in Class. (dec3bf0e)
AutoService 1.1.0
AutoService now verifies by default that the annotated class does indeed implement the interface in @AutoServce. Previously this only happened when compiling with -Averify=true. The verification can be disabled either by compiling with -Averify=false or by adding @SuppressWarnings("AutoService") to the annotated class. (965e89328)
The @AutoService annotation can no longer be applied to an interface or abstract class. This new verification can also be disabled in the same way. (591731c32)
AutoFactory 1.1.0
AutoFactory now recognizes and generates both javax.inject and jakarta.inject. If jakarta.inject is on the classpath then it will be used, and otherwise javax.inject. A new compiler option -Acom.google.auto.factory.InjectApi can be set to either javax or jakarta to force the use of one or the other. (67772b26d)
There is now a way to add annotations to generated AutoFactory classes. See the javadoc for @AutoFactory.AnnotationsToApply. (b2a1c0885)
The exception message for a null value now indicates not only which number argument it is but also how many arguments there are in total. This may lead to a small increase in code size. (ab6c7bfb6)
AutoFactory now correctly handles the case where a parameter annotation has @Target with both PARAMETER and TYPE_USE. (9d455fa17)
When a requested supertype of the generated factory class has a type parameter, the generated class now always has the same parameter. (206b67396)
Better error message when detecting duplicate parameters (59ec5e659)
AutoService 1.0.2
Updating Maven dependencies only. No functional changes.
Commits
b890639 Set version number for auto-service-aggregator
Migrated some classes from finalize() to PhantomReference in preparation for the removal of finalization. (786b619dd6, 7c6b17c, aeef90988d)
cache: Deprecated CacheBuilder APIs that use TimeUnit in favor of those that use Duration. (73f8b0bb84)
collect: Added toImmutableSortedMap collectors that use the natural comparator. (64d70b9f94)
collect: Changed ConcurrentHashMultiset, ImmutableMap and TreeMultiset deserialization to avoid mutating final fields. In extremely unlikely scenarios in which an instance of that type contains an object that refers back to that instance, this could lead to a broken instance that throws NullPointerException when used. (8240c7e596, 046468055f)
graph: Removed @Beta from all APIs in the package. (dae9566b73)
graph: Added support to Graphs.transitiveClosure() for different strategies for adding self-loops. (2e13df25b2)
graph: Added an asNetwork() view to Graph and ValueGraph. (909c593c61)
Changed assertions like assertThat(nullMap).isEmpty() to fail with a useful failure message instead of throwing NullPointerException (and similarly for other "bogus" values, such as negative sizes). (da5d6e96f)
Made Kotlin's isInstanceOf(Int::class.java) (and Java's isInstanceOf(int.class)) a valid way to check for Int/Integer instances. (974ef195b)
Improved isWithin to pretty-print numbers in its failure messages. (de785536d, 07318c23e)
Improved some assertions that print class names to print simpler names (e.g., Integer instead of java.lang.Integer). (0ba72d60fdb384aa97da03e2403a6757f63bf129)
Changed ExpectFailure to never generate "value of" lines based on bytecode. This slightly simplifies writing new tests with ExpectFailure and prevents future behavior changes in some ExpectFailure tests that already exist. However, it may also require changes to other existing ExpectFailure tests to remove or change any assertions about the "value of" line. (3caa0e845)
Our Android minSdkVersion is now 23 (Marshmallow). This follows the minimum of Google's foundational Android libraries, and we expect it to have no practical impact on users. (c85c75cf4)
Changed our []/J2CL artifact to omit usages of @NullMarked. This was making all our types non-null in those environments, since we don't yet use @Nullable in the []/J2CL artifact. (6392d37e7)
v1.4.4
Annotated the rest of the main package for nullness, and moved the @NullMarked annotation from individual classes up to the package to avoid a warning under --release 8. (e107aeadc)
Improved the failure message for matches to conditionally suggest using containsMatch. (7e9fc7aec)
1.4.3
Known Issue for at least some builds targeting Java 8, fixed in 1.4.4: "unknown enum constant ElementType.MODULE": google/truth#1320. As far as we know, this is only a warning, so it should cause practical problems only if you use -Werror or you perform reflection on @NullMarked under a Java 8 runtime.
Added more nullness information to our APIs (in the form of JSpecify annotations). This could lead to additional warnings (or even errors) for users of Kotlin and other nullness checkers. Please report any problems. (ee680cbaf)