Closed
Description
Reproduction steps
Scala version: 2.13.8 (also in 2.12.x)
// $ cat Bar.scala:
trait Bar[F] {
def f : F
final def bar: F = f // the real life example is more involved here
}
// ==================================================
//$ cat Foo.scala:
class Foo() extends Bar[Foo] {
override def f: Foo = this
}
// ==================================================
//$ cat Baz.java:
class Baz {
public static void main(String args[]) {
// Foo foo = new Foo().bar(); // compilation error: incompatible types: Object cannot be converted to Foo
Foo foo = (Foo)(new Foo().bar()); // compiles
}
}
Problem
See more details on Scala Users: https://users.scala-lang.org/t/issue-with-calling-scala-code-from-java/8321
Metadata
Metadata
Assignees
Labels
No labels