Reputation: 83
I recently updated scala from v2.11.8 to 2.12.1 and got a CNF exception:
java.lang.ClassNotFoundException: scala.Product$class
I saw the class is shipped by scala-library.jar. The error happens when running a scalatest (the project is still at a very early stage so I have only tests).
Do you have any idea? I found nothing on the release notes.
Upvotes: 7
Views: 10028
Reputation: 39587
In particular, trait implementations are no longer provided in classes named with the $class
suffix. You'll find the notice about "trait encoding" in the release notes.
Probably you want to use sbt or ammonite if experimenting with any dependencies besides built-ins. One day they will have a tidy "platform" to help you.
$ cat notraitclass.scala
package notraitclass
trait T {
def t: Int = 42
}
$ scalac211 notraitclass.scala
$ ls notraitclass
T.class T$class.class
$ rm -rf notraitclass
$ scalac notraitclass.scala
$ ls notraitclass
T.class
Upvotes: 1
Reputation: 480
libraries are not binary compatible between 2.11 and 2.12, most likely one of your libraries has to be recompiled with scala 2.12
Upvotes: 12