(Class<? super T> supertype)
| 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 |
| 1148 | of(newArrayClassOrGenericArrayType(componentSupertype.runtimeType)); |
| 1149 | return result; |
| 1150 | } |
| 1151 | |
| 1152 | |
| 1153 | private TypeToken<? extends T> getArraySubtype(Class<?> subclass) { |
no test coverage detected