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
.
Suppress false positives by adding the suppression annotation @SuppressWarnings("TypeEquals")
to the enclosing element.