Bug 111882 - [assist] Invalid relevance while completing in case of a switch
Summary: [assist] Invalid relevance while completing in case of a switch
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.2   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 3.4 M1   Edit
Assignee: David Audel CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-10-07 05:12 EDT by Frederic Fusier CLA
Modified: 2007-08-03 05:45 EDT (History)
0 users

See Also:


Attachments
Proposed fix (18.25 KB, patch)
2007-07-04 03:56 EDT, David Audel CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Frederic Fusier CLA 2005-10-07 05:12:30 EDT
3.2 M2

Consider following test case:
class X {
  static char[] AN_ARRAY = new char[10];
  static int AN_INT_VALUE = 0;
  static int ANOTHER_VALUE = 1;

  void foo(int i) {
    switch (i) {
      case AN // <-- complete after the 'AN'
    }
  }
}

Proposals list starts with:
AN_ARRAY  char[] - X
AN_INT_VALUE int - X
ANOTHER_VALUE int - X
...

I see 2 problems here:
1) int values should have an higher relevance than other proposals
2) not sure that AN_ARRAY should be proposed as this is not an int and no int
constants can be reached through it
Comment 1 David Audel CLA 2007-07-04 03:56:56 EDT
Created attachment 73006 [details]
Proposed fix
Comment 2 David Audel CLA 2007-07-04 04:08:39 EDT
Released for 3.4M1

Test added
  CompletionTests#testCompletionAfterCase3() -> testCompletionAfterCase4()

This patch fix only 1). Now the relevance take into account the type of the expression.

I will enter another bug report for problem 2) which is another issue.
Comment 3 David Audel CLA 2007-07-04 04:13:16 EDT
I entered bug 195346 about the issue 2)
Comment 4 Frederic Fusier CLA 2007-08-03 05:45:14 EDT
Verified issue 1) for 3.4M1 using build I20070802-0800.