|
|
|
[
Permlink
| « Hide
]
Eugene Vigdorchik - 26 Mar 06 12:39
Several considerations here:
It seems to me that this is a small step forward from things like hiding and automatically organizing import statements. I think it would be nice if IDEA could hide and automatically manage the types of local variables too. But it is true that this is a fairly bold idea and that implementing this feature would be crossing a line.
Regarding problems with generics: I have to admit that I don't fully understand generics but it seems like this should work. As I understand it, a generic method's type is inferred from its arguments, not its return type. (If a generic method takes no arguments, you have to give it a type parameter when you call it.) Once the method's type is known, the method call's return type is known, and that can be used to deduce the type of the expression containing the method call. And, as you say, IDEA can already auto-complete a local variable's type. Also, IDEA has to determine a local variable's type when it executes the "introduce variable" refactoring, which always works as far as I know. But perhaps I am missing something? Brian,
generic type arguments ARE inferred from return type also (see inference for Collections.emptyList() for example). I believe this is duplicate of, or closely related to, http://www.jetbrains.net/jira/browse/IDEABKL-2359
|
|||||||||||||||||||||||||||||||||||||||||||