Module openj9.dtfj

Class JavaClass

All Implemented Interfaces:
JavaClass

public class JavaClass extends JavaAbstractClass
  • Constructor Details

    • JavaClass

      public JavaClass(JavaRuntime vm, ImagePointer classPointer, long superClassID, String name, int instanceSize, long classLoaderID, int modifiers, int flagOffset, String fileName, 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
    • 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:
    • addConstantPoolClassRef

      public void addConstantPoolClassRef(long id)
      The constant pool consists of class IDs and object instances. This is how the class IDs are added
      Parameters:
      id -
    • 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)
    • getFilename

      public String getFilename() throws DataUnavailable, CorruptDataException
      Throws:
      DataUnavailable
      CorruptDataException
    • createNewField

      public void createNewField(String name, String sig, int modifiers, int offset, long classID)
    • createNewMethod

      public JavaMethod createNewMethod(long id, String name, String signature, int modifiers)
    • createConstantPoolObjectRef

      public void createConstantPoolObjectRef(long id)
    • createNewStaticField

      public void createNewStaticField(String name, String sig, int modifiers, String value)
    • getReferences

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

      public boolean isAncestorOf(JavaClass theClass)
    • 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