equals

open operator override fun equals(other: Any?): Boolean

Determines whether this KmType is equal to the given other.

KmTypes are compared using structural equality, i.e., two objects are considered equal if they have all the following parts equal: attributes (such as isNullable and isSuspend), classifier, arguments, outerType, abbreviatedType, flexibleTypeUpperBound, and all platform extensions (such as annotations on JVM).

Note that equality of KmType instances differs from the concept of type equality in the Kotlin language. In the language, types A and B are equal if A.isSubtypeOf(B) && B.isSubtypeOf(A). Since kotlin-metadata-jvm does not provide subtyping algorithms (or any kind of type inference algorithms whatsoever), KmType equality adheres to a comparison of what is written to the metadata. For example, flexible types are not considered equal to their lower and upper bounds — which means that String? and String! are not equal KmTypes, despite being freely assignable from each other in the Kotlin language.

Return

true if the objects are equal, false otherwise.

Parameters

other

The object to compare for equality.