Return true if any of the following conditions is met: 'this' and formalType are equal formalType is <? extends Foo> and 'this' is a subtype of Foo formalType is <? super Foo> and 'this' is a supertype of Foo
(Type formalType)
| 981 | |
| 982 | |
| 983 | private boolean is(Type formalType) { |
| 984 | if (runtimeType.equals(formalType)) { |
| 985 | return true; |
| 986 | } |
| 987 | if (formalType instanceof WildcardType) { |
| 988 | // if "formalType" is <? extends Foo>, "this" can be: |
| 989 | // Foo, SubFoo, <? extends Foo>, <? extends SubFoo>, <T extends Foo> or |
| 990 | // <T extends SubFoo>. |
| 991 | // if "formalType" is <? super Foo>, "this" can be: |
| 992 | // Foo, SuperFoo, <? super Foo> or <? super SuperFoo>. |
| 993 | return every(((WildcardType) formalType).getUpperBounds()).isSupertypeOf(runtimeType) |
| 994 | && every(((WildcardType) formalType).getLowerBounds()).isSubtypeOf(runtimeType); |
| 995 | } |
| 996 | return false; |
| 997 | } |
| 998 | |
| 999 | |
| 1000 | private static Bounds every(Type[] bounds) { |
no test coverage detected