The top level, yes, they end up being publicly available in Java (not default access).
But also:
package accesstest {
trait T {
protected[accesstest] object Foo { def foo = 7 }
private[accesstest] object Bar { def bar = 8 }
}
object Test extends App {
val t = new T {}
Console println t.Foo.foo
Console println t.Bar.bar
Console println other.Other.foo
}
}
package other {
object Other extends accesstest.T {
def foo = Foo.foo
//def bar = Bar.bar // nope
}
}
So, all that matters is extensibility and access to closing things.