Bug 37730 - code assist suggests uninitialized temps
Summary: code assist suggests uninitialized temps
Status: RESOLVED WORKSFORME
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 2.1   Edit
Hardware: PC Windows 2000
: P3 normal (vote)
Target Milestone: 3.0 M7   Edit
Assignee: David Audel CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2003-05-15 13:15 EDT by Adam Kiezun CLA
Modified: 2004-01-29 07:57 EST (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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.