Search in sources :

Example 1 with LookupKey

use of com.ibm.dtfj.image.javacore.LookupKey in project openj9 by eclipse.

the class JCJavaRuntime method addJavaClass.

/**
 * NON-DTFJ
 * <br>
 * <b>For internal building purposes only</b>. Do not call outside the DTFJ implementation.
 * <br><br>
 * Two separate maps are kept for classes. One based on class ID, the other based on class name. Both
 * are used for lookups while building the runtime object. When a valid javaclass is added, it gets
 * added at least the name-based map, and may be added to the ID-based map if the ID is available. The
 * class name of the java class is a requirement, so this field must be set in the java class being passed.
 *
 * @param javaClass must not be null or exception thrown
 * @throws JCRegistrationFailureException if java class is null
 */
public void addJavaClass(JCJavaClass javaClass) throws JCInvalidArgumentsException {
    if (javaClass == null) {
        throw new JCInvalidArgumentsException("Must pass a valid javaClass");
    }
    String javaClassName = javaClass.internalGetName();
    ImagePointer pointer = javaClass.getID();
    if (pointer != null) {
        long id = pointer.getAddress();
        fJavaClassIDs.put(new LookupKey(id), javaClass);
    }
    fJavaClasses.put(javaClassName, javaClass);
}
Also used : ImagePointer(com.ibm.dtfj.image.ImagePointer) LookupKey(com.ibm.dtfj.image.javacore.LookupKey)

Aggregations

ImagePointer (com.ibm.dtfj.image.ImagePointer)1 LookupKey (com.ibm.dtfj.image.javacore.LookupKey)1