public final class JavaSourceIClassLoader extends IClassLoader
IClassLoader
finds, scans and parses compilation units.
Notice that it does not compile them!
Constructor and Description |
---|
JavaSourceIClassLoader(ResourceFinder sourceFinder,
String optionalCharacterEncoding,
Set unitCompilers,
IClassLoader optionalParentIClassLoader)
Notice that the
unitCompilers set is both read and written
by the JavaSourceIClassLoader : As it searches for IClass es, 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(String type)
|
void |
setCharacterEncoding(String optionalCharacterEncoding) |
void |
setCompileErrorHandler(UnitCompiler.ErrorHandler optionalCompileErrorHandler) |
void |
setSourceFinder(ResourceFinder pathResourceFinder) |
void |
setWarningHandler(WarningHandler optionalWarningHandler) |
createJavacLikePathIClassLoader, defineIClass, loadIClass, postConstruct
public JavaSourceIClassLoader(ResourceFinder sourceFinder, String optionalCharacterEncoding, Set unitCompilers, IClassLoader optionalParentIClassLoader)
unitCompilers
set is both read and written
by the JavaSourceIClassLoader
: As it searches for IClass
es, 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(String optionalCharacterEncoding)
public void setCompileErrorHandler(UnitCompiler.ErrorHandler optionalCompileErrorHandler)
public void setWarningHandler(WarningHandler optionalWarningHandler)
public IClass findIClass(String type) throws ClassNotFoundException
IClassLoader
IClass
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 IClassLoader
type
- field descriptor of the IClass
to load, e.g. "Lpkg1/pkg2/Outer$Inner;"null
if a class with that descriptor could not be foundClassNotFoundException
- if an exception was raised while loading the IClass
Copyright © 2001-2012. All Rights Reserved.