diff options
Diffstat (limited to 'test/files')
-rw-r--r-- | test/files/run/reflection-implClass.scala | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/test/files/run/reflection-implClass.scala b/test/files/run/reflection-implClass.scala new file mode 100644 index 0000000000..ed5acfc04e --- /dev/null +++ b/test/files/run/reflection-implClass.scala @@ -0,0 +1,18 @@ +/** + * Tries to load a symbol for the `Foo$class` using Scala reflection. + * Since trait implementation classes do not get pickling information + * symbol for them should be created using fallback mechanism + * that exposes Java reflection information dressed up in + * a Scala symbol. + **/ +object Test extends App { + import scala.reflect.mirror + val name = manifest[Foo].erasure.getName + "$class" + val implClass = Class.forName(name) + val symbol = mirror.classToSymbol(implClass) + assert(symbol != mirror.NoSymbol) +} + +trait Foo { + def bar = 1 +} |