{@code A.is(B)} is defined as {@code Foo<A>.isSubtypeOf(Foo<B>)}. <p>Specifically, returns true if any of the following conditions is met: <ol> <li>'this' and {@code formalType} are equal. <li>'this' and {@code formalType} have equal canonical form. <li>{@code formalType} is {@code <? extend
(Type formalType, TypeVariable<?> declaration)
| 982 | * bound when {@code formalType} is a wildcard with implicit upper bound. |
| 983 | */ |
| 984 | private boolean is(Type formalType, TypeVariable<?> declaration) { |
| 985 | if (runtimeType.equals(formalType)) { |
| 986 | return true; |
| 987 | } |
| 988 | if (formalType instanceof WildcardType) { |
| 989 | WildcardType your = canonicalizeWildcardType(declaration, (WildcardType) formalType); |
| 990 | // if "formalType" is <? extends Foo>, "this" can be: |
| 991 | // Foo, SubFoo, <? extends Foo>, <? extends SubFoo>, <T extends Foo> or |
| 992 | // <T extends SubFoo>. |
| 993 | // if "formalType" is <? super Foo>, "this" can be: |
| 994 | // Foo, SuperFoo, <? super Foo> or <? super SuperFoo>. |
| 995 | return every(your.getUpperBounds()).isSupertypeOf(runtimeType) |
| 996 | && every(your.getLowerBounds()).isSubtypeOf(runtimeType); |
| 997 | } |
| 998 | return canonicalizeWildcardsInType(runtimeType).equals(canonicalizeWildcardsInType(formalType)); |
| 999 | } |
| 1000 | |
| 1001 | /** |
| 1002 | * In reflection, {@code Foo<?>.getUpperBounds()[0]} is always {@code Object.class}, even when Foo |
no test coverage detected