Package org.codehaus.janino

# Class IClassLoader

java.lang.Object
org.codehaus.janino.IClassLoader

Direct Known Subclasses:
  `ClassLoaderIClassLoader`, `JavaSourceIClassLoader`, `ResourceFinderIClassLoader`

public abstract class IClassLoader extends Object
Loads an `IClass` by type name.

## Field Summary

Fields
Modifier and Type
Field
Description
`IClass.IConstructor`
`CTOR_java_lang_StringBuilder__java_lang_String`
`IClass.IMethod`
`METH_java_lang_Enum__ordinal`
`IClass.IMethod`
`METH_java_lang_Iterable__iterator`
`IClass.IMethod`
`METH_java_lang_String__concat__java_lang_String`
`IClass.IMethod`
`METH_java_lang_String__equals__java_lang_Object`
`IClass.IMethod`
`METH_java_lang_String__hashCode`
`IClass.IMethod`
`METH_java_lang_String__valueOf__boolean`
`IClass.IMethod`
`METH_java_lang_String__valueOf__char`
`IClass.IMethod`
`METH_java_lang_String__valueOf__double`
`IClass.IMethod`
`METH_java_lang_String__valueOf__float`
`IClass.IMethod`
`METH_java_lang_String__valueOf__int`
`IClass.IMethod`
`METH_java_lang_String__valueOf__java_lang_Object`
`IClass.IMethod`
`METH_java_lang_String__valueOf__long`
`IClass.IMethod`
`METH_java_lang_StringBuilder__append__boolean`
`IClass.IMethod`
`METH_java_lang_StringBuilder__append__char`
`IClass.IMethod`
`METH_java_lang_StringBuilder__append__double`
`IClass.IMethod`
`METH_java_lang_StringBuilder__append__float`
`IClass.IMethod`
`METH_java_lang_StringBuilder__append__int`
`IClass.IMethod`
`METH_java_lang_StringBuilder__append__java_lang_Object`
`IClass.IMethod`
`METH_java_lang_StringBuilder__append__java_lang_String`
`IClass.IMethod`
`METH_java_lang_StringBuilder__append__long`
`IClass.IMethod`
`METH_java_lang_StringBuilder__toString`
`IClass.IMethod`
`METH_java_lang_Throwable__addSuppressed`
`IClass.IMethod`
`METH_java_util_Iterator__hasNext`
`IClass.IMethod`
`METH_java_util_Iterator__next`
`IClass`
`TYPE_java_io_Serializable`
`IClass`
`TYPE_java_lang_annotation_Retention`
`IClass`
`TYPE_java_lang_AssertionError`
`IClass`
`TYPE_java_lang_Boolean`
`IClass`
`TYPE_java_lang_Byte`
`IClass`
`TYPE_java_lang_Character`
`IClass`
`TYPE_java_lang_Class`
`IClass`
`TYPE_java_lang_Cloneable`
`IClass`
`TYPE_java_lang_Double`
`IClass`
`TYPE_java_lang_Enum`
`IClass`
`TYPE_java_lang_Error`
`IClass`
`TYPE_java_lang_Exception`
`IClass`
`TYPE_java_lang_Float`
`IClass`
`TYPE_java_lang_Integer`
`IClass`
`TYPE_java_lang_Iterable`
`IClass`
`TYPE_java_lang_Long`
`IClass`
`TYPE_java_lang_Object`
`IClass`
`TYPE_java_lang_Override`
`IClass`
`TYPE_java_lang_RuntimeException`
`IClass`
`TYPE_java_lang_Short`
`IClass`
`TYPE_java_lang_String`
`IClass`
`TYPE_java_lang_StringBuilder`
`IClass`
`TYPE_java_lang_System`
`IClass`
`TYPE_java_lang_Throwable`
`IClass`
`TYPE_java_lang_Void`
`IClass`
`TYPE_java_util_Iterator`

## Constructor Summary

Constructors
Constructor
Description
`IClassLoader(IClassLoader parentIClassLoader)`

## Method Summary

