Returns the sequence of instructions that adapts values of this
type to values
of the target type.
Compares this type with the given type.
Compares this type with the given type.
Comparison of types is implemented by comparing the associated ids. I.e., the result of the comparison of two types is not stable across multiple runs of OPAL.
The computational type of values of this type.
The computational type of values of this type.
The number of dimensions of this array.
The number of dimensions of this array. E.g. "Object[]" has one dimension and "Object[][]" has two dimensions.
Returns the component type of this array type after dropping the given number of dimensions.
Returns the component type of this array type after dropping the given number
of dimensions. E.g., if dimensions is 0
this
is returned; if it is 1
then this arraytype's component type is returned.
If the value is larger than 1
then the componentType
has to be an array type
and drop(dimensions-1)
will be called on that type.
The number of dimensions to drop. This values has be equal or smaller than the number of dimensions of this array.
Returns this array type's element type.
Returns this array type's element type. E.g., the element type of an
array of arrays of arrays of int
is int
.
Each reference type is associated with a unique id.
Each reference type is associated with a unique id. Object types get ids >= 0 and array types get ids < 0.
Returns true
if this type is a base type (also called primitive type).
Returns true
if this type is a base type (also called primitive type).
Returns true
if this type is the primitive type boolean
.
Returns true
if this type is the primitive type boolean
.
Returns true
if this type is the primitive type byte
.
Returns true
if this type is the primitive type byte
.
Returns true
if this type is the primitive type char
(Range: [0..65535].
Returns true
if this type is the primitive type char
(Range: [0..65535].
Returns true
if this type is the primitive type double
.
Returns true
if this type is the primitive type double
.
Returns true
if this type can be used by fields.
Returns true
if this type is the primitive type float
.
Returns true
if this type is the primitive type float
.
Returns true
if this type is the primitive type int
.
Returns true
if this type is the primitive type int
.
Returns true
if this type is the primitive type long
.
Returns true
if this type is the primitive type long
.
Returns true
if this type is a reference type; that is, an array type or an
object type (class/interface type).
Returns true
if this type is a reference type; that is, an array type or an
object type (class/interface type).
In general, we can distinguish the following three categories of types:
Returns true
if this type is the primitive type short
.
Returns true
if this type is the primitive type short
.
Returns true
if this type represents void
; false
otherwise.
Returns true
if this type represents void
; false
otherwise.
Returns the binary name of this type as used by the Java runtime.
Returns the representation of this type as used by the JVM in, for example, method descriptors or signatures.
A String representation of this type as it would be used in Java source code.
Returns the Java class object representing this type.
Returns the Java class object representing this type.
This is generally only useful in very special cases and – to be meaningful at all – it is necessary that the class path used for running the static analysis also contains the classes that are analyzed. This is (often) only the case for the JDK.
However, one example where this is useful is the creation of a real object of
a specific type and to use that object when a method is called on that object.
This avoids the reimplementation of the respective logic as part of the analysis.
For example, if you want to get the String
that is created by a specific
StringBuffer
it is possible to implement the API of StringBuffer as part of
your analysis or (probably more efficient) to just create an instance of a
StringBuffer
object and to redirect every call to the real object. In this case
only some general logic is required to redirect calls and to convert the values
between the representation used by the analysis and the representation required
by the called method.
Represents an array type.
Comparing
ArrayType
sTo facilitate comparisons of (array) types, each array type is represented at any given time, by exactly one instance of
ArrayType
.General Information
From the JVM specification
An array type consists of a component type with a single dimension (whose length is not given by the type). The component type of an array type may itself be an array type. If, starting from any array type, one considers its component type, and then (if that is also an array type) the component type of that type, and so on, eventually one must reach a component type that is not an array type; this is called the element type of the array type. The element type of an array type is necessarily either a primitive type, or a class type, or an interface type.