This class makes heavy use of Function and BiFunction types when interacting
with generated fast-classes and enhanced proxies. This is a deliberate design decision to avoid
using Guice-specific types in the generated classes. This means generated classes can be defined
in the same ClassLoader as their host class without needing access to Guice's own ClassLoader. (In other words it removes any need for bridge ClassLoaders.)
| Modifier and Type | Class and Description |
|---|---|
| public static interface | BytecodeGen.
Builder of enhanced classes. |
| Modifier and Type | Field and Description |
|---|---|
| private static final Map | |
| private static final LoadingCache | ENHANCER_BUILDERS
Cache of recent |
| public static final String | |
| private static final ClassValue | FAST_CLASSES
Lazy association between classes and their generated fast-classes. |
| public static final String |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| pack-priv static BiFunction | enhancedConstructor(Function<String, BiFunction<Object, Object[], Object>> enhancer, Constructor<?> constructor)
Returns an invoker that constructs an enhanced instance. |
| pack-priv static BytecodeGen. | |
| private static Function | fastClass(Executable member)
Prepares the class declaring the given member for fast invocation using bytecode generation. |
| pack-priv static BiFunction | |
| pack-priv static BiFunction | |
| public static boolean | |
| pack-priv static <T> T | newCircularProxy(Class<T> type, InvocationHandler handler)
Creates a new circular proxy for the given type. |
| pack-priv static BiFunction | superMethod(Function<String, BiFunction<Object, Object[], Object>> enhancer, Method method)
Returns an invoker that calls the original unenhanced method. |
| circularProxyTypeCache | back to summary |
|---|---|
| private static final Map<Class<?>, Boolean> circularProxyTypeCache | |
| ENHANCER_BUILDERS | back to summary |
|---|---|
| private static final LoadingCache<Class<?>, BytecodeGen. Cache of recent Uses weak values so builders can be collected after they're done enhancing. | |
| ENHANCER_BY_GUICE_MARKER | back to summary |
|---|---|
| public static final String ENHANCER_BY_GUICE_MARKER | |
| FAST_CLASSES | back to summary |
|---|---|
| private static final ClassValue<Function<String, BiFunction<Object, Object[], Object>>> FAST_CLASSES Lazy association between classes and their generated fast-classes. | |
| FASTCLASS_BY_GUICE_MARKER | back to summary |
|---|---|
| public static final String FASTCLASS_BY_GUICE_MARKER | |
| BytecodeGen | back to summary |
|---|---|
| public BytecodeGen() | |
| enhancedConstructor | back to summary |
|---|---|
| pack-priv static BiFunction Returns an invoker that constructs an enhanced instance. The invoker function accepts an array of invocation handlers plus an array of arguments for the original constructor. | |
| enhancerBuilder | back to summary |
|---|---|
| pack-priv static BytecodeGen. Create a builder of enhancers for the given class. | |
| fastClass | back to summary |
|---|---|
| private static Function Prepares the class declaring the given member for fast invocation using bytecode generation. | |
| fastConstructor | back to summary |
|---|---|
| pack-priv static BiFunction Returns a fast invoker for the given constructor. The invoker function ignores the first parameter and accepts an array of arguments for the constructor in the second parameter. Returns | |
| fastMethod | back to summary |
|---|---|
| pack-priv static BiFunction Returns a fast invoker for the given method. The invoker function accepts an instance, which
will be Returns | |
| isCircularProxy | back to summary |
|---|---|
| public static boolean isCircularProxy(Object object) Returns true if the given object is a circular proxy. | |
| newCircularProxy | back to summary |
|---|---|
| pack-priv static <T> T newCircularProxy(Class<T> type, InvocationHandler handler) Creates a new circular proxy for the given type. | |
| superMethod | back to summary |
|---|---|
| pack-priv static BiFunction Returns an invoker that calls the original unenhanced method. The invoker function accepts an enhanced instance plus an array of arguments for the original method. | |
| Modifier and Type | Method and Description |
|---|---|
| public Function | |
| public Method[] |
| buildEnhancer | back to summary |
|---|---|
| public Function Generates an enhancer for the selected subset of methods. The enhancer maps constructor and method signatures to invokers, where each invoker is
represented as a Constructor invokers take an array of Method invokers take an enhanced instance as their context object and call the original super-method with arguments unpacked from the argument array, ie. provides super-invocation. | |
| getEnhanceableMethods | back to summary |
|---|---|
| public Method[] getEnhanceableMethods() Lists the methods in the host class that can be enhanced. This always includes public and protected methods that are neither static nor final. Package-private methods can only be enhanced if they're in the same package as the host
and we can define types in the same class loader with Unsafe. The | |