Modifier and Type
Method
Description
`static IClassLoader`
`createJavacLikePathIClassLoader(File[] bootClassPath, File[] extDirs, File[] classPath)`
Creates an `IClassLoader` that looks for classes in the given "boot class path", then in the given "extension directories", and then in the given "class path".
`protected final void`
`defineIClass(IClass iClass)`
Defines an `IClass` in the context of this `IClassLoader`.
`protected abstract IClass`
`findIClass(String descriptor)`
Finds a new `IClass` by descriptor and calls `defineIClass(IClass)`.
`IClass`
`getArrayIClass(IClass componentType)`
Gets an `IClass` that represents an array of this type.
`IClass`
`getArrayIClass(IClass componentType, int n)`
Gets an `IClass` that represents an n-dimensional array of this type.
`IClassLoader`
`getParentIClassLoader()`
`final IClass`
`loadIClass(String fieldDescriptor)`
Gets an `IClass` by field descriptor.
`protected final void`
`postConstruct()`
This method must be called by the constructor of the derived class.

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Field Details

### TYPE_java_lang_annotation_Retention

public IClass TYPE_java_lang_annotation_Retention

### TYPE_java_lang_AssertionError

public IClass TYPE_java_lang_AssertionError

### TYPE_java_lang_Boolean

public IClass TYPE_java_lang_Boolean

### TYPE_java_lang_Byte

public IClass TYPE_java_lang_Byte

### TYPE_java_lang_Character

public IClass TYPE_java_lang_Character

### TYPE_java_lang_Class

public IClass TYPE_java_lang_Class

### TYPE_java_lang_Cloneable

public IClass TYPE_java_lang_Cloneable

### TYPE_java_lang_Double

public IClass TYPE_java_lang_Double

### TYPE_java_lang_Enum

public IClass TYPE_java_lang_Enum

### TYPE_java_lang_Error

public IClass TYPE_java_lang_Error

### TYPE_java_lang_Exception

public IClass TYPE_java_lang_Exception

### TYPE_java_lang_Float

public IClass TYPE_java_lang_Float

### TYPE_java_lang_Integer

public IClass TYPE_java_lang_Integer

### TYPE_java_lang_Iterable

public IClass TYPE_java_lang_Iterable

### TYPE_java_lang_Long

public IClass TYPE_java_lang_Long

### TYPE_java_lang_Object

public IClass TYPE_java_lang_Object

### TYPE_java_lang_Override

public IClass TYPE_java_lang_Override

### TYPE_java_lang_RuntimeException

public IClass TYPE_java_lang_RuntimeException

### TYPE_java_lang_Short

public IClass TYPE_java_lang_Short

### TYPE_java_lang_String

public IClass TYPE_java_lang_String

### TYPE_java_lang_StringBuilder

public IClass TYPE_java_lang_StringBuilder

### TYPE_java_lang_System

public IClass TYPE_java_lang_System

### TYPE_java_lang_Throwable

public IClass TYPE_java_lang_Throwable

### TYPE_java_lang_Void

public IClass TYPE_java_lang_Void

### TYPE_java_io_Serializable

public IClass TYPE_java_io_Serializable

### TYPE_java_util_Iterator

public IClass TYPE_java_util_Iterator

### METH_java_lang_Enum__ordinal

public IClass.IMethod METH_java_lang_Enum__ordinal

### METH_java_lang_Iterable__iterator

public IClass.IMethod METH_java_lang_Iterable__iterator

### METH_java_lang_String__concat__java_lang_String

public IClass.IMethod METH_java_lang_String__concat__java_lang_String

### METH_java_lang_String__equals__java_lang_Object

public IClass.IMethod METH_java_lang_String__equals__java_lang_Object

### METH_java_lang_String__hashCode

public IClass.IMethod METH_java_lang_String__hashCode

### METH_java_lang_String__valueOf__int

public IClass.IMethod METH_java_lang_String__valueOf__int

### METH_java_lang_String__valueOf__long

public IClass.IMethod METH_java_lang_String__valueOf__long

### METH_java_lang_String__valueOf__float

public IClass.IMethod METH_java_lang_String__valueOf__float

### METH_java_lang_String__valueOf__double

public IClass.IMethod METH_java_lang_String__valueOf__double

### METH_java_lang_String__valueOf__char

public IClass.IMethod METH_java_lang_String__valueOf__char

### METH_java_lang_String__valueOf__boolean

public IClass.IMethod METH_java_lang_String__valueOf__boolean

### METH_java_lang_String__valueOf__java_lang_Object

public IClass.IMethod METH_java_lang_String__valueOf__java_lang_Object

