public final class TypesWalker
extends java.lang.Object
Algorithm:
T<A,B>) then align types (resolve hierarchy for upper type and
compare generics of lower types) and cycle for each generic pair
Generics rules are not honored. For example, List<?> is considered as List<Object> and
assumed compatible with any list. <? extends Something> is considered as Something and
compatible with any subtype.
The only exception is wildcard's lower bound: <? super Something> is compatible with any super type
of Something but not compatible with any subtype.
If generic declares multiple bounds T extends A & B and it was not resolved with actual type
(sub type did not declare exact generic for it), then both bounds will be used for comparison.
When one of types is primitive then wrapper class used instead (e.g. Integer instead of int) to simplify visitor logic.
| Modifier and Type | Method and Description |
|---|---|
static void |
walk(java.lang.reflect.Type one,
java.lang.reflect.Type two,
TypesVisitor visitor)
Walk will stop if visitor tells it's enough or when hierarchy incompatibility will be found.
|
public static void walk(java.lang.reflect.Type one,
java.lang.reflect.Type two,
TypesVisitor visitor)
one - first typetwo - second typevisitor - visitor