-
Notifications
You must be signed in to change notification settings - Fork 21
Should report error when invoking method on package visible class via super #4626
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
Comments
Imported From: https://issues.scala-lang.org/browse/SI-4626?orig=1
|
@paulp said (edited on Jul 5, 2011 5:24:23 AM UTC): // A.java
package a;
class A {
public void foo1() { }
public void foo2() { }
public void foo3() { }
}
// A2.java
package a;
public class A2 extends A { } Now look at A2. It gets accessor methods for every method in A even though it can access them just fine since it's in the same package. But its subclasses won't be able to, and thanks to separate compilation it has to assume the worst and put in forwarders for everything. Nice.
Of course if you make A public, A2 gets nothing. |
@paulp said: |
@adriaanm said: |
Not a crasher, but surprisingly:
but 2.12 and 2.13 have no problem with it. |
Suppose we have class "A" implemented in Java in the package "a" defined with the default visibility and implementing public method foo:
And public class "SuperA" in the same package that extends class "a.A" (it doesn't matter if this class is implemented in java or scala):
The third class "B" in the package "b" extends "SuperA" and invokes "super.foo()":
On an attempt to compile class "b.B" scala compiler crashes throwing the following exception:
To reproduce this issue unpack attached archive and execute runme.sh script with scala 2.9.0
The text was updated successfully, but these errors were encountered: