Package com.google.inject.internal.aop
Class UnsafeClassDefiner
java.lang.Object
com.google.inject.internal.aop.UnsafeClassDefiner
- All Implemented Interfaces:
ClassDefiner
ClassDefiner that defines classes using sun.misc.Unsafe.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate static classprivate static class -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription(package private) static ClassDefineraccessDefineClass(Class<?> loaderClass) Generates helper in same package as theClassLoaderso it can access defineClassprivate static byte[]buildDefineClassAccess(Class<?> loaderClass) ClassLoaderhelper that sits in the same package and passes on defineClass requestsstatic booleancanDowncastToProxy(Class<?> hostClass) Returns true if it's possible to downcast to proxies defined from the given host.static booleancanLoadProxyByName(Class<?> hostClass) Returns true if it's possible to load by name proxies defined from the given host.Class<?> Defines a new class relative to the host.private static ClassDefinerfindClassDefiner(ClassLoader hostLoader) Finds the appropriate class definer for the given class loader.static booleanDo we have access tosun.misc.Unsafe?(package private) static ClassDefinertryAccessDefineClass(Class<?> loaderClass) (package private) static <T> TtryPrivileged(PrivilegedExceptionAction<T> action, String errorMessage)
-
Field Details
-
logger
-
UNSAFE_DEFINER
-
ALWAYS_DEFINE_ANONYMOUSLY
private static final boolean ALWAYS_DEFINE_ANONYMOUSLY -
DEFINEACCESS_BY_GUICE_MARKER
- See Also:
-
DEFINEACCESS_API
-
CLASS_LOADER_TYPE
-
BYTE_ARRAY_TYPE
-
-
Constructor Details
-
UnsafeClassDefiner
UnsafeClassDefiner()
-
-
Method Details
-
isAccessible
public static boolean isAccessible()Do we have access tosun.misc.Unsafe? -
canLoadProxyByName
Returns true if it's possible to load by name proxies defined from the given host. -
canDowncastToProxy
Returns true if it's possible to downcast to proxies defined from the given host. -
define
Description copied from interface:ClassDefinerDefines a new class relative to the host.- Specified by:
definein interfaceClassDefiner- Throws:
Exception
-
findClassDefiner
Finds the appropriate class definer for the given class loader. -
tryPrivileged
-
tryAccessDefineClass
-
accessDefineClass
Generates helper in same package as theClassLoaderso it can access defineClass- Throws:
Exception
-
buildDefineClassAccess
ClassLoaderhelper that sits in the same package and passes on defineClass requests
-