New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Deriving from abstract Java class/method does not fail to compile #6013
Comments
Imported From: https://issues.scala-lang.org/browse/SI-6013?orig=1 |
@dgruntz said (edited on Jul 3, 2012 9:33:25 PM UTC): scala> class A {def foo = 0 }
defined class A
scala> abstract class B extends A { def foo: Int }
defined class B
scala> class C extends B
<console>:9: error: class C needs to be abstract, since there is a deferred decl
aration of method foo in class B of type => Int which is not implemented in a su
bclass
class C extends B
^ |
@retronym said: |
Christopher Currie (codemonkey) said: I understand that in order to compile successfully that DerivedJava must be declared abstract. The DerivedJava class is there to demonstrate an expected compilation failure. The description doesn't make sense if DeclaredJava compiles, so I have returned the description to its original state. The class is not "used" except as an example of where javac should (and does) fail to compile. The compiler does not flag an error on DerivedScala, which is the point of the bug report. |
@retronym said: |
@retronym said: |
Christopher Currie (codemonkey) said: |
@retronym said: The policy, given limited resources, is to only backport if the interested party either:
It's also not clear if there will be a 2.9.3 release at all. |
Christopher Currie (codemonkey) said: I understand there may not be a 2.9.3, but if there is I would predict it will before 2.10, and have less impact to development (and more importantly, my end users) than a 2.10 upgrade. I'll take a look at doing the cherry-pick legwork, in the hopes that a 2.9.3 release happens. Thanks again for the quick fix. |
Given the following files:
WIth these present, javac will fail to compile DerivedJava, complaining that foo needs to be defined. However, scalac will not fail to compile DerivedScala.scala, and when Main.scala is compiled and run, it crashes with AbstractMethodError (shown here from the REPL):
The text was updated successfully, but these errors were encountered: