Why does Guava's TypeToken.getRawType() return Class<? super T> instead of Class

前端 未结 2 1780
逝去的感伤
逝去的感伤 2021-01-02 05:15

From Effective Java Second Edition, Item 28 : \"Do not use wildcard types as return types. Rather than providing additional flexibility for your users it would force them to

2条回答
  •  [愿得一人]
    2021-01-02 05:47

    What if you have a TypeToken> and you want to get Class (that is the raw type). If it returned Class, then it would return Class> which is not Class that you want.

提交回复
热议问题