Bug 274466 - [assist] Assert expressions should be proposed with high relevance
Summary: [assist] Assert expressions should be proposed with high relevance
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.5   Edit
Hardware: PC All
: P3 normal (vote)
Target Milestone: 3.6 M1   Edit
Assignee: Jay Arthanareeswaran CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-04-30 01:48 EDT by Jay Arthanareeswaran CLA
Modified: 2010-05-27 17:35 EDT (History)
2 users (show)

See Also:
srikanth_sankaran: review+


Attachments
Proposed patch (3.16 KB, patch)
2009-05-11 07:44 EDT, Jay Arthanareeswaran CLA
no flags Details | Diff
Updated Patch (7.90 KB, patch)
2009-05-13 04:25 EDT, Jay Arthanareeswaran CLA
no flags Details | Diff
Updated Patch (7.91 KB, patch)
2009-05-13 04:36 EDT, Jay Arthanareeswaran CLA
no flags Details | Diff
Updated Patch (3.89 KB, patch)
2009-05-14 01:52 EDT, Jay Arthanareeswaran CLA
srikanth_sankaran: iplog+
srikanth_sankaran: review+
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Jay Arthanareeswaran CLA 2009-04-30 01:48:32 EDT
Build ID: I20090426-2000

Steps To Reproduce:
This is similar to the bug 253008. Apart from if, while etc. we should consider assert statements also to get boolean methods with higher relevance.
e.g.

public class TestMain {
	   private int returnA() { return 0;}

	   private boolean returnB() { return false; }
	   
	   public void foo(String... args) {
	      assert ret|
	   }
}
( | Ctrl + Space)

More information:
Comment 1 Jay Arthanareeswaran CLA 2009-05-11 07:44:28 EDT
Created attachment 135127 [details]
Proposed patch

Added a case for the AssertStatement to add a boolean as an expected type. Test cases included in the patch.
Comment 2 David Audel CLA 2009-05-11 09:01:56 EDT
The fix is not complete.

In test case like 'assert foo() : bar|'

the assert statement is also the parent node of the assist node.
Comment 3 Jay Arthanareeswaran CLA 2009-05-13 04:25:16 EDT
Created attachment 135526 [details]
Updated Patch

Updated the patch to include fix and tests for the message part of an assert statement.
Comment 4 Jay Arthanareeswaran CLA 2009-05-13 04:36:38 EDT
Created attachment 135528 [details]
Updated Patch

Corrected the comments about the fix.
Comment 5 Jay Arthanareeswaran CLA 2009-05-14 01:52:44 EDT
Created attachment 135737 [details]
Updated Patch

Removed the second part of the fix (expression part of the assert stateement), which should have actually been another bug. At this point, the fix will depend on another bug. Hence removing the second part and the related tests.
Comment 6 David Audel CLA 2009-05-29 09:07:11 EDT
Patch looks good.

It is too late for 3.5, we should release this fix for 3.6.
Comment 7 Srikanth Sankaran CLA 2009-06-23 06:05:09 EDT
Released Jay's fix in HEAD for 3.6 M1.
Comment 8 Frederic Fusier CLA 2009-08-03 12:20:32 EDT
Verified for 3.6M1 using I20090802-2000 build