|
Generated by JDiff |
||||||||
| PREV PACKAGE NEXT PACKAGE FRAMES NO FRAMES | |||||||||
This file contains all the changes in documentation in the packageorg.objectweb.asm.utilas colored differences. Deletions are shownlike this, and additions are shown like this.
If no deletions or additions are shown in an entry, the HTML tags will be what has changed. The new HTML tags are shown in the differences. If no documentation existed, and then some was added in a later version, this change is noted in the appropriate class pages of differences, but the change is not shown on this page. Only changes in existing text are shown here. Similarly, documentation which was inherited from another class or interface is not shown here.
Note that an HTML error in the new documentation may cause the display of other documentation changes to be presented incorrectly. For instance, failure to close a <code> tag will cause all subsequent paragraphs to be displayed differently.
A ClassVisitor that prints the ASM code that generates the classes it visits. This class visitor can be used to quickly write ASM code to generate some given bytecode:The source code printed when visiting the Hello class is the following:
- write the Java source code equivalent to the bytecode you want to generate;
- compile it with javac;
- make a ASMifierClassVisitor visit this compiled class (see the main method);
- edit the generated source code, if necessary.
where Hello is defined by:import org.objectweb.asm.*;public class HelloDump implements Opcodes {public static byte[] dump() throws Exception {ClassWriter cw = new ClassWriter(false0); FieldVisitor fv; MethodVisitor mv; AnnotationVisitor av0;cw.visit(49, ACC_PUBLIC + ACC_SUPER, "Hello", null, "java/lang/Object", null);cw.visitSource("Hello.java", null);{ mv = cw.visitMethod(ACC_PUBLIC, "<init>", "()V", null, null); mv.visitVarInsn(ALOAD, 0); mv.visitMethodInsn(INVOKESPECIAL, "java/lang/Object", "<init>", "()V"); mv.visitInsn(RETURN); mv.visitMaxs(1, 1); mv.visitEnd(); } { mv = cw.visitMethod(ACC_PUBLIC + ACC_STATIC, "main", "([Ljava/lang/String;)V", null, null); mv.visitFieldInsn(GETSTATIC, "java/lang/System", "out", "Ljava/io/PrintStream;"); mv.visitLdcInsn("hello"); mv.visitMethodInsn(INVOKEVIRTUAL, "java/io/PrintStream", "println", "(Ljava/lang/String;)V"); mv.visitInsn(RETURN); mv.visitMaxs(2, 1); mv.visitEnd(); } cw.visitEnd();return cw.toByteArray(); } }
@author Eric Bruneton @author Eugene Kuleshovpublic class Hello {public static void main(String[] args) { System.out.println("hello"); } }
Returns the textprintedconstructed by this visitor. @return the textprintedconstructed by this visitor.
Checks a given class @param cr aClassReaderthat contains bytecode forthethe analysis.@param dump true if bytecode should be printed out not only whenerrorserrors are found. @param pw write where results going to be printed