Package org.codehaus.janino
Class IClassLoader
- java.lang.Object
-
- org.codehaus.janino.IClassLoader
-
- Direct Known Subclasses:
ClassLoaderIClassLoader
,Compiler.CompilerIClassLoader
,JavaSourceIClassLoader
,JGrep.JGrepIClassLoader
,ResourceFinderIClassLoader
public abstract class IClassLoader extends java.lang.Object
Loads anIClass
by type name.
-
-
Field Summary
Fields Modifier and Type Field Description IClass
ANNO_java_lang_Override
Representation of theOverride
annotation.IClass.IConstructor
CTOR_java_lang_StringBuilder__java_lang_String
Representation of theStringBuilder(String)
constructor.private static boolean
DEBUG
private java.util.Map<java.lang.String,IClass>
loadedIClasses
IClass.IMethod
METH_java_lang_Iterable__iterator
Representation of theIterable.iterator()
method.IClass.IMethod
METH_java_lang_String__concat__java_lang_String
Representation of theString.concat(String)
method.IClass.IMethod
METH_java_lang_String__valueOf__boolean
Representation of theString.valueOf(boolean)
method.IClass.IMethod
METH_java_lang_String__valueOf__char
Representation of theString.valueOf(char)
method.IClass.IMethod
METH_java_lang_String__valueOf__double
Representation of theString.valueOf(double)
method.IClass.IMethod
METH_java_lang_String__valueOf__float
Representation of theString.valueOf(float)
method.IClass.IMethod
METH_java_lang_String__valueOf__int
Representation of theString.valueOf(int)
method.IClass.IMethod
METH_java_lang_String__valueOf__java_lang_Object
Representation of theString.valueOf(Object)
method.IClass.IMethod
METH_java_lang_String__valueOf__long
Representation of theString.valueOf(long)
method.IClass.IMethod
METH_java_lang_StringBuilder__append__java_lang_String
Representation of theStringBuilder.append(String)
method.IClass.IMethod
METH_java_lang_StringBuilder__toString
Representation of theStringBuilder.toString()
method.IClass.IMethod
METH_java_util_Iterator__hasNext
Representation of theIterator.hasNext()
method.IClass.IMethod
METH_java_util_Iterator__next
Representation of theIterator.next()
method.private IClassLoader
optionalParentIClassLoader
IClass
TYPE_java_io_Serializable
Representation of theSerializable
type.IClass
TYPE_java_lang_AssertionError
Representation of theAssertionError
type.IClass
TYPE_java_lang_Boolean
Representation of theBoolean
type.IClass
TYPE_java_lang_Byte
Representation of theByte
type.IClass
TYPE_java_lang_Character
Representation of theCharacter
type.IClass
TYPE_java_lang_Class
Representation of theClass
type.IClass
TYPE_java_lang_Cloneable
Representation of theCloneable
type.IClass
TYPE_java_lang_Double
Representation of theDouble
type.IClass
TYPE_java_lang_Error
Representation of theError
type.IClass
TYPE_java_lang_Exception
Representation of theException
type.IClass
TYPE_java_lang_Float
Representation of theFloat
type.IClass
TYPE_java_lang_Integer
Representation of theInteger
type.IClass
TYPE_java_lang_Iterable
Representation of theIterable
type.IClass
TYPE_java_lang_Long
Representation of theLong
type.IClass
TYPE_java_lang_Object
Representation of theObject
type.IClass
TYPE_java_lang_RuntimeException
Representation of theRuntimeException
type.IClass
TYPE_java_lang_Short
Representation of theShort
type.IClass
TYPE_java_lang_String
Representation of theString
type.IClass
TYPE_java_lang_StringBuilder
Representation of theStringBuilder
type.IClass
TYPE_java_lang_Throwable
Representation of theThrowable
type.IClass
TYPE_java_util_Iterator
Representation of theIterator
type.private java.util.Set<java.lang.String>
unloadableIClasses
-
Constructor Summary
Constructors Constructor Description IClassLoader(IClassLoader optionalParentIClassLoader)
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description static IClassLoader
createJavacLikePathIClassLoader(java.io.File[] optionalBootClassPath, java.io.File[] optionalExtDirs, java.io.File[] classPath)
Create anIClassLoader
that looks for classes in the given "boot class path", then in the given "extension directories", and then in the given "class path".protected void
defineIClass(IClass iClass)
Define anIClass
in the context of thisIClassLoader
.protected abstract IClass
findIClass(java.lang.String descriptor)
IClass
loadIClass(java.lang.String fieldDescriptor)
Get anIClass
by field descriptor.protected void
postConstruct()
This method must be called by the constructor of the directly derived class.
-
-
-
Field Detail
-
DEBUG
private static final boolean DEBUG
- See Also:
- Constant Field Values
-
ANNO_java_lang_Override
public IClass ANNO_java_lang_Override
Representation of theOverride
annotation.
-
TYPE_java_lang_AssertionError
public IClass TYPE_java_lang_AssertionError
Representation of theAssertionError
type.
-
TYPE_java_lang_Boolean
public IClass TYPE_java_lang_Boolean
Representation of theBoolean
type.
-
TYPE_java_lang_Byte
public IClass TYPE_java_lang_Byte
Representation of theByte
type.
-
TYPE_java_lang_Character
public IClass TYPE_java_lang_Character
Representation of theCharacter
type.
-
TYPE_java_lang_Class
public IClass TYPE_java_lang_Class
Representation of theClass
type.
-
TYPE_java_lang_Cloneable
public IClass TYPE_java_lang_Cloneable
Representation of theCloneable
type.
-
TYPE_java_lang_Double
public IClass TYPE_java_lang_Double
Representation of theDouble
type.
-
TYPE_java_lang_Exception
public IClass TYPE_java_lang_Exception
Representation of theException
type.
-
TYPE_java_lang_Error
public IClass TYPE_java_lang_Error
Representation of theError
type.
-
TYPE_java_lang_Float
public IClass TYPE_java_lang_Float
Representation of theFloat
type.
-
TYPE_java_lang_Integer
public IClass TYPE_java_lang_Integer
Representation of theInteger
type.
-
TYPE_java_lang_Iterable
public IClass TYPE_java_lang_Iterable
Representation of theIterable
type.
-
TYPE_java_lang_Long
public IClass TYPE_java_lang_Long
Representation of theLong
type.
-
TYPE_java_lang_Object
public IClass TYPE_java_lang_Object
Representation of theObject
type.
-
TYPE_java_lang_RuntimeException
public IClass TYPE_java_lang_RuntimeException
Representation of theRuntimeException
type.
-
TYPE_java_lang_Short
public IClass TYPE_java_lang_Short
Representation of theShort
type.
-
TYPE_java_lang_String
public IClass TYPE_java_lang_String
Representation of theString
type.
-
TYPE_java_lang_StringBuilder
public IClass TYPE_java_lang_StringBuilder
Representation of theStringBuilder
type.
-
TYPE_java_lang_Throwable
public IClass TYPE_java_lang_Throwable
Representation of theThrowable
type.
-
TYPE_java_io_Serializable
public IClass TYPE_java_io_Serializable
Representation of theSerializable
type.
-
TYPE_java_util_Iterator
public IClass TYPE_java_util_Iterator
Representation of theIterator
type.
-
METH_java_lang_Iterable__iterator
public IClass.IMethod METH_java_lang_Iterable__iterator
Representation of theIterable.iterator()
method.
-
METH_java_lang_String__concat__java_lang_String
public IClass.IMethod METH_java_lang_String__concat__java_lang_String
Representation of theString.concat(String)
method.
-
METH_java_lang_String__valueOf__int
public IClass.IMethod METH_java_lang_String__valueOf__int
Representation of theString.valueOf(int)
method.
-
METH_java_lang_String__valueOf__long
public IClass.IMethod METH_java_lang_String__valueOf__long
Representation of theString.valueOf(long)
method.
-
METH_java_lang_String__valueOf__float
public IClass.IMethod METH_java_lang_String__valueOf__float
Representation of theString.valueOf(float)
method.
-
METH_java_lang_String__valueOf__double
public IClass.IMethod METH_java_lang_String__valueOf__double
Representation of theString.valueOf(double)
method.
-
METH_java_lang_String__valueOf__char
public IClass.IMethod METH_java_lang_String__valueOf__char
Representation of theString.valueOf(char)
method.
-
METH_java_lang_String__valueOf__boolean
public IClass.IMethod METH_java_lang_String__valueOf__boolean
Representation of theString.valueOf(boolean)
method.
-
METH_java_lang_String__valueOf__java_lang_Object
public IClass.IMethod METH_java_lang_String__valueOf__java_lang_Object
Representation of theString.valueOf(Object)
method.
-
METH_java_lang_StringBuilder__append__java_lang_String
public IClass.IMethod METH_java_lang_StringBuilder__append__java_lang_String
Representation of theStringBuilder.append(String)
method.
-
METH_java_lang_StringBuilder__toString
public IClass.IMethod METH_java_lang_StringBuilder__toString
Representation of theStringBuilder.toString()
method.
-
METH_java_util_Iterator__hasNext
public IClass.IMethod METH_java_util_Iterator__hasNext
Representation of theIterator.hasNext()
method.
-
METH_java_util_Iterator__next
public IClass.IMethod METH_java_util_Iterator__next
Representation of theIterator.next()
method.
-
CTOR_java_lang_StringBuilder__java_lang_String
public IClass.IConstructor CTOR_java_lang_StringBuilder__java_lang_String
Representation of theStringBuilder(String)
constructor.
-
optionalParentIClassLoader
private final IClassLoader optionalParentIClassLoader
-
loadedIClasses
private final java.util.Map<java.lang.String,IClass> loadedIClasses
-
unloadableIClasses
private final java.util.Set<java.lang.String> unloadableIClasses
-
-
Constructor Detail
-
IClassLoader
public IClassLoader(IClassLoader optionalParentIClassLoader)
-
-
Method Detail
-
postConstruct
protected final void postConstruct()
This method must be called by the constructor of the directly derived class. (The reason being is that this method invokes abstractloadIClass(String)
which will not work until the implementing class is constructed.)
-
loadIClass
public final IClass loadIClass(java.lang.String fieldDescriptor) throws java.lang.ClassNotFoundException
Get anIClass
by field descriptor.
-
findIClass
protected abstract IClass findIClass(java.lang.String descriptor) throws java.lang.ClassNotFoundException
Find a newIClass
by descriptor; returnnull
if a class for thatdescriptor
could not be found.Similar
ClassLoader.findClass(java.lang.String)
, this method must- Get an
IClass
object from somewhere for the given type - Call
defineIClass(IClass)
with thatIClass
object as the argument - Return the
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.
- Returns:
null
if a class with that descriptor could not be found- Throws:
java.lang.ClassNotFoundException
- if an exception was raised while loading the class
- Get an
-
defineIClass
protected final void defineIClass(IClass iClass)
Define anIClass
in the context of thisIClassLoader
. If anIClass
with that descriptor already exists, aRuntimeException
is thrown.This method should only be called from an implementation of
findIClass(String)
.- Throws:
java.lang.RuntimeException
- A differentIClass
object is already defined for this type
-
createJavacLikePathIClassLoader
public static IClassLoader createJavacLikePathIClassLoader(java.io.File[] optionalBootClassPath, java.io.File[] optionalExtDirs, java.io.File[] classPath)
Create anIClassLoader
that looks for classes in the given "boot class path", then in the given "extension directories", and then in the given "class path".The default for the
optionalBootClassPath
is the path defined in the system property "sun.boot.class.path", and the default for theoptionalExtensionDirs
is the path defined in the "java.ext.dirs" system property.
-
-