Bug 37730

Summary: code assist suggests uninitialized temps
Product: [Eclipse Project] JDT Reporter: Adam Kiezun <akiezun>
Component: CoreAssignee: David Audel <david_audel>
Status: RESOLVED WORKSFORME QA Contact:
Severity: normal    
Priority: P3    
Version: 2.1   
Target Milestone: 3.0 M7   
Hardware: PC   
OS: Windows 2000   
Whiteboard:

Description Adam Kiezun CLA 2003-05-15 13:15:01 EDT
20030506
void f(int[] numbers){
   int number= n<CODE ASSIST HERE>
}

'number' should not be suggested because it's unitialized and i will get a 
compile error right away

for simplicity, code assist could just handle this one case, i.e. a local 
variable declaration (don't suggest the variable's name in the variable's 
initializer)
Comment 1 Philipe Mulet CLA 2003-05-16 04:57:54 EDT
int number = number = 0;

This is legal code. On the right-hand side, 'number' should not be proposed as 
the best match though.

David - pls verify.
Comment 2 Adam Kiezun CLA 2003-05-16 08:55:54 EDT
it's especially annoying in scenarios like this (which i stuble upon over and 
over):

void foo(Bar[] bars){
  for(int i= 0; i < bars.length; i++){
     Bar bar= b<CODE ASSSIST>
  }
}

it suggests 'bar' as first, while i clearly want 'bars' to be the first on that 
list
Comment 3 David Audel CLA 2003-12-09 09:36:14 EST
We could give an higher relevance for an array variable ("bars").
We could give the smallest relevance for the initialized variable ("bar").
Comment 4 Philipe Mulet CLA 2004-01-29 07:57:11 EST
Last suggestion got implemented and does the trick.