scalastuff/scalabeans — pull request #9 by nbauernfeind (2012-12-16 22:01:06+00:00)
Title: Bug Fix getting Class Info from a class with a field from another class' inner class.

I'm using jackson-module-scala which uses scalabeans under the covers. I want to serialize a class that looks like this:

```scala
class Metrics {
outer =>
val numThingA = new Counter(...)
val numThingB = new Counter(...)
val currThingC = new AtomicReference(...)
// ... etc you get the point

def newSnapshot = new Snapshot
case class Snapshot (
numThingA: Long = outer.numThingA.count,
numThingB: Long = outer.numThingB.count,
currThingC: C = outer.currThingC.get
)
}
```

In the end I stick the snapshot into a case class:
```scala
case class DataResponse(..., metrics: Metrics#Snapshot)
```

But it fails to serialize the snapshot with this exception:
```java
scala.MatchError: org.scalastuff.scalabeans.sig.OuterTestClass (of class org.scalastuff.scalabeans.sig.ClassDeclExtractor$$anonfun$13$$anon$10)
at org.scalastuff.scalabeans.sig.ScalaTypeCompiler.getTypeDecl$1(ScalaTypeCompiler.scala:155)
at org.scalastuff.scalabeans.sig.ScalaTypeCompiler.resolveScalaType(ScalaTypeCompiler.scala:167)
at org.scalastuff.scalabeans.sig.ScalaTypeCompiler$$anonfun$3.apply(ScalaTypeCompiler.scala:146)
at org.scalastuff.scalabeans.sig.ScalaTypeCompiler$$anonfun$3.apply(ScalaTypeCompiler.scala:145)
at scala.collection.TraversableLike$$anonfun$map$1.apply(TraversableLike.scala:233)
at scala.collection.TraversableLike$$anonfun$map$1.apply(TraversableLike.scala:233)
at scala.collection.mutable.ResizableArray$class.foreach(ResizableArray.scala:60)
at scala.collection.mutable.ArrayBuffer.foreach(ArrayBuffer.scala:47)
at scala.collection.TraversableLike$class.map(TraversableLike.scala:233)
at scala.collection.mutable.ArrayBuffer.map(ArrayBuffer.scala:47)
at org.scalastuff.scalabeans.sig.ScalaTypeCompiler.compile(ScalaTypeCompiler.scala:145)
at org.scalastuff.scalabeans.sig.ScalaTypeCompiler$$anonfun$1$$anonfun$apply$2.apply(ScalaTypeCompiler.scala:51)
at org.scalastuff.scalabeans.sig.ScalaTypeCompiler$$anonfun$1$$anonfun$apply$2.apply(ScalaTypeCompiler.scala:48)
at scala.Option$WithFilter.map(Option.scala:174)
at org.scalastuff.scalabeans.sig.ScalaTypeCompiler$$anonfun$1.apply(ScalaTypeCompiler.scala:48)
at org.scalastuff.scalabeans.sig.ScalaTypeCompiler$$anonfun$1.apply(ScalaTypeCompiler.scala:47)
at scala.Option.flatMap(Option.scala:146)
at org.scalastuff.scalabeans.sig.ScalaTypeCompiler$.classInfoOf(ScalaTypeCompiler.scala:47)
...
```

So, here's a fix... and it works. Test fails beforehand but required the helper classes to be at the top level.