Class ArrayType

  • All Implemented Interfaces:
    IRType

    public final class ArrayType
    extends Object
    implements IRType
    Represents an array type.
    • Constructor Detail

      • ArrayType

        public ArrayType​(IRType elementType,
                         int dimensions)
        Creates an array type with specified element type and dimensions.
        Parameters:
        elementType - the element type
        dimensions - the number of dimensions
      • ArrayType

        public ArrayType​(IRType elementType)
        Creates a single-dimensional array type.
        Parameters:
        elementType - the element type
    • Method Detail

      • getElementType

        public IRType getElementType()
        Returns:
        the element type
      • getDimensions

        public int getDimensions()
        Returns:
        the dimensions
      • fromDescriptor

        public static ArrayType fromDescriptor​(String descriptor)
        Creates an array type from a descriptor string.
        Parameters:
        descriptor - the array descriptor
        Returns:
        the array type
      • getDescriptor

        public String getDescriptor()
        Specified by:
        getDescriptor in interface IRType
        Returns:
        the JVM type descriptor for this type
      • getSize

        public int getSize()
        Specified by:
        getSize in interface IRType
        Returns:
        the number of stack or local slots a value of this type occupies
      • isReference

        public boolean isReference()
        Specified by:
        isReference in interface IRType
        Returns:
        true for object and array types
      • isPrimitive

        public boolean isPrimitive()
        Specified by:
        isPrimitive in interface IRType
        Returns:
        true for the eight primitive types
      • isVoid

        public boolean isVoid()
        Specified by:
        isVoid in interface IRType
        Returns:
        true for the void type
      • isArray

        public boolean isArray()
        Specified by:
        isArray in interface IRType
        Returns:
        true for array types
      • isTwoSlot

        public boolean isTwoSlot()
        Specified by:
        isTwoSlot in interface IRType
        Returns:
        true for long and double, which occupy two slots
      • getBaseElementType

        public IRType getBaseElementType()
        Gets the base element type for multi-dimensional arrays.
        Returns:
        the innermost element type
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object