### METH_java_lang_StringBuilder__append__int

public IClass.IMethod METH_java_lang_StringBuilder__append__int

### METH_java_lang_StringBuilder__append__long

public IClass.IMethod METH_java_lang_StringBuilder__append__long

### METH_java_lang_StringBuilder__append__float

public IClass.IMethod METH_java_lang_StringBuilder__append__float

### METH_java_lang_StringBuilder__append__double

public IClass.IMethod METH_java_lang_StringBuilder__append__double

### METH_java_lang_StringBuilder__append__char

public IClass.IMethod METH_java_lang_StringBuilder__append__char

### METH_java_lang_StringBuilder__append__boolean

public IClass.IMethod METH_java_lang_StringBuilder__append__boolean

### METH_java_lang_StringBuilder__append__java_lang_Object

public IClass.IMethod METH_java_lang_StringBuilder__append__java_lang_Object

### METH_java_lang_StringBuilder__append__java_lang_String

public IClass.IMethod METH_java_lang_StringBuilder__append__java_lang_String

### METH_java_lang_StringBuilder__toString

public IClass.IMethod METH_java_lang_StringBuilder__toString

### METH_java_lang_Throwable__addSuppressed

@Nullable public IClass.IMethod METH_java_lang_Throwable__addSuppressed

### METH_java_util_Iterator__hasNext

public IClass.IMethod METH_java_util_Iterator__hasNext

### METH_java_util_Iterator__next

public IClass.IMethod METH_java_util_Iterator__next

### CTOR_java_lang_StringBuilder__java_lang_String

public IClass.IConstructor CTOR_java_lang_StringBuilder__java_lang_String

## Constructor Details

### IClassLoader

public IClassLoader(@Nullable IClassLoader parentIClassLoader)

Parameters:
  `parentIClassLoader` - `null` iff this `IClassLoader` has no parent

## Method Details

### getParentIClassLoader

public IClassLoader getParentIClassLoader()

### postConstruct

protected final void postConstruct()
This method must be called by the constructor of the derived class. (The reason being is that this method invokes abstract `loadIClass(String)` which will not work until the derived class is constructed.)

### loadIClass

@Nullable public final IClass loadIClass(String fieldDescriptor) throws ClassNotFoundException
Gets an `IClass` by field descriptor.

Parameters:
  `fieldDescriptor` - E.g. 'Lpkg1/pkg2/Outer$Inner;'
Returns:
  `null` if an `IClass` could not be loaded
Throws:
  `ClassNotFoundException` - An exception was raised while loading the `IClass`

### findIClass

@Nullable protected abstract IClass findIClass(String descriptor) throws ClassNotFoundException
Finds a new `IClass` by descriptor and calls `defineIClass(IClass)`.

Similar `ClassLoader.findClass(java.lang.String)`, this method must

- Get an `IClass` object from somewhere for the given type
- Call `defineIClass(IClass)` with that `IClass` 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/Clazz;` (Class declared in package)
- `Lpkg1/pkg2/Outer$Inner;` Member class

Notice that this method is never called for array types.

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 thread-safe.

Returns:
  `null` if a class with that descriptor could not be found
Throws:
  `ClassNotFoundException` - An exception was raised while loading the class

### defineIClass

protected final void defineIClass(IClass iClass)
Defines an `IClass` in the context of this `IClassLoader`.

This method should only be called from an implementation of `findIClass(String)`.

Throws:
  `InternalCompilerException` - A different `IClass` object is already defined for this type

### getArrayIClass

public IClass getArrayIClass(IClass componentType, int n)
Gets an `IClass` that represents an n-dimensional array of this type.

Parameters:
  `componentType` - Required because the superclass of an array class is `Object` by definition
  `n` - Dimension count

### getArrayIClass

public IClass getArrayIClass(IClass componentType)
Gets an `IClass` that represents an array of this type.

Parameters:
  `componentType` - Required because the superclass of an array class is `Object` by definition

### createJavacLikePathIClassLoader

public static IClassLoader createJavacLikePathIClassLoader(@Nullable File[] bootClassPath, @Nullable File[] extDirs, File[] classPath)
Creates an `IClassLoader` 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 `bootClassPath` is the path defined in the system property "sun.boot.class.path", and the default for the `extensionDirs` is the path defined in the "java.ext.dirs" system property.