Class JavaArrayClass

java.lang.Object
com.ibm.dtfj.java.j9.JavaAbstractClass
com.ibm.dtfj.java.j9.JavaArrayClass
All Implemented Interfaces:
JavaClass

public class JavaArrayClass extends JavaAbstractClass
  • Constructor Details

    • JavaArrayClass

      public JavaArrayClass(JavaRuntime runtime, ImagePointer pointer, int modifiers, int flagOffset, int sizeOffset, int bytesForSize, int firstElementOffset, long leafClassID, int dimension, long loaderID, ImagePointer objectID, int hashcodeSlot)
  • Method Details

    • getName

      public String getName() throws CorruptDataException
      Description copied from interface: JavaClass
      Get the name of the class.
      Returns:
      the name of the class in the form: "full/package/class$innerclass"
      Throws:
      CorruptDataException
    • getSuperclass

      public JavaClass getSuperclass() throws CorruptDataException
      Description copied from interface: JavaClass
      Get the immediate superclass of this class.
      Returns:
      the immediate superclass of this class, or null if this class has no superclass. For interfaces, Object, primitive types and void null is always returned.
      Throws:
      CorruptDataException
    • isArray

      public boolean isArray() throws CorruptDataException
      Description copied from interface: JavaClass
      Is this an array class ?
      Returns:
      true if this class is an array class
      Throws:
      CorruptDataException
    • getLeafClass

      public JavaClass getLeafClass()
    • getComponentType

      public JavaClass getComponentType() throws CorruptDataException
      Description copied from interface: JavaClass
      For array classes, returns a JavaClass representing the component type of this array class.
      Returns:
      a JavaClass representing the component type of this array class
      Throws:
      CorruptDataException
    • getDeclaredFields

      public Iterator getDeclaredFields()
      Description copied from interface: JavaClass
      Get the set of fields declared in this class.
      Returns:
      an iterator over the collection of fields declared in this class.
      See Also:
    • getDeclaredMethods

      public Iterator getDeclaredMethods()
      Description copied from interface: JavaClass
      Get the set of methods declared in this class.
      Returns:
      an iterator over the collection of methods declared in this class.
      See Also:
    • getConstantPoolReferences

      public Iterator getConstantPoolReferences()
      Description copied from interface: JavaClass
      Java classes may refer to other classes and to String objects via the class's constant pool. These references are followed by the garbage collector, forming edges on the graph of reachable objects. This getConstantPoolReferences() may be used to determine which objects are referred to by the receiver's constant pool.

      Although Java VMs typically permit only Class and String objects in the constant pool, some esoteric or future virtual machines may permit other types of objects to occur in the constant pool. This API imposes no restrictions on the types of JavaObjects which might be included in the Iterator.

      No assumption should be made about the order in which constant pool references are returned.

      Classes may also refer to objects through static variables. These may be found with the getDeclaredFields() API. Objects referenced by static variables are not returned by getConstantPoolReferences() unless the object is also referenced by the constant pool.

      Returns:
      an iterator over the collection of JavaObjects which are referred to by the constant pool of this class
      See Also:
    • getInstanceSize

      public int getInstanceSize(JavaObject instance)
      Specified by:
      getInstanceSize in class JavaAbstractClass
      Parameters:
      instance - The instance is needed for array types to calculate the size of a per-instance basis
      Returns:
      The size, in bytes, of an instance of this class (required for iterating the heap)
    • getBytesPerElement

      public int getBytesPerElement(int refFieldSize) throws CorruptDataException
      Looks up the class name of the child elements to determine the size of one element
      Parameters:
      refFieldSize - The size of reference fields (fj9object_t) in the heap of the object instance we are sizing
      Returns:
      The size of one element, in bytes
      Throws:
      CorruptDataException
    • getFirstElementOffset

      public int getFirstElementOffset()
      Returns:
    • getSizeOffset

      public int getSizeOffset()
      Returns:
      The offset into an array where the length (in elements) is found
    • getNumberOfSizeBytes

      public int getNumberOfSizeBytes()
      Returns:
      The number of bytes to read from the object header as the size field
    • getReferences

      public Iterator getReferences()
      Description copied from interface: JavaClass
      Get the set of references from this class.
      Returns:
      an iterator of JavaReferences
      See Also:
    • getInstanceSize

      public long getInstanceSize() throws CorruptDataException
      Description copied from interface: JavaClass
      Returns the size in bytes of an instance of this class on the heap.

      The call is only meaningful for a non-array JavaClass, where all instances of the class are of the same size. If this method is called on a JavaArrayClass, where instances can be of different sizes, an UnsupportedOperationException will be thrown. DataUnavailable can be thrown if no value is available: for example when DTFJ is examining a javacore, where the instance size for a class is not recorded.

      Returns:
      size in bytes of an instance
      Throws:
      CorruptDataException