With the new reflection library in Scala 2.10 (starting with Milestone 4), you can get internal objects:
scala> import scala.reflect.runtime.{universe => u} import scala.reflect.runtime.{universe=>u} scala> val outer = u.typeOf[Outer.type] outer: reflect.runtime.universe.Type = Outer.type scala> val objects = outer.declarations.filter(_.isModule).toList objects: List[reflect.runtime.universe.Symbol] = List(object O1, object O2)
source share