Class JavaClass
-
Field Summary
Fields declared in class com.ibm.dtfj.java.j9.JavaAbstractClass
_classPointer, _javaVM
Fields declared in interface com.ibm.dtfj.java.JavaClass
MODIFIERS_UNAVAILABLE
-
Constructor Summary
ConstructorDescriptionJavaClass
(JavaRuntime vm, ImagePointer classPointer, long superClassID, String name, int instanceSize, long classLoaderID, int modifiers, int flagOffset, String fileName, ImagePointer objectID, int hashcodeSlot) -
Method Summary
Modifier and TypeMethodDescriptionvoid
addConstantPoolClassRef
(long id) The constant pool consists of class IDs and object instances.void
createConstantPoolObjectRef
(long id) void
createNewField
(String name, String sig, int modifiers, int offset, long classID) createNewMethod
(long id, String name, String signature, int modifiers) void
createNewStaticField
(String name, String sig, int modifiers, String value) For array classes, returns a JavaClass representing the component type of this array class.Java classes may refer to other classes and to String objects via the class's constant pool.Get the set of fields declared in this class.Get the set of methods declared in this class.long
Returns the size in bytes of an instance of this class on the heap.int
getInstanceSize
(JavaObject instance) getName()
Get the name of the class.Get the set of references from this class.Get the immediate superclass of this class.boolean
isAncestorOf
(JavaClass theClass) boolean
isArray()
Is this an array class ?Methods declared in class com.ibm.dtfj.java.j9.JavaAbstractClass
addClassLoaderReference, addClassObjectReference, addInterfaceName, addSuperclassReference, equals, getClassLoader, getHashcodeSlotSize, getID, getInterfaces, getModifiers, getObject, getProtectionDomain, hashCode, readFlagsFromInstance
-
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
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
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
Description copied from interface:JavaClass
Is this an array class ?- Returns:
- true if this class is an array class
- Throws:
CorruptDataException
-
getComponentType
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
-
getDeclaredMethods
-
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
- Specified by:
getInstanceSize
in classJavaAbstractClass
- 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
- Throws:
DataUnavailable
CorruptDataException
-
createNewField
-
createNewMethod
-
createConstantPoolObjectRef
public void createConstantPoolObjectRef(long id) -
createNewStaticField
-
getReferences
-
isAncestorOf
-
getInstanceSize
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
-