Skip to content

Scala 2.12.3 regression: interfaces of a class are removed if they exist in a superclass #10473

Closed
@sjrd

Description

@sjrd

Scala 2.12.2:

$ scala
Welcome to Scala 2.12.2 (Java HotSpot(TM) 64-Bit Server VM, Java 1.8.0_60).
Type in expressions for evaluation. Or try :help.

scala> final class RuntimeLong extends java.lang.Number with java.io.Serializable {
     |   def intValue(): Int = 0; def longValue(): Long = 0L; def floatValue(): Float = 0.0f; def doubleValue(): Double = 0.0
     | }
defined class RuntimeLong

scala> classOf[RuntimeLong].getInterfaces
res0: Array[Class[_]] = Array(interface java.io.Serializable)

scala> class A extends java.io.Serializable
defined class A

scala> class B extends A with java.io.Serializable
defined class B

scala> classOf[B].getInterfaces
res1: Array[Class[_]] = Array(interface java.io.Serializable)

Scala 2.12.3:

$ scala
Welcome to Scala 2.12.3 (Java HotSpot(TM) 64-Bit Server VM, Java 1.8.0_60).
Type in expressions for evaluation. Or try :help.

scala> final class RuntimeLong extends java.lang.Number with java.io.Serializable {
     |   def intValue(): Int = 0; def longValue(): Long = 0L; def floatValue(): Float = 0.0f; def doubleValue(): Double = 0.0
     | }
defined class RuntimeLong

scala> classOf[RuntimeLong].getInterfaces
res0: Array[Class[_]] = Array()

scala> class A extends java.io.Serializable
defined class A

scala> class B extends A with java.io.Serializable
defined class B

scala> classOf[B].getInterfaces
res1: Array[Class[_]] = Array()

This causes MiMa to report compatibility errors like the following, when upgrading a library from Scala 2.12.2 to 2.12.3:

[info] Scala.js library: found 1 potential binary incompatibilities while checking against org.scala-js:scalajs-library_2.12:0.6.19
[error]  * the type hierarchy of class scala.scalajs.runtime.RuntimeLong is different in current version. Missing types {java.io.Serializable}
[error]    filter with: ProblemFilters.exclude[MissingTypesProblem]("scala.scalajs.runtime.RuntimeLong")

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions