Question: constraints are not allowed in non generic declaration?
Answer: The problem is that your method does not define the generic type <T> . It just uses the type T given by the enclosing type. And you can declare constraints only at the same place where you define generic parameters. The constrain needs to be in same place as the generic parameter.