When A ClassVisitor's visitMethod will be called in asm?
<p>Let's say I have class like this:</p>

<pre><code>public class ClassPrinter extends ClassVisitor {


    public ClassPrinter(ClassWriter writer) {
        super(Opcodes.ASM5, writer);
    }

    @Override
    public void visit(int version, int access, String name, String signature, String superName, String[] interfaces) {
        super.visit(version, access, name, signature, superName, interfaces);
    }

    @Override
    public MethodVisitor visitMethod(int access, String name, String desc, String signature, String[] exceptions) {
        // when this line will get executed?
        System.out.println(name);
    }

}
</code></pre>

<p>now when the <code>visitMethod</code> will be called? Is it when the classloading happens in Java (thats where class visitor gets called?) or when a method is called on the class object?</p>

<p>I'm getting confused on this. </p>