I hava a Java interface:
public interface FooJava {
void consume(String... strings);
void consume(Integer... ints);
}
and I want to implement it in Scala:
class BarScala extends FooJava {
override def consume(strings: String*): Unit = ???
override def consume(ints: Integer*): Unit = ???
}
Unfortunately this fails with:
double definition:
override def consume(strings: String*): Unit at line 4 and
override def consume(ints: Integer*): Unit at line 5
have same type after erasure: (strings: Seq)Unit
override def consume(ints: Integer*): Unit = ???
I am aware that Java compiler creates Bridge methods, and Scala compiler does not do that.
I tried an approach with DummyImplicits: Are DummyImplicits used, and if so, how?,
but it obviously fails - consume(ints: Integer*)(implicit i: DummyImplicit) overrides nothing
class BarScala extends FooJava {
override def consume(strings: String*): Unit = ???
override def consume(ints: Integer*)(implicit i: DummyImplicit): Unit = ???
}
I don't own the Java interface. Is is possible to implement it in Scala? I'm on Scala 2.12