Whenever I use nested classes, I give them names that do not contain the name of the outer class, for example, MySomething.Kind , and not MySomething.MySomethingKind . Nested classes are sometimes visible from the outside, and then I always want to refer to them by the name assigned to the class, i.e. MySomething.Kind , not just Kind . Sometimes there are several classes that contain a nested Kind , so using an unqualified name can be confusing.
Is there a way to prevent unnecessarily importing Eclipse mypackage.MySomething.Kind instead of using the (already imported) mypackage.MySomething along with a semi- mypackage.MySomething name?
UPDATE:
This does not happen spontaneously. As jprete pointed out , when I always use a semi-qualified name, the nested class is not imported. But any refactoring that creates a variable of type MySomething.Kind declares it only as Kind and adds an unwanted import statement. This makes refactoring useless, since I have to edit it manually. Whenever I forget, I get the worst of both: a mixture of unqualified and semi-qualified names.
source share