ケース クラスが廃止された場合、そのコンパニオン オブジェクトは廃止されていないことに気付きました。
scala> @deprecated case class A(x: Int)
warning: there was one deprecation warning; re-run with -deprecation for details
defined class A
scala> A(0)
res0: A = A(0)
scala> new A(0)
warning: there was one deprecation warning; re-run with -deprecation for details
res1: A = A(0)
A(0)
の場合とまったく同じように、 の警告を受け取りたいと思いますnew A(0)
。コンパニオン オブジェクトを明示的に定義して非推奨にする必要がありますか? もっと良い方法はありますか?