Consider the following Java interface that defines default method:
interface TestInterface{
public void testMe();
default public void aDefaulter() {
System.out.println("Default from interface");
}
}
and the following Scala code:
class TestImpl extends TestInterface {
def testMe() { println("TestImpl.testMe") }
/*override def aDefaulter() { { println("TestImpl.aDefaulter") } }*/
}
When we try to compile it by passing both source files, Scala's parser for java files chokes on default modifier:
scalac -d classes/ src/TestInterface.java src/TestImpl.scala
src/TestInterface.java:4: error: illegal start of type
default public void aDefaulter() {
^
src/TestInterface.java:7: error: identifier expected but `}' found.
}
^
two errors found
Consider the following Java interface that defines default method:
and the following Scala code:
When we try to compile it by passing both source files, Scala's parser for java files chokes on default modifier: