Pablo Napoli wrote:I was expecting that <T> was turn into String and compiler allows me to make it.
That is correct,
at line 7. Where you write "Test.<String>make()", the compiler understands that for that method invocation, T is String, and therefore the expression you wrote will return a String. That's fine, for line 7.
However, for lines 2-4 where you declare the make() method, those are outside the scope of your <String> mentioned at line 7. In that context, T could be anything.
I'm not really sure how to "make it work" here since I don't know what you're really trying to do. If you want to make a method that will always return a String, just declare it as a method that returns a String. There's not really a way to make it generic with T there.