Interface Type

All Known Implementing Classes:
ArrayType, BooleanType, ByteType, CharType, DoubleType, FloatType, FunctionType, IntType, LongType, ObjectType, ShortType, StringType, UnitType

The interface representing all JFuncMachine types
  • Method Summary

    Modifier and Type
    Method
    Description
    default Type
    Returns the type of this type's box class, if any.
    default String
    Returns the name of this type's box class, if any For example, SimpleTypes.INT has a box class name of "java.lang.Integer"
    default char
    Returns the character that the JVM uses to represent this type
    default int
    The number of stack slots that this type consumes on the JVM stack.
    default Type
    Returns the unboxed type of this type, if any
    default boolean
    Tests whether this type is represented as an int in the JVM.
    default boolean
    Test whether this type is a box type
    default boolean
    Tests whether this type is an enum type
    default boolean
    Test whether this type can be unboxed from the given class name
    default boolean
    Tests whether this type has the same JVM representation as another type
  • Method Details

    • getBoxTypeName

      default String getBoxTypeName()
      Returns the name of this type's box class, if any For example, SimpleTypes.INT has a box class name of "java.lang.Integer"
      Returns:
      The name of the box class, or null if there isn't one
    • getBoxType

      default Type getBoxType()
      Returns the type of this type's box class, if any. For example, SimpleTypes.INT has a box type of new ObjectType("java.lang.Integer")
      Returns:
      The type of this type's box class, or null if there isn't one
    • getUnboxedType

      default Type getUnboxedType()
      Returns the unboxed type of this type, if any
      Returns:
      The unboxed type of this type, or null if there isn't one
    • isBoxType

      default boolean isBoxType()
      Test whether this type is a box type
      Returns:
      True if this type is a box type
    • isUnboxableFrom

      default boolean isUnboxableFrom(String className)
      Test whether this type can be unboxed from the given class name
      Parameters:
      className - The name of a possible box type
      Returns:
      True if this type can be unboxed from the given class name
    • getStackSize

      default int getStackSize()
      The number of stack slots that this type consumes on the JVM stack. A long or double type consumes two slots, all others consume one.
      Returns:
      The number of stack slots this type consumes
    • hasIntRepresentation

      default boolean hasIntRepresentation()
      Tests whether this type is represented as an int in the JVM. This is true for boolean, byte, char, int, and short.
      Returns:
      True if this type is represented as an int by the JVM
    • getJVMTypeRepresentation

      default char getJVMTypeRepresentation()
      Returns the character that the JVM uses to represent this type
      Returns:
      I for types represented by an int, J for Long, F for Float, D for double, A for object
    • sameJavaType

      default boolean sameJavaType(Type other)
      Tests whether this type has the same JVM representation as another type
      Parameters:
      other - The other type to compare against
      Returns:
      True if the types have the same representation in the JVM
    • isEnum

      default boolean isEnum()
      Tests whether this type is an enum type
      Returns:
      True if this type represents an enum