diff --git a/asm-analysis/src/main/java/org/objectweb/asm/tree/analysis/package.html b/asm-analysis/src/main/java/org/objectweb/asm/tree/analysis/package.html deleted file mode 100644 index b60c7dd4f..000000000 --- a/asm-analysis/src/main/java/org/objectweb/asm/tree/analysis/package.html +++ /dev/null @@ -1,65 +0,0 @@ - - -
- --Provides a framework for static code analysis based on the asm.tree package. -
- --Basic usage: -
- --ClassReader classReader = new ClassReader(bytecode); -ClassNode classNode = new ClassNode(); -classReader.accept(classNode, ClassReader.SKIP_DEBUG); - -for (MethodNode method : classNode.methods) { - if (method.instructions.size() > 0) { - Analyzer analyzer = new Analyzer(new BasicInterpreter()); - analyzer.analyze(classNode.name, method); - Frame[] frames = analyzer.getFrames(); - // Elements of the frames array now contains info for each instruction - // from the analyzed method. BasicInterpreter creates BasicValue, that - // is using simplified type system that distinguishes the UNINITIALZED, - // INT, FLOAT, LONG, DOUBLE, REFERENCE and RETURNADDRESS types. - ... - } -} -- -
-@since ASM 1.4.3 -
- - - diff --git a/asm-tree/src/main/java/org/objectweb/asm/tree/package.html b/asm-tree/src/main/java/org/objectweb/asm/tree/package.html deleted file mode 100644 index d8906c84f..000000000 --- a/asm-tree/src/main/java/org/objectweb/asm/tree/package.html +++ /dev/null @@ -1,193 +0,0 @@ - - - - --Provides an ASM visitor that constructs a tree representation of the -classes it visits. This class adapter can be useful to implement "complex" -class manipulation operations, i.e., operations that would be very hard to -implement without using a tree representation (such as optimizing the number -of local variables used by a method). -
- --However, this class adapter has a cost: it makes ASM bigger and slower. Indeed -it requires more than twenty new classes, and multiplies the time needed to -transform a class by almost two (it is almost two times faster to read, "modify" -and write a class with a ClassVisitor than with a ClassNode). This is why -this package is bundled in an optional asm-tree.jar library that -is separated from (but requires) the asm.jar library, which contains -the core ASM framework. This is also why it is recommended -not to use this class adapter when it is possible. -
- --The root class is the ClassNode, that can be created from existing bytecode. For example: -
- -- ClassReader classReader = new ClassReader(source); - ClassNode classNode = new ClassNode(); - classReader.accept(classNode, 0); -- -
-Now the content of ClassNode can be modified and then -serialized back into bytecode: -
- -- ClassWriter classWriter = new ClassWriter(0); - classNode.accept(classWriter); -- -
-Using a simple ClassVisitor it is possible to create MethodNode instances per-method. -In this example MethodNode is acting as a buffer that is flushed out at visitEnd() call: -
- -- ClassReader classReader = new ClassReader(source); - ClassWriter classWriter = new ClassWriter(0); - ClassVisitor classVisitor = new ClassVisitor(ASM6, classWriter) { - public MethodVisitor visitMethod(int access, String name, - String desc, String signature, String[] exceptions) { - final MethodVisitor methodVisitor = - super.visitMethod(access, name, desc, signature, exceptions); - MethodNode methodNode = new MethodNode(access, name, desc, signature, exceptions) { - public void visitEnd() { - // transform or analyze method code using tree API - accept(methodVisitor); - } - }; - } - }; - classReader.accept(classVisitor, 0); -- -
-Several strategies can be used to construct method code from scratch. The first -option is to create a MethodNode, and then create XxxInsnNode instances and -add them to the instructions list: -
- --MethodNode methodNode = new MethodNode(...); -methodNode.instructions.add(new VarInsnNode(ALOAD, 0)); -... -- -
-Alternatively, you can use the fact that MethodNode is a MethodVisitor, and use -that to create the XxxInsnNode and add them to the instructions list through -the standard MethodVisitor methods: -
- --MethodNode methodNode = new MethodNode(...); -methodNode.visitVarInsn(ALOAD, 0); -... -- -
-If you cannot generate all the instructions in sequential order, i.e. if you -need to save some pointer in the instruction list and then insert instructions -at that place after other instructions have been generated, you can use InsnList -methods insert() and insertBefore() to insert instructions at a saved pointer. -
- --MethodNode methodNode = new MethodNode(...); -methodNode.visitVarInsn(ALOAD, 0); -AbstractInsnNode ptr = methodNode.instructions.getLast(); -methodNode.visitVarInsn(ALOAD, 1); -// inserts an instruction between ALOAD 0 and ALOAD 1 -methodNode.instructions.insert(ptr, new VarInsnNode(ALOAD, 0)); -... -- -
-If you need to insert instructions while iterating over an existing instruction -list, you can also use several strategies. The first one is to use a -ListIterator over the instruction list: -
- --ListIterator it = methodNode.instructions.iterator(); -while (it.hasNext()) { - AbstractInsnNode insnNode = (AbstractInsnNode) it.next(); - if (...) { - it.add(new VarInsnNode(ALOAD, 0)); - } -} -- -
-It is also possible to convert an instruction list into an array and iterate through -array elements: -
- --AbstractInsnNode[] insns = methodNode.instructions.toArray(); -for(int i = 0; i<insns.length; i++) { - AbstractInsnNode insn = insns[i]; - if (...) { - methodNode.instructions.insert(insn, new VarInsnNode(ALOAD, 0)); - } -} -- -
-If you want to insert these instructions through the MethodVisitor methods, -you can use another instance of MethodNode as a MethodVisitor and then -insert instructions collected by that instance into the instruction list. -For example: -
- --AbstractInsnNode[] insns = methodNode.instructions.toArray(); -for(int i = 0; i<insns.length; i++) { - AbstractInsnNode insn = insns[i]; - if (...) { - MethodNode toInsert = new MethodNode(); - toInsert.visitVarInsn(ALOAD, 0); - toInsert.visitVarInsn(ALOAD, 1); - m.instructions.insert(insn, toInsert.instructions); - } -} -- -
-@since ASM 1.3.3 -
- - - diff --git a/asm-util/src/main/java/org/objectweb/asm/util/package.html b/asm-util/src/main/java/org/objectweb/asm/util/package.html deleted file mode 100644 index 91d74204b..000000000 --- a/asm-util/src/main/java/org/objectweb/asm/util/package.html +++ /dev/null @@ -1,40 +0,0 @@ - - - -Provides ASM visitors that can be useful for programming and -debugging purposes. These class visitors are normally not used by applications -at runtime. This is why they are bundled in an optional asm-util.jar -library that is separated from (but requires) the asm.jar library, -which contains the core ASM framework. - -@since ASM 1.3.2 - - diff --git a/asm/src/main/java/org/objectweb/asm/package.html b/asm/src/main/java/org/objectweb/asm/package.html deleted file mode 100644 index 85de04dda..000000000 --- a/asm/src/main/java/org/objectweb/asm/package.html +++ /dev/null @@ -1,74 +0,0 @@ - - - -Provides a small and fast bytecode manipulation framework. - --The ASM framework is organized -around the {@link org.objectweb.asm.ClassVisitor ClassVisitor}, -{@link org.objectweb.asm.FieldVisitor FieldVisitor}, -{@link org.objectweb.asm.MethodVisitor MethodVisitor} and -{@link org.objectweb.asm.AnnotationVisitor AnnotationVisitor} abstract classes, -which allow one to visit the fields, methods and annotations of a class, -including the bytecode instructions of each method. - -
-In addition to these main abstract classes, ASM provides a {@link -org.objectweb.asm.ClassReader ClassReader} class, that can parse an -existing class and make a given visitor visit it. ASM also provides -a {@link org.objectweb.asm.ClassWriter ClassWriter} class, which is -a visitor that generates Java class files. - -
-In order to generate a class from scratch, only the {@link -org.objectweb.asm.ClassWriter ClassWriter} class is necessary. Indeed, -in order to generate a class, one must just call its visitXxx -methods with the appropriate arguments to generate the desired fields -and methods. - -
-In order to modify existing classes, one must use a {@link -org.objectweb.asm.ClassReader ClassReader} class to analyze -the original class, a class modifier, and a {@link org.objectweb.asm.ClassWriter -ClassWriter} to construct the modified class. The class modifier -is just a {@link org.objectweb.asm.ClassVisitor ClassVisitor} -that delegates most of the work to another {@link org.objectweb.asm.ClassVisitor -ClassVisitor}, but that sometimes changes some parameter values, -or call additional methods, in order to implement the desired -modification process. In order to make it easier to implement such -class modifiers, the {@link org.objectweb.asm.ClassVisitor -ClassVisitor} and {@link org.objectweb.asm.MethodVisitor MethodVisitor} -classes delegate by default all the method calls they receive to an -optional visitor. - -@since ASM 1.3 - - diff --git a/asm/src/main/java/org/objectweb/asm/signature/package.html b/asm/src/main/java/org/objectweb/asm/signature/package.html deleted file mode 100644 index 0c07d120a..000000000 --- a/asm/src/main/java/org/objectweb/asm/signature/package.html +++ /dev/null @@ -1,36 +0,0 @@ - - -
-Provides support for type signatures. - -@since ASM 2.0 - - diff --git a/scripts/selectAndPrepareSources b/scripts/selectAndPrepareSources index 663e09a2c..4bd929810 100755 --- a/scripts/selectAndPrepareSources +++ b/scripts/selectAndPrepareSources @@ -37,6 +37,7 @@ mkdir -p src/main/java/scala/tools/asm for base in asm asm-util asm-commons asm-tree asm-analysis; do cp -R $base/src/main/java/org/objectweb/asm/* src/main/java/scala/tools/asm/ rm -r $base + git add -A $base done git add src