Suppose I have type alias defined in scala as
object Foo {
type Bar = Option[String]
}
It looks like I cannot refer to alias in Java cod
Type aliases are only visible to the Scala compiler, and like generic types they don't appear anywhere in the JVM class files.
If you're in Java, you're stuck using the unaliased type Option[String]
since javac has no way of knowing about the type alias Bar
that you declared in your Scala code. Wherever you would have used Bar
just use Option[String]
(which is scala.Option<String>
in Java) and it should work fine.