public class Bug307 { public void main() { IVisitor v = new Visitor(); Impl2 f = new Impl2(); Impl1 g = new Impl1(); f.accept(v); g.accept(v); } } interface IVisitor { void visit(Impl1 f); void visit(Impl2 fb); } interface IAcceptor { void accept(IVisitor v); } class Visitor implements IVisitor { @Override public void visit(Impl1 f) { } @Override public void visit(Impl2 fb) { } } class Impl1 implements IAcceptor { @Override public void accept(IVisitor v) { v.visit(this); } } class Impl2 implements IAcceptor { @Override public void accept(IVisitor v) { v.visit(this); } }