public final class JavaSourceIClassLoader extends IClassLoader
IClassLoader finds, scans and parses compilation units.
Notice that it does not compile them!
JAVA_IO_SERIALIZABLE, JAVA_LANG_ASSERTIONERROR, JAVA_LANG_BOOLEAN, JAVA_LANG_BYTE, JAVA_LANG_CHARACTER, JAVA_LANG_CLASS, JAVA_LANG_CLONEABLE, JAVA_LANG_DOUBLE, JAVA_LANG_ERROR, JAVA_LANG_FLOAT, JAVA_LANG_INTEGER, JAVA_LANG_LONG, JAVA_LANG_OBJECT, JAVA_LANG_OVERRIDE, JAVA_LANG_RUNTIMEEXCEPTION, JAVA_LANG_SHORT, JAVA_LANG_STRING, JAVA_LANG_THROWABLE| Constructor and Description |
|---|
JavaSourceIClassLoader(ResourceFinder sourceFinder,
java.lang.String optionalCharacterEncoding,
java.util.Set unitCompilers,
IClassLoader optionalParentIClassLoader)
Notice that the
unitCompilers set is both read and written
by the JavaSourceIClassLoader: As it searches for IClasses, it looks
into unitCompilers for class declarations, and as it opens,
scans and parses compilation units on-the-fly, it adds them to
unitCompilers. |
| Modifier and Type | Method and Description |
|---|---|
IClass |
findIClass(java.lang.String fieldDescriptor)
|
void |
setCharacterEncoding(java.lang.String optionalCharacterEncoding) |
void |
setCompileErrorHandler(UnitCompiler.ErrorHandler optionalCompileErrorHandler) |
void |
setSourceFinder(ResourceFinder pathResourceFinder) |
void |
setWarningHandler(WarningHandler optionalWarningHandler) |
createJavacLikePathIClassLoader, defineIClass, loadIClass, postConstructpublic JavaSourceIClassLoader(ResourceFinder sourceFinder, java.lang.String optionalCharacterEncoding, java.util.Set unitCompilers, IClassLoader optionalParentIClassLoader)
unitCompilers set is both read and written
by the JavaSourceIClassLoader: As it searches for IClasses, it looks
into unitCompilers for class declarations, and as it opens,
scans and parses compilation units on-the-fly, it adds them to
unitCompilers.public void setSourceFinder(ResourceFinder pathResourceFinder)
public void setCharacterEncoding(java.lang.String optionalCharacterEncoding)
public void setCompileErrorHandler(UnitCompiler.ErrorHandler optionalCompileErrorHandler)
public void setWarningHandler(WarningHandler optionalWarningHandler)
public IClass findIClass(java.lang.String fieldDescriptor) throws java.lang.ClassNotFoundException
IClassLoaderIClass by descriptor; return null if a class
for that descriptor could not be found.
Similar ClassLoader.findClass(java.lang.String), this method
must
IClass object from somewhere for the given type
IClassLoader.defineIClass(IClass) with that IClass object as
the argument
IClass object
The format of a descriptor is defined in JVMS 4.3.2. Typical
descriptors are:
I (Integer)
Lpkg1/pkg2/Cls; (Class declared in package)
Lpkg1/pkg2/Outer$Inner; Member class
Notice that this method is never called from more than one thread at a time. In other words, implementations of this method need not be synchronized.
findIClass in class IClassLoaderfieldDescriptor - Field descriptor of the IClass to load, e.g. "Lpkg1/pkg2/Outer$Inner;"null if a class with that descriptor could not be foundjava.lang.ClassNotFoundException - An exception was raised while loading the IClass