As @Sotirios Delimanolis wrote, you cannot even run that code.
Try this one:
@SuppressWarnings("unchecked")
public T getSomeValue(boolean tf) {
T number;
if (tf) {
number = (T) new Double(1.0);
} else {
number = (T) new Integer(11);
}
return number;
}