Thread: [Proxool-cvs] proxool/src/java/org/logicalcobwebs/asm/tree AbstractInsnNode.java,NONE,1.1 ClassNode.
UNMAINTAINED!
Brought to you by:
billhorsman
Update of /cvsroot/proxool/proxool/src/java/org/logicalcobwebs/asm/tree In directory sc8-pr-cvs1:/tmp/cvs-serv22981/src/java/org/logicalcobwebs/asm/tree Added Files: AbstractInsnNode.java ClassNode.java FieldInsnNode.java FieldNode.java IincInsnNode.java InnerClassNode.java InsnNode.java IntInsnNode.java JumpInsnNode.java LdcInsnNode.java LineNumberNode.java LocalVariableNode.java LookupSwitchInsnNode.java MethodInsnNode.java MethodNode.java MultiANewArrayInsnNode.java TableSwitchInsnNode.java TreeClassAdapter.java TreeCodeAdapter.java TryCatchBlockNode.java TypeInsnNode.java VarInsnNode.java package.html Log Message: Repackaged ASM project --- NEW FILE: AbstractInsnNode.java --- /*** * ASM: a very small and fast Java bytecode manipulation framework * Copyright (c) 2000,2002,2003 INRIA, France Telecom * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. Neither the name of the copyright holders nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF * THE POSSIBILITY OF SUCH DAMAGE. * * Contact: Eri...@rd... * * Author: Eric Bruneton */ package org.logicalcobwebs.asm.tree; import org.logicalcobwebs.asm.CodeVisitor; /** * A node that represents a bytecode instruction. */ public abstract class AbstractInsnNode { /** * The opcode of this instruction. */ protected int opcode; /** * Constructs a new {@link AbstractInsnNode AbstractInsnNode} object. * * @param opcode the opcode of the instruction to be constructed. */ protected AbstractInsnNode (final int opcode) { this.opcode = opcode; } /** * Returns the opcode of this instruction. * * @return the opcode of this instruction. */ public int getOpcode () { return opcode; } /** * Makes the given code visitor visit this instruction. * * @param cv a code visitor. */ public abstract void accept (final CodeVisitor cv); } --- NEW FILE: ClassNode.java --- /*** * ASM: a very small and fast Java bytecode manipulation framework * Copyright (c) 2000,2002,2003 INRIA, France Telecom * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. Neither the name of the copyright holders nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF * THE POSSIBILITY OF SUCH DAMAGE. * * Contact: Eri...@rd... * * Author: Eric Bruneton */ package org.logicalcobwebs.asm.tree; import org.logicalcobwebs.asm.ClassVisitor; import org.logicalcobwebs.asm.Attribute; import java.util.List; import java.util.ArrayList; import java.util.Arrays; /** * A node that represents a class. */ public class ClassNode { /** * The class's access flags (see {@link org.logicalcobwebs.asm.Constants}). This * field also indicates if the class is deprecated. */ public int access; /** * The internal name of the class (see {@link * org.logicalcobwebs.asm.Type#getInternalName getInternalName}). */ public String name; /** * The internal of name of the super class (see {@link * org.logicalcobwebs.asm.Type#getInternalName getInternalName}). For interfaces, * the super class is {@link Object}. May be <tt>null</tt>, but only for the * {@link Object java.lang.Object} class. */ public String superName; /** * The internal names of the class's interfaces (see {@link * org.logicalcobwebs.asm.Type#getInternalName getInternalName}). This list is a * list of {@link String} objects. */ public final List interfaces; /** * The name of the source file from which this class was compiled. May be * <tt>null</tt>. */ public String sourceFile; /** * Informations about the inner classes of this class. This list is a list of * {@link InnerClassNode InnerClassNode} objects. */ public final List innerClasses; /** * The fields of this class. This list is a list of {@link FieldNode * FieldNode} objects. */ public final List fields; /** * The methods of this class. This list is a list of {@link MethodNode * MethodNode} objects. */ public final List methods; /** * The non standard attributes of the class. */ public Attribute attrs; /** * Constructs a new {@link ClassNode ClassNode} object. * * @param access the class's access flags (see {@link * org.logicalcobwebs.asm.Constants}). This parameter also indicates if the * class is deprecated. * @param name the internal name of the class (see {@link * org.logicalcobwebs.asm.Type#getInternalName getInternalName}). * @param superName the internal of name of the super class (see {@link * org.logicalcobwebs.asm.Type#getInternalName getInternalName}). For * interfaces, the super class is {@link Object}. * @param interfaces the internal names of the class's interfaces (see {@link * org.logicalcobwebs.asm.Type#getInternalName getInternalName}). May be * <tt>null</tt>. * @param sourceFile the name of the source file from which this class was * compiled. May be <tt>null</tt>. */ public ClassNode ( final int access, final String name, final String superName, final String[] interfaces, final String sourceFile) { this.access = access; this.name = name; this.superName = superName; this.interfaces = new ArrayList(); this.sourceFile = sourceFile; this.innerClasses = new ArrayList(); this.fields = new ArrayList(); this.methods = new ArrayList(); if (interfaces != null) { this.interfaces.addAll(Arrays.asList(interfaces)); } } /** * Makes the given class visitor visit this class. * * @param cv a class visitor. */ public void accept (final ClassVisitor cv) { // visits header String[] interfaces = new String[this.interfaces.size()]; this.interfaces.toArray(interfaces); cv.visit(access, name, superName, interfaces, sourceFile); // visits inner classes int i; for (i = 0; i < innerClasses.size(); ++i) { ((InnerClassNode)innerClasses.get(i)).accept(cv); } // visits fields for (i = 0; i < fields.size(); ++i) { ((FieldNode)fields.get(i)).accept(cv); } // visits methods for (i = 0; i < methods.size(); ++i) { ((MethodNode)methods.get(i)).accept(cv); } // visits attributes Attribute attrs = this.attrs; while (attrs != null) { cv.visitAttribute(attrs); attrs = attrs.next; } // visits end cv.visitEnd(); } } --- NEW FILE: FieldInsnNode.java --- /*** * ASM: a very small and fast Java bytecode manipulation framework * Copyright (c) 2000,2002,2003 INRIA, France Telecom * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. Neither the name of the copyright holders nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF * THE POSSIBILITY OF SUCH DAMAGE. * * Contact: Eri...@rd... * * Author: Eric Bruneton */ package org.logicalcobwebs.asm.tree; import org.logicalcobwebs.asm.CodeVisitor; /** * A node that represents a field instruction. A field instruction is an * instruction that loads or stores the value of a field of an object. */ public class FieldInsnNode extends AbstractInsnNode { /** * The internal name of the field's owner class (see {@link * org.logicalcobwebs.asm.Type#getInternalName getInternalName}). */ public String owner; /** * The field's name. */ public String name; /** * The field's descriptor (see {@link org.logicalcobwebs.asm.Type Type}). */ public String desc; /** * Constructs a new {@link FieldInsnNode FieldInsnNode} object. * * @param opcode the opcode of the type instruction to be constructed. This * opcode must be GETSTATIC, PUTSTATIC, GETFIELD or PUTFIELD. * @param owner the internal name of the field's owner class (see {@link * org.logicalcobwebs.asm.Type#getInternalName getInternalName}). * @param name the field's name. * @param desc the field's descriptor (see {@link org.logicalcobwebs.asm.Type * Type}). */ public FieldInsnNode ( final int opcode, final String owner, final String name, final String desc) { super(opcode); this.owner = owner; this.name = name; this.desc = desc; } /** * Sets the opcode of this instruction. * * @param opcode the new instruction opcode. This opcode must be GETSTATIC, * PUTSTATIC, GETFIELD or PUTFIELD. */ public void setOpcode (final int opcode) { this.opcode = opcode; } public void accept (final CodeVisitor cv) { cv.visitFieldInsn(opcode, owner, name, desc); } } --- NEW FILE: FieldNode.java --- /*** * ASM: a very small and fast Java bytecode manipulation framework * Copyright (c) 2000,2002,2003 INRIA, France Telecom * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. Neither the name of the copyright holders nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF * THE POSSIBILITY OF SUCH DAMAGE. * * Contact: Eri...@rd... * * Author: Eric Bruneton */ package org.logicalcobwebs.asm.tree; import org.logicalcobwebs.asm.ClassVisitor; import org.logicalcobwebs.asm.Attribute; /** * A node that represents a field. */ public class FieldNode { /** * The field's access flags (see {@link org.logicalcobwebs.asm.Constants}). This * field also indicates if the field is synthetic and/or deprecated. */ public int access; /** * The field's name. */ public String name; /** * The field's descriptor (see {@link org.logicalcobwebs.asm.Type Type}). */ public String desc; /** * The field's initial value. This field, which may be <tt>null</tt> if the * field does not have an initial value, must be an {@link java.lang.Integer * Integer}, a {@link java.lang.Float Float}, a {@link java.lang.Long Long}, * a {@link java.lang.Double Double} or a {@link String String}. */ public Object value; /** * The non standard attributes of the field. */ public Attribute attrs; /** * Constructs a new {@link FieldNode FieldNode} object. * * @param access the field's access flags (see {@link * org.logicalcobwebs.asm.Constants}). This parameter also indicates if the * field is synthetic and/or deprecated. * @param name the field's name. * @param desc the field's descriptor (see {@link org.logicalcobwebs.asm.Type * Type}). * @param value the field's initial value. This parameter, which may be * <tt>null</tt> if the field does not have an initial value, must be an * {@link java.lang.Integer Integer}, a {@link java.lang.Float Float}, a * {@link java.lang.Long Long}, a {@link java.lang.Double Double} or a * {@link String String}. * @param attrs the non standard attributes of the field. */ public FieldNode ( final int access, final String name, final String desc, final Object value, final Attribute attrs) { this.access = access; this.name = name; this.desc = desc; this.value = value; this.attrs = attrs; } /** * Makes the given class visitor visit this field. * * @param cv a class visitor. */ public void accept (final ClassVisitor cv) { cv.visitField(access, name, desc, value, attrs); } } --- NEW FILE: IincInsnNode.java --- /*** * ASM: a very small and fast Java bytecode manipulation framework * Copyright (c) 2000,2002,2003 INRIA, France Telecom * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. Neither the name of the copyright holders nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF * THE POSSIBILITY OF SUCH DAMAGE. * * Contact: Eri...@rd... * * Author: Eric Bruneton */ package org.logicalcobwebs.asm.tree; import org.logicalcobwebs.asm.CodeVisitor; import org.logicalcobwebs.asm.Constants; /** * A node that represents an IINC instruction. */ public class IincInsnNode extends AbstractInsnNode { /** * Index of the local variable to be incremented. */ public int var; /** * Amount to increment the local variable by. */ public int incr; /** * Constructs a new {@link IincInsnNode IincInsnNode} node. * * @param var index of the local variable to be incremented. * @param incr increment amount to increment the local variable by. */ public IincInsnNode (final int var, final int incr) { super(Constants.IINC); this.var = var; this.incr = incr; } public void accept (final CodeVisitor cv) { cv.visitIincInsn(var, incr); } } --- NEW FILE: InnerClassNode.java --- /*** * ASM: a very small and fast Java bytecode manipulation framework * Copyright (c) 2000,2002,2003 INRIA, France Telecom * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. Neither the name of the copyright holders nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF * THE POSSIBILITY OF SUCH DAMAGE. * * Contact: Eri...@rd... * * Author: Eric Bruneton */ package org.logicalcobwebs.asm.tree; import org.logicalcobwebs.asm.ClassVisitor; /** * A node that represents an inner class. */ public class InnerClassNode { /** * The internal name of an inner class (see {@link * org.logicalcobwebs.asm.Type#getInternalName getInternalName}). */ public String name; /** * The internal name of the class to which the inner class belongs (see * {@link org.logicalcobwebs.asm.Type#getInternalName getInternalName}). May be * <tt>null</tt>. */ public String outerName; /** * The (simple) name of the inner class inside its enclosing class. May be * <tt>null</tt> for anonymous inner classes. */ public String innerName; /** * The access flags of the inner class as originally declared in the enclosing * class. */ public int access; /** * Constructs a new {@link InnerClassNode InnerClassNode} object. * * @param name the internal name of an inner class (see {@link * org.logicalcobwebs.asm.Type#getInternalName getInternalName}). * @param outerName the internal name of the class to which the inner class * belongs (see {@link org.logicalcobwebs.asm.Type#getInternalName * getInternalName}). May be <tt>null</tt>. * @param innerName the (simple) name of the inner class inside its enclosing * class. May be <tt>null</tt> for anonymous inner classes. * @param access the access flags of the inner class as originally declared * in the enclosing class. */ public InnerClassNode ( final String name, final String outerName, final String innerName, final int access) { this.name = name; this.outerName = outerName; this.innerName = innerName; this.access = access; } /** * Makes the given class visitor visit this inner class. * * @param cv a class visitor. */ public void accept (final ClassVisitor cv) { cv.visitInnerClass(name, outerName, innerName, access); } } --- NEW FILE: InsnNode.java --- /*** * ASM: a very small and fast Java bytecode manipulation framework * Copyright (c) 2000,2002,2003 INRIA, France Telecom * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. Neither the name of the copyright holders nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF * THE POSSIBILITY OF SUCH DAMAGE. * * Contact: Eri...@rd... * * Author: Eric Bruneton */ package org.logicalcobwebs.asm.tree; import org.logicalcobwebs.asm.CodeVisitor; /** * A node that represents a zero operand instruction. */ public class InsnNode extends AbstractInsnNode { /** * Constructs a new {@link InsnNode InsnNode} object. * * @param opcode the opcode of the instruction to be constructed. This opcode * must be NOP, ACONST_NULL, ICONST_M1, ICONST_0, ICONST_1, ICONST_2, * ICONST_3, ICONST_4, ICONST_5, LCONST_0, LCONST_1, FCONST_0, FCONST_1, * FCONST_2, DCONST_0, DCONST_1, * * IALOAD, LALOAD, FALOAD, DALOAD, AALOAD, BALOAD, CALOAD, SALOAD, * IASTORE, LASTORE, FASTORE, DASTORE, AASTORE, BASTORE, CASTORE, * SASTORE, * * POP, POP2, DUP, DUP_X1, DUP_X2, DUP2, DUP2_X1, DUP2_X2, SWAP, * * IADD, LADD, FADD, DADD, ISUB, LSUB, FSUB, DSUB, IMUL, LMUL, FMUL, * DMUL, IDIV, LDIV, FDIV, DDIV, IREM, LREM, FREM, DREM, INEG, LNEG, * FNEG, DNEG, ISHL, LSHL, ISHR, LSHR, IUSHR, LUSHR, IAND, LAND, IOR, * LOR, IXOR, LXOR, * * I2L, I2F, I2D, L2I, L2F, L2D, F2I, F2L, F2D, D2I, D2L, D2F, I2B, I2C, * I2S, * * LCMP, FCMPL, FCMPG, DCMPL, DCMPG, * * IRETURN, LRETURN, FRETURN, DRETURN, ARETURN, RETURN, * * ARRAYLENGTH, * * ATHROW, * * MONITORENTER, or MONITOREXIT. */ public InsnNode (final int opcode) { super(opcode); } /** * Sets the opcode of this instruction. * * @param opcode the new instruction opcode. This opcode must be NOP, * ACONST_NULL, ICONST_M1, ICONST_0, ICONST_1, ICONST_2, * ICONST_3, ICONST_4, ICONST_5, LCONST_0, LCONST_1, FCONST_0, FCONST_1, * FCONST_2, DCONST_0, DCONST_1, * * IALOAD, LALOAD, FALOAD, DALOAD, AALOAD, BALOAD, CALOAD, SALOAD, * IASTORE, LASTORE, FASTORE, DASTORE, AASTORE, BASTORE, CASTORE, * SASTORE, * * POP, POP2, DUP, DUP_X1, DUP_X2, DUP2, DUP2_X1, DUP2_X2, SWAP, * * IADD, LADD, FADD, DADD, ISUB, LSUB, FSUB, DSUB, IMUL, LMUL, FMUL, * DMUL, IDIV, LDIV, FDIV, DDIV, IREM, LREM, FREM, DREM, INEG, LNEG, * FNEG, DNEG, ISHL, LSHL, ISHR, LSHR, IUSHR, LUSHR, IAND, LAND, IOR, * LOR, IXOR, LXOR, * * I2L, I2F, I2D, L2I, L2F, L2D, F2I, F2L, F2D, D2I, D2L, D2F, I2B, I2C, * I2S, * * LCMP, FCMPL, FCMPG, DCMPL, DCMPG, * * IRETURN, LRETURN, FRETURN, DRETURN, ARETURN, RETURN, * * ARRAYLENGTH, * * ATHROW, * * MONITORENTER, or MONITOREXIT. */ public void setOpcode (final int opcode) { this.opcode = opcode; } /** * Makes the given code visitor visit this instruction. */ public void accept (final CodeVisitor cv) { cv.visitInsn(opcode); } } --- NEW FILE: IntInsnNode.java --- /*** * ASM: a very small and fast Java bytecode manipulation framework * Copyright (c) 2000,2002,2003 INRIA, France Telecom * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. Neither the name of the copyright holders nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF * THE POSSIBILITY OF SUCH DAMAGE. * * Contact: Eri...@rd... * * Author: Eric Bruneton */ package org.logicalcobwebs.asm.tree; import org.logicalcobwebs.asm.CodeVisitor; /** * A node that represents an instruction with a single int operand. */ public class IntInsnNode extends AbstractInsnNode { /** * The operand of this instruction. */ public int operand; /** * Constructs a new {@link IntInsnNode IntInsnNode} object. * * @param opcode the opcode of the instruction to be constructed. This opcode * must be BIPUSH, SIPUSH or NEWARRAY. * @param operand the operand of the instruction to be constructed. */ public IntInsnNode (final int opcode, final int operand) { super(opcode); this.operand = operand; } /** * Sets the opcode of this instruction. * * @param opcode the new instruction opcode. This opcode must be BIPUSH, * SIPUSH or NEWARRAY. */ public void setOpcode (final int opcode) { this.opcode = opcode; } public void accept (final CodeVisitor cv) { cv.visitIntInsn(opcode, operand); } } --- NEW FILE: JumpInsnNode.java --- /*** * ASM: a very small and fast Java bytecode manipulation framework * Copyright (c) 2000,2002,2003 INRIA, France Telecom * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. Neither the name of the copyright holders nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF * THE POSSIBILITY OF SUCH DAMAGE. * * Contact: Eri...@rd... * * Author: Eric Bruneton */ package org.logicalcobwebs.asm.tree; import org.logicalcobwebs.asm.Label; import org.logicalcobwebs.asm.CodeVisitor; /** * A node that represents a jump instruction. A jump instruction is an * instruction that may jump to another instruction. */ public class JumpInsnNode extends AbstractInsnNode { /** * The operand of this instruction. This operand is a label that designates * the instruction to which this instruction may jump. */ public Label label; /** * Constructs a new {@link JumpInsnNode JumpInsnNode} object. * * @param opcode the opcode of the type instruction to be constructed. This * opcode must be IFEQ, IFNE, IFLT, IFGE, IFGT, IFLE, IF_ICMPEQ, * IF_ICMPNE, IF_ICMPLT, IF_ICMPGE, IF_ICMPGT, IF_ICMPLE, IF_ACMPEQ, * IF_ACMPNE, GOTO, JSR, IFNULL or IFNONNULL. * @param label the operand of the instruction to be constructed. This operand * is a label that designates the instruction to which the jump * instruction may jump. */ public JumpInsnNode (final int opcode, final Label label) { super(opcode); this.label = label; } /** * Sets the opcode of this instruction. * * @param opcode the new instruction opcode. This opcode must be * IFEQ, IFNE, IFLT, IFGE, IFGT, IFLE, IF_ICMPEQ, IF_ICMPNE, * IF_ICMPLT, IF_ICMPGE, IF_ICMPGT, IF_ICMPLE, IF_ACMPEQ, IF_ACMPNE, * GOTO, JSR, IFNULL or IFNONNULL. */ public void setOpcode (final int opcode) { this.opcode = opcode; } public void accept (final CodeVisitor cv) { cv.visitJumpInsn(opcode, label); } } --- NEW FILE: LdcInsnNode.java --- /*** * ASM: a very small and fast Java bytecode manipulation framework * Copyright (c) 2000,2002,2003 INRIA, France Telecom * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. Neither the name of the copyright holders nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF * THE POSSIBILITY OF SUCH DAMAGE. * * Contact: Eri...@rd... * * Author: Eric Bruneton */ package org.logicalcobwebs.asm.tree; import org.logicalcobwebs.asm.CodeVisitor; import org.logicalcobwebs.asm.Constants; /** * A node that represents an LDC instruction. */ public class LdcInsnNode extends AbstractInsnNode { /** * The constant to be loaded on the stack. This parameter must be a non null * {@link java.lang.Integer Integer}, a {@link java.lang.Float Float}, a * {@link java.lang.Long Long}, a {@link java.lang.Double Double} or a {@link * String String}. */ public Object cst; /** * Constructs a new {@link LdcInsnNode LdcInsnNode} object. * * @param cst the constant to be loaded on the stack. This parameter must be * a non null {@link java.lang.Integer Integer}, a {@link java.lang.Float * Float}, a {@link java.lang.Long Long}, a {@link java.lang.Double * Double} or a {@link String String}. */ public LdcInsnNode (final Object cst) { super(Constants.LDC); this.cst = cst; } public void accept (final CodeVisitor cv) { cv.visitLdcInsn(cst); } } --- NEW FILE: LineNumberNode.java --- /*** * ASM: a very small and fast Java bytecode manipulation framework * Copyright (c) 2000,2002,2003 INRIA, France Telecom * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. Neither the name of the copyright holders nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF * THE POSSIBILITY OF SUCH DAMAGE. * * Contact: Eri...@rd... * * Author: Eric Bruneton */ package org.logicalcobwebs.asm.tree; import org.logicalcobwebs.asm.Label; import org.logicalcobwebs.asm.CodeVisitor; /** * A node that represents a line number declaration. */ public class LineNumberNode { /** * A line number. This number refers to the source file from which the class * was compiled. */ public int line; /** * The first instruction corresponding to this line number. */ public Label start; /** * Constructs a new {@link LineNumberNode LineNumberNode} object. * * @param line a line number. This number refers to the source file * from which the class was compiled. * @param start the first instruction corresponding to this line number. */ public LineNumberNode (final int line, final Label start) { this.line = line; this.start = start; } /** * Makes the given code visitor visit this line number declaration. * * @param cv a code visitor. */ public void accept (final CodeVisitor cv) { cv.visitLineNumber(line, start); } } --- NEW FILE: LocalVariableNode.java --- /*** * ASM: a very small and fast Java bytecode manipulation framework * Copyright (c) 2000,2002,2003 INRIA, France Telecom * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. Neither the name of the copyright holders nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF * THE POSSIBILITY OF SUCH DAMAGE. * * Contact: Eri...@rd... * * Author: Eric Bruneton */ package org.logicalcobwebs.asm.tree; import org.logicalcobwebs.asm.CodeVisitor; import org.logicalcobwebs.asm.Label; /** * A node that represents a local variable declaration. */ public class LocalVariableNode { /** * The name of a local variable. */ public String name; /** * The type descriptor of this local variable. */ public String desc; /** * The first instruction corresponding to the scope of this local variable * (inclusive). */ public Label start; /** * The last instruction corresponding to the scope of this local variable * (exclusive). */ public Label end; /** * The local variable's index. */ public int index; /** * Constructs a new {@link LocalVariableNode LocalVariableNode} object. * * @param name the name of a local variable. * @param desc the type descriptor of this local variable. * @param start the first instruction corresponding to the scope of this * local variable (inclusive). * @param end the last instruction corresponding to the scope of this * local variable (exclusive). * @param index the local variable's index. */ public LocalVariableNode ( final String name, final String desc, final Label start, final Label end, final int index) { this.name = name; this.desc = desc; this.start = start; this.end = end; this.index = index; } /** * Makes the given code visitor visit this local variable declaration. * * @param cv a code visitor. */ public void accept (final CodeVisitor cv) { cv.visitLocalVariable(name, desc, start, end, index); } } --- NEW FILE: LookupSwitchInsnNode.java --- /*** * ASM: a very small and fast Java bytecode manipulation framework * Copyright (c) 2000,2002,2003 INRIA, France Telecom * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. Neither the name of the copyright holders nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF * THE POSSIBILITY OF SUCH DAMAGE. * * Contact: Eri...@rd... * * Author: Eric Bruneton */ package org.logicalcobwebs.asm.tree; import org.logicalcobwebs.asm.Label; import org.logicalcobwebs.asm.Constants; import org.logicalcobwebs.asm.CodeVisitor; import java.util.List; import java.util.ArrayList; import java.util.Arrays; /** * A node that represents a LOOKUPSWITCH instruction. */ public class LookupSwitchInsnNode extends AbstractInsnNode { /** * Beginning of the default handler block. */ public Label dflt; /** * The values of the keys. This list is a list a {@link java.lang.Integer * Integer} objects. */ public final List keys; /** * Beginnings of the handler blocks. This list is a list of {@link Label * Label} objects. */ public final List labels; /** * Constructs a new {@link LookupSwitchInsnNode LookupSwitchInsnNode} object. * * @param dflt beginning of the default handler block. * @param keys the values of the keys. * @param labels beginnings of the handler blocks. <tt>labels[i]</tt> is the * beginning of the handler block for the <tt>keys[i]</tt> key. */ public LookupSwitchInsnNode ( final Label dflt, final int[] keys, final Label[] labels) { super(Constants.LOOKUPSWITCH); this.dflt = dflt; this.keys = new ArrayList(); this.labels = new ArrayList(); if (keys != null) { for (int i = 0; i < keys.length; ++i) { this.keys.add(new Integer(keys[i])); } } if (labels != null) { this.labels.addAll(Arrays.asList(labels)); } } public void accept (final CodeVisitor cv) { int[] keys = new int[this.keys.size()]; for (int i = 0; i < keys.length; ++i) { keys[i] = ((Integer)this.keys.get(i)).intValue(); } Label[] labels = new Label[this.labels.size()]; this.labels.toArray(labels); cv.visitLookupSwitchInsn(dflt, keys, labels); } } --- NEW FILE: MethodInsnNode.java --- /*** * ASM: a very small and fast Java bytecode manipulation framework * Copyright (c) 2000,2002,2003 INRIA, France Telecom * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. Neither the name of the copyright holders nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF * THE POSSIBILITY OF SUCH DAMAGE. * * Contact: Eri...@rd... * * Author: Eric Bruneton */ package org.logicalcobwebs.asm.tree; import org.logicalcobwebs.asm.CodeVisitor; /** * A node that represents a method instruction. A method instruction is an * instruction that invokes a method. */ public class MethodInsnNode extends AbstractInsnNode { /** * The internal name of the method's owner class (see {@link * org.logicalcobwebs.asm.Type#getInternalName getInternalName}). */ public String owner; /** * The method's name. */ public String name; /** * The method's descriptor (see {@link org.logicalcobwebs.asm.Type Type}). */ public String desc; /** * Constructs a new {@link MethodInsnNode MethodInsnNode} object. * * @param opcode the opcode of the type instruction to be constructed. This * opcode must be INVOKEVIRTUAL, INVOKESPECIAL, INVOKESTATIC or * INVOKEINTERFACE. * @param owner the internal name of the method's owner class (see {@link * org.logicalcobwebs.asm.Type#getInternalName getInternalName}). * @param name the method's name. * @param desc the method's descriptor (see {@link org.logicalcobwebs.asm.Type * Type}). */ public MethodInsnNode ( final int opcode, final String owner, final String name, final String desc) { super(opcode); this.owner = owner; this.name = name; this.desc = desc; } /** * Sets the opcode of this instruction. * * @param opcode the new instruction opcode. This opcode must be * INVOKEVIRTUAL, INVOKESPECIAL, INVOKESTATIC or INVOKEINTERFACE. */ public void setOpcode (final int opcode) { this.opcode = opcode; } public void accept (final CodeVisitor cv) { cv.visitMethodInsn(opcode, owner, name, desc); } } --- NEW FILE: MethodNode.java --- /*** * ASM: a very small and fast Java bytecode manipulation framework * Copyright (c) 2000,2002,2003 INRIA, France Telecom * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. Neither the name of the copyright holders nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF * THE POSSIBILITY OF SUCH DAMAGE. * * Contact: Eri...@rd... * * Author: Eric Bruneton */ package org.logicalcobwebs.asm.tree; import org.logicalcobwebs.asm.ClassVisitor; import org.logicalcobwebs.asm.CodeVisitor; import org.logicalcobwebs.asm.Label; import org.logicalcobwebs.asm.Attribute; import java.util.List; import java.util.ArrayList; import java.util.Arrays; /** * A node that represents a method. */ public class MethodNode { /** * The method's access flags (see {@link org.logicalcobwebs.asm.Constants}). This * field also indicates if the method is synthetic and/or deprecated. */ public int access; /** * The method's name. */ public String name; /** * The method's descriptor (see {@link org.logicalcobwebs.asm.Type Type}). */ public String desc; /** * The internal names of the method's exception classes (see {@link * org.logicalcobwebs.asm.Type#getInternalName getInternalName}). This list is a * list of {@link String} objects. */ public final List exceptions; /** * The non standard attributes of the method. */ public Attribute attrs; /** * The instructions of this method. This list is a list of {@link * AbstractInsnNode AbstractInsnNode} and {@link Label Label} objects. */ public final List instructions; /** * The try catch blocks of this method. This list is a list of {@link * TryCatchBlockNode TryCatchBlockNode} objects. */ public final List tryCatchBlocks; /** * The maximum stack size of this method. */ public int maxStack; /** * The maximum number of local variables of this method. */ public int maxLocals; /** * The local variables of this method. This list is a list of {@link * LocalVariableNode LocalVariableNode} objects. */ public final List localVariables; /** * The line numbers of this method. This list is a list of {@link * LineNumberNode LineNumberNode} objects. */ public final List lineNumbers; /** * The non standard attributes of the method's code. */ public Attribute codeAttrs; /** * Constructs a new {@link MethodNode MethodNode} object. * * @param access the method's access flags (see {@link * org.logicalcobwebs.asm.Constants}). This parameter also indicates if the * method is synthetic and/or deprecated. * @param name the method's name. * @param desc the method's descriptor (see {@link org.logicalcobwebs.asm.Type * Type}). * @param exceptions the internal names of the method's exception * classes (see {@link org.logicalcobwebs.asm.Type#getInternalName * getInternalName}). May be <tt>null</tt>. * @param attrs the non standard attributes of the method. */ public MethodNode ( final int access, final String name, final String desc, final String[] exceptions, final Attribute attrs) { this.access = access; this.name = name; this.desc = desc; this.exceptions = new ArrayList(); this.instructions = new ArrayList(); this.tryCatchBlocks = new ArrayList(); this.localVariables = new ArrayList(); this.lineNumbers = new ArrayList(); if (exceptions != null) { this.exceptions.addAll(Arrays.asList(exceptions)); } this.attrs = attrs; } /** * Makes the given class visitor visit this method. * * @param cv a class visitor. */ public void accept (final ClassVisitor cv) { String[] exceptions = new String[this.exceptions.size()]; this.exceptions.toArray(exceptions); CodeVisitor mv = cv.visitMethod(access, name, desc, exceptions, attrs); if (mv != null && instructions.size() > 0) { int i; // visits instructions for (i = 0; i < instructions.size(); ++i) { Object insn = instructions.get(i); if (insn instanceof Label) { mv.visitLabel((Label)insn); } else { ((AbstractInsnNode)insn).accept(mv); } } // visits try catch blocks for (i = 0; i < tryCatchBlocks.size(); ++i) { ((TryCatchBlockNode)tryCatchBlocks.get(i)).accept(mv); } // visits maxs mv.visitMaxs(maxStack, maxLocals); // visits local variables for (i = 0; i < localVariables.size(); ++i) { ((LocalVariableNode)localVariables.get(i)).accept(mv); } // visits line numbers for (i = 0; i < lineNumbers.size(); ++i) { ((LineNumberNode)lineNumbers.get(i)).accept(mv); } // visits the code attributes Attribute attrs = codeAttrs; while (attrs != null) { mv.visitAttribute(attrs); attrs = attrs.next; } } } } --- NEW FILE: MultiANewArrayInsnNode.java --- /*** * ASM: a very small and fast Java bytecode manipulation framework * Copyright (c) 2000,2002,2003 INRIA, France Telecom * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. Neither the name of the copyright holders nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF * THE POSSIBILITY OF SUCH DAMAGE. * * Contact: Eri...@rd... * * Author: Eric Bruneton */ package org.logicalcobwebs.asm.tree; import org.logicalcobwebs.asm.Constants; import org.logicalcobwebs.asm.CodeVisitor; /** * A node that represents a MULTIANEWARRAY instruction. */ public class MultiANewArrayInsnNode extends AbstractInsnNode { /** * An array type descriptor (see {@link org.logicalcobwebs.asm.Type Type}). */ public String desc; /** * Number of dimensions of the array to allocate. */ public int dims; /** * Constructs a new {@link MultiANewArrayInsnNode MultiANewArrayInsnNode} * object. * * @param desc an array type descriptor (see {@link org.logicalcobwebs.asm.Type * Type}). * @param dims number of dimensions of the array to allocate. */ public MultiANewArrayInsnNode (final String desc, final int dims) { super(Constants.MULTIANEWARRAY); this.desc = desc; this.dims = dims; } public void accept (final CodeVisitor cv) { cv.visitMultiANewArrayInsn(desc, dims); } } --- NEW FILE: TableSwitchInsnNode.java --- /*** * ASM: a very small and fast Java bytecode manipulation framework * Copyright (c) 2000,2002,2003 INRIA, France Telecom * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. Neither the name of the copyright holders nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ... [truncated message content] |