Package com.google.inject.internal.aop
Class MethodPartition
java.lang.Object
com.google.inject.internal.aop.MethodPartition
Accumulates methods with the same name and number of parameters. This helps focus the search for
bridge delegates that involve type-erasure of generic parameter types, since the parameter count
will be the same for the bridge method and its delegate.
-
Field Summary
FieldsModifier and TypeFieldDescriptionReverse order of declaration; super-methods appear later in the list. -
Constructor Summary
ConstructorsConstructorDescriptionMethodPartition
(Method first, Method second) Each partition starts off with at least two methods. -
Method Summary
Modifier and TypeMethodDescriptionaddCandidate
(Method method) Add a new method to this partition for resolution.void
collectEnhanceableMethods
(TypeLiteral<?> hostType, Consumer<Method> methodVisitor, Map<Method, Method> bridgeDelegates) Resolve and collect enhanceable methods into the given list; one per method-signature.private static String
parametersKey
(Class<?>[] parameterTypes) Each method is uniquely identified in the partition by its actual parameter types.private static boolean
resolvedParametersMatch
(Method subMethod, TypeLiteral<?> host, Method superMethod) Compares a sub-method with a generic super-method by resolving it against the host class.
-
Field Details
-
candidates
Reverse order of declaration; super-methods appear later in the list.
-
-
Constructor Details
-
MethodPartition
Each partition starts off with at least two methods.
-
-
Method Details
-
addCandidate
Add a new method to this partition for resolution. -
collectEnhanceableMethods
public void collectEnhanceableMethods(TypeLiteral<?> hostType, Consumer<Method> methodVisitor, Map<Method, Method> bridgeDelegates) Resolve and collect enhanceable methods into the given list; one per method-signature. Methods declared in sub-classes are preferred over those in super-classes with the same signature. (Unless it's a bridge method, in which case we prefer to report the non-bridge method from the super-class as a convenience to AOP method matchers that always ignore synthetic methods.)At the same time we use generic type resolution to match resolved bridge methods to the methods they delegate to (this avoids the need to crack open the original class resource for in-depth analysis by ASM, especially since the class bytes might not be accessible.)
-
parametersKey
Each method is uniquely identified in the partition by its actual parameter types. -
resolvedParametersMatch
private static boolean resolvedParametersMatch(Method subMethod, TypeLiteral<?> host, Method superMethod) Compares a sub-method with a generic super-method by resolving it against the host class.
-