Bug 193045 - [1.5][assist] Code completion fails in inner class w/ foreach loop
Summary: [1.5][assist] Code completion fails in inner class w/ foreach loop
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.2   Edit
Hardware: PC Linux
: P3 normal (vote)
Target Milestone: 3.4 M7   Edit
Assignee: David Audel CLA
QA Contact:
URL:
Whiteboard:
Keywords:
: 149640 195910 227606 (view as bug list)
Depends on:
Blocks:
 
Reported: 2007-06-17 20:29 EDT by Reuben Firmin CLA
Modified: 2008-04-29 01:26 EDT (History)
5 users (show)

See Also:


Attachments
Proposed fix (3.05 KB, patch)
2008-04-04 08:06 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 Reuben Firmin CLA 2007-06-17 20:29:19 EDT
Build ID: M20070212-1330

Steps To Reproduce:
Code completion does not work for loop variables in foreach loops within inner classes. The cases below demonstrate this. All are commented out, with comments above explaining whether they work or not.

#1, #2, and #3 are within an inner class declaration.
#4 is within a class method.

#1 & #3 fail. (commented out) 

#2 & #4  work.
private final Filter<Element> BRFilter = new Filter<Element>() {
		public boolean accept(Element... elements) {
			for (Element element : elements) {
				// #1 bug, does not work
				// element.
				
				// #2 works
				String s;
				// s.
				
				String[] ts = new String[]{};
				for (String t : ts) {
					// #3 bug, does not work
					//t.
				}
			}
			return false;
		}
	};
	
	public void foo() {
		String[] ts = new String[]{};
		for (String t : ts) {
			// #4 works
			// t.
		}		
	}

More information:
Comment 1 David Audel CLA 2007-07-10 08:11:09 EDT
*** Bug 195910 has been marked as a duplicate of this bug. ***
Comment 2 Dani Megert CLA 2007-07-10 08:36:06 EDT
David, is this a regression compared to 3.2?
Comment 3 David Audel CLA 2007-07-10 08:48:48 EDT
It's not a regression.
Comment 4 David Audel CLA 2008-04-04 08:06:51 EDT
Created attachment 94835 [details]
Proposed fix
Comment 5 David Audel CLA 2008-04-04 09:14:40 EDT
Released for 3.4M7.

Tests added
  GenericsCompletionParserTest#test0216_Diet()
Comment 6 David Audel CLA 2008-04-10 07:12:27 EDT
*** Bug 149640 has been marked as a duplicate of this bug. ***
Comment 7 David Audel CLA 2008-04-18 04:41:14 EDT
*** Bug 227606 has been marked as a duplicate of this bug. ***
Comment 8 Eric Jodet CLA 2008-04-29 01:26:40 EDT
Verified for 3.4M7 using I20080427-2000.