AutoValue has a number of ways to set a property with a method whose parameter
does not exactly match the return type of the property method. For example, a
property defined by abstract ImmutableList<String> getFoo() can be set by an
abstract method abstract Builder setFoo(List<String>). AutoValue knows how
to implement this by calling ImmutableList.copyOf. Here, we don't need to know
about ImmutableList.copyOf, we just need to know that this setter is indeed
callable to set the value of the list. There are similar considerations for
list builders (ImmutableList.Builder<String> fooBuilder()) and for Optional
(Optional<String> set by plain String). This change allows auto-value-gson
to use these alternative ways of setting a property, rather than requiring that
the setter parameter exactly match the property type.
Also made two changes that should facilitate updating to newer JDKs and
to newer versions of the Truth library:
use an appropriate @Generated annotation depending on the target
Java version;
remove a reference to the named(String) method, which no longer
exists in Truth.
AutoValue has a number of ways to set a property with a method whose parameter does not exactly match the return type of the property method. For example, a property defined by
abstract ImmutableList<String> getFoo()
can be set by an abstract methodabstract Builder setFoo(List<String>)
. AutoValue knows how to implement this by callingImmutableList.copyOf
. Here, we don't need to know aboutImmutableList.copyOf
, we just need to know that this setter is indeed callable to set the value of the list. There are similar considerations for list builders (ImmutableList.Builder<String> fooBuilder()
) and forOptional
(Optional<String>
set by plainString
). This change allows auto-value-gson to use these alternative ways of setting a property, rather than requiring that the setter parameter exactly match the property type.Also made two changes that should facilitate updating to newer JDKs and to newer versions of the Truth library:
use an appropriate
@Generated
annotation depending on the target Java version;remove a reference to the
named(String)
method, which no longer exists in Truth.