Why are nested Java classes not importable from Scala?

For future readers’ benefit: you also asked this at https://stackoverflow.com/questions/52132456/why-are-nested-java-classes-not-importable-from-scala

And the reason why they can’t be imported in the way you want is exactly the same as for Scala nested classes. A nested (non-static) class is tied to an instance of the outer class. So Outer.Nested is not a stable, importable path because Outer is not an instance nor a package.

What works is

val out = new Outer
val n1 = new out.Nested

import out.Nested
val n2 = new Nested
1 Like