报告递归 equals(==) 调用。

在 Kotlin 中,== 会通过在后台调用 equals 方法来比较对象值。 另一方面,=== 则通过引用来比较对象。

=== 通常用于 equals 方法实现。 但 === 可能会错误地与 == 混淆,从而导致无限递归。

示例:


  class X {
      override fun equals(other: Any?): Boolean {
          if (this == other) return true
          return false
      }
  }

在应用快速修复后:


  class X {
      override fun equals(other: Any?): Boolean {
          if (this === other) return true
          return false
      }
  }