Module openj9.dtfj

Class JavaAbstractClass

java.lang.Object
com.ibm.dtfj.java.j9.JavaAbstractClass
All Implemented Interfaces:
JavaClass
Direct Known Subclasses:
JavaArrayClass, JavaClass

public abstract class JavaAbstractClass extends Object implements JavaClass
  • Field Details

  • Constructor Details

    • JavaAbstractClass

      protected JavaAbstractClass(JavaRuntime vm, ImagePointer id, int modifiers, long loaderID, ImagePointer objectID, int flagOffset, int hashcodeSlot)
  • Method Details

    • getClassLoader

      public JavaClassLoader getClassLoader() throws CorruptDataException
      Description copied from interface: JavaClass
      Fetch the class loader associated with this class. Classes defined in the bootstrap class loader (including classes representing primitive types or void) will always return a JavaClassLoader representing the bootstrap class loader. This asymmetry with java.lang.Class#getClassLoader() is intentional.
      Specified by:
      getClassLoader in interface JavaClass
      Returns:
      the JavaClassLoader in which this class was defined
      Throws:
      CorruptDataException - if the class loader for this class cannot be found (a class cannot exist without a loader so this implies corruption)
    • getObject

      public JavaObject getObject() throws CorruptDataException
      Description copied from interface: JavaClass
      Fetch the java.lang.Class object associated with this class.

      In some implementations this may be null if no object has been created to represent this class, or if the class is synthetic.

      Specified by:
      getObject in interface JavaClass
      Returns:
      the java.lang.Class object associated with this class
      Throws:
      CorruptDataException
      See Also:
    • getModifiers

      public int getModifiers() throws CorruptDataException
      Description copied from interface: JavaClass
      Return the Java language modifiers for this class.

      The modifiers are defined by the JVM Specification.

      Return MODIFIERS_UNAVAILABLE if the modifiers are unavailable. This might be the case if DTFJ is operating against an artefact such as a portable heap dump that does not contain information about a class's modifiers.

      Note that, for inner classes, the actual modifiers are returned, not the synthetic modifiers. For instance, a class will never have its 'protected' modifier set, even if the inner class was a protected member, since 'protected' is not a legal modifier for a class file.

      Specified by:
      getModifiers in interface JavaClass
      Returns:
      the modifiers for this class
      Throws:
      CorruptDataException
    • getID

      public ImagePointer getID()
      Description copied from interface: JavaClass
      The ID of a class is a pointer to a section of memory which identifies the class. The contents of this memory are implementation defined.

      In some implementations getID() and getObject().getID() may return the same value. This implies that the class object is also the primary internal representation of the class. DTFJ users should not rely on this behaviour.

      In some implementations, getID() may return null for some classes. This indicates that the class is a synthetic class which has been constructed for DTFJ purposes only. The class has no physical representation in the VM.

      Specified by:
      getID in interface JavaClass
      Returns:
      a pointer to the class
    • getInterfaces

      public Iterator getInterfaces()
      Description copied from interface: JavaClass
      Get the set of names of interfaces directly implemented by this class.
      Specified by:
      getInterfaces in interface JavaClass
      Returns:
      an iterator over the collection of the names of interfaces directly implemented by this class. Some JVM implementations may choose to load interfaces lazily, so only the names are returned. The JavaClass objects may be found through the defining class loader.
      See Also:
    • addInterfaceName

      public void addInterfaceName(String interfaceName)
    • getInstanceSize

      public abstract int getInstanceSize(JavaObject instance)
      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)
    • equals

      public boolean equals(Object obj)
      Description copied from class: java.lang.Object
      Compares the argument to the receiver, and answers true if they represent the same object using a class specific comparison. The implementation in Object answers true only if the argument is the exact same object as the receiver (==).
      Specified by:
      equals in interface JavaClass
      Overrides:
      equals in class Object
      Parameters:
      obj - Object the object to compare with this object.
      Returns:
      boolean true if the object is the same as this object false if it is different from this object.
      See Also:
    • getHashcodeSlotSize

      public int getHashcodeSlotSize()
      Returns the size of the extra slot needed for stored hashcode - if the object was moved - in JVMs built with J9VM_OPT_NEW_OBJECT_HASH. If the hashcode could fit in spare space in the object header, this will return 0. . *
      Returns:
      object instance size delta, in bytes
    • hashCode

      public int hashCode()
      Description copied from class: java.lang.Object
      Answers an integer hash code for the receiver. Any two objects which answer true when passed to .equals must answer the same value for this method.
      Specified by:
      hashCode in interface JavaClass
      Overrides:
      hashCode in class Object
      Returns:
      the receiver's hash.
      See Also:
    • readFlagsFromInstance

      public int readFlagsFromInstance(JavaObject instance) throws MemoryAccessException, CorruptDataException
      Throws:
      MemoryAccessException
      CorruptDataException
    • addClassLoaderReference

      protected void addClassLoaderReference(Collection coll)
    • addSuperclassReference

      protected void addSuperclassReference(Collection coll)
    • addClassObjectReference

      protected void addClassObjectReference(Collection coll)
    • getProtectionDomain

      public JavaObject getProtectionDomain() throws DataUnavailable, CorruptDataException
      Description copied from interface: JavaClass
      Returns the protection domain for this class.
      Specified by:
      getProtectionDomain in interface JavaClass
      Returns:
      the protection domain or null for the default protection domain
      Throws:
      DataUnavailable
      CorruptDataException