Enhance ClassVisitor to support multiple chain forwarding
As described in asm4-guide.pdf, chapter "2.2.7 Transformation chains" it is possible to forward calls to several ClassVisitors. This mechanism can be quite easily implemented (with full downward compatibility) in ClassVisitor. The public API could be extended by a constructor that accepts a ClassVisitor argument. This argument can be stored in a (preferably private) field (named e.g. cvs). The original constructor(s) with a ClassVisitor argument, should store its argument in the "old" cv field (only for backward compatibility) AND as the first item in the cvs array. All methods should then use the cvs array to forward calls. The use of a protected instead of a private cv is not very clear to me. I would prefer to call the super method over using the protected field to invoke the (same) method. If I look at the code examples in chapter "3.2.3 Transforming methods", the use of "mv1=super.visitMethod(..." would be better (automatic check for null of cv) than the proposed "mv1=cv.visitMethod(...". But if I am wrong, please try to explain it to me! If you want me to upload an enhanced ClassVisitor, let me know.
This same mechanisme should be implemented in the MethodVisitor.
changed title from Enhance ClassVisitor to support multiple chain forwarding to Enhance ClassVisitor to support multiple chain forwardingToggle commit list