summaryrefslogtreecommitdiff
path: root/test/files/run/reflection-implClass.scala
diff options
context:
space:
mode:
authorPaul Phillips <paulp@improving.org>2012-02-05 09:49:30 -0800
committerPaul Phillips <paulp@improving.org>2012-02-05 21:58:45 -0800
commit9d00ea8d389f4426f1f644e0a7f48e9ea380e9fc (patch)
treeda7f1c6a2fe12dcffe372b5165b19abc58947d61 /test/files/run/reflection-implClass.scala
parent25c6d0a8bc23da696d76dd99ac670adb6eece2c3 (diff)
downloadscala-9d00ea8d389f4426f1f644e0a7f48e9ea380e9fc.tar.gz
scala-9d00ea8d389f4426f1f644e0a7f48e9ea380e9fc.tar.bz2
scala-9d00ea8d389f4426f1f644e0a7f48e9ea380e9fc.zip
Refining the reflection api.
In the pursuit of simplicity and consistency. - Method names like getType, getClass, and getValue are far too ambiguous, both internally and especially with java reflection names. Methods which accept or return scala symbols should not refer to them as "classes" in the reflection library. (We can live with the FooClass convention for naming the well-known symbols, it's names like "getClass" and "classToType" which are needlessly conflationary.) - Meaningless names like "subst" have to be expanded. - We should hew closely to the terms which are used by scala programmers wherever possible, thus using "thisType" to mean "C.this" can only beget confusion, given that "thisType" doesn't mean "this.type" but what is normally called the "self type." - It's either "enclosing" or "encl", not both, and similar consistency issues. - Eliminated getAnnotations. - Removed what I could get away with from the API; would like to push those which are presently justified as being "required for LiftCode" out of the core. - Changed a number of AnyRefs to Any both on general principles and because before long it may actually matter. - There are !!!s scattered all over this commit, mostly where I think the name could be better. - I think we should standardize on method names like "vmSignature, vmClass" etc. when we are talking about jvm (and ostensibly other vm) things. There are a bunch more places to make this distinction clear (e.g. Symbol's javaBinaryName, etc.) - There is a lot more I want to do on this and I don't know where the time will come from to do it. Review by @odersky, @scalamacros.
Diffstat (limited to 'test/files/run/reflection-implClass.scala')
-rw-r--r--test/files/run/reflection-implClass.scala16
1 files changed, 8 insertions, 8 deletions
diff --git a/test/files/run/reflection-implClass.scala b/test/files/run/reflection-implClass.scala
index 2b30e29bb3..7718b52f33 100644
--- a/test/files/run/reflection-implClass.scala
+++ b/test/files/run/reflection-implClass.scala
@@ -8,19 +8,19 @@
object Test extends App with Outer {
import scala.reflect.mirror
- assert(mirror.classToSymbol(manifest[Foo].erasure).typeSig.declaration(mirror.newTermName("bar")).typeSig ==
- mirror.classToSymbol(manifest[Bar].erasure).typeSig.declaration(mirror.newTermName("foo")).typeSig)
+ assert(mirror.classToSymbol(manifest[Foo].erasure).typeSignature.declaration(mirror.newTermName("bar")).typeSignature ==
+ mirror.classToSymbol(manifest[Bar].erasure).typeSignature.declaration(mirror.newTermName("foo")).typeSignature)
val s1 = implClass(manifest[Foo].erasure)
assert(s1 != mirror.NoSymbol)
- assert(s1.typeSig != mirror.NoType)
- assert(s1.companionModule.typeSig != mirror.NoType)
- assert(s1.companionModule.typeSig.declaration(mirror.newTermName("bar")) != mirror.NoSymbol)
+ assert(s1.typeSignature != mirror.NoType)
+ assert(s1.companionSymbol.typeSignature != mirror.NoType)
+ assert(s1.companionSymbol.typeSignature.declaration(mirror.newTermName("bar")) != mirror.NoSymbol)
val s2 = implClass(manifest[Bar].erasure)
assert(s2 != mirror.NoSymbol)
- assert(s2.typeSig != mirror.NoType)
- assert(s2.companionModule.typeSig != mirror.NoType)
- assert(s2.companionModule.typeSig.declaration(mirror.newTermName("foo")) != mirror.NoSymbol)
+ assert(s2.typeSignature != mirror.NoType)
+ assert(s2.companionSymbol.typeSignature != mirror.NoType)
+ assert(s2.companionSymbol.typeSignature.declaration(mirror.newTermName("foo")) != mirror.NoSymbol)
def implClass(clazz: Class[_]) = {
val implClass = Class.forName(clazz.getName + "$class")
mirror.classToSymbol(implClass)