| Modifier and Type | Field and Description |
|---|---|
| protected final boolean | _cfgUseParentLoader
Flag that determines if we should first try to load new class using parent class loader or not; this may be done to try to force access to protected/package-access properties. |
| private static final ConcurrentHashMap | |
| private static final Charset |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public static boolean | canAddClassInPackageOf(Class<?> cls)
Helper method called to check whether it is acceptable to create a new class in package that given class is part of. |
| pack-priv Class | defineClassOnParent(ClassLoader parentClassLoader, String className, byte[] byteCode, int offset, int length)
|
| private Class | |
| private Object | getParentClassLoadingLock(ClassLoader
The parent ClassLoader parentClassLoader, String The name of the to-be-loaded class className)Get the class loading lock for the parent class loader for loading the named class. |
| public Class | loadAndResolve(ClassName
Interface or abstract class that class to load should extend or
implement className, byte[] byteCode)
|
| private Class | Returns: the loaded class, ornull if the class could not be loaded on the parent classloader.Interface or abstract class that class to load should extend or implement className, byte[] the generated bytecode for the class to load byteCode)Attempt to load (and resolve) the class using the parent class loader (if it is configured and present). |
| public static int | |
| private void |
| _cfgUseParentLoader | back to summary |
|---|---|
| protected final boolean _cfgUseParentLoader Flag that determines if we should first try to load new class using parent class loader or not; this may be done to try to force access to protected/package-access properties. | |
| parentParallelLockMap | back to summary |
|---|---|
| private static final ConcurrentHashMap<String, Object> parentParallelLockMap | |
| UTF8 | back to summary |
|---|---|
| private static final Charset UTF8 | |
| MyClassLoader | back to summary |
|---|---|
| public MyClassLoader(ClassLoader parent, boolean tryToUseParent) | |
| canAddClassInPackageOf | back to summary |
|---|---|
| public static boolean canAddClassInPackageOf(Class<?> cls) Helper method called to check whether it is acceptable to create a new class in package that given class is part of. This is used to prevent certain class of failures, related to access limitations: for example, we can not add classes in sealed packages, or core Java packages (java.*).
| |
| defineClassOnParent | back to summary |
|---|---|
| pack-priv Class | |
| findLoadedClassOnParent | back to summary |
|---|---|
| private Class | |
| getParentClassLoadingLock | back to summary |
|---|---|
| private Object getParentClassLoadingLock(ClassLoader parentClassLoader, String className) Get the class loading lock for the parent class loader for loading the named class. This is effectively the same implementation as ClassLoader#getClassLoadingLock, but using our static parentParallelLockMap and keying off of the parent ClassLoader instance as well as the class name to load.
| |
| loadAndResolve | back to summary |
|---|---|
public Class
| |
| loadAndResolveUsingParentClassloader | back to summary |
|---|---|
| private Class Attempt to load (and resolve) the class using the parent class loader (if it is configured and present).
This method will return | |
| replaceName | back to summary |
|---|---|
| public static int replaceName(byte[] byteCode, String from, String to) | |
| resolveClassOnParent | back to summary |
|---|---|
| private void resolveClassOnParent(ClassLoader parentClassLoader, Class<?> clazz) | |