`TypeAdapterRuntimeTypeWrapper` 会尽快解析运行时类型适配器,因此如果构建适配器失败,它会丢弃适配器,转而向调用者传递异常
作者: d-william创建于 2026年9月15日更新于 2026年9月17日
标签bug
static class Holder { List<? extends Number> field; } /** A trivial adapter for WildcardType. It never uses reflection. */ static final TypeAdapter<WildcardType> WILDCARD_ADAPTER = new TypeAdapter<WildcardType>() { @Override public void write(JsonWriter out, WildcardType value) throws IOException { out.writeString(value.getTypeName()); } @Override public WildcardType read(JsonReader in) throws IOException { return new WildcardType(in); } };
内容来源: google/gson