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

Method getSupertype

output/java_guava/1.4.19/TypeToken.java:388–402  ·  view source on GitHub ↗

Returns the generic form of superclass. For example, if this is ArrayList , Iterable is returned given the input Iterable.class.

(Class<? super T> superclass)

Source from the content-addressed store, hash-verified

386
387
388 public final TypeToken<? super T> getSupertype(Class<? super T> superclass) {
389 checkArgument(this.someRawTypeIsSubclassOf(superclass), "%s is not a super class of %s", superclass, this);
390 if (runtimeType instanceof TypeVariable) {
391 return getSupertypeFromUpperBounds(superclass, ((TypeVariable<?>) runtimeType).getBounds());
392 }
393 if (runtimeType instanceof WildcardType) {
394 return getSupertypeFromUpperBounds(superclass, ((WildcardType) runtimeType).getUpperBounds());
395 }
396 if (superclass.isArray()) {
397 return getArraySupertype(superclass);
398 }
399 @SuppressWarnings("unchecked") // resolved supertype
400 TypeToken<? super T> supertype = (TypeToken<? super T>) resolveSupertype(toGenericType(superclass).runtimeType);
401 return supertype;
402 }
403
404 /**
405 * Returns subtype of {@code this} with {@code subclass} as the raw class. For example, if this is

Callers 3

getArraySupertypeMethod · 0.95

Calls 9

getArraySupertypeMethod · 0.95
resolveSupertypeMethod · 0.95
toGenericTypeMethod · 0.95
checkArgumentMethod · 0.45
getBoundsMethod · 0.45
getUpperBoundsMethod · 0.45
isArrayMethod · 0.45

Tested by

no test coverage detected