You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The specification is correct by definition. As the linked ticket says, concrete overrides abstract, irrespective of linearization.
Scala 3 says
-- Error: DerivedScala.scala:2:15 ----------------------------------------------
2 |abstract class DerivedScala extends BaseJava {
| ^
|error overriding method fn1 in class DerivedScala of type (): Unit;
| method fn1 in class BaseJava of type (): Unit has weaker access privileges; it should be public;
| (Note that method fn1 in class DerivedScala of type (): Unit is abstract,
| and is therefore overridden by concrete method fn1 in class BaseJava of type (): Unit)
1 error found
I thought they intended to modify this rule, so it's worth expressing your incredulity on gitter or the forum. They have tweaked interop rules similarly to what is suggested on the ticket, that is, a special rule when a Java definition is implicated.
One could also lodge a ticket against Scala 3 for their exuberant use of semicolon in the error message. And lack of period. (See what I did there.)
Not sure whether to close this is as duplicate, question (see "please, no questions"), or both.
reproduction steps
using Scala 2.13.5, on Oracle Java SE Development Kit 8u202.
In the #6760.
Scala does not allow non-public concrete methods in superclasses to be made
public
when declaring them asabstract
in subclasses.question
Is this specification correct? Java allows this.
If
protected
is added(fn2
) or the abstract method is redefined(fn3
), Scala will not cause an error.The text was updated successfully, but these errors were encountered: