diff options
Diffstat (limited to 'tests/pending/run/reflect-priv-ctor.scala')
-rw-r--r-- | tests/pending/run/reflect-priv-ctor.scala | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/tests/pending/run/reflect-priv-ctor.scala b/tests/pending/run/reflect-priv-ctor.scala new file mode 100644 index 000000000..9cb3e658c --- /dev/null +++ b/tests/pending/run/reflect-priv-ctor.scala @@ -0,0 +1,22 @@ + +import language.postfixOps +import reflect.runtime._ +import universe._ + +object Test { + + class Foo private () { + override def toString = "privately constructed" + } + + def main(args: Array[String]): Unit = { + + //val foo = new Foo // no access + val klass = currentMirror reflectClass typeOf[Foo].typeSymbol.asClass + val init = typeOf[Foo].members find { case m: MethodSymbol => m.isConstructor case _ => false } get + val ctor = klass reflectConstructor init.asMethod + val foo = ctor() // no access? + Console println foo + } +} + |