On 7/14/12 5:36 AM, Guillaume Chatelet wrote:
class Fruit {
class Seed {
}
}
class Apple extends Fruit {
class AppleSeed extends Fruit.Seed {
Apple getOuter() {
return Apple.this;
}
}
}
class Main {
public static void main(String[] args) {
final Apple apple = new Apple();
final Apple.AppleSeed appleSeed = apple.new AppleSeed();
assert (appleSeed instanceof Fruit.Seed);
assert (apple == appleSeed.getOuter());
assert (appleSeed.getOuter() instanceof Apple);
assert (appleSeed.getOuter() instanceof Fruit);
}
}
This is valid Java code actually and I agree with Gor I would have
expected it to work with D.
Guillaume
You may want to add the example to the bug report.
Thanks,
Andrei