-
Notifications
You must be signed in to change notification settings - Fork 21
Scala 2.12.3 regression: interfaces of a class are removed if they exist in a superclass #10473
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Isn't that change binary compatible and it's a MiMa issue? It might be caused by scala/scala#5792 |
It's binary compatible if you control your parent classes. MiMa (correctly IMO) assumes that classes from separate jars are not under your control. In any case, IMO dropping the interface is wrong. If I explicitly write it in my source code, I want it to be 1) in the doc and 2) in the class files. |
Just to be absolutely sure, does this mean that the following code produces different results on 2.12.2 and 2.12.3? trait A
trait B extends A
class C
println(classOf[C].getInterfaces) |
@gzm0 I think you forgot some |
No, the change is only with respect to Java-defined interfaces. We're minimizing parent interfaces for a long time. For example in
only |
So ... does that mean that this change is intended and will stay forever? It's not consistent with Java, FWIW: public class Test {
public static void main(String[] args) {
for (Class<?> intf: C.class.getInterfaces())
System.out.println(intf);
}
}
interface A {}
class B extends Object implements A {}
class C extends B implements A {} prints
|
One observation we made while changing the trait method implementation to default methods in 2.12: default method resolution (during classfile parsing, in the JVM) gets a huge slowdown by the number of parent interfaces (scala/scala-dev#98 (comment)). Minimizing parents was originally added in scala/scala@7a99c03da1, the commit message mentions android (probably referring to https://groups.google.com/forum/#!topic/scala-debate/El3QZEbIwHg) and #5278. |
So I'd still call this a MiMa bug. If one of your parents changes to remove one of its interfaces, then that's where the binary incompatible change is, and not in your code. I'm for closing this ticket. |
I still think it's not normal that the compiler would just ignore things I have textually specified. But I won't fight this. For our specific issue we've anyway worked around it already: scala-js/scala-js@2cdbbfd |
Scala 2.12.2:
Scala 2.12.3:
This causes MiMa to report compatibility errors like the following, when upgrading a library from Scala 2.12.2 to 2.12.3:
I discovered this in scala-js/scala-js#3098. See the log of the failing build at https://scala-webapps.epfl.ch/jenkins/job/scalajs-task-worker/189205/console
The text was updated successfully, but these errors were encountered: