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 class
private static class
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription(package private) static ClassDefiner
accessDefineClass
(Class<?> loaderClass) Generates helper in same package as theClassLoader
so it can access defineClassprivate static byte[]
buildDefineClassAccess
(Class<?> loaderClass) ClassLoader
helper that sits in the same package and passes on defineClass requestsstatic boolean
canDowncastToProxy
(Class<?> hostClass) Returns true if it's possible to downcast to proxies defined from the given host.static boolean
canLoadProxyByName
(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 ClassDefiner
findClassDefiner
(ClassLoader hostLoader) Finds the appropriate class definer for the given class loader.static boolean
Do we have access tosun.misc.Unsafe
?(package private) static ClassDefiner
tryAccessDefineClass
(Class<?> loaderClass) (package private) static <T> T
tryPrivileged
(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:ClassDefiner
Defines a new class relative to the host.- Specified by:
define
in interfaceClassDefiner
- Throws:
Exception
-
findClassDefiner
Finds the appropriate class definer for the given class loader. -
tryPrivileged
-
tryAccessDefineClass
-
accessDefineClass
Generates helper in same package as theClassLoader
so it can access defineClass- Throws:
Exception
-
buildDefineClassAccess
ClassLoader
helper that sits in the same package and passes on defineClass requests
-