1

hashCodeバイナリ互換性のない変更をオーバーライドする理由:

前:

trait Foo extends Product

後:

trait Foo extends Product {
  private[this] lazy val _hashCode = ScalaRunTime._hashCode(this)
  override def hashCode: Int = _hashCode
}

移行マネージャー 言います:

[error]  * synthetic method Foo$$_hashCode()Int in trait Foo is present only in current version
[error]    filter with: ProblemFilters.exclude[ReversedMissingMethodProblem]("Foo.Foo$$_hashCode")

これは実際に問題ですか?または、この変更で同じマイナー バージョンを維持できますか?

4

1 に答える 1

0

直接的な答えではありませんが、おそらくprivate[this] lazy val完全に避けることができます:

trait Foo extends Product {
  override lazy val hashCode: Int = ScalaRunTime._hashCode(this)
}

ここで、MiMa は文句を言いません。

于 2016-10-16T22:59:18.490 に答える