Bug 102747 - [5.0][templates] For template for iteration over collection should be generics aware
Summary: [5.0][templates] For template for iteration over collection should be generic...
Status: ASSIGNED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Text (show other bugs)
Version: 3.1   Edit
Hardware: PC Windows XP
: P3 enhancement (vote)
Target Milestone: ---   Edit
Assignee: JDT-Text-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords: helpwanted
: 98429 112175 122026 154414 200920 254858 357910 (view as bug list)
Depends on: 95787
Blocks:
  Show dependency tree
 
Reported: 2005-07-05 12:44 EDT by Dirk Baeumer CLA
Modified: 2011-09-16 08:33 EDT (History)
10 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Dirk Baeumer CLA 2005-07-05 12:44:40 EDT
3.1

List<String> names= new ArrayList<String>();
for<code assist>

should produce

List<String> names= new ArrayList<String>();
for (Iterator<String> iter = names.iterator(); iter.hasNext();) {
	String element = iter.next();
	
}
Comment 1 Tom Hofmann CLA 2005-10-11 10:11:02 EDT
*** Bug 112175 has been marked as a duplicate of this bug. ***
Comment 2 Dani Megert CLA 2005-12-27 08:25:52 EST
*** Bug 122026 has been marked as a duplicate of this bug. ***
Comment 3 Dani Megert CLA 2005-12-27 08:26:42 EST
Time permitting for 3.2.
Comment 4 Tom Hofmann CLA 2006-01-20 12:43:27 EST
*** Bug 98429 has been marked as a duplicate of this bug. ***
Comment 5 Tom Hofmann CLA 2006-08-21 02:35:13 EDT
*** Bug 154414 has been marked as a duplicate of this bug. ***
Comment 6 Dani Megert CLA 2006-09-19 03:54:20 EDT
Time permitting for 3.3.
Comment 7 Dani Megert CLA 2007-08-23 11:10:49 EDT
*** Bug 200920 has been marked as a duplicate of this bug. ***
Comment 8 Dani Megert CLA 2007-08-23 11:11:22 EDT
We should first fix bug 95787.
Comment 9 Dani Megert CLA 2008-11-11 06:42:53 EST
*** Bug 254858 has been marked as a duplicate of this bug. ***
Comment 10 Hosam Aly CLA 2009-09-05 07:59:09 EDT
Isn't this template sufficient?

for (${iteratorType:newType(java.util.Iterator)}<${type:elemType(collection)}> ${iterator} = ${collection}.iterator(); ${iterator}.hasNext(); ) {
	${type:elemType(collection)} ${name:newName(type)} = ${iterator}.next();
	${cursor}
}

(This is the default template, but added "<${type:elemType(collection)}>" after the iterator type.)
Comment 11 Markus Keller CLA 2009-09-07 08:39:58 EDT
See comment 8:
> We should first fix bug 95787.

Without that, the 'for' template would be broken if source level is < 1.5.
Comment 12 Deepak Azad CLA 2011-06-10 03:27:20 EDT
This is annoying me ever since JDT/UI moved to 1.5.
Comment 13 Markus Keller CLA 2011-09-16 08:33:00 EDT
*** Bug 357910 has been marked as a duplicate of this bug. ***