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.

Bug 241969

Summary: Convert to for loop eats preceding comment
Product: java Reporter: swpalmer <swpalmer>
Component: HintsAssignee: Svata Dedic <sdedic>
Status: RESOLVED FIXED    
Severity: normal    
Priority: P3    
Version: 8.0   
Hardware: PC   
OS: Windows 7   
Issue Type: DEFECT Exception Reporter:
Bug Depends on: 239487    
Bug Blocks:    

Description swpalmer 2014-02-17 01:02:33 UTC
NetBeans 8 build 201402150001

Given the following Java code:
	ObservableList list = assetList.getItems();
	// consider some sort of SortedSet<String> or SortedSet<TestSuitAsset>
	for(int i =0; i < tdrdocs.size(); i++) {
		TDRDocument assetDoc = tdrdocs.get(i);
		String assetId = (String) assetDoc.getFieldValue("id");


I am presented with a hint on the for-loop line stating "Use enhanced for loop to iterate over the array"
- I'm iterating over a "List" not an array.
- When I click the light bulb and pick the poorly named "Convert to for-loop" (it's already a for-loop). It removed the comment, resulting in:

	ObservableList list = assetList.getItems();
	for (TDRDocument assetDoc : tdrdocs) {
		String assetId = (String) assetDoc.getFieldValue("id");
Comment 1 Svata Dedic 2014-07-10 14:28:14 UTC
Fixed by general support implemented as part of issue #239487 and isssue #245348