Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 357910

Summary: [templates] for iterate over collection should use generics
Product: [Eclipse Project] JDT Reporter: Hannes Niederhausen <hniederhausen>
Component: TextAssignee: JDT-Text-Inbox <jdt-text-inbox>
Status: CLOSED DUPLICATE QA Contact:
Severity: minor    
Priority: P3 CC: daniel_megert, markus.kell.r
Version: 3.8   
Target Milestone: ---   
Hardware: All   
OS: All   
Whiteboard:

Description Hannes Niederhausen CLA 2011-09-16 04:14:52 EDT
Build Identifier: 20110615-0604

The template should use Generics.
A possible template specification would be:

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

This would produce a for loop with an iterator using the type and no cast in the  block.

Reproducible: Always

Steps to Reproduce:
1. type for
2. press CTRL-Space
3. Use the template
Comment 1 Dani Megert CLA 2011-09-16 07:46:12 EDT

*** This bug has been marked as a duplicate of bug 357408 ***
Comment 2 Markus Keller CLA 2011-09-16 08:33:00 EDT

*** This bug has been marked as a duplicate of bug 102747 ***