Scala traits can contain implementations, unlike Java interfaces. scalac
compiles this into an interface and an implementation class:
~/code/scratch/20120505 cat trait.scala
package test
trait T {
def a = println("foo")
}
~/code/scratch/20120505 scalac210 -d . trait.scala
~/code/scratch/20120505 javap -classpath . test/T
Compiled from "trait.scala"
public interface test.T extends scala.ScalaObject{
public abstract void a();
}
~/code/scratch/20120505 javap -classpath . test/T\$class
Compiled from "trait.scala"
public abstract class test.T$class extends java.lang.Object{
public static void a(test.T);
public static void $init$(test.T);
}
The IntelliJ Scala plugin does not expose the implementation class to Java code. It's not really a good idea to use this directly, as you are relying on an implementation detail of the Scala compiler.
You should invoke the corresponding methods on a subclass of the trait. You'll have to write that in Scala, though.
More info: How are Scala traits compiled into Java bytecode?