1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
|
package scala
package object reflect {
import ReflectionUtils._
import scala.compat.Platform.EOL
// !!! This was a val; we can't throw exceptions that aggressively without breaking
// non-standard environments, e.g. google app engine. I made it a lazy val, but
// I think it would be better yet to throw the exception somewhere else - not during
// initialization, but in response to a doomed attempt to utilize it.
// todo. default mirror (a static object) might become a source for memory leaks (because it holds a strong reference to a classloader)!
lazy val mirror: api.Mirror = mkMirror(defaultReflectionClassLoader)
private def mirrorDiagnostics(cl: ClassLoader): String = """
|
| This error has happened because `scala.reflect.runtime.package` located in
| scala-compiler.jar cannot be loaded. Classloader you are using is:
| %s.
|
| In Scala 2.10.0 M3, scala-compiler.jar is required to be on the classpath
| for manifests and type tags to function. This will change in the final release,
| but for now you need to adjust your scripts or the build system to proceed.
|
| For the instructions for some of the situations that might be relevant
| visit our knowledge base at https://gist.github.com/2391081.
""".stripMargin('|').format(show(cl))
def mkMirror(classLoader: ClassLoader): api.Mirror = {
val coreClassLoader = getClass.getClassLoader
val instance = invokeFactoryOpt(coreClassLoader, "scala.reflect.runtime.package", "mkMirror", classLoader)
instance match {
case Some(x: api.Mirror) => x
case Some(_) => throw new UnsupportedOperationException("Available scala reflection implementation is incompatible with this interface." + mirrorDiagnostics(coreClassLoader))
case None => throw new UnsupportedOperationException("Scala reflection not available on this platform." + mirrorDiagnostics(coreClassLoader))
}
}
@deprecated("Use `@scala.beans.BeanDescription` instead", "2.10.0")
type BeanDescription = scala.beans.BeanDescription
@deprecated("Use `@scala.beans.BeanDisplayName` instead", "2.10.0")
type BeanDisplayName = scala.beans.BeanDisplayName
@deprecated("Use `@scala.beans.BeanInfo` instead", "2.10.0")
type BeanInfo = scala.beans.BeanInfo
@deprecated("Use `@scala.beans.BeanInfoSkip` instead", "2.10.0")
type BeanInfoSkip = scala.beans.BeanInfoSkip
@deprecated("Use `@scala.beans.BeanProperty` instead", "2.10.0")
type BeanProperty = scala.beans.BeanProperty
@deprecated("Use `@scala.beans.BooleanBeanProperty` instead", "2.10.0")
type BooleanBeanProperty = scala.beans.BooleanBeanProperty
@deprecated("Use `@scala.beans.ScalaBeanInfo` instead", "2.10.0")
type ScalaBeanInfo = scala.beans.ScalaBeanInfo
@deprecated("Use `@scala.reflect.ClassTag` instead", "2.10.0")
type ClassManifest[T] = ClassTag[T]
@deprecated("OptManifest is no longer supported, and using it may lead to incorrect results, Use `@scala.reflect.TypeTag` instead", "2.10.0")
type OptManifest[T] = TypeTag[T]
@deprecated("Use `@scala.reflect.ConcreteTypeTag` instead", "2.10.0")
type Manifest[T] = ConcreteTypeTag[T]
@deprecated("Use `@scala.reflect.ClassTag` instead", "2.10.0")
val ClassManifest = ClassTag
@deprecated("Use `@scala.reflect.ConcreteTypeTag` instead", "2.10.0")
lazy val Manifest = ConcreteTypeTag
@deprecated("NoManifest is no longer supported, and using it may lead to incorrect results, Use `@scala.reflect.TypeTag` instead", "2.10.0")
object NoManifest extends OptManifest[Nothing](scala.reflect.mirror.TypeTag.Nothing.tpe)
// ClassTag class is defined separately from the mirror
type TypeTag[T] = scala.reflect.mirror.TypeTag[T]
type ConcreteTypeTag[T] = scala.reflect.mirror.ConcreteTypeTag[T]
// ClassTag object is defined separately from the mirror
lazy val TypeTag = scala.reflect.mirror.TypeTag
lazy val ConcreteTypeTag = scala.reflect.mirror.ConcreteTypeTag
}
|