File: BadAnnotationImplementation.md

package info (click to toggle)
error-prone-java 2.4.0-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 15,076 kB
  • sloc: java: 171,398; xml: 1,459; sh: 34; makefile: 7
file content (8 lines) | stat: -rw-r--r-- 493 bytes parent folder | download
1
2
3
4
5
6
7
8
Implementations of `java.lang.annotation.Annotation` must override `equals` and
`hashCode`, otherwise they inherit the implementations from `java.lang.Object`,
and those implementations do not meet the contract specified by the `Annotation`
interface.

It is very difficult to write these methods correctly, so consider using
[AutoAnnotation](https://github.com/google/auto/blob/master/value/src/main/java/com/google/auto/value/AutoAnnotation.java)
to generate the correct code automatically.