Bug 253008 - [assist] Boolean expressions should be proposed with higher relevence in if(), while() etc
Summary: [assist] Boolean expressions should be proposed with higher relevence in if()...
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.5   Edit
Hardware: PC Windows XP
: P3 enhancement (vote)
Target Milestone: 3.5 M7   Edit
Assignee: Srikanth Sankaran CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-10-31 14:30 EDT by Paramasivam CLA
Modified: 2009-04-27 09:41 EDT (History)
3 users (show)

See Also:


Attachments
Patch version 0.9 (21.16 KB, patch)
2009-04-01 08:21 EDT, Srikanth Sankaran CLA
no flags Details | Diff
Proposed patch (19.73 KB, patch)
2009-04-06 06:04 EDT, Srikanth Sankaran CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Paramasivam CLA 2008-10-31 14:30:16 EDT
when i press Ctrl + Space bar in place of boolean expression like 
while, if, for, it can show only boolean methods of reference variable


  For Example
  -----------

   StringTokenizer st = new StringTokenizer("somthing")
   
   while( st. [ display only boolean returning methods of "st" reference] ){
   
   }

   Note:
   For more, please check attachment
Comment 1 Srikanth Sankaran CLA 2009-02-25 06:07:46 EST
(In reply to comment #0)
> when i press Ctrl + Space bar in place of boolean expression like 
> while, if, for, it can show only boolean methods of reference variable
>   For Example
>   -----------
>    StringTokenizer st = new StringTokenizer("somthing")
>    while( st. [ display only boolean returning methods of "st" reference] ){
>    }
>    Note:
>    For more, please check attachment

This sounds problematic as it calls for too much mind reading. Boolean
expressions get composed out of non boolean types by using operators.
So a user may intend to do:

    String str = ...
    if (str.indexOf("com.ibm") > 0)

and type 

    String str = ...
    if (str.ind<Ctrl-Space>

    If we don't propose indexOf on account of its being a int method and not
a boolean method, it would upset lots of users.

Do we really want to do this feature ? Perhaps the suggested idea has been
misunderstood ?

I don't see any attachments that is being referred to in comment# 0

Comment 2 David Audel CLA 2009-02-25 07:16:35 EST
You are right, non boolean proposals should not be filtered but perhaps the boolean proposals could be proposed before the others in the list of proposals.

To do that the 'relevance' of boolean proposals must be increase.(CompletionProposal#getRelevance())
Comment 3 Srikanth Sankaran CLA 2009-04-01 08:21:37 EDT
Created attachment 130550 [details]
Patch version 0.9 

Potential patch.
Comment 4 Srikanth Sankaran CLA 2009-04-06 06:04:55 EDT
Created attachment 130970 [details]
Proposed patch

Proposed patch + tests
Comment 5 Srikanth Sankaran CLA 2009-04-06 06:33:35 EDT
Released in HEAD for 3.5 M7.

Raised bug # 271295 and bug #271296 for issues found during this fix.
Comment 6 David Audel CLA 2009-04-27 09:41:23 EDT
Verified for 3.5M7 using I20090426-2000