BType

dotty.tools.backend.jvm.BTypes.BType
trait BType

A BType is either a primitve type, a ClassBType, an ArrayBType of one of these, or a MethodType referring to BTypes.

Attributes

Graph
Supertypes
class Object
trait Matchable
class Any
Known subtypes
object BOOL.type
object BYTE.type
object CHAR.type
object DOUBLE.type
object FLOAT.type
object INT.type
object LONG.type
object SHORT.type
object UNIT.type
trait RefBType

Members list

Concise view

Value members

Concrete methods

final def conformsTo(other: BType): Boolean
final def descriptor: String

Attributes

Returns:

The Java descriptor of this type. Examples:

  • int: I
  • java.lang.String: Ljava/lang/String;
  • int[]: [I
  • Object m(String s, double d): (Ljava/lang/String;D)Ljava/lang/Object;
final def isArray: Boolean
final def isBoxed: Boolean
final def isClass: Boolean
final def isMethod: Boolean
final def isNullType: Boolean
final def isPrimitive: Boolean
final def isRealType: Boolean
final def isRef: Boolean
final def isWideType: Boolean
final def maxType(other: BType): BType

Compute the upper bound of two types. Takes promotions of numeric primitives into account.

Compute the upper bound of two types. Takes promotions of numeric primitives into account.

Attributes

final def size: Int

Attributes

Returns:

0 for void, 2 for long and double, 1 otherwise

The asm.Type corresponding to this BType.

The asm.Type corresponding to this BType.

Note about asm.Type.getObjectType (*): For class types, the method expects the internal name, i.e. without the surrounding 'L' and ';'. For array types on the other hand, the method expects a full descriptor, for example "[Ljava/lang/String;".

See method asm.Type.getType that creates a asm.Type from a type descriptor

  • for an OBJECT type, the 'L' and ';' are not part of the range of the created Type
  • for an ARRAY type, the full descriptor is part of the range

Attributes

final override def toString: String

Returns a string representation of the object.

Returns a string representation of the object.

The default representation is platform dependent.

Attributes

Returns:

a string representation of the object.

Definition Classes
Any
final def typedOpcode(opcode: Int): Int

Some JVM opcodes have typed variants. This method returns the correct opcode according to the type.

Some JVM opcodes have typed variants. This method returns the correct opcode according to the type.

Attributes

opcode

A JVM instruction opcode. This opcode must be one of ILOAD, ISTORE, IALOAD, IASTORE, IADD, ISUB, IMUL, IDIV, IREM, INEG, ISHL, ISHR, IUSHR, IAND, IOR IXOR and IRETURN.

Returns:

The opcode adapted to this java type. For example, if this type is float and opcode is IRETURN, this method returns FRETURN.