I would suggest to implement ElementA.accept in terms of the base class Visitor, and ElementB.accept in terms of Visitor2.
public ElementA {
public void accept(Visitor v) {
//...
}
}
public ElementB {
public void accept(Visitor2 v) {
//...
}
}
That way, you avoid the code duplication which leads to the extendability problem mentioned in your question.