Bug 274466

Summary: [assist] Assert expressions should be proposed with high relevance
Product: [Eclipse Project] JDT Reporter: Jay Arthanareeswaran <jarthana>
Component: CoreAssignee: Jay Arthanareeswaran <jarthana>
Status: VERIFIED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: david_audel, srikanth_sankaran
Version: 3.5Flags: srikanth_sankaran: review+
Target Milestone: 3.6 M1   
Hardware: PC   
OS: All   
Whiteboard:
Attachments:
Description Flags
Proposed patch
none
Updated Patch
none
Updated Patch
none
Updated Patch srikanth_sankaran: iplog+, srikanth_sankaran: review+

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