Bug 253008

Summary: [assist] Boolean expressions should be proposed with higher relevence in if(), while() etc
Product: [Eclipse Project] JDT Reporter: Paramasivam <paramasivam.kaliyamoorthi>
Component: CoreAssignee: Srikanth Sankaran <srikanth_sankaran>
Status: VERIFIED FIXED QA Contact:
Severity: enhancement    
Priority: P3 CC: david_audel, Olivier_Thomann, srikanth_sankaran
Version: 3.5   
Target Milestone: 3.5 M7   
Hardware: PC   
OS: Windows XP   
Whiteboard:
Attachments:
Description Flags
Patch version 0.9
none
Proposed patch none

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