| Priority |
Normal |
| Type | Feature |
| State | Duplicate |
| Assignee | Unassigned |
| Subsystem | Editor. Editing Text |
| Affected versions |
No affected versions
|
| Fixed in |
No fix versions
|
| Fixed in build | Next build |
| Build |
4155
|
IDEA-7194 |
hide local variable types using "auto" or "var" keyword |
|
|
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?
generic type arguments ARE inferred from return type also (see inference for Collections.emptyList() for example).