Documentation of ModuleVisitor is incorrect
The javadoc for ModuleVisitor indicates that the visitMainClass method is obligatory and needs to be invoked first. From the code, I would not understand why the method would need to be invoked first. That multiple invocations do not make sense is however obvious.