This repository was archived by the owner on Feb 20, 2019. It is now read-only.
File tree Expand file tree Collapse file tree 3 files changed +30
-3
lines changed Expand file tree Collapse file tree 3 files changed +30
-3
lines changed Original file line number Diff line number Diff line change @@ -164,7 +164,12 @@ object FastTypeTag {
164
164
// debug(s"!!! could not find primitive tag for class ${clazz.getName} !!!")
165
165
// handle arrays of non-primitive element type
166
166
if (clazz.isArray) mkRawArray(clazz, mirror)
167
- else apply(mirror, clazz.getName())
167
+ else {
168
+ val clazzName =
169
+ if (clazz.getName().contains(" anonfun$" )) clazz.getName()
170
+ else clazz.getName().replace('$' , '.' )
171
+ apply(mirror, clazzName)
172
+ }
168
173
})
169
174
} catch {
170
175
case t : Throwable =>
Original file line number Diff line number Diff line change @@ -79,10 +79,11 @@ class Tools[C <: Context](val c: C) {
79
79
val subclasses = MutableList [Symbol ]()
80
80
def analyze (sym : Symbol ) = if (isRelevantSubclass(baseSym, sym)) subclasses += sym
81
81
def loop (tree : Tree ): Unit = tree match {
82
- // NOTE: only looking for top-level classes!
82
+ // NOTE: only looking for classes defined in objects or top-level classes!
83
83
case PackageDef (_, stats) => stats.foreach(loop)
84
84
case cdef : ClassDef => analyze(cdef.symbol)
85
- case mdef : ModuleDef => analyze(mdef.symbol.asModule.moduleClass)
85
+ case mdef : ModuleDef => // analyze(mdef.symbol.asModule.moduleClass)
86
+ mdef.impl.body.foreach(loop)
86
87
case _ => // do nothing
87
88
}
88
89
c.enclosingRun.units.map(_.body).foreach(loop)
Original file line number Diff line number Diff line change @@ -10,6 +10,7 @@ object Commands {
10
10
}
11
11
12
12
case class CommandMessage (cmd : Command )
13
+ case class CommandMessage2 (cmd : AnyRef )
13
14
14
15
class NestedObjectTest extends FunSuite {
15
16
test(" json" ) {
@@ -30,3 +31,23 @@ class NestedObjectTest extends FunSuite {
30
31
assert(c.cmd == up.cmd)
31
32
}
32
33
}
34
+
35
+ class NestedObjectRuntimeTest extends FunSuite {
36
+ test(" json" ) {
37
+ import json ._
38
+ val cmd = Commands .SomeCommand (" hey, this is a command!" )
39
+ val c = CommandMessage2 (cmd)
40
+ val p : JSONPickle = c.pickle
41
+ val up = p.unpickle[CommandMessage2 ]
42
+ assert(c.cmd == up.cmd)
43
+ }
44
+
45
+ test(" binary" ) {
46
+ import binary ._
47
+ val cmd = Commands .SomeCommand (" hey, this is a command!" )
48
+ val c = CommandMessage2 (cmd)
49
+ val p : BinaryPickle = c.pickle
50
+ val up = p.unpickle[CommandMessage2 ]
51
+ assert(c.cmd == up.cmd)
52
+ }
53
+ }
You can’t perform that action at this time.
0 commit comments