Type symbols have their names of type TypeName
.
Type symbols have their names of type TypeName
.
The overloaded alternatives of this symbol
The overloaded alternatives of this symbol
A list of annotations attached to this Symbol.
A list of annotations attached to this Symbol.
The list of all base classes of this type (including its own typeSymbol) in linearization order, starting with the class itself and ending in class Any.
For a class: its companion object if exists.
For a class: its companion object if exists. For a module or a module class: companion class of the module if exists. For a package or a package class: NoSymbol. For all others: NoSymbol.
Filters the underlying alternatives (or a single-element list composed of the symbol itself if the symbol is not overloaded).
Filters the underlying alternatives (or a single-element list composed of the symbol itself if the symbol is not overloaded). Returns an overloaded symbol is there are multiple matches. Returns a NoSymbol if there are no matches.
The encoded full path name of this symbol, where outer names and inner names are separated by periods.
The encoded full path name of this symbol, where outer names and inner names are separated by periods.
The type signature of this symbol.
The type signature of this symbol.
This method always returns signatures in the most generic way possible, even if the underlying symbol is obtained from an
instantiation of a generic type. For example, signature
of the method def map[B](f: (A) ⇒ B): List[B]
, which refers to the type parameter A
of the declaring class List[A]
,
will always feature A
, regardless of whether map
is loaded from the List[_]
or from List[Int]
. To get a signature
with type parameters appropriately instantiated, one should use infoIn
.
The type signature of this symbol seen as a member of given type site
.
The type signature of this symbol seen as a member of given type site
.
Is this symbol abstract (i.
Is this symbol abstract (i.e. an abstract class, an abstract method, value or type member)?
Is this symbol labelled as "abstract override"?
Is this symbol labelled as "abstract override"?
Does this symbol represent the definition of a type alias?
Does this symbol represent the definition of a type alias?
Does this symbol represent a case class?
Does this method represent a constructor?
Does this method represent a constructor?
If owner
is a class, then this is a vanilla JVM constructor.
If owner
is a trait, then this is a mixin constructor.
Is the type parameter represented by this symbol contravariant?
Is the type parameter represented by this symbol contravariant?
Is the type parameter represented by this symbol contravariant?
Is the type parameter represented by this symbol contravariant?
Does this symbol represent the definition of a custom value class? Namely, is AnyVal among its parent classes?
Does this symbol represent an existentially bound type?
Does this symbol represent an existentially bound type?
Is this symbol final?
Is this symbol final?
Does this symbol represent an implementation artifact that isn't meant for public use? Examples of such artifacts are erasure bridges and outer fields.
Does this symbol represent an implementation artifact that isn't meant for public use? Examples of such artifacts are erasure bridges and outer fields.
Does this symbol represent an implicit value, definition, class or parameter?
Does this symbol represent an implicit value, definition, class or parameter?
Is this symbol defined by Java?
Is this symbol defined by Java?
Is this symbol a macro?
Is this symbol a macro?
Does this symbol represent the definition of a numeric value class? Namely, is it one of scala.Double, scala.Float, scala.Long, scala.Int, scala.Char, scala.Short, scala.Byte, scala.Unit or scala.Boolean?
Does this symbol represent the definition of a package? Known issues: https://issues.scala-lang.org/browse/SI-6732.
Does this symbol represent the definition of a package? Known issues: https://issues.scala-lang.org/browse/SI-6732.
Does this symbol represent a package class?
If yes, isClass
is also guaranteed to be true.
Does this symbol represent a package class?
If yes, isClass
is also guaranteed to be true.
Is this symbol a parameter (either a method parameter or a type parameter)?
Is this symbol a parameter (either a method parameter or a type parameter)?
Does this symbol represent the definition of a primitive class? Namely, is it one of scala.Double, scala.Float, scala.Long, scala.Int, scala.Char, scala.Short, scala.Byte, scala.Unit or scala.Boolean?
Does this symbol represent a private declaration or definition?
If yes, privateWithin
might tell more about this symbol's visibility scope.
Does this symbol represent a private declaration or definition?
If yes, privateWithin
might tell more about this symbol's visibility scope.
Does this symbol represent a declaration or definition written in a source file as private[this]
or generated in tree/symbol form with the combination of flags LOCAL and PRIVATE?
If yes, isPrivate
is guaranteed to be true,
Does this symbol represent a declaration or definition written in a source file as private[this]
or generated in tree/symbol form with the combination of flags LOCAL and PRIVATE?
If yes, isPrivate
is guaranteed to be true,
Does this symbol represent a protected declaration or definition?
If yes, privateWithin
might tell more about this symbol's visibility scope.
Does this symbol represent a protected declaration or definition?
If yes, privateWithin
might tell more about this symbol's visibility scope.
Does this symbol represent a declaration or definition written in a source file as protected[this]
or generated in tree/symbol form with the combination of flags LOCAL and PROTECTED?
If yes, isProtected
is guaranteed to be true,
Does this symbol represent a declaration or definition written in a source file as protected[this]
or generated in tree/symbol form with the combination of flags LOCAL and PROTECTED?
If yes, isProtected
is guaranteed to be true,
Does this symbol represent a public declaration or definition?
Does this symbol represent a public declaration or definition?
Does this symbol represent a sealed class?
Is this symbol a specialized type parameter or a generated specialized member?
Is this symbol a specialized type parameter or a generated specialized member?
Is this symbol static (i.
Is this symbol static (i.e. with no outer instance)? Q: When exactly is a sym marked as STATIC? A: If it's a member of a toplevel object, or of an object contained in a toplevel object, or any number of levels deep. http://groups.google.com/group/scala-internals/browse_thread/thread/d385bcd60b08faf6
Does this symbol represent a synthetic (i.
Does this symbol represent a synthetic (i.e. a compiler-generated) entity? Examples of synthetic entities are accessors for vals and vars or mixin constructors in trait implementation classes.
Does this symbol represent a trait?
If this is a sealed class, its known direct subclasses.
If this is a sealed class, its known direct subclasses. Otherwise, the empty set.
If this is a NoSymbol, returns NoSymbol, otherwise
returns the result of applying f
to this symbol.
If this is a NoSymbol, returns NoSymbol, otherwise
returns the result of applying f
to this symbol.
The module corresponding to this module class, or NoSymbol if this symbol is not a module class.
The name of the symbol as a member of the Name
type.
The name of the symbol as a member of the Name
type.
Provides an alternate if symbol is a NoSymbol.
Provides an alternate if symbol is a NoSymbol.
Returns all symbols overriden by this symbol.
Returns all symbols overriden by this symbol.
The owner of this symbol.
The owner of this symbol. This is the symbol
that directly contains the current symbol's definition.
The NoSymbol
symbol does not have an owner, and calling this method
on one causes an internal error.
The owner of the Scala root class scala.reflect.api.Mirror.RootClass
and the Scala root object scala.reflect.api.Mirror.RootPackage is NoSymbol
.
Every other symbol has a chain of owners that ends in
scala.reflect.api.Mirror.RootClass.
Position of the tree.
Position of the tree.
For a Scala class or module class, the primary constructor of the class.
For a Scala class or module class, the primary constructor of the class. For a Scala trait, its mixin constructor. For a Scala package class, NoSymbol. For a Java class, NoSymbol.
Known issues: Due to SI-8367, primaryConstructor may return unexpected results when called for Java classes (for some vague definition of a "Java class", which apparently not only includes javac-produced classfiles, but also consists of classes defined in Scala programs under the java.lang package). What's even worse, for some Java classes we can't even guarantee stability of the return value - depending on your classloader configuration and/or JDK version you might get different primaryConstructor for the same ClassSymbol. We have logged these issues at SI-8193.
Set when symbol has a modifier of the form private[X] or protected[X], NoSymbol otherwise.
Set when symbol has a modifier of the form private[X] or protected[X], NoSymbol otherwise.
Access level encoding: there are three scala flags (PRIVATE, PROTECTED, and LOCAL) which combine with value privateWithin (the "foo" in private[foo]) to define from where an entity can be accessed. The meanings are as follows:
PRIVATE access restricted to class only. PROTECTED access restricted to class and subclasses only. LOCAL can only be set in conjunction with PRIVATE or PROTECTED. Further restricts access to the same object instance.
In addition, privateWithin can be used to set a visibility barrier. When set, everything contained in the named enclosing package or class has access. It is incompatible with PRIVATE or LOCAL, but is additive with PROTECTED (i.e. if either the flags or privateWithin allow access, then it is allowed.)
The java access levels translate as follows:
java private: isPrivate && (privateWithin == NoSymbol) java package: !isPrivate && !isProtected && (privateWithin == enclosingPackage) java protected: isProtected && (privateWithin == enclosingPackage) java public: !isPrivate && !isProtected && (privateWithin == NoSymbol)
If this symbol is a class or trait, its self type, otherwise the type of the symbol itself.
Does the same as filter
, but crashes if there are multiple matches.
Does the same as filter
, but crashes if there are multiple matches.
The type C.super[M]
, where C
is the current class and M
is supertpe.
The type C.this
, where C
is the current class
A type reference that refers to this type symbol
Note if symbol is a member of a class, one almost always is interested
in asTypeIn
with a site type instead.
A type reference that refers to this type symbol
Note if symbol is a member of a class, one almost always is interested
in asTypeIn
with a site type instead.
Example: Given a class declaration class C[T] { ... }
, that generates a symbol
C
. Then C.toType
is the type C[T]
.
By contrast, C.info
would be a type signature of form
PolyType(ClassInfoType(...))
that describes type parameters, value
parameters, parent types, and members of C
.
The type constructor corresponding to this type symbol.
The type constructor corresponding to this type symbol.
This is different from toType
in that type parameters
are part of results of toType
, but not of toTypeConstructor
.
Example: Given a class declaration class C[T] { ... }
, that generates a symbol
C
. Then C.toType
is the type C[T]
, but C.toTypeConstructor
is C
.
A type reference that refers to this type symbol seen
as a member of given type site
.
A type reference that refers to this type symbol seen
as a member of given type site
.
For a polymorphic class/trait, its type parameters, the empty list for all other classes/trait
For a polymorphic class/trait, its type parameters, the empty list for all other classes/trait
Source file if this symbol is created during this compilation run, or a class file if this symbol is loaded from a *.
Source file if this symbol is created during this compilation run, or a class file if this symbol is loaded from a *.class or *.jar.
The return type is scala.reflect.io.AbstractFile
, which belongs to an experimental part of Scala reflection.
It should not be used unless you know what you are doing. In subsequent releases, this API will be refined
and exposed as a part of scala.reflect.api.
(Since version 2.11.0) Use pos.source.file
instead
For a class: the module or case class factory with the same name in the same package.
For a class: the module or case class factory with the same name in the same package. For a module: the class with the same name in the same package. For all others: NoSymbol
This API may return unexpected results for module classes, packages and package classes.
Use companion
instead in order to get predictable results.
(Since version 2.11.0) Use companion
instead, but beware of possible changes in behavior
Does this symbol represent an abstract class?
Does this symbol represent an abstract class?
(Since version 2.11.0) Use isAbstract instead
Does this symbol represent the definition of an abstract type?
Does this symbol represent the definition of an abstract type?
(Since version 2.11.0) Use isAbstract instead
This symbol cast to a ClassSymbol representing a class or trait.
This symbol cast to a ClassSymbol representing a class or trait.
if isClass
is false.
This symbol cast to a MethodSymbol.
This symbol cast to a MethodSymbol.
if isMethod
is false.
This symbol cast to a ModuleSymbol defined by an object definition.
This symbol cast to a ModuleSymbol defined by an object definition.
if isModule
is false.
This symbol cast to a TermSymbol.
This symbol cast to a TermSymbol.
if isTerm
is false.
This symbol cast to a TypeSymbol.
This symbol cast to a TypeSymbol.
if isType
is false.
Does this symbol represent the definition of a class or trait?
If yes, isType
is also guaranteed to be true.
Does this symbol represent the definition of a class or trait?
If yes, isType
is also guaranteed to be true.
Does this symbol represent the definition of a method?
If yes, isTerm
is also guaranteed to be true.
Does this symbol represent the definition of a method?
If yes, isTerm
is also guaranteed to be true.
Does this symbol represent the definition of a module (i.
Does this symbol represent the definition of a module (i.e. it
results from an object definition?).
If yes, isTerm
is also guaranteed to be true.
Does this symbol represent the definition of a class implicitly associated with an object definition (module class in scala compiler parlance).
Does this symbol represent the definition of a class implicitly associated
with an object definition (module class in scala compiler parlance).
If yes, isType
is also guaranteed to be true.
Used to provide a better error message for asMethod
Used to provide a better error message for asMethod
Does this symbol represent the definition of a term? Note that every symbol is either a term or a type.
Does this symbol represent the definition of a term?
Note that every symbol is either a term or a type.
So for every symbol sym
(except for NoSymbol
),
either sym.isTerm
is true or sym.isType
is true.
Does this symbol represent the definition of a type? Note that every symbol is either a term or a type.
Does this symbol represent the definition of a type?
Note that every symbol is either a term or a type.
So for every symbol sym
(except for NoSymbol
),
either sym.isTerm
is true or sym.isType
is true.
These methods enable collections-like operations on symbols.
The API of class symbols. The main source of information about symbols is the Symbols page.
Class Symbol defines
isXXX
test methods such asisPublic
orisFinal
,params
andreturnType
methods for method symbols,baseClasses
for class symbols and so on. Some of these methods don't make sense for certain subclasses ofSymbol
and returnNoSymbol
,Nil
or other empty values.