I donโt think there is a way to unambiguously change the type parameter, and I think it was a reasonable design decision.
- The conventions are clear that type parameters should be one character long, if possible, and the flip side of this is that other classes should not have single-character names.
- If you had the opportunity to disambiguate, then you will have the opportunity to rename the type parameter
X to Bar<X> . In other words, if you had the opportunity to say foobar(TypeParameter.X t) , you would have the opportunity to simply use something other than X for the type parameter on Bar . Renaming X is how you avoid name conflicts.
Remember that type parameter names do not extend to other classes in a more than trivial way. You should never use a parameter name of a particular type, ever. Therefore, it makes sense that language developers would not think that it is worth adding complexity to the language.
source share