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

Method getArraySupertype

output/java_guava/1.4.18/TypeToken.java:1137–1150  ·  view source on GitHub ↗
(Class<? super T> supertype)

Source from the content-addressed store, hash-verified

1135
1136
1137 private TypeToken<? super T> getArraySupertype(Class<? super T> supertype) {
1138 // with component type, we have lost generic type information
1139 // Use raw type so that compiler allows us to call getSupertype()
1140 @SuppressWarnings("rawtypes")
1141 TypeToken componentType = checkNotNull(getComponentType(), "%s isn't a super type of %s", supertype, this);
1142 // array is covariant. component type is super type, so is the array type.
1143 @SuppressWarnings("unchecked") // going from raw type back to generics
1144 TypeToken<?> componentSupertype = componentType.getSupertype(supertype.getComponentType());
1145 @SuppressWarnings("unchecked") // component type is super type, so is array type.
1146 TypeToken<? super T> result = (TypeToken<? super T>)
1147 // If we are passed with int[].class, don't turn it to GenericArrayType
1148of(newArrayClassOrGenericArrayType(componentSupertype.runtimeType));
1149 return result;
1150 }
1151
1152
1153 private TypeToken<? extends T> getArraySubtype(Class<?> subclass) {

Callers 1

getSupertypeMethod · 0.95

Calls 5

getComponentTypeMethod · 0.95
getSupertypeMethod · 0.95
ofMethod · 0.95
checkNotNullMethod · 0.45

Tested by

no test coverage detected