Bug 84720

Summary: [1.5][assist] proposal ranking by return value should consider auto(un)boxing
Product: [Eclipse Project] JDT Reporter: Tom Hofmann <eclipse>
Component: CoreAssignee: Jay Arthanareeswaran <jarthana>
Status: VERIFIED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: david_audel, srikanth_sankaran
Version: 3.1   
Target Milestone: 3.5 M7   
Hardware: PC   
OS: All   
Whiteboard:
Attachments:
Description Flags
Proposed patch
none
Latest patch david_audel: iplog+, david_audel: review+

Description Tom Hofmann CLA 2005-02-08 13:03:07 EST
I20050202 (jdt-core from 20050207)

- invoke content assist in the following locations (|)

void method(List list) {
    Integer type= list.| 
    int primitive= list.|
}

expected: proposals are ranked about the same in both locations
actual: for the primitive, the List methods returning an int (indexOf, size,
hashCode) are ranked high. For the Integer, the methods returning void (add...)
are ranked the highest.

I would support ranking autoboxing-proposals a little lower than direct matches,
but autoboxing-proposals should still rank before the big mass (e.g. methods
with a void return type).
Comment 1 Srikanth Sankaran CLA 2009-04-09 02:24:10 EDT
*** Bug 271295 has been marked as a duplicate of this bug. ***
Comment 2 Srikanth Sankaran CLA 2009-04-09 02:33:12 EDT
Though the defect title mentions only return value, in many other
contexts also we should consider auto(un)boxing. For one example
see bug #271295
Comment 3 Jay Arthanareeswaran CLA 2009-04-23 04:12:18 EDT
Created attachment 132897 [details]
Proposed patch

This fix does a compatibility check for the left hand and right hand side type and if found compatible, uses R_EXPECTED_TYPE as the relevance value. Test cases are part of the patch.
Comment 4 David Audel CLA 2009-04-23 11:49:09 EDT
Comment on attachment 132897 [details]
Proposed patch

Autoboxing is a 1.5 features, so the compatibility check should be done only if compliance is at least 1.5.
Comment 5 Jay Arthanareeswaran CLA 2009-04-24 05:14:35 EDT
Created attachment 133082 [details]
Latest patch

Instead of calling the LookupEnvironment.computeBoxingType method, modified the fix to use Scope.isBoxingCompatibleWith, which already handles the compiler compatibility checks.
Comment 6 David Audel CLA 2009-04-27 05:36:10 EDT
Comment on attachment 133082 [details]
Latest patch

This patch is good.
Comment 7 David Audel CLA 2009-04-27 05:37:45 EDT
Released for 3.5M7.
Comment 8 David Audel CLA 2009-04-28 05:31:46 EDT
Verified for 3.5M7 using I20090427-1800.

I found a problem in relevance computation while verifying this bug. I entered bug 273991 for this problem.