@Test public void boundedWildcardTypeWithSuper_notSupported() { assertThrows( "<? super T> is not supported", IllegalArgumentException.class, () -> { TypeToken.of(new Safe<List<? super Foo>>() {}); }); }
@NonNull public static <T> TypeToken<T> of(@NonNull Safe<T> token) { Type superclass = token.getClass().getGenericSuperclass(); if (superclass instanceof Class) { throw new IllegalArgumentException("Missing type parameters"); } @SuppressWarnings("ConstantConditions") Type type = ((ParameterizedType) superclass).getActualTypeArguments()[0]; return of(type); }
TypeToken { @NonNull public static <T> TypeToken<T> of(@NonNull Safe<T> token) { Type superclass = token.getClass().getGenericSuperclass(); if (superclass instanceof Class) { throw new IllegalArgumentException("Missing type parameters"); } @SuppressWarnings("ConstantConditions") Type type = ((ParameterizedType) superclass).getActualTypeArguments()[0]; return of(type); } }
TypeToken { @NonNull public static <T> TypeToken<T> of(@NonNull Safe<T> token) { Type superclass = token.getClass().getGenericSuperclass(); if (superclass instanceof Class) { throw new IllegalArgumentException("Missing type parameters"); } @SuppressWarnings("ConstantConditions") Type type = ((ParameterizedType) superclass).getActualTypeArguments()[0]; return of(type); } private  TypeToken(); }
TypeToken { @NonNull public static <T> TypeToken<T> of(@NonNull Safe<T> token) { Type superclass = token.getClass().getGenericSuperclass(); if (superclass instanceof Class) { throw new IllegalArgumentException("Missing type parameters"); } @SuppressWarnings("ConstantConditions") Type type = ((ParameterizedType) superclass).getActualTypeArguments()[0]; return of(type); } private  TypeToken(); @NonNull static TypeToken<T> of(@NonNull Safe<T> token); @NonNull static TypeToken<T> of(@NonNull Class<T> typeToken); @NonNull @Override String toString(); }
TypeToken { @NonNull public static <T> TypeToken<T> of(@NonNull Safe<T> token) { Type superclass = token.getClass().getGenericSuperclass(); if (superclass instanceof Class) { throw new IllegalArgumentException("Missing type parameters"); } @SuppressWarnings("ConstantConditions") Type type = ((ParameterizedType) superclass).getActualTypeArguments()[0]; return of(type); } private  TypeToken(); @NonNull static TypeToken<T> of(@NonNull Safe<T> token); @NonNull static TypeToken<T> of(@NonNull Class<T> typeToken); @NonNull @Override String toString();  }