In order to impose tight security restrictions on untrusted classes but
not on trusted system classes, we have to be able to distinguish between
those types of classes. This is done by keeping track of how the classes
are loaded into the system. By definition, any class that the interpreter
loads directly from the CLASSPATH is trusted. This means that we can't
load untrusted code in that way--we can't load it with Class.forName().
Instead, we create a ClassLoader subclass to load the untrusted code.
This one loads classes from a specified directory (which should not
be part of the CLASSPATH).
This class has been altered to fit this project needs.
We would like to thank the author of its original version, Ulf Dittmer.
Original version available at
SECURITY ISSUE: Currently, this class loader is not being used by the
framework. All classes are being loaded with the default security manager,
what is a security issue.
This is one abstract method of ClassLoader that all subclasses must
define. Its job is to load an array of bytes from somewhere and to
pass them to defineClass(). If the resolve argument is true, it must
also call resolveClass(), which will do things like verify the presence
of the superclass. Because of this second step, this method may be called to
load superclasses that are system classes, and it must take this into account.