TypeEquals
TypeMirror should be compared using Types#isSameType, not equality operators or equals().

Severity
WARNING

The problem

TypeMirror doesn’t override Object.equals and instances are not interned by javac, so testing types for equality should be done with Types#isSameType instead.

If you’re implementing an Error Prone BugChecker, you can get a Types instance from VisitorState.

If you’re implementing AnnotationProcessor, you can get the Types instance from javax.annotation.processing.ProcessingEnvironment.

For more discussion of preferred APIs for comparing types, see https://errorprone.info/bugpattern/TypeToString

Suppression

Suppress false positives by adding the suppression annotation @SuppressWarnings("TypeEquals") to the enclosing element.