summaryrefslogtreecommitdiff
path: root/test/files/run
diff options
context:
space:
mode:
Diffstat (limited to 'test/files/run')
-rw-r--r--test/files/run/reflection-sanitychecks.check4
-rw-r--r--test/files/run/reflection-sanitychecks.scala4
2 files changed, 8 insertions, 0 deletions
diff --git a/test/files/run/reflection-sanitychecks.check b/test/files/run/reflection-sanitychecks.check
index d977e0ed66..4881285bc0 100644
--- a/test/files/run/reflection-sanitychecks.check
+++ b/test/files/run/reflection-sanitychecks.check
@@ -1,8 +1,12 @@
field: 1
method: 2
+constructor #1: scala.ScalaReflectionException: expected a constructor of class C, you provided method bar
+constructor #2: an instance of class C
class: CC
object: java.lang.Error: inner and nested modules are not supported yet
field: scala.ScalaReflectionException: expected a member of class C, you provided value D.foo
method: scala.ScalaReflectionException: expected a member of class C, you provided method D.bar
+constructor #1: scala.ScalaReflectionException: expected a constructor of class C, you provided method bar
+constructor #2: scala.ScalaReflectionException: expected a constructor of class C, you provided constructor D
class: scala.ScalaReflectionException: expected a member of class C, you provided class D.C
object: scala.ScalaReflectionException: expected a member of class C, you provided object D.O
diff --git a/test/files/run/reflection-sanitychecks.scala b/test/files/run/reflection-sanitychecks.scala
index e95d130460..b0982fc2fc 100644
--- a/test/files/run/reflection-sanitychecks.scala
+++ b/test/files/run/reflection-sanitychecks.scala
@@ -3,6 +3,7 @@ class C {
def bar = 2
class C { override def toString = "CC" }
object O { override def toString = "CO" }
+ override def toString = "an instance of class C"
}
class D {
@@ -10,6 +11,7 @@ class D {
def bar = 4
class C { override def toString = "DC" }
object O { override def toString = "DO" }
+ override def toString = "an instance of class D"
}
object Test extends App {
@@ -21,6 +23,8 @@ object Test extends App {
def failsafe(action: => Any): Any = try action catch { case ex: Throwable => ex.toString }
println("field: " + failsafe(im.reflectField(tpe.member(newTermName("foo")).asTerm).get))
println("method: " + failsafe(im.reflectMethod(tpe.member(newTermName("bar")).asMethod)()))
+ println("constructor #1: " + failsafe(cm.reflectClass(im.symbol).reflectConstructor(tpe.member(newTermName("bar")).asMethod)()))
+ println("constructor #2: " + failsafe(cm.reflectClass(im.symbol).reflectConstructor(tpe.member(newTermName("<init>")).asMethod)()))
println("class: " + failsafe(im.reflectClass(tpe.member(newTypeName("C")).asClass).reflectConstructor(typeOf[C].member(newTypeName("C")).asClass.typeSignature.member(newTermName("<init>")).asMethod)()))
println("object: " + failsafe(im.reflectModule(tpe.member(newTermName("O")).asModule).instance))
}