-
Notifications
You must be signed in to change notification settings - Fork 21
Open
Labels
fixed in Scala 3This issue does not exist in the Scala 3 compiler (https://github.com/lampepfl/dotty/)This issue does not exist in the Scala 3 compiler (https://github.com/lampepfl/dotty/)java interop
Milestone
Description
Reproduction steps
Scala version: 2.13.12
Java interfaces:
interface Parent {
default Object bug() {
return "Hello world";
}
}
interface Child extends Parent {
@Override
String bug();
}
Problem
Do compile in Java:
public class MainJava {
public static void main(String[] args) {
Child child = null;
String value = child.bug();
}
}
Do not compile in Scala:
object MainScala {
def main(args: Array[String]): Unit = {
val child: Child = null
val value: String = child.bug()
}
}
Result:
[error] type mismatch;
[error] found : Object
[error] required: String
[error] val value: String = child.bug()
Java and Scala implementation should have the same behavior.
Metadata
Metadata
Assignees
Labels
fixed in Scala 3This issue does not exist in the Scala 3 compiler (https://github.com/lampepfl/dotty/)This issue does not exist in the Scala 3 compiler (https://github.com/lampepfl/dotty/)java interop