Test two objects for inequality.
Test two objects for inequality.
true
if !(this == that), false otherwise.
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
.
a hash value consistent with ==
The expression x == that
is equivalent to if (x eq null) that eq null else x.equals(that)
.
The expression x == that
is equivalent to if (x eq null) that eq null else x.equals(that)
.
the object to compare against this object for equality.
true
if the receiver object is equivalent to the argument; false
otherwise.
Adapt a tree that has an annotated type to the given type tp, taking into account the given mode (see method adapt in trait Typers).
Adapt a tree that has an annotated type to the given type tp, taking into account the given mode (see method adapt in trait Typers).
An implementation cannot rely on canAdaptAnnotations being called before. If the implementing class cannot do the adapting, it should return the tree unchanged.
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.
the receiver object.
ClassCastException
if the receiver object is not an instance of the erasure of type T0
.
Decide whether this analyzer plugin can adapt a tree that has an annotated type to the given type tp, taking into account the given mode (see method adapt in trait Typers).
Create a copy of the receiver object.
Create a copy of the receiver object.
The default implementation of the clone
method is platform dependent.
a copy of the receiver object.
not specified by SLS as a member of AnyRef
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:
x
and y
of type AnyRef
, multiple invocations of
x.eq(y)
consistently returns true
or consistently returns false
.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
).
true
if the argument is a reference to the receiver object; false
otherwise.
The equality method for reference types.
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.
not specified by SLS as a member of AnyRef
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.
a representation that corresponds to the dynamic class of the receiver object.
not specified by SLS as a member of AnyRef
The hashCode method for reference types.
Selectively activate this analyzer plugin, e.g.
Selectively activate this analyzer plugin, e.g. according to the compiler phase.
Note that the current phase can differ from the global compiler phase (look for enteringPhase
invocations in the compiler). For instance, lazy types created by the UnPickler are completed
at the phase in which their symbol is created. Observations show that this can even be the
parser phase. Since symbol completion can trigger subtyping, typing etc, your plugin might
need to be active also in phases other than namer and typer.
Typically, this method can be implemented as
global.phase.id < global.currentRun.picklerPhase.id
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.
true
if the receiver object is an instance of erasure of type T0
; false
otherwise.
Equivalent to !(this eq that)
.
Equivalent to !(this eq that)
.
true
if the argument is not a reference to the receiver object; false
otherwise.
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.
not specified by SLS as a member of AnyRef
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.
not specified by SLS as a member of AnyRef
Let analyzer plugins change the expected type before type checking a tree.
Let analyzer plugins change the types assigned to definitions.
Let analyzer plugins change the types assigned to definitions. For definitions that have an annotated type, the assigned type is obtained by typing that type tree. Otherwise, the type is inferred by typing the definition's righthand side.
In order to know if the type was inferred, you can query the wasEmpty
field in the tpt
TypeTree of the definition (for DefDef and ValDef).
(*) If the type of a method or value is inferred, the type-checked tree is stored in the
analyzer.transformed
hash map, indexed by the definition's rhs tree.
NOTE: Invoking the type checker can lead to cyclic reference errors. For instance, if this
method is called from the type completer of a recursive method, type checking the method
rhs will invoke the same completer again. It might be possible to avoid this situation by
assigning tpe
to defTree.symbol
(untested) - the final type computed by this method
will then be assigned to the definition's symbol by monoTypeCompleter (in Namers).
The hooks into typeSig
allow analyzer plugins to add annotations to (or change the types
of) definition symbols. This cannot not be achieved by using pluginsTyped
: this method
is only called during type checking, so changing the type of a symbol at this point is too
late: references to the symbol might already be typed and therefore obtain the the original
type assigned during naming.
is the definition for which the type was computed. The different cases are outlined below. Note that this type is untyped (for methods and values with inferred type, the typed rhs trees are available in analyzer.transformed). Case defTree: Template
pluginsTypeSigAccessor
)
Case defTree: TypeDefModify the types of field accessors.
Modify the types of field accessors. The namer phase creates method types for getters and setters based on the type of the corresponding field.
Note: in order to compute the method type of an accessor, the namer calls typeSig
on the
ValDef
tree of the corresponding field. This implies that the pluginsTypeSig
method
is potentially called multiple times for the same ValDef tree.
The method type created by the namer for the accessor
The typer for the ValDef (not for the rhs)
The ValDef corresponding to the accessor
The accessor method symbol (getter, setter, beanGetter or beanSetter)
Let analyzer plugins modify the type that has been computed for a tree.
Let analyzer plugins modify the type that has been computed for a tree.
The type inferred by the type checker, initially (for first plugin) tree.tpe
The yper that type checked tree
The type-checked tree
Mode that was used for typing tree
Expected type that was used for typing tree
Modify the type of a return expression.
Modify the type of a return expression. By default, return expressions have type NothingTpe.
The type of the return expression
The typer that was used for typing the return tree
The typed return expression tree
The return type of the enclosing method
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.
a String representation of the object.