Input:
publicclassFoo {
publicstatic <Textendsnumber> booleanisNegative(Tnumber) {
returnnumber.longValue() < 0;
}
}Output (incorrect):
publicclassFoo{publicstaticboolIsNegative<T extends number>(Tnumber){returnnumber.LongValue()<0;}}Output (expected; syntactically correct but might be wrong):
publicclassFoo{publicstaticboolIsNegative<T>(Tnumber){returnnumber.LongValue()<0;}}Note that in this case there is no C# equivalent of constraining a generic type parameter to be a number, but at least we can make it syntactically correct.
Input:
Output (incorrect):
Output (expected; syntactically correct but might be wrong):
Note that in this case there is no C# equivalent of constraining a generic type parameter to be a number, but at least we can make it syntactically correct.