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.
Example: import java.net.BufferedInputStream; public class Example { BufferedInputStream stream; } Performing Fix Imports once results in: import java.io.BufferedInputStream; import java.net.BufferedInputStream; public class Example { BufferedInputStream stream; } Performing it a second time then results in: import java.io.BufferedInputStream; public class Example { BufferedInputStream stream; } Fix Imports should give the second result right away, since by adding java.io.BufferedInputStream it already knows that java.net.BufferedInputStream is unused.
Same for using the "Add import..." hint instead of Fix Imports in the example, by the way: "Add import" should remove the faulty import it is replacing.
*** Bug 192882 has been marked as a duplicate of this bug. ***
Disagree with the note about "Add import". Since the hint describes itself as "Add", it should not remove or optimize import statements. It is the job of Fix imports or Organize imports to analyze/remove extraneous statements.
(In reply to Svata Dedic from comment #3) > Disagree with the note about "Add import". Since the hint describes itself > as "Add", it should not remove or optimize import statements. It is the job > of Fix imports or Organize imports to analyze/remove extraneous statements. The comment is probably obsolete, because no "Add import" hint is shown anymore for the example (tested with 7.3.1).
This old bug may not be relevant anymore. If you can still reproduce it in 8.2 development builds please reopen this issue. Thanks for your cooperation, NetBeans IDE 8.2 Release Boss
Still reproducible in current dev build.