Intellij IDEA java.lang.NoSuchMethodError: scala.collection.immutable.$colon$colon.hd$1()Ljava/lang/Object

I had this issue. Agree with Andrzej, idea uses its own compiler, so you have to disable it somehow. Go to Settings->Scala->Worksheet and uncheck "Run worksheet in the compiler process".


Any answer wasn't usefull in my case. Still i found a solution which worked for me.. It was problem with scalatest version. In pom.xml uprade to

  <dependency>
        <groupId>org.scalatest</groupId>
        <artifactId>scalatest_2.11</artifactId>
         <version>2.2.4</version>
         <scope>test</scope>
  </dependency>

helped


So, although the above didn't solve my problem it is related to intellij.

Basically, it was preferring the Scala SDK to resolve the Class::method instead of loading from the dependencies.

I used

-verbose:class

in the JVM switch to have it show me where it was looking; immediately cluing me into it being because it's trying to load the class from the Scala SDK (it would expect it to pull in libs from Maven).

I literally just deleted the Scala SDK from my project settings and the problem went away. So far, my experience with Scala (and definitely in a mixed Java environment) leads me to believe it has a ways to go to mature. This is such a fundamental class/method I can't believe it vanished between versions. The scala version I had installed was 2.11. Apparently what get's pulled in is 2.10.4 from maven.

Anytime you see "NoSuchMethodError" it always means there is a version conflict; it's a question of why.