A cache that maintains a bijection between Java reflection type J
and Scala reflection type S
.
Defines the classloader that will be used for all class resolution activities in this mirror.
Defines the classloader that will be used for all class resolution activities in this mirror. Is mutable, since sometimes we need to change it in flight (e.g. to make the default mirror work with REPL).
If you want to have a mirror with non-standard class resolution, override this var
(or, even simpler, use the mkMirror
function from scala.reflect
package)
Be careful, though, since fancy stuff might happen. Here's one example:
partest uses a URLClassLoader(urls, null) with custom classpath to run workers (in separate threads) however it doesn't set the context classloader for them, so they inherit the system classloader http://www.javaworld.com/javaworld/javaqa/2003-06/01-qa-0606-load.html
Once upon a time, scala.reflect.mirror was loaded using getClass.getClassLoader, which also means that classOf[...] constructs such as:
classOf[scala.reflect.ScalaSignature]
in unpickleClass were also loaded by the URLClassLoader
But mirror's classLoader used Thread.currentThread.getContextClassLoader, which introduced a subtle bug that made the following snippet incorrectly:
jclazz.getAnnotation(classOf[scala.reflect.ScalaSignature])
Indeed, jclazz was loaded by context classloader, which defaulted to system classloader, while ScalaSignature class was loaded by getClass.getClassLoader, which was incompatible with system classloader. As a result, unpickler couldn't see the signature and that blew up the mirror.
the type of this symbol after Scala -> Java transformsi in refChecks, uncurry, erasure
the type of this symbol after Scala -> Java transformsi in refChecks, uncurry, erasure
The Java class thaty given type compiles to
The Java class thaty given type compiles to
The Scala class that corresponds to a given Java class.
The Scala class that corresponds to a given Java class.
The Java class
A Scala class symbol that reflects all elements of the Java class, in the form they appear in the Scala pickling info, or, if that is not available, wrapped from the Java reflection info.
The Scala constructor corresponding to given Java constructor.
The Scala constructor corresponding to given Java constructor.
The Java constructor
A Scala method object that corresponds to jconstr
.
Does constructor meth
erase to Java method jconstr
?
This is true if the Java constructor type is the same as the Scala constructor type after performing
all Scala-specific transformations in InfoTransformers.
Does constructor meth
erase to Java method jconstr
?
This is true if the Java constructor type is the same as the Scala constructor type after performing
all Scala-specific transformations in InfoTransformers. (to be done)
Does method meth
erase to Java method jmeth
?
This is true if the Java method type is the same as the Scala method type after performing
all Scala-specific transformations in InfoTransformers.
Does method meth
erase to Java method jmeth
?
This is true if the Java method type is the same as the Scala method type after performing
all Scala-specific transformations in InfoTransformers. (to be done)
The Scala symbol that corresponds to a given Java generic declaration (class, method, or constructor)
Does path
correspond to a Java class with that fully qualified name?
Paul: It seems the default class loader does not pick up root classes, whereas the system classloader does.
Paul: It seems the default class loader does not pick up root classes, whereas the system classloader does. Can you check with your newly acquired classloader fu whether this implementation makes sense?
The Scala package with given fully qualified name.
The Scala package with given fully qualified name. Unlike packageNameToScala
,
this one bypasses the cache.
The Scala method corresponding to given Java method.
The Scala method corresponding to given Java method.
The Java method
A Scala method object that corresponds to jmeth
.
The Scala package with given fully qualified name.
The Scala package corresponding to given Java package
used to avoid cyclies
The Scala type parameter that corresponds to a given Java type parameter.
The Scala type parameter that corresponds to a given Java type parameter.
The Java type parameter
A Scala type parameter symbol that has the same owner and name as the Java type parameter
The Scala type that corresponds to given Java type
Generate types for top-level Scala root class and root companion object from the pickled information stored in a corresponding Java class
Generate types for top-level Scala root class and root companion object from the pickled information stored in a corresponding Java class
The top-level Scala class for which info is unpickled
The top-level Scala companion object for which info is unpickled
The Java class which contains the unpickled information in a ScalaSignature or ScalaLongSignature annotation.
(Since version 2.10.0) Use leftOfArrow instead
(Since version 2.10.0) Use resultOfEnsuring instead