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 159385 - AI in fix imports
Summary: AI in fix imports
Status: NEW
Alias: None
Product: java
Classification: Unclassified
Component: Editor (show other bugs)
Version: 6.x
Hardware: All All
: P3 blocker with 1 vote (vote)
Assignee: Dusan Balek
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-03-01 12:46 UTC by tronicek
Modified: 2015-01-23 09:28 UTC (History)
2 users (show)

See Also:
Issue Type: ENHANCEMENT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description tronicek 2009-03-01 12:46:42 UTC
It would be nice if the IDE "learns" from the project.
Example: I have 20 classes and use Kind in each of them.
When I select 'fix import' in any of them, it offers 'javax.tools.Diagnostic.Kind' as the first choice
and I always have to change it to 'com.sun.source.tree.Tree.Kind'.
It would have been convinient, if the IDE had some clever heuristics which class to offer as first.
For example, if all previous imports of Kind were 'com.sun.source.tree.Tree.Kind',
select this as the first choice.
Comment 1 Max Sauer 2009-03-02 13:04:45 UTC
Good hint, thanks.

Comment 2 terje7601 2015-01-22 12:48:44 UTC
If I have "Serializable" in my class & do "Fix Imports...", NetBeans proposes me "scala.Serializable" by default, with "java.io.Serializable" only as second option.

I feel NetBeans should be smarter in this regard:
* "scala.Serializable" is only available in the project because some transitive dependency deep in the hierarchy depends on Scala
* java.io.Serializable is a Java SE class

Some simple ordering that already seems much more logical to me is:
* classes in the local project
* java.*, javax.*, javafx.*
* classes in direct Maven dependencies (i.e. dependencies in the "dependencies" section of the effective POM)
* classes in transitive Maven dependencies (as e.g. scala.Serializable in this case)

Please also note that there are already many issues related to NetBeans Fix Imports functionality & ways to improve it (bug 49573, bug 52088, bug 57853, bug 85968, bug 152192, bug 185612, bug 186368, bug 201222). Maybe it would be better to create a new umbrella bug & have it depend on all the aforementioned bugs? That way people can all vote on the umbrella bug & maybe priority will be raised.