This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.
The code template forc does not add import of Iterator to the source file. The result is broken source file.
Fixed in trunk. /cvs/java/editor/lib/src/org/netbeans/editor/ext/java/JavaSettingsDefaults.java new revision: 1.12; previous revision: 1.11 /cvs/java/editor/src/org/netbeans/modules/java/editor/codetemplates/JavaCodeTemplateProcessor.java new revision: 1.7; previous revision: 1.6
In case the Iterator is not imported before typing forc the collection is wrongly resolved. Have the following code List l; and try forc template. You get for (Iterator it = collection.iterator(); it.hasNext();) { ^^^^^^^^^^ Object elem = (Object) it.next(); } In case the Iterotor IS imported everything works as expected for (Iterator it = l.iterator(); it.hasNext();) { Object elem = (Object) it.next(); }
Order of actions taken during processing a code template was bad. Imports are required to be add after all needed information is retrieved from jmi model (including variable names). Should be fixed now. /cvs/java/editor/src/org/netbeans/modules/java/editor/codetemplates/JavaCodeTemplateProcessor.java new revision: 1.8; previous revision: 1.7
verified