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.
Environment: Windows7 + NetBeans 201403180001 Summary: Accepting the hint "Use functional operation" to convert a for-each loop on a Collection works, but also causes the previous line with a comment to be deleted. Steps to Reproduce: [1] Create a trivial Java application exactly as follows: package functiontest; import java.util.Arrays; import java.util.List; public class FunctionTest { public static void main(String[] args) { List<String> strings = Arrays.asList("AAA", "BBB", "CCC"); // for (String s : strings) { for (String s : strings) { System.out.println("Hello world " + s); } } } [2] There is a warning on the line with the for loop: "Can use functional operations". [3] Press alt-enter on that line, then accept the hint to modify the code. [4] An appropriate change is made, but the comment on the preceding line is also deleted. Additional information: Bugs 241883 and 238887 look similar, but those problems relate to comment deletion for other hints.
I am also experiencing this, but it will delete entire blocks of comments following the point of refactoring.
Fixed by general support implemented as part of issue #239487 and isssue #245348