migration-manager

Is adding a trait method with implementation breaking backward compatibility?

橙三吉。 提交于 2020-01-01 02:28:08
问题 I am confused regarding backward compatibility when adding a method with default implementation to a trait. Like: Previous Version trait Foo New Version trait Foo { def verifyConsistency: Option[String] = ??? // provide default implementation } The Migration Manager reports this addition as a binary incompatibility. Is that correct? 回答1: Well yes it is correct. When you define trait Foo , it will under the hood create both a (JVM) interface Foo and a (JVM) class Foo$class with all the method

Is adding a trait method with implementation breaking backward compatibility?

走远了吗. 提交于 2019-12-03 06:02:18
I am confused regarding backward compatibility when adding a method with default implementation to a trait. Like: Previous Version trait Foo New Version trait Foo { def verifyConsistency: Option[String] = ??? // provide default implementation } The Migration Manager reports this addition as a binary incompatibility. Is that correct? Well yes it is correct. When you define trait Foo , it will under the hood create both a (JVM) interface Foo and a (JVM) class Foo$class with all the method implementations defined as static methods. The corresponding java code would look like something like this