JavaEclipse,内部类的完成
我有一个类B
被定义为A
的内部类
package hello;
class A {
static class B {
// ...
}
// ...
}
我正在编辑第三个类C
,我需要声明一个A.B
对象:
A.B something = new A.B(...);
如果我使用Eclipse的代码完成,让Eclipse推断表达式的类型,我会得到如下结果:
import hello.A;
import hello.A.B;
// ...
class C {
// ...
void foo() {
B something = new A.B(...);
}
}
有没有办法避免这种行为,让eclipse使用A.B
而不是导入它
我想要的是:
import hello.A;
class C {
void foo() {
A.B something = new A.B(...);
}
}
# 1 楼答案
试试看
然后
但请注意Eclipse,我认为它会尝试优化您的导入(我认为您可以禁用它,但我不知道如何禁用)