0
votes

The following generic type contains the type parameter A two times:

class Something<B<A>, A>

I wonder if it would be possible to write only class Something<B<A>> because A is already given through B<A>.

I think it is not possible, but maybe I've overlooked something.

1
I don't think the compiler can infer this. It is not the same as generic method inferance. - Davin Tryon
FYI: "maybe I've overlooked something", Oversee defined and Overlook defined. Hope this helps. - Binary Worrier
@BinaryWorrier Thanks for the hint. - deamon
If you need the type parameter A within the class Something, you'll have to leave it as two type parameters as the type parameter to B will be unavailable to Something - Peter Ritchie

1 Answers

0
votes

To answer the question officially: The compiler cannot infer the type this way.