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

Method getSupertype

output/java_guava/1.4.18/TypeToken.java:389–403  ·  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

387
388
389 public final TypeToken<? super T> getSupertype(Class<? super T> superclass) {
390 checkArgument(this.someRawTypeIsSubclassOf(superclass), "%s is not a super class of %s", superclass, this);
391 if (runtimeType instanceof TypeVariable) {
392 return getSupertypeFromUpperBounds(superclass, ((TypeVariable<?>) runtimeType).getBounds());
393 }
394 if (runtimeType instanceof WildcardType) {
395 return getSupertypeFromUpperBounds(superclass, ((WildcardType) runtimeType).getUpperBounds());
396 }
397 if (superclass.isArray()) {
398 return getArraySupertype(superclass);
399 }
400 @SuppressWarnings("unchecked") // resolved supertype
401 TypeToken<? super T> supertype = (TypeToken<? super T>) resolveSupertype(toGenericType(superclass).runtimeType);
402 return supertype;
403 }
404
405 /**
406 * 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