Community
Participate
Working Groups
The Organize Imports function and other quickfixes and refactorings that automatically add imports for types referenced by them are pretty great. But when it comes to inner classes, the result often is less than helpful. Oftentimes inner classes use names that only make sense when qualified by their outer class: - Entry is much less helpful than Map.Entry - EMF has inner classes called Internal or similar all over the place (Adapter.Internal, Resource.Internal ...) Therefore it would make sense to only import their outer class and have the inner classes qualified by them. Currently, after an "Organize Imports", what you get is something like import java.util.Map.Entry; ... Entry foo = something(); I'd propose to add a preference "Import inner classes" to the "Organize Imports" section, which when enabled (the default?) yields the old result and when disabled yields something like this instead: import java.util.Map; ... Map.Entry foo = something();
Created attachment 255656 [details] A Similar feature in a competing IDE This is a image of similar feature in IntelliJ Idea IDE
Yes, this has been really troublesome and the code become less readable once the static inner classes are directly imported to the client class. Having the semi qualified name as 'OuterClass.InnerClass' within the code is much more readable. I've notice this happening when we use the "Add Unimplemented methods" when implementing interfaces. Even if the interface it self has Semi qualified names of inner classes as the parameter types of its methods, still the automatically added method implementations will have only the direct unqualified names of the inner classes in the method parameter list and, we can see the import statement for Inner classes rather than the outer class at the top. The preference to select the option "Insert imports for inner classes" is available in other competing IDEs as well(e.g IntelliJ Idea). Any updates on this change request?
Will keep this in the radar, but no promise yet. Meanwhile, if anyone is willing to contribute a patch, that will speed up things!
Bulk move out of 4.8