Closed
Description
This code shouldn't compile:
package outer {
private class A
package inner {
object Test {
def main(args: Array[String]): Unit = {
println(new A)
}
}
}
}
Because if you try to run it you get:
% dotr outer.inner.Test
Exception in thread "main" java.lang.IllegalAccessError: tried to access class outer.A from class outer.inner.Test$
at outer.inner.Test$.main(i3302.scala:7)
at outer.inner.Test.main(i3302.scala
This code compiles and run with scalac because the class A
is emitted as public
whereas dotty emits it as private
.