Eclipse, completion of inner classes

I have a class B that is defined as an inner class for A

 package hello; class A { static class B { // ... } // ... } 

I am editing the third class C , and I need to declare an AB object:

 AB something = new AB(...); 

If I use Eclipse code completion, and I let Eclipse output the type of expression, I get something like this:

 import hello.A; import hello.AB; // ... class C { // ... void foo() { B something = new AB(...); } } 

Is there a way to avoid this behavior and use eclipse using AB instead of importing it?

I would like to:

 import hello.A; class C { void foo() { AB something = new AB(...); } } 
+2
source share
1 answer

try

 package my.pack; public class A { public static class B {} } 

and then

 package my.other.pack; public class C { my.pack.AB myB = new my.pack.AB(); } 

but watch out for Eclipse, I think it will try to optimize your import (I think you can disable it, but I don’t know how).

0
source

All Articles