scala.reflect.runtime.JavaMirrors

JavaMirror

class JavaMirror extends Roots with JavaMirror

The API of a mirror for a reflective universe

Definition Classes
JavaMirrorsJavaUniverse
Self Type
JavaMirror
Source
JavaMirrors.scala
Linear Supertypes
Ordering
  1. Alphabetic
  2. By inheritance
Inherited
  1. JavaMirror
  2. JavaMirror
  3. RuntimeMirror
  4. ReflectiveMirror
  5. Roots
  6. RootsBase
  7. MirrorOf
  8. AnyRef
  9. Any
Implicitly
  1. by any2stringadd
  2. by any2stringfmt
  3. by any2ArrowAssoc
  4. by any2Ensuring
  1. Hide All
  2. Show all
Learn more about member selection
Visibility
  1. Public
  2. All

Instance Constructors

  1. new JavaMirror(owner: Symbol, classLoader: ClassLoader)

Type Members

  1. implicit class RichClass extends AnyRef

  2. sealed trait RootSymbol extends Symbol with WellKnownSymbol

    Definition Classes
    Roots
  3. sealed trait WellKnownSymbol extends Symbol

    Definition Classes
    Roots

Value Members

  1. final def !=(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  2. final def !=(arg0: Any): Boolean

    Test two objects for inequality.

    Test two objects for inequality.

    returns

    true if !(this == that), false otherwise.

    Definition Classes
    Any
  3. final def ##(): Int

    Equivalent to x.hashCode except for boxed numeric types and null.

    Equivalent to x.hashCode except for boxed numeric types and null. For numerics, it returns a hash value which is consistent with value equality: if two value type instances compare as true, then ## will produce the same hash value for each of them. For null returns a hashcode where null.hashCode throws a NullPointerException.

    returns

    a hash value consistent with ==

    Definition Classes
    AnyRef → Any
  4. def +(other: String): String

    Implicit information
    This member is added by an implicit conversion from JavaMirror to StringAdd performed by method any2stringadd in scala.Predef.
    Definition Classes
    StringAdd
  5. def ->[B](y: B): (JavaMirror, B)

    Implicit information
    This member is added by an implicit conversion from JavaMirror to ArrowAssoc[JavaMirror] performed by method any2ArrowAssoc in scala.Predef.
    Definition Classes
    ArrowAssoc
    Annotations
    @inline()
  6. final def ==(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  7. final def ==(arg0: Any): Boolean

    Test two objects for equality.

    Test two objects for equality. The expression x == that is equivalent to if (x eq null) that eq null else x.equals(that).

    returns

    true if the receiver object is equivalent to the argument; false otherwise.

    Definition Classes
    Any
  8. object EmptyPackage extends ModuleSymbol with WellKnownSymbol

    Definition Classes
    RootsRootsBaseMirrorOf
  9. object EmptyPackageClass extends PackageClassSymbol with WellKnownSymbol

    Definition Classes
    RootsRootsBaseMirrorOf
  10. object RootClass extends PackageClassSymbol with RootSymbol

    .

  11. object RootPackage extends ModuleSymbol with RootSymbol

    Definition Classes
    RootsRootsBaseMirrorOf
  12. final def asInstanceOf[T0]: T0

    Cast the receiver object to be of type T0.

    Cast the receiver object to be of type T0.

    Note that the success of a cast at runtime is modulo Scala's erasure semantics. Therefore the expression 1.asInstanceOf[String] will throw a ClassCastException at runtime, while the expression List(1).asInstanceOf[List[String]] will not. In the latter example, because the type argument is erased as part of compilation it is not possible to check whether the contents of the list are of the requested type.

    returns

    the receiver object.

    Definition Classes
    Any
    Exceptions thrown
    ClassCastException

    if the receiver object is not an instance of the erasure of type T0.

  13. val classLoader: ClassLoader

    Definition Classes
    JavaMirrorJavaMirror
  14. def classSymbol(rtcls: RuntimeClass): ClassSymbol

    A class symbol for the specified runtime class.

    A class symbol for the specified runtime class.

    returns

    The class symbol for the runtime class in the current class loader.

    Definition Classes
    JavaMirrorRuntimeMirror
    Exceptions thrown
    java.lang.ClassNotFoundException

    if no class with that name exists

    scala.reflect.internal.MissingRequirementError

    if no corresponding symbol exists to do: throws anything else?

  15. def classToJava(clazz: ClassSymbol): Class[_]

    The Java class corresponding to given Scala class.

    The Java class corresponding to given Scala class. Note: This only works for

    • top-level classes
    • Scala classes that were generated via jclassToScala
    • classes that have a class owner that has a corresponding Java class
    Annotations
    @throws( clazz = classOf[ClassNotFoundException] )
    Exceptions thrown
    A

    ClassNotFoundException for all Scala classes not in one of these categories.

  16. def classToScala(jclazz: Class[_]): ClassSymbol

    The Scala class that corresponds to a given Java class.

    The Scala class that corresponds to a given Java class.

    jclazz

    The Java class

    returns

    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.

  17. def clone(): AnyRef

    Create a copy of the receiver object.

    Create a copy of the receiver object.

    The default implementation of the clone method is platform dependent.

    returns

    a copy of the receiver object.

    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws()
    Note

    not specified by SLS as a member of AnyRef

  18. def constructorToJava(constr: MethodSymbol): java.lang.reflect.Constructor[_]

    The Java constructor corresponding to a given Scala constructor.

    The Java constructor corresponding to a given Scala constructor.

    constr

    The Scala constructor

  19. def constructorToScala(jconstr: java.lang.reflect.Constructor[_]): MethodSymbol

    The Scala constructor corresponding to given Java constructor.

    The Scala constructor corresponding to given Java constructor.

    jconstr

    The Java constructor

    returns

    A Scala method object that corresponds to jconstr.

  20. def ensuring(cond: (JavaMirror) ⇒ Boolean, msg: ⇒ Any): JavaMirror

    Implicit information
    This member is added by an implicit conversion from JavaMirror to Ensuring[JavaMirror] performed by method any2Ensuring in scala.Predef.
    Definition Classes
    Ensuring
  21. def ensuring(cond: (JavaMirror) ⇒ Boolean): JavaMirror

    Implicit information
    This member is added by an implicit conversion from JavaMirror to Ensuring[JavaMirror] performed by method any2Ensuring in scala.Predef.
    Definition Classes
    Ensuring
  22. def ensuring(cond: Boolean, msg: ⇒ Any): JavaMirror

    Implicit information
    This member is added by an implicit conversion from JavaMirror to Ensuring[JavaMirror] performed by method any2Ensuring in scala.Predef.
    Definition Classes
    Ensuring
  23. def ensuring(cond: Boolean): JavaMirror

    Implicit information
    This member is added by an implicit conversion from JavaMirror to Ensuring[JavaMirror] performed by method any2Ensuring in scala.Predef.
    Definition Classes
    Ensuring
  24. final def eq(arg0: AnyRef): Boolean

    Tests whether the argument (arg0) is a reference to the receiver object (this).

    Tests whether the argument (arg0) is a reference to the receiver object (this).

    The eq method implements an equivalence relation on non-null instances of AnyRef, and has three additional properties:

    • It is consistent: for any non-null instances x and y of type AnyRef, multiple invocations of x.eq(y) consistently returns true or consistently returns false.
    • For any non-null instance x of type AnyRef, x.eq(null) and null.eq(x) returns false.
    • null.eq(null) returns true.

    When overriding the equals or hashCode methods, it is important to ensure that their behavior is consistent with reference equality. Therefore, if two objects are references to each other (o1 eq o2), they should be equal to each other (o1 == o2) and they should hash to the same value (o1.hashCode == o2.hashCode).

    returns

    true if the argument is a reference to the receiver object; false otherwise.

    Definition Classes
    AnyRef
  25. def equals(arg0: Any): Boolean

    The equality method for reference types.

    The equality method for reference types. Default implementation delegates to eq.

    See also equals in Any.

    returns

    true if the receiver object is equivalent to the argument; false otherwise.

    Definition Classes
    AnyRef → Any
  26. def erasureName[T](implicit arg0: ClassTag[T]): String

    Definition Classes
    RootsBase
  27. def fieldToJava(fld: TermSymbol): Field

    The Java field corresponding to a given Scala field.

  28. def fieldToScala(jfield: Field): TermSymbol

    The Scala field corresponding to given Java field.

    The Scala field corresponding to given Java field.

    jfield

    The Java field

    returns

    A Scala field object that corresponds to jfield. // ??? should we return the getter instead?

  29. def finalize(): Unit

    Called by the garbage collector on the receiver object when there are no more references to the object.

    Called by the garbage collector on the receiver object when there are no more references to the object.

    The details of when and if the finalize method is invoked, as well as the interaction between finalize and non-local returns and exceptions, are all platform dependent.

    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws()
    Note

    not specified by SLS as a member of AnyRef

  30. def findMemberFromRoot(fullName: Name): Symbol

    Definition Classes
    RootsBase
  31. def formatted(fmtstr: String): String

    Returns string formatted according to given format string.

    Returns string formatted according to given format string. Format strings are as for String.format (@see java.lang.String.format).

    Implicit information
    This member is added by an implicit conversion from JavaMirror to StringFormat performed by method any2stringfmt in scala.Predef.
    Definition Classes
    StringFormat
    Annotations
    @inline()
  32. def genericDeclarationToScala(jdecl: GenericDeclaration): Symbol

    The Scala symbol that corresponds to a given Java generic declaration (class, method, or constructor)

  33. final def getClass(): Class[_]

    A representation that corresponds to the dynamic class of the receiver object.

    A representation that corresponds to the dynamic class of the receiver object.

    The nature of the representation is platform dependent.

    returns

    a representation that corresponds to the dynamic class of the receiver object.

    Definition Classes
    AnyRef → Any
    Note

    not specified by SLS as a member of AnyRef

  34. def getClassByName(fullname: Name): ClassSymbol

    Definition Classes
    RootsBase
  35. def getClassIfDefined(fullname: Name): Symbol

    Definition Classes
    RootsBase
  36. def getClassIfDefined(fullname: String): Symbol

    Definition Classes
    RootsBase
  37. def getModule(fullname: Name): ModuleSymbol

    Definition Classes
    RootsBase
  38. def getModuleIfDefined(fullname: Name): Symbol

    Definition Classes
    RootsBase
  39. def getModuleIfDefined(fullname: String): Symbol

    Definition Classes
    RootsBase
  40. def getPackage(fullname: Name): ModuleSymbol

    Definition Classes
    RootsBase
  41. def getPackageObject(fullname: String): ModuleSymbol

    Definition Classes
    RootsBase
  42. def getPackageObjectIfDefined(fullname: String): Symbol

    Definition Classes
    RootsBase
  43. def getRequiredClass(fullname: String): ClassSymbol

    Definition Classes
    RootsBase
  44. def getRequiredModule(fullname: String): ModuleSymbol

    Definition Classes
    RootsBase
  45. def getRequiredPackage(fullname: String): ModuleSymbol

    Definition Classes
    RootsBase
  46. def hashCode(): Int

    The hashCode method for reference types.

    The hashCode method for reference types. See hashCode in Any.

    returns

    the hash code value for this object.

    Definition Classes
    AnyRef → Any
  47. def init(): Unit

    getModule2/getClass2 aren't needed at present but may be again, so for now they're mothballed.

    getModule2/getClass2 aren't needed at present but may be again, so for now they're mothballed.

    Definition Classes
    RootsBase
  48. final def isInstanceOf[T0]: Boolean

    Test whether the dynamic type of the receiver object is T0.

    Test whether the dynamic type of the receiver object is T0.

    Note that the result of the test is modulo Scala's erasure semantics. Therefore the expression 1.isInstanceOf[String] will return false, while the expression List(1).isInstanceOf[List[String]] will return true. In the latter example, because the type argument is erased as part of compilation it is not possible to check whether the contents of the list are of the specified type.

    returns

    true if the receiver object is an instance of erasure of type T0; false otherwise.

    Definition Classes
    Any
  49. def javaClass(path: String): Class[_]

  50. def methodToJava(meth: MethodSymbol): Method

    The Java method corresponding to a given Scala method.

    The Java method corresponding to a given Scala method.

    meth

    The Scala method

  51. def methodToScala(jmeth: Method): MethodSymbol

    The Scala method corresponding to given Java method.

    The Scala method corresponding to given Java method.

    jmeth

    The Java method

    returns

    A Scala method object that corresponds to jmeth.

  52. def mirrorDefining(jclazz: Class[_]): JavaMirror

    The mirror that corresponds to the classloader that original defined the given Java class

  53. def mirrorMissingHook(owner: Symbol, name: Name): Symbol

    Attributes
    protected
    Definition Classes
    RootsBase
  54. def moduleSymbol(rtcls: RuntimeClass): ModuleSymbol

    A module symbol for the specified runtime class.

    A module symbol for the specified runtime class.

    returns

    The module symbol for the runtime class in the current class loader.

    Definition Classes
    JavaMirrorRuntimeMirror
    Exceptions thrown
    java.lang.ClassNotFoundException

    if no class with that name exists

    scala.reflect.internal.MissingRequirementError

    if no corresponding symbol exists to do: throws anything else?

  55. final def ne(arg0: AnyRef): Boolean

    Equivalent to !(this eq that).

    Equivalent to !(this eq that).

    returns

    true if the argument is not a reference to the receiver object; false otherwise.

    Definition Classes
    AnyRef
  56. final def notify(): Unit

    Wakes up a single thread that is waiting on the receiver object's monitor.

    Wakes up a single thread that is waiting on the receiver object's monitor.

    Definition Classes
    AnyRef
    Note

    not specified by SLS as a member of AnyRef

  57. final def notifyAll(): Unit

    Wakes up all threads that are waiting on the receiver object's monitor.

    Wakes up all threads that are waiting on the receiver object's monitor.

    Definition Classes
    AnyRef
    Note

    not specified by SLS as a member of AnyRef

  58. def packageNameToScala(fullname: String): ModuleSymbol

    The Scala package with given fully qualified name.

  59. def packageToJavaOption(pkg: ModuleSymbol): Option[Package]

    Optionally, the Java package corresponding to a given Scala package, or None if no such Java package exists.

    Optionally, the Java package corresponding to a given Scala package, or None if no such Java package exists.

    pkg

    The Scala package

  60. def packageToScala(jpkg: Package): ModuleSymbol

    The Scala package corresponding to given Java package

  61. def reflect(obj: Any): InstanceMirror

    A reflective mirror for the given object

    A reflective mirror for the given object

    obj

    An arbitrary value

    returns

    The mirror for obj.

    Definition Classes
    JavaMirrorReflectiveMirror
  62. def reflectClass(cls: ClassSymbol): ClassMirror

    .

    ..

    Definition Classes
    JavaMirrorReflectiveMirror
  63. def reflectModule(mod: ModuleSymbol): ModuleMirror

    .

    ..

    Definition Classes
    JavaMirrorReflectiveMirror
  64. def requiredClass[T](implicit arg0: ClassTag[T]): ClassSymbol

    Definition Classes
    RootsBase
  65. def requiredModule[T](implicit arg0: ClassTag[T]): ModuleSymbol

    Definition Classes
    RootsBase
  66. lazy val rootLoader: LazyType

    The lazy type for root.

    The lazy type for root.

    Definition Classes
    JavaMirrorRootsBase
  67. def runtimeClass(cls: ClassSymbol): RuntimeClass

    Maps a Scala class symbol to the corresponding Java class object

    Maps a Scala class symbol to the corresponding Java class object

    Definition Classes
    JavaMirrorRuntimeMirror
    Exceptions thrown
    ClassNotFoundException

    if there is no Java class corresponding to the given Scala class symbol. Note: If the Scala symbol is ArrayClass, a ClassNotFound exception is thrown because there is no unique Java class corresponding to a Scala generic array

  68. def runtimeClass(tpe: Type): RuntimeClass

    Maps a Scala type to the corresponding Java class object

    Maps a Scala type to the corresponding Java class object

    Definition Classes
    JavaMirrorRuntimeMirror
  69. def staticClass(fullName: String): ClassSymbol

    The symbol corresponding to the globally accessible class with the given fully qualified name fullName.

    The symbol corresponding to the globally accessible class with the given fully qualified name fullName.

    Definition Classes
    RootsBaseMirrorOf
  70. def staticModule(fullName: String): ModuleSymbol

    The symbol corresponding to the globally accessible object with the given fully qualified name fullName.

    The symbol corresponding to the globally accessible object with the given fully qualified name fullName.

    Definition Classes
    RootsBaseMirrorOf
  71. def symbolTableMissingHook(owner: Symbol, name: Name): Symbol

    Attributes
    protected
    Definition Classes
    RootsBase
  72. final def synchronized[T0](arg0: ⇒ T0): T0

    Definition Classes
    AnyRef
  73. def toScala[J, S](cache: TwoWayCache[J, S], key: J)(body: (JavaMirror, J) ⇒ S)(implicit arg0: HasJavaClass[J]): S

  74. def toString(): String

    Creates a String representation of this object.

    Creates a String representation of this object. The default representation is platform dependent. On the java platform it is the concatenation of the class name, "@", and the object's hashcode in hexadecimal.

    returns

    a String representation of the object.

    Definition Classes
    JavaMirror → AnyRef → Any
  75. def tryJavaClass(path: String): Option[Class[_]]

    Does path correspond to a Java class with that fully qualified name in the current class loader?

  76. def typeParamToScala(jparam: java.lang.reflect.TypeVariable[_ <: java.lang.reflect.GenericDeclaration]): TypeSymbol

    The Scala type parameter that corresponds to a given Java type parameter.

    The Scala type parameter that corresponds to a given Java type parameter.

    jparam

    The Java type parameter

    returns

    A Scala type parameter symbol that has the same owner and name as the Java type parameter

  77. def typeToJavaClass(tpe: Type): Class[_]

    The Java class that corresponds to given Scala type.

    The Java class that corresponds to given Scala type. Pre: Scala type is already transformed to Java level.

  78. def typeToScala(jtpe: Type): Type

    The Scala type that corresponds to given Java type

  79. val universe: JavaMirrors.this.type

    .

    ..

    Definition Classes
    JavaMirrorMirrorOf
  80. def unpickleClass(clazz: Symbol, module: Symbol, jclazz: Class[_]): Unit

    how connected???? Generate types for top-level Scala root class and root companion object from the pickled information stored in a corresponding Java class

    how connected???? Generate types for top-level Scala root class and root companion object from the pickled information stored in a corresponding Java class

    clazz

    The top-level Scala class for which info is unpickled

    module

    The top-level Scala companion object for which info is unpickled

    jclazz

    The Java class which contains the unpickled information in a ScalaSignature or ScalaLongSignature annotation.

  81. final def wait(): Unit

    Definition Classes
    AnyRef
    Annotations
    @throws()
  82. final def wait(arg0: Long, arg1: Int): Unit

    Definition Classes
    AnyRef
    Annotations
    @throws()
  83. final def wait(arg0: Long): Unit

    Definition Classes
    AnyRef
    Annotations
    @throws()
  84. def [B](y: B): (JavaMirror, B)

    Implicit information
    This member is added by an implicit conversion from JavaMirror to ArrowAssoc[JavaMirror] performed by method any2ArrowAssoc in scala.Predef.
    Definition Classes
    ArrowAssoc

Shadowed Implict Value Members

  1. val self: Any

    Implicit information
    This member is added by an implicit conversion from JavaMirror to StringAdd performed by method any2stringadd in scala.Predef.
    Shadowing
    This implicitly inherited member is ambiguous. One or more implicitly inherited members have similar signatures, so calling this member may produce an ambiguous implicit conversion compiler error.
    To access this member you can use a type ascription:
    (javaMirror: StringAdd).self
    Definition Classes
    StringAdd
  2. val self: Any

    Implicit information
    This member is added by an implicit conversion from JavaMirror to StringFormat performed by method any2stringfmt in scala.Predef.
    Shadowing
    This implicitly inherited member is ambiguous. One or more implicitly inherited members have similar signatures, so calling this member may produce an ambiguous implicit conversion compiler error.
    To access this member you can use a type ascription:
    (javaMirror: StringFormat).self
    Definition Classes
    StringFormat

Deprecated Value Members

  1. def getClass(fullname: Name): ClassSymbol

    Definition Classes
    RootsBase
    Annotations
    @deprecated
    Deprecated

    (Since version 2.10.0) Use getClassByName

  2. def x: JavaMirror

    Implicit information
    This member is added by an implicit conversion from JavaMirror to ArrowAssoc[JavaMirror] performed by method any2ArrowAssoc in scala.Predef.
    Shadowing
    This implicitly inherited member is ambiguous. One or more implicitly inherited members have similar signatures, so calling this member may produce an ambiguous implicit conversion compiler error.
    To access this member you can use a type ascription:
    (javaMirror: ArrowAssoc[JavaMirror]).x
    Definition Classes
    ArrowAssoc
    Annotations
    @deprecated
    Deprecated

    (Since version 2.10.0) Use leftOfArrow instead

  3. def x: JavaMirror

    Implicit information
    This member is added by an implicit conversion from JavaMirror to Ensuring[JavaMirror] performed by method any2Ensuring in scala.Predef.
    Shadowing
    This implicitly inherited member is ambiguous. One or more implicitly inherited members have similar signatures, so calling this member may produce an ambiguous implicit conversion compiler error.
    To access this member you can use a type ascription:
    (javaMirror: Ensuring[JavaMirror]).x
    Definition Classes
    Ensuring
    Annotations
    @deprecated
    Deprecated

    (Since version 2.10.0) Use resultOfEnsuring instead

Inherited from JavaMirror

Inherited from RuntimeMirror

Inherited from ReflectiveMirror

Inherited from Roots

Inherited from RootsBase

Inherited from MirrorOf[JavaMirrors.this.type]

Inherited from AnyRef

Inherited from Any

Inherited by implicit conversion any2stringadd from JavaMirror to StringAdd

Inherited by implicit conversion any2stringfmt from JavaMirror to StringFormat

Inherited by implicit conversion any2ArrowAssoc from JavaMirror to ArrowAssoc[JavaMirror]

Inherited by implicit conversion any2Ensuring from JavaMirror to Ensuring[JavaMirror]