class CompilationUnit { } public interface VoidVisitor { void visit(CompilationUnit n, A arg); void visit(JavadocComment n, A arg); } public interface GenericVisitor { R visit(CompilationUnit n, A arg); R visit(JavadocComment n, A arg); } class JavadocComment { public R accept(GenericVisitor v, A arg) { return v.visit(this, arg); } public void accept(VoidVisitor v, A arg) { v.visit(this, arg); } } public abstract class VoidVisitorAdapter implements VoidVisitor { @Override public void visit(final AnnotationDeclaration n, final A arg) { JavadocComment javadocComment; javadocComment.accept(this, arg); } }