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 - Convert to for loop eats preceding comment
Summary: Convert to for loop eats preceding comment
Status: RESOLVED FIXED
Alias: None
Product: java
Classification: Unclassified
Component: Hints (show other bugs)
Version: 8.0
Hardware: PC Windows 7
: P3 normal (vote)
Assignee: Svata Dedic
URL:
Keywords:
Depends on: 239487
Blocks:
  Show dependency tree
 
Reported: 2014-02-17 01:02 UTC by swpalmer
Modified: 2014-07-10 14:28 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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