Skip to content

Commit

Permalink
Document the order of properties in @autovalue classes. This matters …
Browse files Browse the repository at this point in the history
…when a class inherits abstract methods from more than one place and uses a constructor rather than a builder.

Fixes #89.

RELNOTES=n/a

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=256046802
  • Loading branch information
eamonnmcmanus authored and netdpb committed Aug 19, 2019
1 parent 066f417 commit 91118b0
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion value/userguide/howto.md
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,16 @@ it simply doesn't exist.
AutoValue will recognize every abstract accessor method whether it is defined
directly in your own hand-written class or in a supertype.
<!-- TODO(kevinb): what about the order? -->
These abstract methods can come from more than one place, for example from an
interface and from the superclass. It may not then be obvious what order they
are in, even though you need to know this order if you want to call the
generated `AutoValue_Foo` constructor. You might find it clearer to use a
[builder](builders.md) instead. But the order is deterministic: within a class
or interface, methods are in the order they appear in the source code; methods
in ancestors come before methods in descendants; methods in interfaces come
before methods in classes; and in a class or interface that has more than one
superinterface, the interfaces are in the order of their appearance in
`implements` or `extends`.
## <a name="generic"></a>... use AutoValue with a generic class?
Expand Down

0 comments on commit 91118b0

Please sign in to comment.