MCPcopy Create free account
hub / github.com/antlr/codebuff / is

Method is

output/java_guava/1.4.18/TypeToken.java:983–997  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

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) {

Callers 1

Calls 6

everyMethod · 0.95
equalsMethod · 0.65
isSupertypeOfMethod · 0.45
getUpperBoundsMethod · 0.45
isSubtypeOfMethod · 0.45
getLowerBoundsMethod · 0.45

Tested by

no test coverage detected