The computational type of values of this type.
The computational type of values of this type.
The unique id of this type.
The unique id of this type. Types are associated with globally unique ids to make it easy to define a global order.
Returns the binary name of this type as used by the Java runtime.
Returns the binary name of this type as used by the Java runtime. Basically
returns the same name as produced by Class.getName
.
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.
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.
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 byte
.
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 can be used by fields.
Returns true
if this type can be used by fields. Returns true
unless
this type represents void
.
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 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 represents void
; false
otherwise.
Represents a JVM type.
Programmatically, we distinguish three major kinds of types:
General Information
From the JVM specification
There are three kinds of reference types: class types, array types, and interface types. Their values are references to dynamically created class instances, arrays, or class instances or arrays that implement interfaces, respectively.
A reference value may also be the special null reference, a reference to no object, which will be denoted here by null. The null reference initially has no runtime type, but may be cast to any type. The default value of a reference type is null. The Java virtual machine specification does not mandate a concrete value encoding null.
Comparing Types/Performance
Given that the comparison of types is a standard operation in static analysis that is usually done over and over again great care was taken to enable an efficient comparison of types. It is - without exception - always possible to compare types using reference equality (i.e., the
eq
/ne
operators). For each type there will always be at most one object that represents that specific type.Additionally, a stable order is defined between types that is based on a type's kind and the unique id of the types in case of reference types. The order is: void type < primitive types < array types < class/interface types