Daniel Holle
b70e435120
Some checks failed
Build and Test with Maven / Build-and-test-with-Maven (push) Failing after 59s
47 lines
711 B
Java
47 lines
711 B
Java
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);
|
|
}
|
|
}
|