File: AutoValueFinalMethods.md

package info (click to toggle)
error-prone-java 2.18.0-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 23,204 kB
  • sloc: java: 222,992; xml: 1,319; sh: 25; makefile: 7
file content (12 lines) | stat: -rw-r--r-- 667 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
Consider that other developers will try to read and understand your value class
while looking only at your hand-written class, not the actual (generated)
implementation class. If you mark your concrete methods final, they won't have
to wonder whether the generated subclass might be overriding them. This is
especially helpful if you are underriding equals, hashCode or toString!

Reference:
https://github.com/google/auto/blob/master/value/userguide/practices.md#mark-all-concrete-methods-final

NOTE:
[Since `@Memoized` methods can't be final](https://github.com/google/auto/blob/master/value/userguide/howto.md#memoize_hash_tostring),
the check doesn't flag them.