在将具有默认实现的方法添加到特征时,我对后向兼容性感到困惑.喜欢:
以前的版本
trait Foo
Run Code Online (Sandbox Code Playgroud)
新版本
trait Foo {
def verifyConsistency: Option[String] = ??? // provide default implementation
}
Run Code Online (Sandbox Code Playgroud)
该迁移管理器报告这除了为二进制不兼容.那是对的吗?
由于auxWindows下的包名称存在问题,我正在我的库的包层次结构中移动一个帮助器类
de.sciss.scalainterpreter.aux
Run Code Online (Sandbox Code Playgroud)
至
de.sciss.scalainterpreter
Run Code Online (Sandbox Code Playgroud)
该类是图书馆私有的,即private[scalainterpreter] object Helper.
现在使用Typesafe Migration-Manager,显然它报告更改不兼容:
Found 2 binary incompatibiities
===============================
* class de.sciss.scalainterpreter.aux.Helper does not have a correspondent
in new version
* object de.sciss.scalainterpreter.aux.Helper does not have a correspondent
in new version
Run Code Online (Sandbox Code Playgroud)
但我怀疑如果客户端代码没有调用任何一个对象,那么接口仍然是兼容的,因此我可以使用次要版本增加来指示更改,并允许这两个版本可以互换使用.
正确?
scala binary-compatibility package-private migration-manager