trait IsReferenceValue extends KnownTypedValue
Describes the essential properties of a reference value in a program.
For example, in the following:
val o = If(...) new Object() else "STRING"
o is a reference value (IsReferenceValue) that (may) refers to two "simple" base values:
new Object() and "STRING"; however, it is a decision of the underlying domain whether
the information about the base values is made available or not. Furthermore, if the base values
are actually used, the constraints in effect for the overall abstraction should be considered
to get the most precise result.
- Alphabetic
- By Inheritance
- IsReferenceValue
- KnownTypedValue
- KnownValue
- ValueInformation
- AnyRef
- Any
- Hide All
- Show All
- Public
- All
Type Members
- abstract type BaseReferenceValue <: IsReferenceValue
Abstract Value Members
- abstract def asBaseReferenceValue: BaseReferenceValue
-
abstract
def
baseValues: Traversable[BaseReferenceValue]
In general an
IsReferenceValueabstracts over all potential values and this information is sufficient for subsequent analyses; but in some cases, analyzing the set of underlying values may increase the overall precision and this set is returned by this function.In general an
IsReferenceValueabstracts over all potential values and this information is sufficient for subsequent analyses; but in some cases, analyzing the set of underlying values may increase the overall precision and this set is returned by this function. In other words: ifbaseValuesis nonEmpty, then the properties returned bythisvalue are derived from the base values, but still maybe more specific. For example,Object o = _; if(...) o = f() else o = g(); // when we reach this point, we generally don't know if the values returned by f and g // are non-null; hence, o is potentially null. if(o != null) // Now, we know that o is not null, but we still don't know if the values returned // by f OR g were null and we cannot establish that when we don't know to which value // o is actually referring to. u(o);
- returns
The set of values this reference value abstracts over. The set is empty if this value is already a base value and it does not abstract over other values.
- Note
A reference value which belongs to the base values by some other reference value never has itself as a direct base value.
-
abstract
def
upperTypeBound: UIDSet[_ <: ReferenceType]
The upper bound of the value's type.
The upper bound of the value's type. The upper bound is empty if this value is
null(i.e.,isNull == Yes). The upper bound is only guaranteed to contain exactly one type if the type is precise. (i.e.,isPrecise == true). Otherwise, the upper type bound may contain one or more types that are not known to be in an inheritance relation, but which will correctly approximate the runtime type.- Note
If only a part of a project is analyzed, the class hierarchy may be fragmented and it may happen that two classes that are indeed in an inheritance relation – if we would analyze the complete project – are part of the upper type bound.
-
abstract
def
valueType: Option[ReferenceType]
The least upper unique type bound of the upper type value.
The least upper unique type bound of the upper type value.
Noneif and only if the underlying value isnull.
Concrete Value Members
-
final
def
!=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
final
def
##(): Int
- Definition Classes
- AnyRef → Any
-
final
def
==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
final
def
allValues: Traversable[BaseReferenceValue]
The set of base values this value abstracts over.
The set of base values this value abstracts over. This set is never empty and contains this value if this value does not (further) abstract over other reference values; otherwise it only contains the base values, but not
thisvalue.- Note
Primarily defined as a convenience interface.
-
final
def
asInstanceOf[T0]: T0
- Definition Classes
- Any
-
final
def
asReferenceType: ReferenceType
Returns the type of the upper type bound if the upper type bound contains exactly one element.
Returns the type of the upper type bound if the upper type bound contains exactly one element. That is, the function is only always defined iff the type is precise.
-
final
def
asReferenceValue: IsReferenceValue
- Definition Classes
- IsReferenceValue → ValueInformation
-
def
clone(): AnyRef
- Attributes
- protected[java.lang]
- Definition Classes
- AnyRef
- Annotations
- @native() @throws( ... )
-
final
def
computationalType: ComputationalType
The computational type of the value.
The computational type of the value.
The precise computational type is, e.g., needed to calculate the effect of generic stack manipulation instructions (e.g.,
DUP_...andSWAP) on the stack as well as to calculate the jump targets ofRETinstructions and to determine which values are actually copied by, e.g., thedup_XXinstructions.- Definition Classes
- IsReferenceValue → KnownTypedValue
- Note
The computational type has to be precise/correct.
-
final
def
eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
def
equals(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
def
finalize(): Unit
- Attributes
- protected[java.lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( classOf[java.lang.Throwable] )
-
final
def
getClass(): Class[_]
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
-
final
def
hasCategory2ComputationalType: Boolean
- Definition Classes
- IsReferenceValue → KnownTypedValue
-
def
hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
-
final
def
isInstanceOf[T0]: Boolean
- Definition Classes
- Any
-
def
isNull: Answer
If
Yesthe value is known to always benullat runtime.If
Yesthe value is known to always benullat runtime. In this case the upper bound is (has to be) empty. If the answer isUnknownthen the analysis was not able to statically determine whether the value isnullor is notnull. In this case the upper bound is expected to be non-empty. If the answer isNothen the value is statically known not to benull. In this case, the upper bound may precisely identify the runtime type or still just identify an upper bound.This default implementation always returns
Unknown; this is a sound over-approximation.- returns
Unknown(default)
- Note
This method is expected to be overridden by subtypes.
-
def
isPrecise: Boolean
Returns
trueif the type information is precise.Returns
trueif the type information is precise. I.e., the type returned byupperTypeBoundprecisely models the runtime type of the value. If,isPrecisereturns true, the type of this value can generally be assumed to represent a class type (not an interface type) or an array type. However, this domain also supports the case thatisPrecisereturnstrueeven though the associated type identifies an interface type or an abstract class type. The later case may be interesting in the context of classes that are generated at run time.This default implementation always returns
false.- returns
false(default)
- Note
,isPreciseis alwaystrueif this value is known to benull.This method is expected to be overridden by subtypes.
-
final
def
isPrimitiveValue: Boolean
True in case of a value with primitive type; undefined if the type is unknown.
True in case of a value with primitive type; undefined if the type is unknown.
- Definition Classes
- IsReferenceValue → ValueInformation
-
final
def
isReferenceValue: Boolean
True if the value has a reference type; undefined if the type is unknown.
True if the value has a reference type; undefined if the type is unknown.
- Definition Classes
- IsReferenceValue → ValueInformation
-
final
def
isUnknownValue: Boolean
Returns
trueif no type information is available.Returns
trueif no type information is available.- Definition Classes
- KnownValue → ValueInformation
-
def
isValueASubtypeOf(referenceType: ReferenceType): Answer
Tests if the type of this value is potentially a subtype of the specified reference type under the assumption that this value is not
null.Tests if the type of this value is potentially a subtype of the specified reference type under the assumption that this value is not
null. This test takes the precision of the type information into account. That is, if the currently available type information is not precise and the given type has a subtype that is always a subtype of the current upper type bound, thenUnknownis returned. Given that it may be computationally intensive to determine whether two types have a common subtype it may be better to just returnUnknownin case that this type and the given type are not in a direct inheritance relationship.Basically, this method implements the same semantics as the
ClassHierarchy'sisSubtypeOfmethod, but it additionally checks if the type of this value could be a subtype of the given supertype. I.e., if this value's type identifies a supertype of the givensupertypeand that type is not known to be precise, the answer isUnknown.For example, assume that the type of this reference value is
java.util.Collectionand we know/have to assume that this is only an upper bound. In this case an answer isNoif and only if it is impossible that the runtime type is a subtype of the given supertype. This condition holds, for example, forjava.io.Filewhich is not a subclass ofjava.util.Collectionand which does not have any further subclasses (in the JDK). I.e., the classesjava.io.Fileandjava.util.Collectionare not in an inheritance relationship. However, if the specified supertype would bejava.util.Listthe answer would be unknown.- returns
This default implementation always returns
Unknown.
- Note
The function
,isValueASubtypeOfis not defined ifisNullreturnsYes; ifisNullisUnknownthen the result is given under the assumption that the value is notnullat runtime. In other words, if this value representsnullthis method is not supported.This method is expected to be overridden by subtypes.
-
final
def
isVoid: Boolean
True if the value is "Void"; undefined if the type is unknown.
True if the value is "Void"; undefined if the type is unknown.
- Definition Classes
- IsReferenceValue → ValueInformation
-
final
def
ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
final
def
notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
-
final
def
notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
-
final
def
synchronized[T0](arg0: ⇒ T0): T0
- Definition Classes
- AnyRef
-
def
toString(): String
- Definition Classes
- AnyRef → Any
-
final
def
wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @native() @throws( ... )