Bug 229927 - No code assist in array initializer
Summary: No code assist in array initializer
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.4   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 3.4 RC1   Edit
Assignee: David Audel CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-05-02 05:41 EDT by Martin Aeschlimann CLA
Modified: 2008-05-14 05:15 EDT (History)
1 user (show)

See Also:
frederic_fusier: review+


Attachments
Proposed fix (4.99 KB, patch)
2008-05-07 03:37 EDT, David Audel CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Martin Aeschlimann CLA 2008-05-02 05:41:59 EDT
I20080501-0100

- create the following class

package p;

public class P {
	private void foo(String key){
		if (key != null) {
			String[] keys= { k };
		}
	}
}

- try to complete 'k' inside the array initializer:
No results. Expected: 'key' and types starting with 'K'
Comment 1 Jerome Lanneluc CLA 2008-05-05 04:51:43 EDT
David, is it a regression comparing to 3.3.2 ?
Comment 2 David Audel CLA 2008-05-05 05:38:22 EDT
It is a regression comparing to 3.3.2 added by the fix for bug 193909.
Comment 3 Jerome Lanneluc CLA 2008-05-05 05:49:50 EDT
Please investigate for RC1
Comment 4 David Audel CLA 2008-05-07 03:37:42 EDT
Created attachment 99011 [details]
Proposed fix

The problem is inside CompletionEngne#buildMoreCompletionEnclosingContext().
The innermost enclosing if statement is rebuild but when the current element of the recovery is RecoveredLocalVariable then this recovered element can be also included inside the if statement.

So if the location of the RecoveredLocalVariable is after the if source start then the recovered AST of the local variable must be computed and added inside the if statement and the RecoveredLocalVariable must be removed from the parent node.
Comment 5 David Audel CLA 2008-05-07 03:42:33 EDT
Frederic - Could you review my fix ?
Comment 6 Frederic Fusier CLA 2008-05-07 04:18:49 EDT
Patch looks good to me: +1
Comment 7 David Audel CLA 2008-05-07 05:29:40 EDT
Released for 3.4RC1.

Test added
  CompletionParserTests2#test0178_Method()
Comment 8 Jerome Lanneluc CLA 2008-05-14 05:15:27 EDT
Verified for 3.4RC1 using I20080513-2000