mardi 4 juillet 2017

Load nested trait class

I have a piece of code under "test" package as below

object TestTraitsUnderObject {

  trait InnerOperation[T] {

  }

  def main(args: Array[String]): Unit = {
    Class.forName("test.OuterOperation")
    Class.forName("test.TestTraitsUnderObject.InnerOperation")

  }
}

trait OuterOperation[T] {

}

seems I can load the class for Outer trait correctly , but for nested trait, the classpath is incorrect ? why is that ? How I can load the `nested trait class correctly ?

Thanks





Aucun commentaire:

Enregistrer un commentaire