Is there a way to define a generic constraint in Java which would be analogous to the following C# generic constratint ?
class Class1 where I : Interface1, Class2 : I
I'm trying to do it like this:
class Class1
But the compiler complains about the "Class2" part: Type parameter cannot be followed by other bounds.
解决方案
The simplest way I can see of resolving the Java code is to make Class2 an interface.
You cannot constrain a type parameter to extends more than one class or type parameter. Further, you can't use super here.