final class MethodPartition
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
private java.util.List<java.lang.reflect.Method> |
candidates
Reverse order of declaration; super-methods appear later in the list.
|
Constructor and Description |
---|
MethodPartition(java.lang.reflect.Method first,
java.lang.reflect.Method second)
Each partition starts off with at least two methods.
|
Modifier and Type | Method and Description |
---|---|
MethodPartition |
addCandidate(java.lang.reflect.Method method)
Add a new method to this partition for resolution.
|
void |
collectEnhanceableMethods(TypeLiteral<?> hostType,
java.util.function.Consumer<java.lang.reflect.Method> methodVisitor,
java.util.Map<java.lang.reflect.Method,java.lang.reflect.Method> bridgeDelegates)
Resolve and collect enhanceable methods into the given list; one per method-signature.
|
private static java.lang.String |
parametersKey(java.lang.Class<?>[] parameterTypes)
Each method is uniquely identified in the partition by its actual parameter types.
|
private static boolean |
resolvedParametersMatch(java.lang.reflect.Method subMethod,
TypeLiteral<?> host,
java.lang.reflect.Method superMethod)
Compares a sub-method with a generic super-method by resolving it against the host class.
|
private final java.util.List<java.lang.reflect.Method> candidates
public MethodPartition(java.lang.reflect.Method first, java.lang.reflect.Method second)
public MethodPartition addCandidate(java.lang.reflect.Method method)
public void collectEnhanceableMethods(TypeLiteral<?> hostType, java.util.function.Consumer<java.lang.reflect.Method> methodVisitor, java.util.Map<java.lang.reflect.Method,java.lang.reflect.Method> bridgeDelegates)
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.)
private static java.lang.String parametersKey(java.lang.Class<?>[] parameterTypes)
private static boolean resolvedParametersMatch(java.lang.reflect.Method subMethod, TypeLiteral<?> host, java.lang.reflect.Method superMethod)