Top Description Fields Constructors Methods
org.codehaus.groovy.reflection

public Class SunClassLoader

extends ClassLoader
implements Opcodes
Class Inheritance
All Implemented Interfaces
org.objectweb.asm.Opcodes
Known Direct Subclasses
org.codehaus.groovy.runtime.callsite.GroovySunClassLoader
Imports
org.objectweb.asm.ClassReader, .ClassWriter, .MethodVisitor, .Opcodes, java.io.IOException, .InputStream, java.security.AccessController, .PrivilegedAction, java.util.HashMap, .Map

Special class loader, which when running on Sun VM allows to generate accessor classes for any method

Field Summary

Modifier and TypeField and Description
protected final Map<String, Class<T>>
protected static final SunClassLoader

Constructor Summary

AccessConstructor and Description
protected

Method Summary

Modifier and TypeMethod and Description
protected void
define(byte[] bytes, final String name)

public Class<T>
protected synchronized Class<T>
loadClass(String
The binary name of the class
name
,
boolean
If true then resolve the class
resolve
)

Overrides java.lang.ClassLoader.loadClass.

Loads the class with the specified binary name.
protected void
private void
protected static String
Inherited from java.lang.ClassLoader:
clearAssertionStatusdefineClassdefineClassdefineClassdefineClassdefinePackagefindClassfindClassfindLibraryfindLoadedClassfindResourcefindResourcefindResourcesfindSystemClassgetClassLoadingLockgetDefinedPackagegetDefinedPackagesgetNamegetPackagegetPackagesgetParentgetPlatformClassLoadergetResourcegetResourceAsStreamgetResourcesgetSystemClassLoadergetSystemResourcegetSystemResourceAsStreamgetSystemResourcesgetUnnamedModuleisRegisteredAsParallelCapableloadClassregisterAsParallelCapableresolveClassresourcessetClassAssertionStatussetDefaultAssertionStatussetPackageAssertionStatussetSigners

Field Detail

knownClassesback to summary
protected final Map<String, Class<T>> knownClasses
sunVMback to summary
protected static final SunClassLoader sunVM

Constructor Detail

SunClassLoaderback to summary
protected SunClassLoader() throws Throwable

Method Detail

defineback to summary
protected void define(byte[] bytes, final String name)
doesKnowback to summary
public Class<T> doesKnow(String name)
loadClassback to summary
protected synchronized Class<T> loadClass(String name, boolean resolve) throws ClassNotFoundException

Overrides java.lang.ClassLoader.loadClass.

Doc from java.lang.ClassLoader.loadClass.

Loads the class with the specified binary name. The default implementation of this method searches for classes in the following order:

  1. Invoke findLoadedClass(String) to check if the class has already been loaded.

  2. Invoke the loadClass method on the parent class loader. If the parent is null the class loader built into the virtual machine is used, instead.

  3. Invoke the findClass(String) method to find the class.

If the class was found using the above steps, and the resolve flag is true, this method will then invoke the resolveClass(Class) method on the resulting Class object.

Subclasses of ClassLoader are encouraged to override findClass(String), rather than this method.

Unless overridden, this method synchronizes on the result of getClassLoadingLock method during the entire class loading process.

Parameters
name:String

The binary name of the class

resolve:boolean

If true then resolve the class

Returns:Class<T>

The resulting Class object

Exceptions
ClassNotFoundException:
If the class could not be found
loadFromResback to summary
protected void loadFromRes(String name) throws IOException
loadMagicback to summary
private void loadMagic()
resNameback to summary
protected static String resName(String s)