I have very strange behavior when using Kotlin class.
I have those simple classes :
ClassA class:
@Entity
class ClassA() : AbstractAuditable<Long>()
AbstractAuditable class
open class AbstractAuditable<T : Serializable> : AbstractPersistable<T>() {
// @Suppress("RedundantOverride")
// override fun equals(other: Any?): Boolean {
// return super.equals(other)
// }
}
AbstractPersistable JAVA class has this equals method overridden
@Override
public boolean equals(Object obj) {
}
Strange thing is that when I try to use equals operator ==
it can not be resolved.
Observation I: When I uncomment AbstractAuditables equals method everything works.
Observation II: As the documentation says == sign searches for equals(Any?) method. and in this case, it is not able to find it because only equals method in parent hierarchy is AbstractPersistables equals(Object) method.
Observation III: Using === works.
Observation IV: It is not the IntelliJ issue. Command-line build gives the same results
Why is Kotlin not able to use equals(Object) method from java class as equals(Any?) equivalent?
