[#718] | project: compiler | priority: low | category: bug | |
---|---|---|---|---|
submitter | assigned to | status | date submitted | |
Sean | Martin | fixed | 2006-08-30 14:57:39.0 | |
subject | mixins + synthetics + separate compilation + Java = boom. | |||
code |
// NOTE: Three separate files // B.scala package test; trait B { private val xxx = 10; def yyy = if (xxx == 0) "Hello" else "World"; } // Test.scala package test; abstract class MyTest extends B { Console.println(yyy); } // Java.java package test; class Java extends MyTest { } |
|||
what happened | sean-mcdirmids-computer:~/workspace/test10/src mcdirmid$ javac -d ../bin -classpath ../../scala/build/quick/lib/\ library/:../bin test/Java.java sean-mcdirmids-computer:~/workspace/test10/src mcdirmid$ ../../scala/build/quick/bin/scalac -d ../bin test/*.sca\ la sean-mcdirmids-computer:~/workspace/test10/src mcdirmid$ javac -d ../bin -classpath ../../scala/build/quick/lib/\ library/:../bin test/Java.java sean-mcdirmids-computer:~/workspace/test10/src mcdirmid$ ../../scala/build/quick/bin/scalac -d ../bin test/Test.\ scala sean-mcdirmids-computer:~/workspace/test10/src mcdirmid$ javac -d ../bin -classpath ../../scala/build/quick/lib/\ library/:../bin test/Java.java test/Java.java:3: test.Java is not abstract and does not override abstract method test$B$$xxx() in test.B class Java extends MyTest { ^ 1 error |
|||
what expected | The method test$B$$xxx() is marked as synthetic when it is compiled separately from B.scala (when compiled together, the method is not synthetic). The Java source compiler does not allow synthetic methods to override non-synthetic methods, so it breaks. | |||
[back to overview] |
Martin edited on 2006-09-04 16:46:11.0 |