Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Reflection for nested classes

I see that most people who have been playing with ScalaSigParser, in an effort to ser/des idiomatic Scala case classes in a nice way, have avoided this issue, but I'd like to know if it's possible. I have a situation much like the following:

trait OuterTrait {
  abstract class InnerAbstract(i: Int)
}

object OuterObject extends OuterTrait {
  case class InnerConcrete(i: Int) extends InnerAbstract(i)
}

val bippy = OuterObject.InnerConcrete(123)

val s = serialize(bippy)

// time passes...

val obj = deserialize[OuterObject.InnerConcrete](s)

So, I can find the ScalaSig for OuterTrait, but I haven't managed to find a nice general way to identify the outer object from the InnerConcrete class. Any protips?

like image 524
Alex Cruise Avatar asked Jul 09 '11 01:07

Alex Cruise


1 Answers

If the problem is navigating from the Class of the inner object to the Class of the outer object, the issue may be fixed in Scala trunk, one of the tickets concerned beeing SI-4983.

like image 155
Iulian Dragos Avatar answered Oct 02 '22 13:10

Iulian Dragos