我在阅读 eclipse JDT 的文档时发现了这段内容:
IMethodBinding.getParameterTypes()
: . . . 注意:结果不包括由内部类模拟引入的合成参数。
我在 JLS 中没有找到任何关于 内部类模拟 的参考......有人知道这个模拟是什么吗?提供一个例子会更好 :)
我在阅读 eclipse JDT 的文档时发现了这段内容:
IMethodBinding.getParameterTypes()
: . . . 注意:结果不包括由内部类模拟引入的合成参数。
我在 JLS 中没有找到任何关于 内部类模拟 的参考......有人知道这个模拟是什么吗?提供一个例子会更好 :)
public class Outer {
class Inner {
@Override
public String toString() {
return "Inner";
}
}
}
内部类会被编译成类似以下的形式:
class Outer$Inner {
final Outer this$0; // the instance of the outer class
Outer$Inner(Outer outer) {
super();
this$0 = outer;
}
public String toString() {
return "Inner";
}
}