Class ObjectInstance

  • Direct Known Subclasses:
    ArrayInstance

    public class ObjectInstance
    extends Object
    A simulated heap object identified by id, holding fields keyed by owner, name, and descriptor.
    • Constructor Detail

      • ObjectInstance

        public ObjectInstance​(int id,
                              String className)
        Creates an object with no fields set.
        Parameters:
        id - the heap object id
        className - internal name of the object's class
    • Method Detail

      • getId

        public int getId()
        Returns:
        the id
      • getClassName

        public String getClassName()
        Returns:
        the class name
      • getField

        public Object getField​(String owner,
                               String name,
                               String descriptor)
        Reads a field value.
        Parameters:
        owner - internal name of the declaring class
        name - the field's name
        descriptor - the field's type descriptor
        Returns:
        the stored value, or null if the field was never set
      • setField

        public void setField​(String owner,
                             String name,
                             String descriptor,
                             Object value)
        Writes a field value.
        Parameters:
        owner - internal name of the declaring class
        name - the field's name
        descriptor - the field's type descriptor
        value - the value to store
      • setClassResolver

        public void setClassResolver​(Object classResolver)
        Attaches the resolver used for type hierarchy queries.
        Parameters:
        classResolver - the resolver to attach
      • isInstanceOf

        public boolean isInstanceOf​(String className)
        Checks assignability by exact class match, treating java/lang/Object as a universal supertype.
        Parameters:
        className - internal name of the candidate type
        Returns:
        true if the class names match exactly or the candidate is java/lang/Object
      • getIdentityHashCode

        public int getIdentityHashCode()
        Returns:
        the identity hash code
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object