Suppressed direct interface definition during reflection

Hello all,

I have noticed a change of behavior from Scala 2.12 to 2.13 (and 3) with regards to the generated class and then the result of Class.getInterfaces() on such class and I’m not sure whether it’s an expected behavior or a bug.

getInterfaces()'s javadoc states:

Returns the interfaces directly implemented by the class or interface represented by this object.

However I’ve noticed that, from 2.13 on, if a Scala class A implements/mixes in an interfaceI and extends a class B, which also implements interface I, then classOf[A].getInterfaces won’t return I.

Examples, using Serializable interface and classes Throwable, which implements Serializable, and Thread, which doesn’t. :

Scala 2.12:

Welcome to Scala 2.12.12 (OpenJDK 64-Bit Server VM, Java 11.0.9.1).
Type in expressions for evaluation. Or try :help.

scala> :paste
// Entering paste mode (ctrl-D to finish)


class A extends Serializable
class B extends Thread with Serializable
class C extends Throwable with Serializable

for (clss <- List(classOf[A], classOf[B], classOf[C])) 
  yield (clss.getSimpleName, clss.getInterfaces.mkString("[", ", ", "]"))

// Exiting paste mode, now interpreting.

defined class A
defined class B
defined class C
res0: List[(String, String)] = List((A,[interface scala.Serializable]), (B,[interface scala.Serializable]), (C,[interface scala.Serializable]))

Scala 2.13:

Welcome to Scala 2.13.3 (OpenJDK 64-Bit Server VM, Java 11.0.9.1).
Type in expressions for evaluation. Or try :help.

scala> :paste
// Entering paste mode (ctrl-D to finish)

class A extends Serializable
class B extends Thread with Serializable
class C extends Throwable with Serializable

for (clss <- List(classOf[A], classOf[B], classOf[C])) 
  yield (clss.getSimpleName, clss.getInterfaces.mkString("[", ", ", "]"))

// Exiting paste mode, now interpreting.

class A
class B
class C
val res0: List[(String, String)] = List((A,[interface java.io.Serializable]), (B,[interface java.io.Serializable]), (C,[]))

Is it an (new) expected behavior?

Is so, why? Something related to trait linearization ?

Thanks in advance.