Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
以下泛型类型包含A两次类型参数:
A
class Something<B<A>, A>
我想知道是否可以只写class Something<B<A>>因为A已经通过B<A>.
class Something<B<A>>
B<A>
我认为这是不可能的,但也许我忽略了一些东西。
正式回答这个问题:编译器不能以这种方式推断类型。