diff options
author | Eugene Burmako <xeno.by@gmail.com> | 2012-10-03 23:28:16 +0200 |
---|---|---|
committer | Eugene Burmako <xeno.by@gmail.com> | 2012-10-04 07:34:47 +0200 |
commit | cfae88959153996c25ba1a93f2456e3e4912194c (patch) | |
tree | 9803bf8104e81ec09dd1d7d3db13f486511ac674 | |
parent | c868038423b5c28234e66788158e379754ed47b3 (diff) | |
download | scala-cfae88959153996c25ba1a93f2456e3e4912194c.tar.gz scala-cfae88959153996c25ba1a93f2456e3e4912194c.tar.bz2 scala-cfae88959153996c25ba1a93f2456e3e4912194c.zip |
introduces api.JavaMirrors
This trait carries mirror-related changes of the API that happen
when api.Universe transforms into api.JavaUniverse.
From a coding standpoint this is a mere rehashing of the code, but
from a documentation standpoint this provides additional insights
into what's going on in reflection.
-rw-r--r-- | src/reflect/scala/reflect/api/JavaMirrors.scala | 16 | ||||
-rw-r--r-- | src/reflect/scala/reflect/api/JavaUniverse.scala | 13 |
2 files changed, 17 insertions, 12 deletions
diff --git a/src/reflect/scala/reflect/api/JavaMirrors.scala b/src/reflect/scala/reflect/api/JavaMirrors.scala new file mode 100644 index 0000000000..cb0fa0f650 --- /dev/null +++ b/src/reflect/scala/reflect/api/JavaMirrors.scala @@ -0,0 +1,16 @@ +package scala.reflect +package api + +trait JavaMirrors { self: JavaUniverse => + + type RuntimeClass = java.lang.Class[_] + + override type Mirror >: Null <: JavaMirror + + trait JavaMirror extends scala.reflect.api.Mirror[self.type] with RuntimeMirror { + val classLoader: ClassLoader + override def toString = s"JavaMirror with ${runtime.ReflectionUtils.show(classLoader)}" + } + + def runtimeMirror(cl: ClassLoader): Mirror +} diff --git a/src/reflect/scala/reflect/api/JavaUniverse.scala b/src/reflect/scala/reflect/api/JavaUniverse.scala index cc703e833d..1a8a02776b 100644 --- a/src/reflect/scala/reflect/api/JavaUniverse.scala +++ b/src/reflect/scala/reflect/api/JavaUniverse.scala @@ -1,18 +1,7 @@ package scala.reflect package api -trait JavaUniverse extends Universe with Mirrors { self => - - type RuntimeClass = java.lang.Class[_] - - override type Mirror >: Null <: JavaMirror - - trait JavaMirror extends scala.reflect.api.Mirror[self.type] with RuntimeMirror { - val classLoader: ClassLoader - override def toString = s"JavaMirror with ${runtime.ReflectionUtils.show(classLoader)}" - } - - def runtimeMirror(cl: ClassLoader): Mirror +trait JavaUniverse extends Universe with JavaMirrors { self => override def typeTagToManifest[T: ClassTag](mirror0: Any, tag: Universe # TypeTag[T]): Manifest[T] = { // SI-6239: make this conversion more precise |