summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEugene Burmako <xeno.by@gmail.com>2012-06-08 11:43:20 +0200
committerEugene Burmako <xeno.by@gmail.com>2012-06-08 15:35:23 +0200
commitabc1c0be79ac2fb2b0e75c87a489570a9c71aa6e (patch)
tree5d2723fa39aa8b28337b1e005ae06891667580a2
parent2123201e3cbc34676d2936226539bdfa0555c275 (diff)
downloadscala-abc1c0be79ac2fb2b0e75c87a489570a9c71aa6e.tar.gz
scala-abc1c0be79ac2fb2b0e75c87a489570a9c71aa6e.tar.bz2
scala-abc1c0be79ac2fb2b0e75c87a489570a9c71aa6e.zip
tests and fixes for the mirror API
-rw-r--r--src/reflect/scala/reflect/api/Mirrors.scala77
-rw-r--r--src/reflect/scala/reflect/api/TagInterop.scala2
-rw-r--r--src/reflect/scala/reflect/runtime/JavaMirrors.scala95
-rw-r--r--test/files/run/reflect-overload.scala2
-rw-r--r--test/files/run/reflection-constructormirror-inner-badpath.check2
-rw-r--r--test/files/run/reflection-constructormirror-inner-badpath.scala32
-rw-r--r--test/files/run/reflection-constructormirror-inner-good.check1
-rw-r--r--test/files/run/reflection-constructormirror-inner-good.scala26
-rw-r--r--test/files/run/reflection-constructormirror-nested-badpath.check2
-rw-r--r--test/files/run/reflection-constructormirror-nested-badpath.scala32
-rw-r--r--test/files/run/reflection-constructormirror-nested-good.check1
-rw-r--r--test/files/run/reflection-constructormirror-nested-good.scala26
-rw-r--r--test/files/run/reflection-constructormirror-toplevel-badpath.check2
-rw-r--r--test/files/run/reflection-constructormirror-toplevel-badpath.scala33
-rw-r--r--test/files/run/reflection-constructormirror-toplevel-good.check1
-rw-r--r--test/files/run/reflection-constructormirror-toplevel-good.scala27
-rw-r--r--test/files/run/reflection-fieldmirror-ctorparam.scala2
-rw-r--r--test/files/run/reflection-fieldmirror-getsetval.scala2
-rw-r--r--test/files/run/reflection-fieldmirror-getsetvar.scala2
-rw-r--r--test/files/run/reflection-fieldmirror-nmelocalsuffixstring.scala4
-rw-r--r--test/files/run/reflection-fieldmirror-privatethis.scala4
-rw-r--r--test/files/run/reflection-fieldmirror-sanitycheck.scala2
-rw-r--r--test/files/run/reflection-implClass.scala6
-rw-r--r--test/files/run/reflection-modulemirror-inner-badpath.check2
-rw-r--r--test/files/run/reflection-modulemirror-inner-badpath.scala24
-rw-r--r--test/files/run/reflection-modulemirror-inner-good.check2
-rw-r--r--test/files/run/reflection-modulemirror-inner-good.scala23
-rw-r--r--test/files/run/reflection-modulemirror-nested-badpath.check2
-rw-r--r--test/files/run/reflection-modulemirror-nested-badpath.scala26
-rw-r--r--test/files/run/reflection-modulemirror-nested-good.check2
-rw-r--r--test/files/run/reflection-modulemirror-nested-good.scala24
-rw-r--r--test/files/run/reflection-modulemirror-toplevel-badpath.check2
-rw-r--r--test/files/run/reflection-modulemirror-toplevel-badpath.scala26
-rw-r--r--test/files/run/reflection-modulemirror-toplevel-good.check1
-rw-r--r--test/files/run/reflection-modulemirror-toplevel-good.scala20
-rw-r--r--test/files/run/reflection-simple.scala2
-rw-r--r--test/files/run/t5256a.scala2
-rw-r--r--test/files/run/t5256b.scala2
-rw-r--r--test/files/run/t5256c.scala2
-rw-r--r--test/files/run/t5256d.check2
-rw-r--r--test/files/run/t5256d.scala2
-rw-r--r--test/files/run/t5256e.check6
-rw-r--r--test/files/run/t5256e.scala2
-rw-r--r--test/files/run/t5256f.check12
-rw-r--r--test/files/run/t5256f.scala4
-rw-r--r--test/files/run/t5256g.scala2
-rw-r--r--test/files/run/t5256h.scala2
-rw-r--r--test/files/run/t5423.scala2
48 files changed, 471 insertions, 108 deletions
diff --git a/src/reflect/scala/reflect/api/Mirrors.scala b/src/reflect/scala/reflect/api/Mirrors.scala
index 2fcee8f227..348ab3656b 100644
--- a/src/reflect/scala/reflect/api/Mirrors.scala
+++ b/src/reflect/scala/reflect/api/Mirrors.scala
@@ -5,10 +5,6 @@ trait Mirrors { self: Universe =>
type RuntimeClass >: Null
- // [Eugene++ to Martin] how do we reflect against inner classes?
- // presumably, we should add `reflectClass` to both InstanceMirror (inner classes) and TemplateMirror (nested classes)
- // in the former case, the resulting ClassMirror should remember the outer instance that spawned it to use it in reflective construction
-
// [Eugene] also, it might make sense to provide shortcuts for the API
//
// for example, right now to invoke the same method for several different instances, you need:
@@ -31,8 +27,8 @@ trait Mirrors { self: Universe =>
/** The instance value reflected by this mirror */
def instance: Any
- /** The mirror corresponding to the run-time class of the reflected instance. */
- def reflectClass: ClassMirror
+ /** The symbol corresponding to the run-time class of the reflected instance. */
+ def symbol: ClassSymbol
/** Get value of field in reflected instance.
* @field A field symbol that should represent a field of the instance class.
@@ -48,6 +44,12 @@ trait Mirrors { self: Universe =>
* @throws ???
*/
def reflectMethod(method: MethodSymbol): MethodMirror
+
+ /** .. */
+ def reflectClass(cls: ClassSymbol): ClassMirror
+
+ /** .. */
+ def reflectModule(mod: ModuleSymbol): ModuleMirror
}
/** A mirror that reflects a field */
@@ -57,7 +59,7 @@ trait Mirrors { self: Universe =>
def receiver: AnyRef
/** The field symbol representing the field */
- def field: TermSymbol
+ def symbol: TermSymbol
/** Retrieves the value stored in the field */
def get: Any
@@ -73,9 +75,10 @@ trait Mirrors { self: Universe =>
def receiver: AnyRef
/** The method symbol representing the method */
- def method: MethodSymbol
+ def symbol: MethodSymbol
/** The result of applying the method to the given arguments */
+ // [Eugene+++] If it's a constructor, it should account for inner classes
def apply(args: Any*): Any
}
@@ -97,8 +100,6 @@ trait Mirrors { self: Universe =>
/** The Scala symbol corresponding to the reflected runtime class or module. */
def symbol: Symbol
- // [Eugene++ to Martin] I've removed `typeSignature`, because we can obtain it via `symbol.typeSignature`
-
/** Optionally, the mirror of the companion reflected by this mirror.
* If this mirror reflects a Scala object, the mirror for the companion class, or None
* if the mirror represents a Scala object that comes without a class.
@@ -157,8 +158,8 @@ trait Mirrors { self: Universe =>
def companion: Option[ModuleMirror]
}
- /** The API of a mirror for a reflective universe */
- trait RuntimeMirror extends MirrorOf[Mirrors.this.type] { self =>
+ /** A mirror that reflects instances and static classes */
+ trait ReflectiveMirror extends MirrorOf[Mirrors.this.type] {
/** A reflective mirror for the given object
* @param obj An arbitrary value
@@ -166,37 +167,15 @@ trait Mirrors { self: Universe =>
*/
def reflect(obj: Any): InstanceMirror
- /** A reflective mirror for the given Runtime class
- * @param runtimeClass A Runtime class object
- * @return The mirror for `runtimeClass`
- */
- def reflectClass(runtimeClass: RuntimeClass): ClassMirror
-
- /** A reflective mirror for the Runtime class with the given name in the
- * current classloader.
- * @param name The fully qualified name of the class
- * @return The mirror for the runtime class with fully qualified name
- * `name` in the current class loader.
- * @throws java.lang.ClassNotFoundException if no class with that name exists
- * to do: throws anything else?
- */
- def reflectClass(fullName: String): ClassMirror
+ /** .. */
+ def reflectClass(cls: ClassSymbol): ClassMirror
- /** A reflective mirror for the given Runtime class
- * @param runtimeClass A Runtime class object
- * @return The mirror for `runtimeClass`
- */
- def reflectModule(runtimeClass: RuntimeClass): ModuleMirror
+ /** .. */
+ def reflectModule(mod: ModuleSymbol): ModuleMirror
+ }
- /** A reflective mirror for the Runtime class with the given name in the
- * current classloader.
- * @param name The fully qualified name of the class
- * @return The mirror for the runtime class with fully qualified name
- * `name` in the current class loader.
- * @throws java.lang.ClassNotFoundException if no class with that name exists
- * to do: throws anything else?
- */
- def reflectModule(fullName: String): ModuleMirror
+ /** The API of a mirror for a reflective universe */
+ trait RuntimeMirror extends ReflectiveMirror { self =>
/** Maps a Scala type to the corresponding Java class object
*/
@@ -209,5 +188,21 @@ trait Mirrors { self: Universe =>
* because there is no unique Java class corresponding to a Scala generic array
*/
def runtimeClass(cls: ClassSymbol): RuntimeClass
+
+ /** A class symbol for the specified runtime class.
+ * @return The class symbol for the runtime class in the current class loader.
+ * @throws java.lang.ClassNotFoundException if no class with that name exists
+ * @throws scala.reflect.internal.MissingRequirementError if no corresponding symbol exists
+ * to do: throws anything else?
+ */
+ def classSymbol(rtcls: RuntimeClass): ClassSymbol
+
+ /** A module symbol for the specified runtime class.
+ * @return The module symbol for the runtime class in the current class loader.
+ * @throws java.lang.ClassNotFoundException if no class with that name exists
+ * @throws scala.reflect.internal.MissingRequirementError if no corresponding symbol exists
+ * to do: throws anything else?
+ */
+ def moduleSymbol(rtcls: RuntimeClass): ModuleSymbol
}
}
diff --git a/src/reflect/scala/reflect/api/TagInterop.scala b/src/reflect/scala/reflect/api/TagInterop.scala
index 95c4e78cf4..f1938083b5 100644
--- a/src/reflect/scala/reflect/api/TagInterop.scala
+++ b/src/reflect/scala/reflect/api/TagInterop.scala
@@ -25,7 +25,7 @@ trait TagInterop { self: JavaUniverse =>
mirror.universe match {
case ju: JavaUniverse =>
val jm = mirror.asInstanceOf[ju.Mirror]
- val sym = jm.reflectClass(manifest.erasure).symbol
+ val sym = jm.classSymbol(manifest.erasure)
val tpe =
if (manifest.typeArguments.isEmpty) sym.asType
else ju.appliedType(sym.asTypeConstructor, manifest.typeArguments map (targ => ju.manifestToTypeTag(jm, targ)) map (_.in(jm).tpe))
diff --git a/src/reflect/scala/reflect/runtime/JavaMirrors.scala b/src/reflect/scala/reflect/runtime/JavaMirrors.scala
index ed03ac30f9..38d280ec73 100644
--- a/src/reflect/scala/reflect/runtime/JavaMirrors.scala
+++ b/src/reflect/scala/reflect/runtime/JavaMirrors.scala
@@ -32,6 +32,8 @@ trait JavaMirrors extends internal.SymbolTable with api.JavaUniverse { self: Sym
jm
}
+ override type RuntimeClass = java.lang.Class[_]
+
override type Mirror = JavaMirror
override lazy val rootMirror: Mirror = createMirror(NoSymbol, rootClassLoader)
@@ -105,30 +107,32 @@ trait JavaMirrors extends internal.SymbolTable with api.JavaUniverse { self: Sym
// ----------- Implementations of mirror operations and classes -------------------
- def reflect(obj: Any): InstanceMirror =
- new JavaInstanceMirror(obj.asInstanceOf[AnyRef])
-
- def reflectClass(runtimeClass: RuntimeClass): ClassMirror =
- new JavaClassMirror(classToScala(runtimeClass))
-
- def reflectClass(fullName: String): ClassMirror =
- reflectClass(java.lang.Class.forName(fullName))
+ def reflect(obj: Any): InstanceMirror = new JavaInstanceMirror(obj.asInstanceOf[AnyRef])
- def reflectModule(runtimeClass: RuntimeClass): ModuleMirror =
- new JavaModuleMirror(classToScala(runtimeClass).companionModule.asModuleSymbol)
+ def reflectClass(cls: ClassSymbol): ClassMirror = {
+ if (!cls.isStatic) throw new Error("this is an inner class, use reflectClass on an InstanceMirror to obtain its ClassMirror")
+ new JavaClassMirror(null, cls)
+ }
- def reflectModule(fullName: String): ModuleMirror =
- reflectModule(java.lang.Class.forName(fullName))
+ def reflectModule(mod: ModuleSymbol): ModuleMirror = {
+ if (!mod.isStatic) throw new Error("this is an inner module, use reflectModule on an InstanceMirror to obtain its ModuleMirror")
+ new JavaModuleMirror(null, mod)
+ }
def runtimeClass(tpe: Type): RuntimeClass = typeToJavaClass(tpe)
def runtimeClass(cls: ClassSymbol): RuntimeClass = classToJava(cls)
+ def classSymbol(rtcls: RuntimeClass): ClassSymbol = classToScala(rtcls)
+
+ def moduleSymbol(rtcls: RuntimeClass): ModuleSymbol = classToScala(rtcls).companionModule.asModuleSymbol
+
private class JavaInstanceMirror(obj: AnyRef)
extends InstanceMirror {
def instance = obj
- def reflectClass = wholemirror.reflectClass(obj.getClass)
+ def symbol = wholemirror.classSymbol(obj.getClass)
def reflectField(field: TermSymbol): FieldMirror = {
+ // [Eugene+++] check whether `field` represents a member of a `symbol`
if (field.isMethod || field.isModule) throw new Error(s"""
|expected a field symbol, you provided a ${field.kind} symbol
|A typical cause of this problem is using a field accessor symbol instead of a field symbol.
@@ -139,79 +143,101 @@ trait JavaMirrors extends internal.SymbolTable with api.JavaUniverse { self: Sym
""".trim.stripMargin)
new JavaFieldMirror(obj, field)
}
- def reflectMethod(method: MethodSymbol): MethodMirror = new JavaMethodMirror(obj, method)
+ def reflectMethod(method: MethodSymbol): MethodMirror = {
+ // [Eugene+++] check whether `method` represents a member of a `symbol`
+ new JavaMethodMirror(obj, method)
+ }
+ def reflectClass(cls: ClassSymbol): ClassMirror = {
+ // [Eugene+++] check whether `cls` represents a member of a `symbol`
+ if (cls.isStatic) throw new Error("this is a static class, use reflectClass on a RuntimeMirror to obtain its ClassMirror")
+ new JavaClassMirror(instance, cls)
+ }
+ def reflectModule(mod: ModuleSymbol): ModuleMirror = {
+ // [Eugene+++] check whether `mod` represents a member of a `symbol`
+ if (mod.isStatic) throw new Error("this is a static module, use reflectModule on a RuntimeMirror to obtain its ModuleMirror")
+ new JavaModuleMirror(instance, mod)
+ }
}
- private class JavaFieldMirror(val receiver: AnyRef, val field: TermSymbol)
+ private class JavaFieldMirror(val receiver: AnyRef, val symbol: TermSymbol)
extends FieldMirror {
lazy val jfield = {
- val jfield = fieldToJava(field)
+ val jfield = fieldToJava(symbol)
if (!jfield.isAccessible) jfield.setAccessible(true)
jfield
}
def get = jfield.get(receiver)
def set(value: Any) = {
- if (!field.isMutable) throw new Error("cannot set an immutable field")
+ if (!symbol.isMutable) throw new Error("cannot set an immutable field")
jfield.set(receiver, value)
}
}
- private class JavaMethodMirror(val receiver: AnyRef, val method: MethodSymbol)
+ private class JavaMethodMirror(val receiver: AnyRef, val symbol: MethodSymbol)
extends MethodMirror {
lazy val jmeth = {
- val jmeth = methodToJava(method)
+ val jmeth = methodToJava(symbol)
if (!jmeth.isAccessible) jmeth.setAccessible(true)
jmeth
}
def apply(args: Any*): Any =
- if (method.owner == ArrayClass)
- method.name match {
+ if (symbol.owner == ArrayClass)
+ symbol.name match {
case nme.length => jArray.getLength(receiver)
case nme.apply => jArray.get(receiver, args(0).asInstanceOf[Int])
case nme.update => jArray.set(receiver, args(0).asInstanceOf[Int], args(1))
- case _ => throw new Error(s"unexpected array method $method")
+ case _ => throw new Error(s"unexpected array method $symbol")
}
else
jmeth.invoke(receiver, args.asInstanceOf[Seq[AnyRef]]: _*)
}
- private class JavaConstructorMirror(val method: MethodSymbol)
+ private class JavaConstructorMirror(val outer: AnyRef, val symbol: MethodSymbol)
extends MethodMirror {
- override val receiver = null
+ override val receiver = outer
lazy val jconstr = {
- val jconstr = constructorToJava(method)
+ val jconstr = constructorToJava(symbol)
if (!jconstr.isAccessible) jconstr.setAccessible(true)
jconstr
}
- def apply(args: Any*): Any = jconstr.newInstance(args.asInstanceOf[Seq[AnyRef]]: _*)
+ def apply(args: Any*): Any = {
+ val effectiveArgs =
+ if (outer == null) args.asInstanceOf[Seq[AnyRef]]
+ else outer +: args.asInstanceOf[Seq[AnyRef]]
+ jconstr.newInstance(effectiveArgs: _*)
+ }
}
private abstract class JavaTemplateMirror
extends TemplateMirror {
+ def outer: AnyRef
def erasure: ClassSymbol
lazy val runtimeClass = classToJava(erasure)
lazy val signature = typeToScala(runtimeClass)
}
- private class JavaClassMirror(val symbol: ClassSymbol)
+ private class JavaClassMirror(val outer: AnyRef, val symbol: ClassSymbol)
extends JavaTemplateMirror with ClassMirror {
def erasure = symbol
def isStatic = false
- def reflectConstructor(constructor: MethodSymbol) = new JavaConstructorMirror(constructor)
+ def reflectConstructor(constructor: MethodSymbol) = new JavaConstructorMirror(outer, constructor)
def companion: Option[ModuleMirror] = symbol.companionModule match {
- case module: ModuleSymbol => Some(new JavaModuleMirror(module))
+ case module: ModuleSymbol => Some(new JavaModuleMirror(outer, module))
case _ => None
}
}
- private class JavaModuleMirror(val symbol: ModuleSymbol)
+ private class JavaModuleMirror(val outer: AnyRef, val symbol: ModuleSymbol)
extends JavaTemplateMirror with ModuleMirror {
def erasure = symbol.moduleClass.asClassSymbol
def isStatic = true
- def instance = singletonInstance(classLoader, symbol.fullName)
+ def instance = {
+ if (!symbol.owner.isPackageClass) throw new Error("inner and nested modules are not supported yet")
+ singletonInstance(classLoader, symbol.fullName)
+ }
def companion: Option[ClassMirror] = symbol.companionClass match {
- case cls: ClassSymbol => Some(new JavaClassMirror(cls))
+ case cls: ClassSymbol => Some(new JavaClassMirror(outer, cls))
case _ => None
}
}
@@ -929,7 +955,10 @@ trait JavaMirrors extends internal.SymbolTable with api.JavaUniverse { self: Sym
def constructorToJava(constr: MethodSymbol): jConstructor[_] = constructorCache.toJava(constr) {
val jclazz = classToJava(constr.owner.asClassSymbol)
val paramClasses = transformedType(constr).paramTypes map typeToJavaClass
- jclazz getConstructor (paramClasses: _*)
+ val effectiveParamClasses =
+ if (!constr.owner.owner.isStaticOwner) jclazz.getEnclosingClass +: paramClasses
+ else paramClasses
+ jclazz getConstructor (effectiveParamClasses: _*)
}
private def jArrayClass(elemClazz: jClass[_]): jClass[_] = {
diff --git a/test/files/run/reflect-overload.scala b/test/files/run/reflect-overload.scala
index ea3767903c..870a200813 100644
--- a/test/files/run/reflect-overload.scala
+++ b/test/files/run/reflect-overload.scala
@@ -5,7 +5,7 @@ object Test extends App {
val s = "hello world"
val m = cm.reflect(s)
- val sc = m.reflectClass.symbol
+ val sc = m.symbol
val st = sc.asType
val meth = (st member newTermName("indexOf")).asTermSymbol
val IntType = definitions.IntClass.asType
diff --git a/test/files/run/reflection-constructormirror-inner-badpath.check b/test/files/run/reflection-constructormirror-inner-badpath.check
new file mode 100644
index 0000000000..28b936eca1
--- /dev/null
+++ b/test/files/run/reflection-constructormirror-inner-badpath.check
@@ -0,0 +1,2 @@
+this is an inner class, use reflectClass on an InstanceMirror to obtain its ClassMirror
+()
diff --git a/test/files/run/reflection-constructormirror-inner-badpath.scala b/test/files/run/reflection-constructormirror-inner-badpath.scala
new file mode 100644
index 0000000000..a42bedea83
--- /dev/null
+++ b/test/files/run/reflection-constructormirror-inner-badpath.scala
@@ -0,0 +1,32 @@
+import scala.reflect.runtime.universe._
+import scala.reflect.ClassTag
+
+class Foo{
+ case class R(
+ sales : Int,
+ name : String
+ )
+
+ def foo = {
+ val expectedType = implicitly[TypeTag[R]]
+ val classTag = implicitly[ClassTag[R]]
+ val cl = classTag.runtimeClass.getClassLoader
+ val cm = runtimeMirror(cl)
+ val constructor = expectedType.tpe.member( nme.CONSTRUCTOR ).asMethodSymbol
+ val sig = constructor.typeSignature
+ val sym = cm.classSymbol( classTag.runtimeClass )
+ try {
+ val cls = cm.reflectClass( sym )
+ cls.reflectConstructor( constructor )( 5,"test" ).asInstanceOf[R]
+ println("this indicates a failure")
+ } catch {
+ case ex: Throwable =>
+ println(ex.getMessage)
+ }
+ }
+
+}
+object Test extends App{
+ val foo = new Foo
+ println( foo.foo )
+} \ No newline at end of file
diff --git a/test/files/run/reflection-constructormirror-inner-good.check b/test/files/run/reflection-constructormirror-inner-good.check
new file mode 100644
index 0000000000..811ecb2e3f
--- /dev/null
+++ b/test/files/run/reflection-constructormirror-inner-good.check
@@ -0,0 +1 @@
+R(5,test)
diff --git a/test/files/run/reflection-constructormirror-inner-good.scala b/test/files/run/reflection-constructormirror-inner-good.scala
new file mode 100644
index 0000000000..c09f464b24
--- /dev/null
+++ b/test/files/run/reflection-constructormirror-inner-good.scala
@@ -0,0 +1,26 @@
+import scala.reflect.runtime.universe._
+import scala.reflect.ClassTag
+
+class Foo{
+ case class R(
+ sales : Int,
+ name : String
+ )
+
+ def foo = {
+ val expectedType = implicitly[TypeTag[R]]
+ val classTag = implicitly[ClassTag[R]]
+ val cl = classTag.runtimeClass.getClassLoader
+ val cm = runtimeMirror(cl)
+ val constructor = expectedType.tpe.member( nme.CONSTRUCTOR ).asMethodSymbol
+ val sig = constructor.typeSignature
+ val sym = cm.classSymbol( classTag.runtimeClass )
+ val cls = cm.reflect( this ).reflectClass( sym )
+ cls.reflectConstructor( constructor )( 5,"test" ).asInstanceOf[R]
+ }
+
+}
+object Test extends App{
+ val foo = new Foo
+ println( foo.foo )
+} \ No newline at end of file
diff --git a/test/files/run/reflection-constructormirror-nested-badpath.check b/test/files/run/reflection-constructormirror-nested-badpath.check
new file mode 100644
index 0000000000..9ceb603dc2
--- /dev/null
+++ b/test/files/run/reflection-constructormirror-nested-badpath.check
@@ -0,0 +1,2 @@
+this is a static class, use reflectClass on a RuntimeMirror to obtain its ClassMirror
+()
diff --git a/test/files/run/reflection-constructormirror-nested-badpath.scala b/test/files/run/reflection-constructormirror-nested-badpath.scala
new file mode 100644
index 0000000000..ece0044c61
--- /dev/null
+++ b/test/files/run/reflection-constructormirror-nested-badpath.scala
@@ -0,0 +1,32 @@
+import scala.reflect.runtime.universe._
+import scala.reflect.ClassTag
+
+class Foo{
+ import Test._
+ def foo = {
+ val expectedType = implicitly[TypeTag[R]]
+ val classTag = implicitly[ClassTag[R]]
+ val cl = classTag.runtimeClass.getClassLoader
+ val cm = runtimeMirror(cl)
+ val constructor = expectedType.tpe.member( nme.CONSTRUCTOR ).asMethodSymbol
+ val sig = constructor.typeSignature
+ val sym = cm.classSymbol( classTag.runtimeClass )
+ try {
+ val cls = cm.reflect( this ).reflectClass( sym )
+ cls.reflectConstructor( constructor )( 5,"test" ).asInstanceOf[R]
+ println("this indicates a failure")
+ } catch {
+ case ex: Throwable =>
+ println(ex.getMessage)
+ }
+ }
+
+}
+object Test extends App{
+ case class R(
+ sales : Int,
+ name : String
+ )
+ val foo = new Foo
+ println( foo.foo )
+} \ No newline at end of file
diff --git a/test/files/run/reflection-constructormirror-nested-good.check b/test/files/run/reflection-constructormirror-nested-good.check
new file mode 100644
index 0000000000..811ecb2e3f
--- /dev/null
+++ b/test/files/run/reflection-constructormirror-nested-good.check
@@ -0,0 +1 @@
+R(5,test)
diff --git a/test/files/run/reflection-constructormirror-nested-good.scala b/test/files/run/reflection-constructormirror-nested-good.scala
new file mode 100644
index 0000000000..432e9d3707
--- /dev/null
+++ b/test/files/run/reflection-constructormirror-nested-good.scala
@@ -0,0 +1,26 @@
+import scala.reflect.runtime.universe._
+import scala.reflect.ClassTag
+
+class Foo{
+ import Test._
+ def foo = {
+ val expectedType = implicitly[TypeTag[R]]
+ val classTag = implicitly[ClassTag[R]]
+ val cl = classTag.runtimeClass.getClassLoader
+ val cm = runtimeMirror(cl)
+ val constructor = expectedType.tpe.member( nme.CONSTRUCTOR ).asMethodSymbol
+ val sig = constructor.typeSignature
+ val sym = cm.classSymbol( classTag.runtimeClass )
+ val cls = cm.reflectClass( sym )
+ cls.reflectConstructor( constructor )( 5,"test" ).asInstanceOf[R]
+ }
+}
+
+object Test extends App{
+ case class R(
+ sales : Int,
+ name : String
+ )
+ val foo = new Foo
+ println( foo.foo )
+} \ No newline at end of file
diff --git a/test/files/run/reflection-constructormirror-toplevel-badpath.check b/test/files/run/reflection-constructormirror-toplevel-badpath.check
new file mode 100644
index 0000000000..9ceb603dc2
--- /dev/null
+++ b/test/files/run/reflection-constructormirror-toplevel-badpath.check
@@ -0,0 +1,2 @@
+this is a static class, use reflectClass on a RuntimeMirror to obtain its ClassMirror
+()
diff --git a/test/files/run/reflection-constructormirror-toplevel-badpath.scala b/test/files/run/reflection-constructormirror-toplevel-badpath.scala
new file mode 100644
index 0000000000..7a7adbd603
--- /dev/null
+++ b/test/files/run/reflection-constructormirror-toplevel-badpath.scala
@@ -0,0 +1,33 @@
+import scala.reflect.runtime.universe._
+import scala.reflect.ClassTag
+
+case class R(
+ sales : Int,
+ name : String
+)
+
+class Foo{
+ import Test._
+ def foo = {
+ val expectedType = implicitly[TypeTag[R]]
+ val classTag = implicitly[ClassTag[R]]
+ val cl = classTag.runtimeClass.getClassLoader
+ val cm = runtimeMirror(cl)
+ val constructor = expectedType.tpe.member( nme.CONSTRUCTOR ).asMethodSymbol
+ val sig = constructor.typeSignature
+ val sym = cm.classSymbol( classTag.runtimeClass )
+ try {
+ val cls = cm.reflect( this ).reflectClass( sym )
+ cls.reflectConstructor( constructor )( 5,"test" ).asInstanceOf[R]
+ println("this indicates a failure")
+ } catch {
+ case ex: Throwable =>
+ println(ex.getMessage)
+ }
+ }
+}
+
+object Test extends App{
+ val foo = new Foo
+ println( foo.foo )
+} \ No newline at end of file
diff --git a/test/files/run/reflection-constructormirror-toplevel-good.check b/test/files/run/reflection-constructormirror-toplevel-good.check
new file mode 100644
index 0000000000..811ecb2e3f
--- /dev/null
+++ b/test/files/run/reflection-constructormirror-toplevel-good.check
@@ -0,0 +1 @@
+R(5,test)
diff --git a/test/files/run/reflection-constructormirror-toplevel-good.scala b/test/files/run/reflection-constructormirror-toplevel-good.scala
new file mode 100644
index 0000000000..96713a11cb
--- /dev/null
+++ b/test/files/run/reflection-constructormirror-toplevel-good.scala
@@ -0,0 +1,27 @@
+import scala.reflect.runtime.universe._
+import scala.reflect.ClassTag
+
+case class R(
+ sales : Int,
+ name : String
+)
+
+class Foo{
+ import Test._
+ def foo = {
+ val expectedType = implicitly[TypeTag[R]]
+ val classTag = implicitly[ClassTag[R]]
+ val cl = classTag.runtimeClass.getClassLoader
+ val cm = runtimeMirror(cl)
+ val constructor = expectedType.tpe.member( nme.CONSTRUCTOR ).asMethodSymbol
+ val sig = constructor.typeSignature
+ val sym = cm.classSymbol( classTag.runtimeClass )
+ val cls = cm.reflectClass( sym )
+ cls.reflectConstructor( constructor )( 5,"test" ).asInstanceOf[R]
+ }
+}
+
+object Test extends App{
+ val foo = new Foo
+ println( foo.foo )
+} \ No newline at end of file
diff --git a/test/files/run/reflection-fieldmirror-ctorparam.scala b/test/files/run/reflection-fieldmirror-ctorparam.scala
index 286399072e..fa9dd81d7f 100644
--- a/test/files/run/reflection-fieldmirror-ctorparam.scala
+++ b/test/files/run/reflection-fieldmirror-ctorparam.scala
@@ -9,7 +9,7 @@ object Test extends App {
val a = new A(42)
val im: InstanceMirror = cm.reflect(a)
- val cs = im.reflectClass.symbol
+ val cs = im.symbol
val f = cs.typeSignature.declaration(newTermName("x")).asTermSymbol
try {
val fm: FieldMirror = im.reflectField(f)
diff --git a/test/files/run/reflection-fieldmirror-getsetval.scala b/test/files/run/reflection-fieldmirror-getsetval.scala
index aeae66b422..af9a6e4c56 100644
--- a/test/files/run/reflection-fieldmirror-getsetval.scala
+++ b/test/files/run/reflection-fieldmirror-getsetval.scala
@@ -9,7 +9,7 @@ object Test extends App {
val a = new A
val im: InstanceMirror = cm.reflect(a)
- val cs = im.reflectClass.symbol
+ val cs = im.symbol
val f = cs.typeSignature.declaration(newTermName("x" + nme.LOCAL_SUFFIX_STRING)).asTermSymbol
val fm: FieldMirror = im.reflectField(f)
try {
diff --git a/test/files/run/reflection-fieldmirror-getsetvar.scala b/test/files/run/reflection-fieldmirror-getsetvar.scala
index 99ecc8996c..d9fbdaade0 100644
--- a/test/files/run/reflection-fieldmirror-getsetvar.scala
+++ b/test/files/run/reflection-fieldmirror-getsetvar.scala
@@ -9,7 +9,7 @@ object Test extends App {
val a = new A
val im: InstanceMirror = cm.reflect(a)
- val cs = im.reflectClass.symbol
+ val cs = im.symbol
val f = cs.typeSignature.declaration(newTermName("x" + nme.LOCAL_SUFFIX_STRING)).asTermSymbol
val fm: FieldMirror = im.reflectField(f)
println(fm.get)
diff --git a/test/files/run/reflection-fieldmirror-nmelocalsuffixstring.scala b/test/files/run/reflection-fieldmirror-nmelocalsuffixstring.scala
index 9dca7b452c..d89e6a90ef 100644
--- a/test/files/run/reflection-fieldmirror-nmelocalsuffixstring.scala
+++ b/test/files/run/reflection-fieldmirror-nmelocalsuffixstring.scala
@@ -9,8 +9,8 @@ object Test extends App {
val a = new A
val im: InstanceMirror = cm.reflect(a)
- val cs = im.reflectClass.symbol
+ val cs = im.symbol
val f = cs.typeSignature.declaration(newTermName("x" + nme.LOCAL_SUFFIX_STRING)).asTermSymbol
val fm: FieldMirror = im.reflectField(f)
- println(fm.field.isVariable)
+ println(fm.symbol.isVariable)
}
diff --git a/test/files/run/reflection-fieldmirror-privatethis.scala b/test/files/run/reflection-fieldmirror-privatethis.scala
index 844822d449..0c415e09e4 100644
--- a/test/files/run/reflection-fieldmirror-privatethis.scala
+++ b/test/files/run/reflection-fieldmirror-privatethis.scala
@@ -9,10 +9,10 @@ object Test extends App {
val a = new A
val im: InstanceMirror = cm.reflect(a)
- val cs = im.reflectClass.symbol
+ val cs = im.symbol
val f = cs.typeSignature.declaration(newTermName("x")).asTermSymbol
val fm: FieldMirror = im.reflectField(f)
- println(fm.field.isVariable)
+ println(fm.symbol.isVariable)
println(fm.get)
fm.set(2)
println(fm.get)
diff --git a/test/files/run/reflection-fieldmirror-sanitycheck.scala b/test/files/run/reflection-fieldmirror-sanitycheck.scala
index abd4cf57c5..6a992dd282 100644
--- a/test/files/run/reflection-fieldmirror-sanitycheck.scala
+++ b/test/files/run/reflection-fieldmirror-sanitycheck.scala
@@ -9,7 +9,7 @@ object Test extends App {
val a = new A
val im: InstanceMirror = cm.reflect(a)
- val cs = im.reflectClass.symbol
+ val cs = im.symbol
//val f = cs.typeSignature.declaration(newTermName("x" + nme.LOCAL_SUFFIX_STRING)).asTermSymbol
val f = cs.typeSignature.declaration(newTermName("x")).asTermSymbol
try {
diff --git a/test/files/run/reflection-implClass.scala b/test/files/run/reflection-implClass.scala
index 91288562f4..b3c0081ccf 100644
--- a/test/files/run/reflection-implClass.scala
+++ b/test/files/run/reflection-implClass.scala
@@ -10,8 +10,8 @@ object Test extends App with Outer {
import scala.reflect.runtime.universe._
import scala.reflect.runtime.{currentMirror => cm}
- assert(cm.reflectClass(classTag[Foo].runtimeClass).symbol.typeSignature.declaration(newTermName("bar")).typeSignature ==
- cm.reflectClass(classTag[Bar].runtimeClass).symbol.typeSignature.declaration(newTermName("foo")).typeSignature)
+ assert(cm.classSymbol(classTag[Foo].runtimeClass).typeSignature.declaration(newTermName("bar")).typeSignature ==
+ cm.classSymbol(classTag[Bar].runtimeClass).typeSignature.declaration(newTermName("foo")).typeSignature)
val s1 = implClass(classTag[Foo].runtimeClass)
assert(s1 != NoSymbol)
@@ -25,7 +25,7 @@ object Test extends App with Outer {
assert(s2.companionSymbol.typeSignature.declaration(newTermName("foo")) != NoSymbol)
def implClass(clazz: Class[_]) = {
val implClass = Class.forName(clazz.getName + "$class")
- cm.reflectClass(implClass).symbol
+ cm.classSymbol(implClass)
}
}
diff --git a/test/files/run/reflection-modulemirror-inner-badpath.check b/test/files/run/reflection-modulemirror-inner-badpath.check
new file mode 100644
index 0000000000..d3fe43336e
--- /dev/null
+++ b/test/files/run/reflection-modulemirror-inner-badpath.check
@@ -0,0 +1,2 @@
+this is an inner module, use reflectModule on an InstanceMirror to obtain its ModuleMirror
+()
diff --git a/test/files/run/reflection-modulemirror-inner-badpath.scala b/test/files/run/reflection-modulemirror-inner-badpath.scala
new file mode 100644
index 0000000000..de200c548b
--- /dev/null
+++ b/test/files/run/reflection-modulemirror-inner-badpath.scala
@@ -0,0 +1,24 @@
+import scala.reflect.runtime.universe._
+import scala.reflect.runtime.{currentMirror => cm}
+import scala.reflect.ClassTag
+
+class Foo{
+ object R { override def toString = "R" }
+ def foo = {
+ val classTag = implicitly[ClassTag[R.type]]
+ val sym = cm.moduleSymbol(classTag.runtimeClass)
+ try {
+ val cls = cm.reflectModule(sym)
+ cls.instance
+ println("this indicates a failure")
+ } catch {
+ case ex: Throwable =>
+ println(ex.getMessage)
+ }
+ }
+}
+
+object Test extends App{
+ val foo = new Foo
+ println(foo.foo)
+} \ No newline at end of file
diff --git a/test/files/run/reflection-modulemirror-inner-good.check b/test/files/run/reflection-modulemirror-inner-good.check
new file mode 100644
index 0000000000..0bf38a73d1
--- /dev/null
+++ b/test/files/run/reflection-modulemirror-inner-good.check
@@ -0,0 +1,2 @@
+inner and nested modules are not supported yet
+()
diff --git a/test/files/run/reflection-modulemirror-inner-good.scala b/test/files/run/reflection-modulemirror-inner-good.scala
new file mode 100644
index 0000000000..b5540dbe1c
--- /dev/null
+++ b/test/files/run/reflection-modulemirror-inner-good.scala
@@ -0,0 +1,23 @@
+import scala.reflect.runtime.universe._
+import scala.reflect.runtime.{currentMirror => cm}
+import scala.reflect.ClassTag
+
+class Foo{
+ object R { override def toString = "R" }
+ def foo = {
+ val classTag = implicitly[ClassTag[R.type]]
+ val sym = cm.moduleSymbol(classTag.runtimeClass)
+ val cls = cm.reflect(this).reflectModule(sym)
+ try {
+ cls.instance
+ } catch {
+ case ex: Throwable =>
+ println(ex.getMessage)
+ }
+ }
+}
+
+object Test extends App{
+ val foo = new Foo
+ println(foo.foo)
+} \ No newline at end of file
diff --git a/test/files/run/reflection-modulemirror-nested-badpath.check b/test/files/run/reflection-modulemirror-nested-badpath.check
new file mode 100644
index 0000000000..16a5b10390
--- /dev/null
+++ b/test/files/run/reflection-modulemirror-nested-badpath.check
@@ -0,0 +1,2 @@
+this is a static module, use reflectModule on a RuntimeMirror to obtain its ModuleMirror
+()
diff --git a/test/files/run/reflection-modulemirror-nested-badpath.scala b/test/files/run/reflection-modulemirror-nested-badpath.scala
new file mode 100644
index 0000000000..43cae00f9c
--- /dev/null
+++ b/test/files/run/reflection-modulemirror-nested-badpath.scala
@@ -0,0 +1,26 @@
+import scala.reflect.runtime.universe._
+import scala.reflect.runtime.{currentMirror => cm}
+import scala.reflect.ClassTag
+
+class Foo{
+ import Test._
+ def foo = {
+ val classTag = implicitly[ClassTag[R.type]]
+ val sym = cm.moduleSymbol(classTag.runtimeClass)
+ try {
+ val cls = cm.reflect(this).reflectModule(sym)
+ cls.instance
+ println("this indicates a failure")
+ } catch {
+ case ex: Throwable =>
+ println(ex.getMessage)
+ }
+ }
+
+}
+
+object Test extends App{
+ object R { override def toString = "R" }
+ val foo = new Foo
+ println(foo.foo)
+}
diff --git a/test/files/run/reflection-modulemirror-nested-good.check b/test/files/run/reflection-modulemirror-nested-good.check
new file mode 100644
index 0000000000..0bf38a73d1
--- /dev/null
+++ b/test/files/run/reflection-modulemirror-nested-good.check
@@ -0,0 +1,2 @@
+inner and nested modules are not supported yet
+()
diff --git a/test/files/run/reflection-modulemirror-nested-good.scala b/test/files/run/reflection-modulemirror-nested-good.scala
new file mode 100644
index 0000000000..8390bbaac7
--- /dev/null
+++ b/test/files/run/reflection-modulemirror-nested-good.scala
@@ -0,0 +1,24 @@
+import scala.reflect.runtime.universe._
+import scala.reflect.runtime.{currentMirror => cm}
+import scala.reflect.ClassTag
+
+class Foo{
+ import Test._
+ def foo = {
+ val classTag = implicitly[ClassTag[R.type]]
+ val sym = cm.moduleSymbol(classTag.runtimeClass)
+ val cls = cm.reflectModule(sym)
+ try {
+ cls.instance
+ } catch {
+ case ex: Throwable =>
+ println(ex.getMessage)
+ }
+ }
+}
+
+object Test extends App{
+ object R { override def toString = "R" }
+ val foo = new Foo
+ println(foo.foo)
+} \ No newline at end of file
diff --git a/test/files/run/reflection-modulemirror-toplevel-badpath.check b/test/files/run/reflection-modulemirror-toplevel-badpath.check
new file mode 100644
index 0000000000..16a5b10390
--- /dev/null
+++ b/test/files/run/reflection-modulemirror-toplevel-badpath.check
@@ -0,0 +1,2 @@
+this is a static module, use reflectModule on a RuntimeMirror to obtain its ModuleMirror
+()
diff --git a/test/files/run/reflection-modulemirror-toplevel-badpath.scala b/test/files/run/reflection-modulemirror-toplevel-badpath.scala
new file mode 100644
index 0000000000..8b2994cabb
--- /dev/null
+++ b/test/files/run/reflection-modulemirror-toplevel-badpath.scala
@@ -0,0 +1,26 @@
+import scala.reflect.runtime.universe._
+import scala.reflect.runtime.{currentMirror => cm}
+import scala.reflect.ClassTag
+
+object R { override def toString = "R" }
+
+class Foo{
+ import Test._
+ def foo = {
+ val classTag = implicitly[ClassTag[R.type]]
+ val sym = cm.moduleSymbol(classTag.runtimeClass)
+ try {
+ val cls = cm.reflect(this).reflectModule(sym)
+ cls.instance
+ println("this indicates a failure")
+ } catch {
+ case ex: Throwable =>
+ println(ex.getMessage)
+ }
+ }
+}
+
+object Test extends App{
+ val foo = new Foo
+ println(foo.foo)
+} \ No newline at end of file
diff --git a/test/files/run/reflection-modulemirror-toplevel-good.check b/test/files/run/reflection-modulemirror-toplevel-good.check
new file mode 100644
index 0000000000..ac044e5e46
--- /dev/null
+++ b/test/files/run/reflection-modulemirror-toplevel-good.check
@@ -0,0 +1 @@
+R \ No newline at end of file
diff --git a/test/files/run/reflection-modulemirror-toplevel-good.scala b/test/files/run/reflection-modulemirror-toplevel-good.scala
new file mode 100644
index 0000000000..0663136a22
--- /dev/null
+++ b/test/files/run/reflection-modulemirror-toplevel-good.scala
@@ -0,0 +1,20 @@
+import scala.reflect.runtime.universe._
+import scala.reflect.runtime.{currentMirror => cm}
+import scala.reflect.ClassTag
+
+object R { override def toString = "R" }
+
+class Foo{
+ import Test._
+ def foo = {
+ val classTag = implicitly[ClassTag[R.type]]
+ val sym = cm.moduleSymbol(classTag.runtimeClass)
+ val cls = cm.reflectModule(sym)
+ cls.instance
+ }
+}
+
+object Test extends App{
+ val foo = new Foo
+ println(foo.foo)
+} \ No newline at end of file
diff --git a/test/files/run/reflection-simple.scala b/test/files/run/reflection-simple.scala
index 152d8c4505..ec34b71cec 100644
--- a/test/files/run/reflection-simple.scala
+++ b/test/files/run/reflection-simple.scala
@@ -6,7 +6,7 @@ object Test {
System.out.println("Running")
case class Foo(a: Int, b: Int, c: Int)
import scala.reflect.runtime.{currentMirror => cm}
- val props = cm.reflectClass(classOf[Foo]).symbol.typeSignature.members.filter(_.isTerm).map(_.toString)
+ val props = cm.classSymbol(classOf[Foo]).typeSignature.members.filter(_.isTerm).map(_.toString)
props.toList.sorted foreach System.out.println
}
}
diff --git a/test/files/run/t5256a.scala b/test/files/run/t5256a.scala
index e3d22f8a93..84ef97b0d2 100644
--- a/test/files/run/t5256a.scala
+++ b/test/files/run/t5256a.scala
@@ -4,7 +4,7 @@ import scala.reflect.runtime.{currentMirror => cm}
class A { def foo = ??? }
object Test extends App {
- val c = cm.reflectClass(classOf[A]).symbol
+ val c = cm.classSymbol(classOf[A])
println(c)
println(c.fullName)
println(c.typeSignature)
diff --git a/test/files/run/t5256b.scala b/test/files/run/t5256b.scala
index fedec6323d..0ffab8a668 100644
--- a/test/files/run/t5256b.scala
+++ b/test/files/run/t5256b.scala
@@ -3,7 +3,7 @@ import scala.reflect.runtime.{currentMirror => cm}
object Test extends App {
class A { def foo = ??? }
- val c = cm.reflectClass(classOf[A]).symbol
+ val c = cm.classSymbol(classOf[A])
println(c)
println(c.fullName)
println(c.typeSignature)
diff --git a/test/files/run/t5256c.scala b/test/files/run/t5256c.scala
index a8a3323443..d56215f6eb 100644
--- a/test/files/run/t5256c.scala
+++ b/test/files/run/t5256c.scala
@@ -4,7 +4,7 @@ import scala.reflect.runtime.{currentMirror => cm}
object Test extends App {
{
class A { def foo = ??? }
- val c = cm.reflectClass(classOf[A]).symbol
+ val c = cm.classSymbol(classOf[A])
println(c)
println(c.fullName)
println(c.typeSignature)
diff --git a/test/files/run/t5256d.check b/test/files/run/t5256d.check
index e466e1e2e8..dd32c05a93 100644
--- a/test/files/run/t5256d.check
+++ b/test/files/run/t5256d.check
@@ -12,7 +12,7 @@ import scala.reflect.runtime.{currentMirror=>cm}
scala> class A { def foo = ??? }
defined class A
-scala> val c = cm.reflectClass(classOf[A]).symbol
+scala> val c = cm.classSymbol(classOf[A])
c: reflect.runtime.universe.ClassSymbol = class A
scala> println(c)
diff --git a/test/files/run/t5256d.scala b/test/files/run/t5256d.scala
index 574013f444..24ac1eb316 100644
--- a/test/files/run/t5256d.scala
+++ b/test/files/run/t5256d.scala
@@ -5,7 +5,7 @@ object Test extends ReplTest {
import scala.reflect.runtime.universe._
import scala.reflect.runtime.{currentMirror => cm}
class A { def foo = ??? }
-val c = cm.reflectClass(classOf[A]).symbol
+val c = cm.classSymbol(classOf[A])
println(c)
println(c.fullName)
println(c.typeSignature)
diff --git a/test/files/run/t5256e.check b/test/files/run/t5256e.check
index 20ea35c74d..6c6de90acc 100644
--- a/test/files/run/t5256e.check
+++ b/test/files/run/t5256e.check
@@ -1,6 +1,6 @@
-class A
-Test.C.A
+class A
+Test.C.A
Object {
def <init>: <?>
def foo: <?>
-}
+}
diff --git a/test/files/run/t5256e.scala b/test/files/run/t5256e.scala
index 32031f919a..f83546f2c0 100644
--- a/test/files/run/t5256e.scala
+++ b/test/files/run/t5256e.scala
@@ -3,7 +3,7 @@ import scala.reflect.runtime.{currentMirror => cm}
object Test extends App {
class C { class A { def foo = ??? } }
- val c = cm.reflectClass(classOf[C#A]).symbol
+ val c = cm.classSymbol(classOf[C#A])
println(c)
println(c.fullName)
println(c.typeSignature)
diff --git a/test/files/run/t5256f.check b/test/files/run/t5256f.check
index 7a58aa003d..c840793fd5 100644
--- a/test/files/run/t5256f.check
+++ b/test/files/run/t5256f.check
@@ -1,12 +1,12 @@
-class A1
-Test.A1
+class A1
+Test.A1
Object {
def <init>: <?>
def foo: <?>
-}
-class A2
-Test.A2
+}
+class A2
+Test.A2
Object {
def <init>: <?>
def foo: <?>
-}
+}
diff --git a/test/files/run/t5256f.scala b/test/files/run/t5256f.scala
index 072f927abc..80c7ad8018 100644
--- a/test/files/run/t5256f.scala
+++ b/test/files/run/t5256f.scala
@@ -4,7 +4,7 @@ import scala.reflect.runtime.{currentMirror => cm}
object Test extends App {
class A1 { def foo = ??? }
- val c1 = cm.reflectClass(classOf[A1]).symbol
+ val c1 = cm.classSymbol(classOf[A1])
println(c1)
println(c1.fullName)
println(c1.typeSignature)
@@ -15,7 +15,7 @@ object Test extends App {
class Test {
class A2 { def foo = ??? }
- val c2 = cm.reflectClass(classOf[A2]).symbol
+ val c2 = cm.classSymbol(classOf[A2])
println(c2)
println(c2.fullName)
println(c2.typeSignature)
diff --git a/test/files/run/t5256g.scala b/test/files/run/t5256g.scala
index a4d81a28dc..358c18601a 100644
--- a/test/files/run/t5256g.scala
+++ b/test/files/run/t5256g.scala
@@ -6,7 +6,7 @@ trait B
object Test extends App {
val mutant = new A with B
- val c = cm.reflectClass(mutant.getClass).symbol
+ val c = cm.classSymbol(mutant.getClass)
println(c)
println(c.fullName)
println(c.typeSignature)
diff --git a/test/files/run/t5256h.scala b/test/files/run/t5256h.scala
index 723d606a1e..fd4ffd9b12 100644
--- a/test/files/run/t5256h.scala
+++ b/test/files/run/t5256h.scala
@@ -3,7 +3,7 @@ import scala.reflect.runtime.{currentMirror => cm}
object Test extends App {
val mutant = new { val x = 2 }
- val c = cm.reflectClass(mutant.getClass).symbol
+ val c = cm.classSymbol(mutant.getClass)
println(c)
println(c.fullName)
println(c.typeSignature)
diff --git a/test/files/run/t5423.scala b/test/files/run/t5423.scala
index 9c73ed0bef..9b8ba090fa 100644
--- a/test/files/run/t5423.scala
+++ b/test/files/run/t5423.scala
@@ -6,6 +6,6 @@ final class table extends annotation.StaticAnnotation
@table class A
object Test extends App {
- val s = cm.reflectClass(classOf[A]).symbol
+ val s = cm.classSymbol(classOf[A])
println(s.getAnnotations)
} \ No newline at end of file