class Foo { interface X { X getParent(); } void test(X x) { x = x.getParent(); x = x.getParent(); } }