Class/Object

org.opalj.br

Type

Related Docs: object Type | package br

Permalink

sealed abstract class Type extends UID with Ordered[Type]

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

Linear Supertypes
Ordered[Type], Comparable[Type], UID, AnyRef, Any
Known Subclasses
Ordering
  1. Alphabetic
  2. By inheritance
Inherited
  1. Type
  2. Ordered
  3. Comparable
  4. UID
  5. AnyRef
  6. Any
  1. Hide All
  2. Show all
Visibility
  1. Public
  2. All

Abstract Value Members

  1. abstract def computationalType: ComputationalType

    Permalink

    The computational type of values of this type.

    The computational type of values of this type.

    Annotations
    @throws( ... )
  2. abstract def id: Int

    Permalink

    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.

    Definition Classes
    Type → UID
  3. abstract def toBinaryJavaName: String

    Permalink

    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( ... )
  4. abstract def toJVMTypeName: String

    Permalink

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

  5. abstract def toJava: String

    Permalink

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

  6. abstract def toJavaClass: Class[_]

    Permalink

    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

    Permalink
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  3. def <(other: Type): Boolean

    Permalink
    Definition Classes
    Type → Ordered
  4. def <=(other: Type): Boolean

    Permalink
    Definition Classes
    Type → Ordered
  5. final def ==(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  6. def >(other: Type): Boolean

    Permalink
    Definition Classes
    Type → Ordered
  7. def >=(other: Type): Boolean

    Permalink
    Definition Classes
    Type → Ordered
  8. def asArrayType: ArrayType

    Permalink
    Annotations
    @throws( "if this type is not an array type" )
  9. def asBaseType: BaseType

    Permalink
    Annotations
    @throws( "if this type is not a base type" )
  10. def asFieldType: FieldType

    Permalink
    Annotations
    @throws( "if this type is not a field type" )
  11. final def asInstanceOf[T0]: T0

    Permalink
    Definition Classes
    Any
  12. def asIntLikeType: IntLikeType

    Permalink
    Annotations
    @throws( "if this is not a numeric type" )
  13. def asNumericType: NumericType

    Permalink
    Annotations
    @throws( "if this is not a numeric type" )
  14. def asObjectType: ObjectType

    Permalink
    Annotations
    @throws( ... )
  15. def asReferenceType: ReferenceType

    Permalink
    Annotations
    @throws( ... )
  16. def clone(): AnyRef

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  17. def compare(that: Type): Int

    Permalink

    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
  18. def compareTo(that: Type): Int

    Permalink
    Definition Classes
    Ordered → Comparable
  19. final def eq(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  20. def equals(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  21. def finalize(): Unit

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  22. final def getClass(): Class[_]

    Permalink
    Definition Classes
    AnyRef → Any
  23. def hashCode(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  24. def isArrayType: Boolean

    Permalink
  25. def isBaseType: Boolean

    Permalink

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

  26. def isBooleanType: Boolean

    Permalink

    Returns true if this type is the primitive type boolean.

  27. def isByteType: Boolean

    Permalink

    Returns true if this type is the primitive type byte.

  28. def isCharType: Boolean

    Permalink

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

  29. def isDoubleType: Boolean

    Permalink

    Returns true if this type is the primitive type double.

  30. def isFieldType: Boolean

    Permalink

    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.

  31. def isFloatType: Boolean

    Permalink

    Returns true if this type is the primitive type float.

  32. final def isInstanceOf[T0]: Boolean

    Permalink
    Definition Classes
    Any
  33. def isIntLikeType: Boolean

    Permalink
  34. def isIntegerType: Boolean

    Permalink

    Returns true if this type is the primitive type int.

  35. def isLongType: Boolean

    Permalink

    Returns true if this type is the primitive type long.

  36. def isNumericType: Boolean

    Permalink
  37. def isObjectType: Boolean

    Permalink
  38. def isReferenceType: Boolean

    Permalink

    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.
  39. def isShortType: Boolean

    Permalink

    Returns true if this type is the primitive type short.

  40. def isVoidType: Boolean

    Permalink

    Returns true if this type represents void; false otherwise.

  41. final def ne(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  42. final def notify(): Unit

    Permalink
    Definition Classes
    AnyRef
  43. final def notifyAll(): Unit

    Permalink
    Definition Classes
    AnyRef
  44. final def synchronized[T0](arg0: ⇒ T0): T0

    Permalink
    Definition Classes
    AnyRef
  45. def toString(): String

    Permalink
    Definition Classes
    AnyRef → Any
  46. final def wait(): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  47. final def wait(arg0: Long, arg1: Int): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  48. final def wait(arg0: Long): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )

Inherited from Ordered[Type]

Inherited from Comparable[Type]

Inherited from UID

Inherited from AnyRef

Inherited from Any

Ungrouped