http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/1c71aec7/plastic/src/external/java/org/apache/tapestry5/internal/plastic/asm/tree/FrameNode.java ---------------------------------------------------------------------- diff --git a/plastic/src/external/java/org/apache/tapestry5/internal/plastic/asm/tree/FrameNode.java b/plastic/src/external/java/org/apache/tapestry5/internal/plastic/asm/tree/FrameNode.java old mode 100644 new mode 100755 index 8600566..a71d05d --- a/plastic/src/external/java/org/apache/tapestry5/internal/plastic/asm/tree/FrameNode.java +++ b/plastic/src/external/java/org/apache/tapestry5/internal/plastic/asm/tree/FrameNode.java @@ -1,210 +1,188 @@ -/*** - * ASM: a very small and fast Java bytecode manipulation framework - * Copyright (c) 2000-2011 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. - */ +// ASM: a very small and fast Java bytecode manipulation framework +// Copyright (c) 2000-2011 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. package org.apache.tapestry5.internal.plastic.asm.tree; import java.util.ArrayList; -import java.util.Arrays; import java.util.List; import java.util.Map; - import org.apache.tapestry5.internal.plastic.asm.MethodVisitor; import org.apache.tapestry5.internal.plastic.asm.Opcodes; /** - * A node that represents a stack map frame. These nodes are pseudo instruction - * nodes in order to be inserted in an instruction list. In fact these nodes - * must(*) be inserted <i>just before</i> any instruction node <b>i</b> that - * follows an unconditionnal branch instruction such as GOTO or THROW, that is - * the target of a jump instruction, or that starts an exception handler block. - * The stack map frame types must describe the values of the local variables and - * of the operand stack elements <i>just before</i> <b>i</b> is executed. <br> + * A node that represents a stack map frame. These nodes are pseudo instruction nodes in order to be + * inserted in an instruction list. In fact these nodes must(*) be inserted <i>just before</i> any + * instruction node <b>i</b> that follows an unconditionnal branch instruction such as GOTO or + * THROW, that is the target of a jump instruction, or that starts an exception handler block. The + * stack map frame types must describe the values of the local variables and of the operand stack + * elements <i>just before</i> <b>i</b> is executed. <br> * <br> - * (*) this is mandatory only for classes whose version is greater than or equal - * to {@link Opcodes#V1_6 V1_6}. - * + * (*) this is mandatory only for classes whose version is greater than or equal to {@link + * Opcodes#V1_6}. + * * @author Eric Bruneton */ public class FrameNode extends AbstractInsnNode { - /** - * The type of this frame. Must be {@link Opcodes#F_NEW} for expanded - * frames, or {@link Opcodes#F_FULL}, {@link Opcodes#F_APPEND}, - * {@link Opcodes#F_CHOP}, {@link Opcodes#F_SAME} or - * {@link Opcodes#F_APPEND}, {@link Opcodes#F_SAME1} for compressed frames. - */ - public int type; + /** + * The type of this frame. Must be {@link Opcodes#F_NEW} for expanded frames, or {@link + * Opcodes#F_FULL}, {@link Opcodes#F_APPEND}, {@link Opcodes#F_CHOP}, {@link Opcodes#F_SAME} or + * {@link Opcodes#F_APPEND}, {@link Opcodes#F_SAME1} for compressed frames. + */ + public int type; - /** - * The types of the local variables of this stack map frame. Elements of - * this list can be Integer, String or LabelNode objects (for primitive, - * reference and uninitialized types respectively - see - * {@link MethodVisitor}). - */ - public List<Object> local; + /** + * The types of the local variables of this stack map frame. Elements of this list can be Integer, + * String or LabelNode objects (for primitive, reference and uninitialized types respectively - + * see {@link MethodVisitor}). + */ + public List<Object> local; - /** - * The types of the operand stack elements of this stack map frame. Elements - * of this list can be Integer, String or LabelNode objects (for primitive, - * reference and uninitialized types respectively - see - * {@link MethodVisitor}). - */ - public List<Object> stack; + /** + * The types of the operand stack elements of this stack map frame. Elements of this list can be + * Integer, String or LabelNode objects (for primitive, reference and uninitialized types + * respectively - see {@link MethodVisitor}). + */ + public List<Object> stack; - private FrameNode() { - super(-1); - } + private FrameNode() { + super(-1); + } - /** - * Constructs a new {@link FrameNode}. - * - * @param type - * the type of this frame. Must be {@link Opcodes#F_NEW} for - * expanded frames, or {@link Opcodes#F_FULL}, - * {@link Opcodes#F_APPEND}, {@link Opcodes#F_CHOP}, - * {@link Opcodes#F_SAME} or {@link Opcodes#F_APPEND}, - * {@link Opcodes#F_SAME1} for compressed frames. - * @param nLocal - * number of local variables of this stack map frame. - * @param local - * the types of the local variables of this stack map frame. - * Elements of this list can be Integer, String or LabelNode - * objects (for primitive, reference and uninitialized types - * respectively - see {@link MethodVisitor}). - * @param nStack - * number of operand stack elements of this stack map frame. - * @param stack - * the types of the operand stack elements of this stack map - * frame. Elements of this list can be Integer, String or - * LabelNode objects (for primitive, reference and uninitialized - * types respectively - see {@link MethodVisitor}). - */ - public FrameNode(final int type, final int nLocal, final Object[] local, - final int nStack, final Object[] stack) { - super(-1); - this.type = type; - switch (type) { - case Opcodes.F_NEW: - case Opcodes.F_FULL: - this.local = asList(nLocal, local); - this.stack = asList(nStack, stack); - break; - case Opcodes.F_APPEND: - this.local = asList(nLocal, local); - break; - case Opcodes.F_CHOP: - this.local = Arrays.asList(new Object[nLocal]); - break; - case Opcodes.F_SAME: - break; - case Opcodes.F_SAME1: - this.stack = asList(1, stack); - break; - } + /** + * Constructs a new {@link FrameNode}. + * + * @param type the type of this frame. Must be {@link Opcodes#F_NEW} for expanded frames, or + * {@link Opcodes#F_FULL}, {@link Opcodes#F_APPEND}, {@link Opcodes#F_CHOP}, {@link + * Opcodes#F_SAME} or {@link Opcodes#F_APPEND}, {@link Opcodes#F_SAME1} for compressed frames. + * @param numLocal number of local variables of this stack map frame. + * @param local the types of the local variables of this stack map frame. Elements of this list + * can be Integer, String or LabelNode objects (for primitive, reference and uninitialized + * types respectively - see {@link MethodVisitor}). + * @param numStack number of operand stack elements of this stack map frame. + * @param stack the types of the operand stack elements of this stack map frame. Elements of this + * list can be Integer, String or LabelNode objects (for primitive, reference and + * uninitialized types respectively - see {@link MethodVisitor}). + */ + public FrameNode( + final int type, + final int numLocal, + final Object[] local, + final int numStack, + final Object[] stack) { + super(-1); + this.type = type; + switch (type) { + case Opcodes.F_NEW: + case Opcodes.F_FULL: + this.local = Util.asArrayList(numLocal, local); + this.stack = Util.asArrayList(numStack, stack); + break; + case Opcodes.F_APPEND: + this.local = Util.asArrayList(numLocal, local); + break; + case Opcodes.F_CHOP: + this.local = Util.asArrayList(numLocal); + break; + case Opcodes.F_SAME: + break; + case Opcodes.F_SAME1: + this.stack = Util.asArrayList(1, stack); + break; + default: + throw new IllegalArgumentException(); } + } - @Override - public int getType() { - return FRAME; - } + @Override + public int getType() { + return FRAME; + } - /** - * Makes the given visitor visit this stack map frame. - * - * @param mv - * a method visitor. - */ - @Override - public void accept(final MethodVisitor mv) { - switch (type) { - case Opcodes.F_NEW: - case Opcodes.F_FULL: - mv.visitFrame(type, local.size(), asArray(local), stack.size(), - asArray(stack)); - break; - case Opcodes.F_APPEND: - mv.visitFrame(type, local.size(), asArray(local), 0, null); - break; - case Opcodes.F_CHOP: - mv.visitFrame(type, local.size(), null, 0, null); - break; - case Opcodes.F_SAME: - mv.visitFrame(type, 0, null, 0, null); - break; - case Opcodes.F_SAME1: - mv.visitFrame(type, 0, null, 1, asArray(stack)); - break; - } + @Override + public void accept(final MethodVisitor methodVisitor) { + switch (type) { + case Opcodes.F_NEW: + case Opcodes.F_FULL: + methodVisitor.visitFrame(type, local.size(), asArray(local), stack.size(), asArray(stack)); + break; + case Opcodes.F_APPEND: + methodVisitor.visitFrame(type, local.size(), asArray(local), 0, null); + break; + case Opcodes.F_CHOP: + methodVisitor.visitFrame(type, local.size(), null, 0, null); + break; + case Opcodes.F_SAME: + methodVisitor.visitFrame(type, 0, null, 0, null); + break; + case Opcodes.F_SAME1: + methodVisitor.visitFrame(type, 0, null, 1, asArray(stack)); + break; + default: + throw new IllegalArgumentException(); } + } - @Override - public AbstractInsnNode clone(final Map<LabelNode, LabelNode> labels) { - FrameNode clone = new FrameNode(); - clone.type = type; - if (local != null) { - clone.local = new ArrayList<Object>(); - for (int i = 0; i < local.size(); ++i) { - Object l = local.get(i); - if (l instanceof LabelNode) { - l = labels.get(l); - } - clone.local.add(l); - } + @Override + public AbstractInsnNode clone(final Map<LabelNode, LabelNode> clonedLabels) { + FrameNode clone = new FrameNode(); + clone.type = type; + if (local != null) { + clone.local = new ArrayList<Object>(); + for (int i = 0, n = local.size(); i < n; ++i) { + Object localElement = local.get(i); + if (localElement instanceof LabelNode) { + localElement = clonedLabels.get(localElement); } - if (stack != null) { - clone.stack = new ArrayList<Object>(); - for (int i = 0; i < stack.size(); ++i) { - Object s = stack.get(i); - if (s instanceof LabelNode) { - s = labels.get(s); - } - clone.stack.add(s); - } - } - return clone; + clone.local.add(localElement); + } } - - // ------------------------------------------------------------------------ - - private static List<Object> asList(final int n, final Object[] o) { - return Arrays.asList(o).subList(0, n); + if (stack != null) { + clone.stack = new ArrayList<Object>(); + for (int i = 0, n = stack.size(); i < n; ++i) { + Object stackElement = stack.get(i); + if (stackElement instanceof LabelNode) { + stackElement = clonedLabels.get(stackElement); + } + clone.stack.add(stackElement); + } } + return clone; + } - private static Object[] asArray(final List<Object> l) { - Object[] objs = new Object[l.size()]; - for (int i = 0; i < objs.length; ++i) { - Object o = l.get(i); - if (o instanceof LabelNode) { - o = ((LabelNode) o).getLabel(); - } - objs[i] = o; - } - return objs; + private static Object[] asArray(final List<Object> list) { + Object[] array = new Object[list.size()]; + for (int i = 0, n = array.length; i < n; ++i) { + Object o = list.get(i); + if (o instanceof LabelNode) { + o = ((LabelNode) o).getLabel(); + } + array[i] = o; } + return array; + } }
http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/1c71aec7/plastic/src/external/java/org/apache/tapestry5/internal/plastic/asm/tree/IincInsnNode.java ---------------------------------------------------------------------- diff --git a/plastic/src/external/java/org/apache/tapestry5/internal/plastic/asm/tree/IincInsnNode.java b/plastic/src/external/java/org/apache/tapestry5/internal/plastic/asm/tree/IincInsnNode.java old mode 100644 new mode 100755 index 729dd3e..2b53001 --- a/plastic/src/external/java/org/apache/tapestry5/internal/plastic/asm/tree/IincInsnNode.java +++ b/plastic/src/external/java/org/apache/tapestry5/internal/plastic/asm/tree/IincInsnNode.java @@ -1,83 +1,74 @@ -/*** - * ASM: a very small and fast Java bytecode manipulation framework - * Copyright (c) 2000-2011 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. - */ +// ASM: a very small and fast Java bytecode manipulation framework +// Copyright (c) 2000-2011 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. package org.apache.tapestry5.internal.plastic.asm.tree; import java.util.Map; - import org.apache.tapestry5.internal.plastic.asm.MethodVisitor; import org.apache.tapestry5.internal.plastic.asm.Opcodes; /** * A node that represents an IINC instruction. - * + * * @author Eric Bruneton */ public class IincInsnNode extends AbstractInsnNode { - /** - * Index of the local variable to be incremented. - */ - public int var; + /** Index of the local variable to be incremented. */ + public int var; - /** - * Amount to increment the local variable by. - */ - public int incr; + /** Amount to increment the local variable by. */ + public int incr; - /** - * Constructs a new {@link IincInsnNode}. - * - * @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(Opcodes.IINC); - this.var = var; - this.incr = incr; - } + /** + * Constructs a new {@link IincInsnNode}. + * + * @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(Opcodes.IINC); + this.var = var; + this.incr = incr; + } - @Override - public int getType() { - return IINC_INSN; - } + @Override + public int getType() { + return IINC_INSN; + } - @Override - public void accept(final MethodVisitor mv) { - mv.visitIincInsn(var, incr); - acceptAnnotations(mv); - } + @Override + public void accept(final MethodVisitor methodVisitor) { + methodVisitor.visitIincInsn(var, incr); + acceptAnnotations(methodVisitor); + } - @Override - public AbstractInsnNode clone(final Map<LabelNode, LabelNode> labels) { - return new IincInsnNode(var, incr).cloneAnnotations(this); - } -} \ No newline at end of file + @Override + public AbstractInsnNode clone(final Map<LabelNode, LabelNode> clonedLabels) { + return new IincInsnNode(var, incr).cloneAnnotations(this); + } +} http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/1c71aec7/plastic/src/external/java/org/apache/tapestry5/internal/plastic/asm/tree/InnerClassNode.java ---------------------------------------------------------------------- diff --git a/plastic/src/external/java/org/apache/tapestry5/internal/plastic/asm/tree/InnerClassNode.java b/plastic/src/external/java/org/apache/tapestry5/internal/plastic/asm/tree/InnerClassNode.java old mode 100644 new mode 100755 index e3eb5db..6ec3a3c --- a/plastic/src/external/java/org/apache/tapestry5/internal/plastic/asm/tree/InnerClassNode.java +++ b/plastic/src/external/java/org/apache/tapestry5/internal/plastic/asm/tree/InnerClassNode.java @@ -1,101 +1,85 @@ -/*** - * ASM: a very small and fast Java bytecode manipulation framework - * Copyright (c) 2000-2011 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. - */ +// ASM: a very small and fast Java bytecode manipulation framework +// Copyright (c) 2000-2011 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. package org.apache.tapestry5.internal.plastic.asm.tree; import org.apache.tapestry5.internal.plastic.asm.ClassVisitor; /** * A node that represents an inner class. - * + * * @author Eric Bruneton */ public class InnerClassNode { - /** - * The internal name of an inner class (see - * {@link org.objectweb.asm.Type#getInternalName() getInternalName}). - */ - public String name; + /** The internal name of an inner class (see {@link org.apache.tapestry5.internal.plastic.asm.Type#getInternalName()}). */ + public String name; - /** - * The internal name of the class to which the inner class belongs (see - * {@link org.objectweb.asm.Type#getInternalName() getInternalName}). May be - * <tt>null</tt>. - */ - public String outerName; + /** + * The internal name of the class to which the inner class belongs (see {@link + * org.apache.tapestry5.internal.plastic.asm.Type#getInternalName()}). May be {@literal null}. + */ + 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 (simple) name of the inner class inside its enclosing class. May be {@literal null} for + * anonymous inner classes. + */ + public String innerName; - /** - * The access flags of the inner class as originally declared in the - * enclosing class. - */ - public int access; + /** The access flags of the inner class as originally declared in the enclosing class. */ + public int access; - /** - * Constructs a new {@link InnerClassNode}. - * - * @param name - * the internal name of an inner class (see - * {@link org.objectweb.asm.Type#getInternalName() - * getInternalName}). - * @param outerName - * the internal name of the class to which the inner class - * belongs (see {@link org.objectweb.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; - } + /** + * Constructs a new {@link InnerClassNode}. + * + * @param name the internal name of an inner class (see {@link + * org.apache.tapestry5.internal.plastic.asm.Type#getInternalName()}). + * @param outerName the internal name of the class to which the inner class belongs (see {@link + * org.apache.tapestry5.internal.plastic.asm.Type#getInternalName()}). May be {@literal null}. + * @param innerName the (simple) name of the inner class inside its enclosing class. May be + * {@literal null} 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); - } + /** + * Makes the given class visitor visit this inner class. + * + * @param classVisitor a class visitor. + */ + public void accept(final ClassVisitor classVisitor) { + classVisitor.visitInnerClass(name, outerName, innerName, access); + } } http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/1c71aec7/plastic/src/external/java/org/apache/tapestry5/internal/plastic/asm/tree/InsnList.java ---------------------------------------------------------------------- diff --git a/plastic/src/external/java/org/apache/tapestry5/internal/plastic/asm/tree/InsnList.java b/plastic/src/external/java/org/apache/tapestry5/internal/plastic/asm/tree/InsnList.java old mode 100644 new mode 100755 index f7e4925..23d4c9f --- a/plastic/src/external/java/org/apache/tapestry5/internal/plastic/asm/tree/InsnList.java +++ b/plastic/src/external/java/org/apache/tapestry5/internal/plastic/asm/tree/InsnList.java @@ -1,632 +1,594 @@ -/*** - * ASM: a very small and fast Java bytecode manipulation framework - * Copyright (c) 2000-2011 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. - */ +// ASM: a very small and fast Java bytecode manipulation framework +// Copyright (c) 2000-2011 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. package org.apache.tapestry5.internal.plastic.asm.tree; +import org.apache.tapestry5.internal.plastic.asm.MethodVisitor; + import java.util.ListIterator; import java.util.NoSuchElementException; -import org.apache.tapestry5.internal.plastic.asm.MethodVisitor; - /** - * A doubly linked list of {@link AbstractInsnNode} objects. <i>This - * implementation is not thread safe</i>. + * A doubly linked list of {@link AbstractInsnNode} objects. <i>This implementation is not thread + * safe</i>. */ public class InsnList { - /** - * The number of instructions in this list. - */ - private int size; - - /** - * The first instruction in this list. May be <tt>null</tt>. - */ - private AbstractInsnNode first; - - /** - * The last instruction in this list. May be <tt>null</tt>. - */ - private AbstractInsnNode last; - - /** - * A cache of the instructions of this list. This cache is used to improve - * the performance of the {@link #get} method. - */ - AbstractInsnNode[] cache; - - /** - * Returns the number of instructions in this list. - * - * @return the number of instructions in this list. - */ - public int size() { - return size; - } - - /** - * Returns the first instruction in this list. - * - * @return the first instruction in this list, or <tt>null</tt> if the list - * is empty. - */ - public AbstractInsnNode getFirst() { - return first; - } - - /** - * Returns the last instruction in this list. - * - * @return the last instruction in this list, or <tt>null</tt> if the list - * is empty. - */ - public AbstractInsnNode getLast() { - return last; - } - - /** - * Returns the instruction whose index is given. This method builds a cache - * of the instructions in this list to avoid scanning the whole list each - * time it is called. Once the cache is built, this method run in constant - * time. This cache is invalidated by all the methods that modify the list. - * - * @param index - * the index of the instruction that must be returned. - * @return the instruction whose index is given. - * @throws IndexOutOfBoundsException - * if (index < 0 || index >= size()). - */ - public AbstractInsnNode get(final int index) { - if (index < 0 || index >= size) { - throw new IndexOutOfBoundsException(); - } - if (cache == null) { - cache = toArray(); - } - return cache[index]; - } - - /** - * Returns <tt>true</tt> if the given instruction belongs to this list. This - * method always scans the instructions of this list until it finds the - * given instruction or reaches the end of the list. - * - * @param insn - * an instruction. - * @return <tt>true</tt> if the given instruction belongs to this list. - */ - public boolean contains(final AbstractInsnNode insn) { - AbstractInsnNode i = first; - while (i != null && i != insn) { - i = i.next; - } - return i != null; - } - - /** - * Returns the index of the given instruction in this list. This method - * builds a cache of the instruction indexes to avoid scanning the whole - * list each time it is called. Once the cache is built, this method run in - * constant time. The cache is invalidated by all the methods that modify - * the list. - * - * @param insn - * an instruction <i>of this list</i>. - * @return the index of the given instruction in this list. <i>The result of - * this method is undefined if the given instruction does not belong - * to this list</i>. Use {@link #contains contains} to test if an - * instruction belongs to an instruction list or not. - */ - public int indexOf(final AbstractInsnNode insn) { - if (cache == null) { - cache = toArray(); - } - return insn.index; - } - - /** - * Makes the given visitor visit all of the instructions in this list. - * - * @param mv - * the method visitor that must visit the instructions. - */ - public void accept(final MethodVisitor mv) { - AbstractInsnNode insn = first; - while (insn != null) { - insn.accept(mv); - insn = insn.next; - } + /** The number of instructions in this list. */ + private int size; + + /** The first instruction in this list. May be {@literal null}. */ + private AbstractInsnNode firstInsn; + + /** The last instruction in this list. May be {@literal null}. */ + private AbstractInsnNode lastInsn; + + /** + * A cache of the instructions of this list. This cache is used to improve the performance of the + * {@link #get} method. + */ + AbstractInsnNode[] cache; + + /** + * Returns the number of instructions in this list. + * + * @return the number of instructions in this list. + */ + public int size() { + return size; + } + + /** + * Returns the first instruction in this list. + * + * @return the first instruction in this list, or {@literal null} if the list is empty. + */ + public AbstractInsnNode getFirst() { + return firstInsn; + } + + /** + * Returns the last instruction in this list. + * + * @return the last instruction in this list, or {@literal null} if the list is empty. + */ + public AbstractInsnNode getLast() { + return lastInsn; + } + + /** + * Returns the instruction whose index is given. This method builds a cache of the instructions in + * this list to avoid scanning the whole list each time it is called. Once the cache is built, + * this method runs in constant time. This cache is invalidated by all the methods that modify the + * list. + * + * @param index the index of the instruction that must be returned. + * @return the instruction whose index is given. + * @throws IndexOutOfBoundsException if (index < 0 || index >= size()). + */ + public AbstractInsnNode get(final int index) { + if (index < 0 || index >= size) { + throw new IndexOutOfBoundsException(); } - - /** - * Returns an iterator over the instructions in this list. - * - * @return an iterator over the instructions in this list. - */ - public ListIterator<AbstractInsnNode> iterator() { - return iterator(0); - } - - /** - * Returns an iterator over the instructions in this list. - * - * @param index - * index of instruction for the iterator to start at - * - * @return an iterator over the instructions in this list. - */ - @SuppressWarnings("unchecked") - public ListIterator<AbstractInsnNode> iterator(int index) { - return new InsnListIterator(index); - } - - /** - * Returns an array containing all of the instructions in this list. - * - * @return an array containing all of the instructions in this list. - */ - public AbstractInsnNode[] toArray() { - int i = 0; - AbstractInsnNode elem = first; - AbstractInsnNode[] insns = new AbstractInsnNode[size]; - while (elem != null) { - insns[i] = elem; - elem.index = i++; - elem = elem.next; - } - return insns; - } - - /** - * Replaces an instruction of this list with another instruction. - * - * @param location - * an instruction <i>of this list</i>. - * @param insn - * another instruction, <i>which must not belong to any - * {@link InsnList}</i>. - */ - public void set(final AbstractInsnNode location, final AbstractInsnNode insn) { - AbstractInsnNode next = location.next; - insn.next = next; - if (next != null) { - next.prev = insn; - } else { - last = insn; - } - AbstractInsnNode prev = location.prev; - insn.prev = prev; - if (prev != null) { - prev.next = insn; - } else { - first = insn; - } - if (cache != null) { - int index = location.index; - cache[index] = insn; - insn.index = index; - } else { - insn.index = 0; // insn now belongs to an InsnList - } - location.index = -1; // i no longer belongs to an InsnList - location.prev = null; - location.next = null; - } - - /** - * Adds the given instruction to the end of this list. - * - * @param insn - * an instruction, <i>which must not belong to any - * {@link InsnList}</i>. - */ - public void add(final AbstractInsnNode insn) { - ++size; - if (last == null) { - first = insn; - last = insn; - } else { - last.next = insn; - insn.prev = last; - } - last = insn; - cache = null; - insn.index = 0; // insn now belongs to an InsnList - } - - /** - * Adds the given instructions to the end of this list. - * - * @param insns - * an instruction list, which is cleared during the process. This - * list must be different from 'this'. - */ - public void add(final InsnList insns) { - if (insns.size == 0) { - return; - } - size += insns.size; - if (last == null) { - first = insns.first; - last = insns.last; - } else { - AbstractInsnNode elem = insns.first; - last.next = elem; - elem.prev = last; - last = insns.last; - } - cache = null; - insns.removeAll(false); - } - - /** - * Inserts the given instruction at the begining of this list. - * - * @param insn - * an instruction, <i>which must not belong to any - * {@link InsnList}</i>. - */ - public void insert(final AbstractInsnNode insn) { - ++size; - if (first == null) { - first = insn; - last = insn; - } else { - first.prev = insn; - insn.next = first; - } - first = insn; - cache = null; - insn.index = 0; // insn now belongs to an InsnList - } - - /** - * Inserts the given instructions at the begining of this list. - * - * @param insns - * an instruction list, which is cleared during the process. This - * list must be different from 'this'. - */ - public void insert(final InsnList insns) { - if (insns.size == 0) { - return; - } - size += insns.size; - if (first == null) { - first = insns.first; - last = insns.last; - } else { - AbstractInsnNode elem = insns.last; - first.prev = elem; - elem.next = first; - first = insns.first; - } - cache = null; - insns.removeAll(false); - } - - /** - * Inserts the given instruction after the specified instruction. - * - * @param location - * an instruction <i>of this list</i> after which insn must be - * inserted. - * @param insn - * the instruction to be inserted, <i>which must not belong to - * any {@link InsnList}</i>. - */ - public void insert(final AbstractInsnNode location, - final AbstractInsnNode insn) { - ++size; - AbstractInsnNode next = location.next; - if (next == null) { - last = insn; - } else { - next.prev = insn; - } - location.next = insn; - insn.next = next; - insn.prev = location; - cache = null; - insn.index = 0; // insn now belongs to an InsnList - } - - /** - * Inserts the given instructions after the specified instruction. - * - * @param location - * an instruction <i>of this list</i> after which the - * instructions must be inserted. - * @param insns - * the instruction list to be inserted, which is cleared during - * the process. This list must be different from 'this'. - */ - public void insert(final AbstractInsnNode location, final InsnList insns) { - if (insns.size == 0) { - return; - } - size += insns.size; - AbstractInsnNode ifirst = insns.first; - AbstractInsnNode ilast = insns.last; - AbstractInsnNode next = location.next; - if (next == null) { - last = ilast; - } else { - next.prev = ilast; - } - location.next = ifirst; - ilast.next = next; - ifirst.prev = location; - cache = null; - insns.removeAll(false); - } - - /** - * Inserts the given instruction before the specified instruction. - * - * @param location - * an instruction <i>of this list</i> before which insn must be - * inserted. - * @param insn - * the instruction to be inserted, <i>which must not belong to - * any {@link InsnList}</i>. - */ - public void insertBefore(final AbstractInsnNode location, - final AbstractInsnNode insn) { - ++size; - AbstractInsnNode prev = location.prev; - if (prev == null) { - first = insn; - } else { - prev.next = insn; - } - location.prev = insn; - insn.next = location; - insn.prev = prev; - cache = null; - insn.index = 0; // insn now belongs to an InsnList - } - - /** - * Inserts the given instructions before the specified instruction. - * - * @param location - * an instruction <i>of this list</i> before which the - * instructions must be inserted. - * @param insns - * the instruction list to be inserted, which is cleared during - * the process. This list must be different from 'this'. - */ - public void insertBefore(final AbstractInsnNode location, - final InsnList insns) { - if (insns.size == 0) { - return; - } - size += insns.size; - AbstractInsnNode ifirst = insns.first; - AbstractInsnNode ilast = insns.last; - AbstractInsnNode prev = location.prev; - if (prev == null) { - first = ifirst; - } else { - prev.next = ifirst; - } - location.prev = ilast; - ilast.next = location; - ifirst.prev = prev; - cache = null; - insns.removeAll(false); - } - - /** - * Removes the given instruction from this list. - * - * @param insn - * the instruction <i>of this list</i> that must be removed. - */ - public void remove(final AbstractInsnNode insn) { - --size; - AbstractInsnNode next = insn.next; - AbstractInsnNode prev = insn.prev; - if (next == null) { - if (prev == null) { - first = null; - last = null; - } else { - prev.next = null; - last = prev; - } - } else { - if (prev == null) { - first = next; - next.prev = null; - } else { - prev.next = next; - next.prev = prev; - } - } - cache = null; - insn.index = -1; // insn no longer belongs to an InsnList - insn.prev = null; - insn.next = null; - } - - /** - * Removes all of the instructions of this list. - * - * @param mark - * if the instructions must be marked as no longer belonging to - * any {@link InsnList}. - */ - void removeAll(final boolean mark) { - if (mark) { - AbstractInsnNode insn = first; - while (insn != null) { - AbstractInsnNode next = insn.next; - insn.index = -1; // insn no longer belongs to an InsnList - insn.prev = null; - insn.next = null; - insn = next; - } - } - size = 0; - first = null; - last = null; - cache = null; - } - - /** - * Removes all of the instructions of this list. - */ - public void clear() { - removeAll(false); - } - - /** - * Reset all labels in the instruction list. This method should be called - * before reusing same instructions list between several - * <code>ClassWriter</code>s. - */ - public void resetLabels() { - AbstractInsnNode insn = first; - while (insn != null) { - if (insn instanceof LabelNode) { - ((LabelNode) insn).resetLabel(); - } - insn = insn.next; - } + if (cache == null) { + cache = toArray(); } + return cache[index]; + } + + /** + * Returns {@literal true} if the given instruction belongs to this list. This method always scans + * the instructions of this list until it finds the given instruction or reaches the end of the + * list. + * + * @param insnNode an instruction. + * @return {@literal true} if the given instruction belongs to this list. + */ + public boolean contains(final AbstractInsnNode insnNode) { + AbstractInsnNode currentInsn = firstInsn; + while (currentInsn != null && currentInsn != insnNode) { + currentInsn = currentInsn.nextInsn; + } + return currentInsn != null; + } + + /** + * Returns the index of the given instruction in this list. This method builds a cache of the + * instruction indexes to avoid scanning the whole list each time it is called. Once the cache is + * built, this method run in constant time. The cache is invalidated by all the methods that + * modify the list. + * + * @param insnNode an instruction <i>of this list</i>. + * @return the index of the given instruction in this list. <i>The result of this method is + * undefined if the given instruction does not belong to this list</i>. Use {@link #contains } + * to test if an instruction belongs to an instruction list or not. + */ + public int indexOf(final AbstractInsnNode insnNode) { + if (cache == null) { + cache = toArray(); + } + return insnNode.index; + } + + /** + * Makes the given visitor visit all the instructions in this list. + * + * @param methodVisitor the method visitor that must visit the instructions. + */ + public void accept(final MethodVisitor methodVisitor) { + AbstractInsnNode currentInsn = firstInsn; + while (currentInsn != null) { + currentInsn.accept(methodVisitor); + currentInsn = currentInsn.nextInsn; + } + } + + /** + * Returns an iterator over the instructions in this list. + * + * @return an iterator over the instructions in this list. + */ + public ListIterator<AbstractInsnNode> iterator() { + return iterator(0); + } + + /** + * Returns an iterator over the instructions in this list. + * + * @param index index of instruction for the iterator to start at. + * @return an iterator over the instructions in this list. + */ + @SuppressWarnings("unchecked") + public ListIterator<AbstractInsnNode> iterator(final int index) { + return new InsnListIterator(index); + } + + /** + * Returns an array containing all the instructions in this list. + * + * @return an array containing all the instructions in this list. + */ + public AbstractInsnNode[] toArray() { + int currentInsnIndex = 0; + AbstractInsnNode currentInsn = firstInsn; + AbstractInsnNode[] insnNodeArray = new AbstractInsnNode[size]; + while (currentInsn != null) { + insnNodeArray[currentInsnIndex] = currentInsn; + currentInsn.index = currentInsnIndex++; + currentInsn = currentInsn.nextInsn; + } + return insnNodeArray; + } + + /** + * Replaces an instruction of this list with another instruction. + * + * @param oldInsnNode an instruction <i>of this list</i>. + * @param newInsnNode another instruction, <i>which must not belong to any {@link InsnList}</i>. + */ + public void set(final AbstractInsnNode oldInsnNode, final AbstractInsnNode newInsnNode) { + AbstractInsnNode nextInsn = oldInsnNode.nextInsn; + newInsnNode.nextInsn = nextInsn; + if (nextInsn != null) { + nextInsn.previousInsn = newInsnNode; + } else { + lastInsn = newInsnNode; + } + AbstractInsnNode previousInsn = oldInsnNode.previousInsn; + newInsnNode.previousInsn = previousInsn; + if (previousInsn != null) { + previousInsn.nextInsn = newInsnNode; + } else { + firstInsn = newInsnNode; + } + if (cache != null) { + int index = oldInsnNode.index; + cache[index] = newInsnNode; + newInsnNode.index = index; + } else { + newInsnNode.index = 0; // newInnsnNode now belongs to an InsnList. + } + oldInsnNode.index = -1; // oldInsnNode no longer belongs to an InsnList. + oldInsnNode.previousInsn = null; + oldInsnNode.nextInsn = null; + } + + /** + * Adds the given instruction to the end of this list. + * + * @param insnNode an instruction, <i>which must not belong to any {@link InsnList}</i>. + */ + public void add(final AbstractInsnNode insnNode) { + ++size; + if (lastInsn == null) { + firstInsn = insnNode; + lastInsn = insnNode; + } else { + lastInsn.nextInsn = insnNode; + insnNode.previousInsn = lastInsn; + } + lastInsn = insnNode; + cache = null; + insnNode.index = 0; // insnNode now belongs to an InsnList. + } + + /** + * Adds the given instructions to the end of this list. + * + * @param insnList an instruction list, which is cleared during the process. This list must be + * different from 'this'. + */ + public void add(final InsnList insnList) { + if (insnList.size == 0) { + return; + } + size += insnList.size; + if (lastInsn == null) { + firstInsn = insnList.firstInsn; + lastInsn = insnList.lastInsn; + } else { + AbstractInsnNode firstInsnListElement = insnList.firstInsn; + lastInsn.nextInsn = firstInsnListElement; + firstInsnListElement.previousInsn = lastInsn; + lastInsn = insnList.lastInsn; + } + cache = null; + insnList.removeAll(false); + } + + /** + * Inserts the given instruction at the beginning of this list. + * + * @param insnNode an instruction, <i>which must not belong to any {@link InsnList}</i>. + */ + public void insert(final AbstractInsnNode insnNode) { + ++size; + if (firstInsn == null) { + firstInsn = insnNode; + lastInsn = insnNode; + } else { + firstInsn.previousInsn = insnNode; + insnNode.nextInsn = firstInsn; + } + firstInsn = insnNode; + cache = null; + insnNode.index = 0; // insnNode now belongs to an InsnList. + } + + /** + * Inserts the given instructions at the beginning of this list. + * + * @param insnList an instruction list, which is cleared during the process. This list must be + * different from 'this'. + */ + public void insert(final InsnList insnList) { + if (insnList.size == 0) { + return; + } + size += insnList.size; + if (firstInsn == null) { + firstInsn = insnList.firstInsn; + lastInsn = insnList.lastInsn; + } else { + AbstractInsnNode lastInsnListElement = insnList.lastInsn; + firstInsn.previousInsn = lastInsnListElement; + lastInsnListElement.nextInsn = firstInsn; + firstInsn = insnList.firstInsn; + } + cache = null; + insnList.removeAll(false); + } + + /** + * Inserts the given instruction after the specified instruction. + * + * @param previousInsn an instruction <i>of this list</i> after which insnNode must be inserted. + * @param insnNode the instruction to be inserted, <i>which must not belong to any {@link + * InsnList}</i>. + */ + public void insert(final AbstractInsnNode previousInsn, final AbstractInsnNode insnNode) { + ++size; + AbstractInsnNode nextInsn = previousInsn.nextInsn; + if (nextInsn == null) { + lastInsn = insnNode; + } else { + nextInsn.previousInsn = insnNode; + } + previousInsn.nextInsn = insnNode; + insnNode.nextInsn = nextInsn; + insnNode.previousInsn = previousInsn; + cache = null; + insnNode.index = 0; // insnNode now belongs to an InsnList. + } + + /** + * Inserts the given instructions after the specified instruction. + * + * @param previousInsn an instruction <i>of this list</i> after which the instructions must be + * inserted. + * @param insnList the instruction list to be inserted, which is cleared during the process. This + * list must be different from 'this'. + */ + public void insert(final AbstractInsnNode previousInsn, final InsnList insnList) { + if (insnList.size == 0) { + return; + } + size += insnList.size; + AbstractInsnNode firstInsnListElement = insnList.firstInsn; + AbstractInsnNode lastInsnListElement = insnList.lastInsn; + AbstractInsnNode nextInsn = previousInsn.nextInsn; + if (nextInsn == null) { + lastInsn = lastInsnListElement; + } else { + nextInsn.previousInsn = lastInsnListElement; + } + previousInsn.nextInsn = firstInsnListElement; + lastInsnListElement.nextInsn = nextInsn; + firstInsnListElement.previousInsn = previousInsn; + cache = null; + insnList.removeAll(false); + } + + /** + * Inserts the given instruction before the specified instruction. + * + * @param nextInsn an instruction <i>of this list</i> before which insnNode must be inserted. + * @param insnNode the instruction to be inserted, <i>which must not belong to any {@link + * InsnList}</i>. + */ + public void insertBefore(final AbstractInsnNode nextInsn, final AbstractInsnNode insnNode) { + ++size; + AbstractInsnNode previousInsn = nextInsn.previousInsn; + if (previousInsn == null) { + firstInsn = insnNode; + } else { + previousInsn.nextInsn = insnNode; + } + nextInsn.previousInsn = insnNode; + insnNode.nextInsn = nextInsn; + insnNode.previousInsn = previousInsn; + cache = null; + insnNode.index = 0; // insnNode now belongs to an InsnList. + } + + /** + * Inserts the given instructions before the specified instruction. + * + * @param nextInsn an instruction <i>of this list</i> before which the instructions must be + * inserted. + * @param insnList the instruction list to be inserted, which is cleared during the process. This + * list must be different from 'this'. + */ + public void insertBefore(final AbstractInsnNode nextInsn, final InsnList insnList) { + if (insnList.size == 0) { + return; + } + size += insnList.size; + AbstractInsnNode firstInsnListElement = insnList.firstInsn; + AbstractInsnNode lastInsnListElement = insnList.lastInsn; + AbstractInsnNode previousInsn = nextInsn.previousInsn; + if (previousInsn == null) { + firstInsn = firstInsnListElement; + } else { + previousInsn.nextInsn = firstInsnListElement; + } + nextInsn.previousInsn = lastInsnListElement; + lastInsnListElement.nextInsn = nextInsn; + firstInsnListElement.previousInsn = previousInsn; + cache = null; + insnList.removeAll(false); + } + + /** + * Removes the given instruction from this list. + * + * @param insnNode the instruction <i>of this list</i> that must be removed. + */ + public void remove(final AbstractInsnNode insnNode) { + --size; + AbstractInsnNode nextInsn = insnNode.nextInsn; + AbstractInsnNode previousInsn = insnNode.previousInsn; + if (nextInsn == null) { + if (previousInsn == null) { + firstInsn = null; + lastInsn = null; + } else { + previousInsn.nextInsn = null; + lastInsn = previousInsn; + } + } else { + if (previousInsn == null) { + firstInsn = nextInsn; + nextInsn.previousInsn = null; + } else { + previousInsn.nextInsn = nextInsn; + nextInsn.previousInsn = previousInsn; + } + } + cache = null; + insnNode.index = -1; // insnNode no longer belongs to an InsnList. + insnNode.previousInsn = null; + insnNode.nextInsn = null; + } + + /** + * Removes all the instructions of this list. + * + * @param mark if the instructions must be marked as no longer belonging to any {@link InsnList}. + */ + void removeAll(final boolean mark) { + if (mark) { + AbstractInsnNode currentInsn = firstInsn; + while (currentInsn != null) { + AbstractInsnNode next = currentInsn.nextInsn; + currentInsn.index = -1; // currentInsn no longer belongs to an InsnList. + currentInsn.previousInsn = null; + currentInsn.nextInsn = null; + currentInsn = next; + } + } + size = 0; + firstInsn = null; + lastInsn = null; + cache = null; + } + + /** Removes all the instructions of this list. */ + public void clear() { + removeAll(false); + } + + /** + * Resets all the labels in the instruction list. This method should be called before reusing an + * instruction list between several <code>ClassWriter</code>s. + */ + public void resetLabels() { + AbstractInsnNode currentInsn = firstInsn; + while (currentInsn != null) { + if (currentInsn instanceof LabelNode) { + ((LabelNode) currentInsn).resetLabel(); + } + currentInsn = currentInsn.nextInsn; + } + } - // this class is not generified because it will create bridges - @SuppressWarnings("rawtypes") - private final class InsnListIterator implements ListIterator { + // Note: this class is not generified because it would create bridges. + @SuppressWarnings("rawtypes") + private final class InsnListIterator implements ListIterator { - AbstractInsnNode next; + AbstractInsnNode nextInsn; - AbstractInsnNode prev; + AbstractInsnNode previousInsn; - AbstractInsnNode remove; + AbstractInsnNode remove; - InsnListIterator(int index) { - if (index == size()) { - next = null; - prev = getLast(); - } else { - next = get(index); - prev = next.prev; - } - } + InsnListIterator(final int index) { + if (index == size()) { + nextInsn = null; + previousInsn = getLast(); + } else { + nextInsn = get(index); + previousInsn = nextInsn.previousInsn; + } + } - public boolean hasNext() { - return next != null; - } + @Override + public boolean hasNext() { + return nextInsn != null; + } - public Object next() { - if (next == null) { - throw new NoSuchElementException(); - } - AbstractInsnNode result = next; - prev = result; - next = result.next; - remove = result; - return result; - } + @Override + public Object next() { + if (nextInsn == null) { + throw new NoSuchElementException(); + } + AbstractInsnNode result = nextInsn; + previousInsn = result; + nextInsn = result.nextInsn; + remove = result; + return result; + } - public void remove() { - if (remove != null) { - if (remove == next) { - next = next.next; - } else { - prev = prev.prev; - } - InsnList.this.remove(remove); - remove = null; - } else { - throw new IllegalStateException(); - } + @Override + public void remove() { + if (remove != null) { + if (remove == nextInsn) { + nextInsn = nextInsn.nextInsn; + } else { + previousInsn = previousInsn.previousInsn; } + InsnList.this.remove(remove); + remove = null; + } else { + throw new IllegalStateException(); + } + } - public boolean hasPrevious() { - return prev != null; - } + @Override + public boolean hasPrevious() { + return previousInsn != null; + } - public Object previous() { - AbstractInsnNode result = prev; - next = result; - prev = result.prev; - remove = result; - return result; - } + @Override + public Object previous() { + AbstractInsnNode result = previousInsn; + nextInsn = result; + previousInsn = result.previousInsn; + remove = result; + return result; + } - public int nextIndex() { - if (next == null) { - return size(); - } - if (cache == null) { - cache = toArray(); - } - return next.index; - } + @Override + public int nextIndex() { + if (nextInsn == null) { + return size(); + } + if (cache == null) { + cache = toArray(); + } + return nextInsn.index; + } - public int previousIndex() { - if (prev == null) { - return -1; - } - if (cache == null) { - cache = toArray(); - } - return prev.index; - } + @Override + public int previousIndex() { + if (previousInsn == null) { + return -1; + } + if (cache == null) { + cache = toArray(); + } + return previousInsn.index; + } - public void add(Object o) { - if (next != null) { - InsnList.this.insertBefore(next, (AbstractInsnNode) o); - } else if (prev != null) { - InsnList.this.insert(prev, (AbstractInsnNode) o); - } else { - InsnList.this.add((AbstractInsnNode) o); - } - prev = (AbstractInsnNode) o; - remove = null; - } + @Override + public void add(final Object o) { + if (nextInsn != null) { + InsnList.this.insertBefore(nextInsn, (AbstractInsnNode) o); + } else if (previousInsn != null) { + InsnList.this.insert(previousInsn, (AbstractInsnNode) o); + } else { + InsnList.this.add((AbstractInsnNode) o); + } + previousInsn = (AbstractInsnNode) o; + remove = null; + } - public void set(Object o) { - if (remove != null) { - InsnList.this.set(remove, (AbstractInsnNode) o); - if (remove == prev) { - prev = (AbstractInsnNode) o; - } else { - next = (AbstractInsnNode) o; - } - } else { - throw new IllegalStateException(); - } + @Override + public void set(final Object o) { + if (remove != null) { + InsnList.this.set(remove, (AbstractInsnNode) o); + if (remove == previousInsn) { + previousInsn = (AbstractInsnNode) o; + } else { + nextInsn = (AbstractInsnNode) o; } + } else { + throw new IllegalStateException(); + } } + } } http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/1c71aec7/plastic/src/external/java/org/apache/tapestry5/internal/plastic/asm/tree/InsnNode.java ---------------------------------------------------------------------- diff --git a/plastic/src/external/java/org/apache/tapestry5/internal/plastic/asm/tree/InsnNode.java b/plastic/src/external/java/org/apache/tapestry5/internal/plastic/asm/tree/InsnNode.java old mode 100644 new mode 100755 index 7eb2359..2e0ea1b --- a/plastic/src/external/java/org/apache/tapestry5/internal/plastic/asm/tree/InsnNode.java +++ b/plastic/src/external/java/org/apache/tapestry5/internal/plastic/asm/tree/InsnNode.java @@ -1,88 +1,73 @@ -/*** - * ASM: a very small and fast Java bytecode manipulation framework - * Copyright (c) 2000-2011 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. - */ +// ASM: a very small and fast Java bytecode manipulation framework +// Copyright (c) 2000-2011 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. package org.apache.tapestry5.internal.plastic.asm.tree; import java.util.Map; - import org.apache.tapestry5.internal.plastic.asm.MethodVisitor; /** * A node that represents a zero operand instruction. - * + * * @author Eric Bruneton */ public class InsnNode extends AbstractInsnNode { - /** - * Constructs a new {@link InsnNode}. - * - * @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); - } + /** + * Constructs a new {@link InsnNode}. + * + * @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); + } - @Override - public int getType() { - return INSN; - } + @Override + public int getType() { + return INSN; + } - /** - * Makes the given visitor visit this instruction. - * - * @param mv - * a method visitor. - */ - @Override - public void accept(final MethodVisitor mv) { - mv.visitInsn(opcode); - acceptAnnotations(mv); - } + @Override + public void accept(final MethodVisitor methodVisitor) { + methodVisitor.visitInsn(opcode); + acceptAnnotations(methodVisitor); + } - @Override - public AbstractInsnNode clone(final Map<LabelNode, LabelNode> labels) { - return new InsnNode(opcode).cloneAnnotations(this); - } + @Override + public AbstractInsnNode clone(final Map<LabelNode, LabelNode> clonedLabels) { + return new InsnNode(opcode).cloneAnnotations(this); + } } http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/1c71aec7/plastic/src/external/java/org/apache/tapestry5/internal/plastic/asm/tree/IntInsnNode.java ---------------------------------------------------------------------- diff --git a/plastic/src/external/java/org/apache/tapestry5/internal/plastic/asm/tree/IntInsnNode.java b/plastic/src/external/java/org/apache/tapestry5/internal/plastic/asm/tree/IntInsnNode.java old mode 100644 new mode 100755 index 5b0c351..e0b091c --- a/plastic/src/external/java/org/apache/tapestry5/internal/plastic/asm/tree/IntInsnNode.java +++ b/plastic/src/external/java/org/apache/tapestry5/internal/plastic/asm/tree/IntInsnNode.java @@ -1,88 +1,79 @@ -/*** - * ASM: a very small and fast Java bytecode manipulation framework - * Copyright (c) 2000-2011 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. - */ +// ASM: a very small and fast Java bytecode manipulation framework +// Copyright (c) 2000-2011 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. package org.apache.tapestry5.internal.plastic.asm.tree; import java.util.Map; - import org.apache.tapestry5.internal.plastic.asm.MethodVisitor; /** * A node that represents an instruction with a single int operand. - * + * * @author Eric Bruneton */ public class IntInsnNode extends AbstractInsnNode { - /** - * The operand of this instruction. - */ - public int operand; + /** The operand of this instruction. */ + public int operand; - /** - * Constructs a new {@link IntInsnNode}. - * - * @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; - } + /** + * Constructs a new {@link IntInsnNode}. + * + * @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; - } + /** + * 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; + } - @Override - public int getType() { - return INT_INSN; - } + @Override + public int getType() { + return INT_INSN; + } - @Override - public void accept(final MethodVisitor mv) { - mv.visitIntInsn(opcode, operand); - acceptAnnotations(mv); - } + @Override + public void accept(final MethodVisitor methodVisitor) { + methodVisitor.visitIntInsn(opcode, operand); + acceptAnnotations(methodVisitor); + } - @Override - public AbstractInsnNode clone(final Map<LabelNode, LabelNode> labels) { - return new IntInsnNode(opcode, operand).cloneAnnotations(this); - } + @Override + public AbstractInsnNode clone(final Map<LabelNode, LabelNode> clonedLabels) { + return new IntInsnNode(opcode, operand).cloneAnnotations(this); + } }