Packages

sealed trait Type extends UIDValue with Ordered[Type]

Represents a JVM type.

Programmatically, we distinguish three major kinds of types:

  • base types/primitive types,
  • reference types,
  • the type void.

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

Source
Type.scala
Linear Supertypes
Ordered[Type], Comparable[Type], UIDValue, UID, AnyRef, Any
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. Type
  2. Ordered
  3. Comparable
  4. UIDValue
  5. UID
  6. AnyRef
  7. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. Protected

Abstract Value Members

  1. abstract def computationalType: ComputationalType

    The computational type of values of this type.

    The computational type of values of this type.

    Annotations
    @throws("if this type has no associated computational type(i.e., if this type represents void)")
  2. abstract def id: Int

    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. The id Int.MinValue is used for Void; Int.MinValue + 1 is used for CTIntType.

    Definition Classes
    TypeUID
  3. abstract def operandSize: Int

    The number of operand stack slots/registers required to store a single value of this type.

    The number of operand stack slots/registers required to store a single value of this type. In case of VoidType 0 is returned.

  4. abstract def toBinaryJavaName: String

    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.

    Annotations
    @throws("if this type has not binary name(i.e., if this type represents void)")
  5. abstract def toJVMTypeName: String

    Returns the representation of this type as used by the JVM in, for example, method descriptors or signatures.

  6. abstract def toJava: String

    A String representation of this type as it would be used in Java source code.

  7. abstract def toJavaClass: Class[_]

    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.

Concrete Value Members

  1. final def !=(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  2. final def ##: Int
    Definition Classes
    AnyRef → Any
  3. def <(other: Type): Boolean
    Definition Classes
    Type → Ordered
  4. def <=(other: Type): Boolean
    Definition Classes
    Type → Ordered
  5. final def ==(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  6. def >(other: Type): Boolean
    Definition Classes
    Type → Ordered
  7. def >=(other: Type): Boolean
    Definition Classes
    Type → Ordered
  8. def asArrayType: ArrayType
    Annotations
    @throws("if this type is not an array type")
  9. def asBaseType: BaseType
    Annotations
    @throws("if this type is not a base type")
  10. def asBooleanType: BooleanType
    Annotations
    @throws("if this is not a boolean type")
  11. def asFieldType: FieldType
    Annotations
    @throws("if this type is not a field type")
  12. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  13. def asIntLikeType: IntLikeType
    Annotations
    @throws("if this is not an int like type")
  14. def asNumericType: NumericType
    Annotations
    @throws("if this is not a numeric type")
  15. def asObjectType: ObjectType
    Annotations
    @throws("if this type is not an object type")
  16. def asReferenceType: ReferenceType
    Annotations
    @throws("if this type is not a reference type")
  17. def clone(): AnyRef
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.CloneNotSupportedException]) @native() @IntrinsicCandidate()
  18. def compare(that: Type): Int

    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.

    Definition Classes
    Type → Ordered
  19. def compareTo(that: Type): Int
    Definition Classes
    Ordered → Comparable
  20. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  21. final def equals(that: UID): Boolean
    Definition Classes
    UIDValue
  22. final def equals(other: Any): Boolean

    Two objects with a unique id are considered equal if they have the same unique id; all other properties will be ignored!

    Two objects with a unique id are considered equal if they have the same unique id; all other properties will be ignored!

    Definition Classes
    UIDValue → AnyRef → Any
  23. final def getClass(): Class[_ <: AnyRef]
    Definition Classes
    AnyRef → Any
    Annotations
    @native() @IntrinsicCandidate()
  24. final def hashCode(): Int

    The unique id.

    The unique id.

    Definition Classes
    UIDValue → AnyRef → Any
  25. def isArrayType: Boolean
  26. def isBaseType: Boolean

    Returns true if this type is a base type (also called primitive type).

  27. def isBooleanType: Boolean

    Returns true if this type is the primitive type boolean.

  28. def isByteType: Boolean

    Returns true if this type is the primitive type byte.

  29. def isCharType: Boolean

    Returns true if this type is the primitive type char (Range: [0..65535]).

  30. def isDoubleType: Boolean

    Returns true if this type is the primitive type double.

  31. def isFieldType: Boolean

    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.

  32. def isFloatType: Boolean

    Returns true if this type is the primitive type float.

  33. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  34. def isIntLikeType: Boolean
  35. def isIntegerType: Boolean

    Returns true if this type is the primitive type int.

  36. def isLongType: Boolean

    Returns true if this type is the primitive type long.

  37. def isNumericType: Boolean
  38. def isObjectType: Boolean
  39. def isReferenceType: Boolean

    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).

    Note

    In general, we can distinguish the following three categories of types:

    • base types,
    • reference types,
    • the type void.
  40. def isShortType: Boolean

    Returns true if this type is the primitive type short.

  41. def isVoidType: Boolean

    Returns true if this type represents void; false otherwise.

  42. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  43. final def notify(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native() @IntrinsicCandidate()
  44. final def notifyAll(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native() @IntrinsicCandidate()
  45. final def synchronized[T0](arg0: => T0): T0
    Definition Classes
    AnyRef
  46. def toString(): String
    Definition Classes
    AnyRef → Any
  47. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])
  48. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])
  49. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])

Deprecated Value Members

  1. def finalize(): Unit
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.Throwable]) @Deprecated
    Deprecated

Inherited from Ordered[Type]

Inherited from Comparable[Type]

Inherited from UIDValue

Inherited from UID

Inherited from AnyRef

Inherited from Any

Ungrouped