Check out the new USENIX Web site. next up previous
Next: Transformers and the ClassLoader Up: The JOIE Environment Previous: The JOIE Environment

The JOIE ClassLoader

Before a class can execute in a JVM it must be loaded by a class loader. The JVM invokes a class loader to resolve a reference to a class that has not yet been loaded. The class loader is responsible for locating the missing class file, fetching it from the file system or a network server, and returning it to the JVM. The JVM then verifies the new class to ensure that it is semantically valid and safe. To allow for flexibility in loading and instantiating classes, the Java environment allows users to define new class loaders as subclasses of java.lang.ClassLoader.

JOIE supports load-time transformation in a special subclass of the ClassLoader. The JOIE ClassLoader exports methods for registering transformers, and it applies registered transformers to each loaded class after fetching the class file into memory but before submitting it to the JVM for verification. The JVM has no way to determine that any changes were made from the original class (although we have adopted the convention of marking transformed classes as implementing an interface Transformed, and recording the transformer responsible).

To expose the class internals to the transformers, the JOIE ClassLoader creates a joie.ClassInfo object for each class as it is loaded. The transformers access the features of the JOIE toolkit by invoking methods of ClassInfo and related classes, as described below. Section 4.1 deals with the internals of the JOIE ClassInfo class in more detail.



Geoff Alex Cohen
Tue Apr 28 14:31:49 EDT 1998