public abstract class SourceClassLoader extends ClassLoader implements Cloneable
Constructor and Description |
---|
SourceClassLoader(ClassLoader parent)
constructor from parent class loader.
|
Modifier and Type | Method and Description |
---|---|
abstract SourceClassLoader |
clone()
creates a clone with identical behavior, typically sharing the same bytecode.
|
abstract BytecodeClassLoader |
findBytecodeClassLoaderBySource(Source source)
tries to find the bytecode class loader that can load classes that were created
by compiling the given source.
|
abstract LoadMode |
getLoadMode()
gets the load mode.
|
abstract Class<?> |
loadClass(Source source,
String name)
loads a class with the given name and from the given source.
|
abstract Class<?> |
loadMainClass(Source source)
loads the main class of the given source.
|
abstract void |
releaseClasses(ClassReleaser releaser)
release metadata for all classed ever loaded by this class loader.
|
clearAssertionStatus, defineClass, defineClass, defineClass, defineClass, definePackage, findClass, findLibrary, findLoadedClass, findResource, findResources, findSystemClass, getClassLoadingLock, getPackage, getPackages, getParent, getResource, getResourceAsStream, getResources, getSystemClassLoader, getSystemResource, getSystemResourceAsStream, getSystemResources, loadClass, loadClass, registerAsParallelCapable, resolveClass, setClassAssertionStatus, setDefaultAssertionStatus, setPackageAssertionStatus, setSigners
public SourceClassLoader(ClassLoader parent)
parent
- parent class loaderpublic abstract Class<?> loadMainClass(Source source)
First searches for the source, then loads the main class that resulted from compiling the source.
source
- sourceCompileException
- if compilation was necessary to load the class and failedLoadException
- if loading failed, including if the class was not foundpublic abstract Class<?> loadClass(Source source, String name)
First searches for the source, only then for the class with given name as part of the classes that resulted from compiling the source.
source
- sourcename
- class nameCompileException
- if compilation was necessary to load the class and failedLoadException
- if loading failed, including if the class was not foundpublic abstract BytecodeClassLoader findBytecodeClassLoaderBySource(Source source)
source
- sourcepublic abstract LoadMode getLoadMode()
public abstract SourceClassLoader clone()
public abstract void releaseClasses(ClassReleaser releaser)
Allows to remove metadata associated by Groovy (or Java) with a class, which is often necessary to get on-the-fly garbage collection.
Generally call only when really done using this class loader and all loaded classes; subsequently trying to use this class loader or its classes results generally in undefined behavior.
releaser
- class releaser