You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tapestry.apache.org by hl...@apache.org on 2011/04/06 21:11:38 UTC

svn commit: r1089584 [14/21] - in /tapestry/tapestry5/trunk/plastic: ./ src/external/ src/external/java/ src/external/java/org/ src/external/java/org/objectweb/ src/external/java/org/objectweb/asm/ src/external/java/org/objectweb/asm/attrs/ src/externa...

Added: tapestry/tapestry5/trunk/plastic/src/external/java/org/objectweb/asm/tree/LocalVariableNode.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/plastic/src/external/java/org/objectweb/asm/tree/LocalVariableNode.java?rev=1089584&view=auto
==============================================================================
--- tapestry/tapestry5/trunk/plastic/src/external/java/org/objectweb/asm/tree/LocalVariableNode.java (added)
+++ tapestry/tapestry5/trunk/plastic/src/external/java/org/objectweb/asm/tree/LocalVariableNode.java Wed Apr  6 19:11:34 2011
@@ -0,0 +1,115 @@
+/***
+ * ASM: a very small and fast Java bytecode manipulation framework
+ * Copyright (c) 2000-2007 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.objectweb.asm.tree;
+
+import org.objectweb.asm.MethodVisitor;
+
+/**
+ * A node that represents a local variable declaration.
+ * 
+ * @author Eric Bruneton
+ */
+public class LocalVariableNode {
+
+    /**
+     * The name of a local variable.
+     */
+    public String name;
+
+    /**
+     * The type descriptor of this local variable.
+     */
+    public String desc;
+
+    /**
+     * The signature of this local variable. May be <tt>null</tt>.
+     */
+    public String signature;
+
+    /**
+     * The first instruction corresponding to the scope of this local variable
+     * (inclusive).
+     */
+    public LabelNode start;
+
+    /**
+     * The last instruction corresponding to the scope of this local variable
+     * (exclusive).
+     */
+    public LabelNode end;
+
+    /**
+     * The local variable's index.
+     */
+    public int index;
+
+    /**
+     * Constructs a new {@link LocalVariableNode}.
+     * 
+     * @param name the name of a local variable.
+     * @param desc the type descriptor of this local variable.
+     * @param signature the signature of this local variable. May be
+     *        <tt>null</tt>.
+     * @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 String signature,
+        final LabelNode start,
+        final LabelNode end,
+        final int index)
+    {
+        this.name = name;
+        this.desc = desc;
+        this.signature = signature;
+        this.start = start;
+        this.end = end;
+        this.index = index;
+    }
+
+    /**
+     * Makes the given visitor visit this local variable declaration.
+     * 
+     * @param mv a method visitor.
+     */
+    public void accept(final MethodVisitor mv) {
+        mv.visitLocalVariable(name,
+                desc,
+                signature,
+                start.getLabel(),
+                end.getLabel(),
+                index);
+    }
+}

Added: tapestry/tapestry5/trunk/plastic/src/external/java/org/objectweb/asm/tree/LookupSwitchInsnNode.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/plastic/src/external/java/org/objectweb/asm/tree/LookupSwitchInsnNode.java?rev=1089584&view=auto
==============================================================================
--- tapestry/tapestry5/trunk/plastic/src/external/java/org/objectweb/asm/tree/LookupSwitchInsnNode.java (added)
+++ tapestry/tapestry5/trunk/plastic/src/external/java/org/objectweb/asm/tree/LookupSwitchInsnNode.java Wed Apr  6 19:11:34 2011
@@ -0,0 +1,113 @@
+/***
+ * ASM: a very small and fast Java bytecode manipulation framework
+ * Copyright (c) 2000-2007 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.objectweb.asm.tree;
+
+import org.objectweb.asm.Label;
+import org.objectweb.asm.Opcodes;
+import org.objectweb.asm.MethodVisitor;
+
+import java.util.List;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Map;
+
+/**
+ * A node that represents a LOOKUPSWITCH instruction.
+ * 
+ * @author Eric Bruneton
+ */
+public class LookupSwitchInsnNode extends AbstractInsnNode {
+
+    /**
+     * Beginning of the default handler block.
+     */
+    public LabelNode dflt;
+
+    /**
+     * The values of the keys. This list is a list of {@link Integer} objects.
+     */
+    public List keys;
+
+    /**
+     * Beginnings of the handler blocks. This list is a list of
+     * {@link LabelNode} objects.
+     */
+    public List labels;
+
+    /**
+     * Constructs a new {@link LookupSwitchInsnNode}.
+     * 
+     * @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 LabelNode dflt,
+        final int[] keys,
+        final LabelNode[] labels)
+    {
+        super(Opcodes.LOOKUPSWITCH);
+        this.dflt = dflt;
+        this.keys = new ArrayList(keys == null ? 0 : keys.length);
+        this.labels = new ArrayList(labels == null ? 0 : labels.length);
+        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 int getType() {
+        return LOOKUPSWITCH_INSN;
+    }
+
+    public void accept(final MethodVisitor mv) {
+        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()];
+        for (int i = 0; i < labels.length; ++i) {
+            labels[i] = ((LabelNode) this.labels.get(i)).getLabel();
+        }
+        mv.visitLookupSwitchInsn(dflt.getLabel(), keys, labels);
+    }
+
+    public AbstractInsnNode clone(final Map labels) {
+        LookupSwitchInsnNode clone = new LookupSwitchInsnNode(clone(dflt,
+                labels), null, clone(this.labels, labels));
+        clone.keys.addAll(keys);
+        return clone;
+    }
+}

Added: tapestry/tapestry5/trunk/plastic/src/external/java/org/objectweb/asm/tree/MemberNode.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/plastic/src/external/java/org/objectweb/asm/tree/MemberNode.java?rev=1089584&view=auto
==============================================================================
--- tapestry/tapestry5/trunk/plastic/src/external/java/org/objectweb/asm/tree/MemberNode.java (added)
+++ tapestry/tapestry5/trunk/plastic/src/external/java/org/objectweb/asm/tree/MemberNode.java Wed Apr  6 19:11:34 2011
@@ -0,0 +1,120 @@
+/***
+ * ASM: a very small and fast Java bytecode manipulation framework
+ * Copyright (c) 2000-2007 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.objectweb.asm.tree;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.objectweb.asm.AnnotationVisitor;
+import org.objectweb.asm.Attribute;
+
+/**
+ * An abstract class, field or method node.
+ * 
+ * @author Eric Bruneton
+ */
+public abstract class MemberNode {
+
+    /**
+     * The runtime visible annotations of this class, field or method. This list
+     * is a list of {@link AnnotationNode} objects. May be <tt>null</tt>.
+     * 
+     * @associates org.objectweb.asm.tree.AnnotationNode
+     * @label visible
+     */
+    public List visibleAnnotations;
+
+    /**
+     * The runtime invisible annotations of this class, field or method. This
+     * list is a list of {@link AnnotationNode} objects. May be <tt>null</tt>.
+     * 
+     * @associates org.objectweb.asm.tree.AnnotationNode
+     * @label invisible
+     */
+    public List invisibleAnnotations;
+
+    /**
+     * The non standard attributes of this class, field or method. This list is
+     * a list of {@link Attribute} objects. May be <tt>null</tt>.
+     * 
+     * @associates org.objectweb.asm.Attribute
+     */
+    public List attrs;
+
+    /**
+     * Constructs a new {@link MemberNode}.
+     */
+    protected MemberNode() {
+    }
+
+    /**
+     * Visits an annotation of this class, field or method.
+     * 
+     * @param desc the class descriptor of the annotation class.
+     * @param visible <tt>true</tt> if the annotation is visible at runtime.
+     * @return a visitor to visit the annotation values.
+     */
+    public AnnotationVisitor visitAnnotation(
+        final String desc,
+        final boolean visible)
+    {
+        AnnotationNode an = new AnnotationNode(desc);
+        if (visible) {
+            if (visibleAnnotations == null) {
+                visibleAnnotations = new ArrayList(1);
+            }
+            visibleAnnotations.add(an);
+        } else {
+            if (invisibleAnnotations == null) {
+                invisibleAnnotations = new ArrayList(1);
+            }
+            invisibleAnnotations.add(an);
+        }
+        return an;
+    }
+
+    /**
+     * Visits a non standard attribute of this class, field or method.
+     * 
+     * @param attr an attribute.
+     */
+    public void visitAttribute(final Attribute attr) {
+        if (attrs == null) {
+            attrs = new ArrayList(1);
+        }
+        attrs.add(attr);
+    }
+
+    /**
+     * Visits the end of this class, field or method.
+     */
+    public void visitEnd() {
+    }
+}

Added: tapestry/tapestry5/trunk/plastic/src/external/java/org/objectweb/asm/tree/MethodInsnNode.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/plastic/src/external/java/org/objectweb/asm/tree/MethodInsnNode.java?rev=1089584&view=auto
==============================================================================
--- tapestry/tapestry5/trunk/plastic/src/external/java/org/objectweb/asm/tree/MethodInsnNode.java (added)
+++ tapestry/tapestry5/trunk/plastic/src/external/java/org/objectweb/asm/tree/MethodInsnNode.java Wed Apr  6 19:11:34 2011
@@ -0,0 +1,105 @@
+/***
+ * ASM: a very small and fast Java bytecode manipulation framework
+ * Copyright (c) 2000-2007 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.objectweb.asm.tree;
+
+import java.util.Map;
+
+import org.objectweb.asm.MethodVisitor;
+
+/**
+ * A node that represents a method instruction. A method instruction is an
+ * instruction that invokes a method.
+ * 
+ * @author Eric Bruneton
+ */
+public class MethodInsnNode extends AbstractInsnNode {
+
+    /**
+     * The internal name of the method's owner class (see
+     * {@link org.objectweb.asm.Type#getInternalName() getInternalName}).
+     */
+    public String owner;
+
+    /**
+     * The method's name.
+     */
+    public String name;
+
+    /**
+     * The method's descriptor (see {@link org.objectweb.asm.Type}).
+     */
+    public String desc;
+
+    /**
+     * Constructs a new {@link MethodInsnNode}.
+     * 
+     * @param opcode the opcode of the type instruction to be constructed. This
+     *        opcode must be INVOKEVIRTUAL, INVOKESPECIAL, INVOKESTATIC,
+     *        INVOKEINTERFACE or INVOKEDYNAMIC.
+     * @param owner the internal name of the method's owner class (see
+     *        {@link org.objectweb.asm.Type#getInternalName() getInternalName})
+     *        or {@link org.objectweb.asm.Opcodes#INVOKEDYNAMIC_OWNER}.
+     * @param name the method's name.
+     * @param desc the method's descriptor (see {@link org.objectweb.asm.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 int getType() {
+        return METHOD_INSN;
+    }
+
+    public void accept(final MethodVisitor mv) {
+        mv.visitMethodInsn(opcode, owner, name, desc);
+    }
+
+    public AbstractInsnNode clone(final Map labels) {
+        return new MethodInsnNode(opcode, owner, name, desc);
+    }
+}
\ No newline at end of file

Added: tapestry/tapestry5/trunk/plastic/src/external/java/org/objectweb/asm/tree/MethodNode.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/plastic/src/external/java/org/objectweb/asm/tree/MethodNode.java?rev=1089584&view=auto
==============================================================================
--- tapestry/tapestry5/trunk/plastic/src/external/java/org/objectweb/asm/tree/MethodNode.java (added)
+++ tapestry/tapestry5/trunk/plastic/src/external/java/org/objectweb/asm/tree/MethodNode.java Wed Apr  6 19:11:34 2011
@@ -0,0 +1,491 @@
+/***
+ * ASM: a very small and fast Java bytecode manipulation framework
+ * Copyright (c) 2000-2007 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.objectweb.asm.tree;
+
+import org.objectweb.asm.AnnotationVisitor;
+import org.objectweb.asm.Attribute;
+import org.objectweb.asm.ClassVisitor;
+import org.objectweb.asm.MethodVisitor;
+import org.objectweb.asm.Label;
+import org.objectweb.asm.Opcodes;
+import org.objectweb.asm.Type;
+
+import java.util.List;
+import java.util.ArrayList;
+import java.util.Arrays;
+
+/**
+ * A node that represents a method.
+ * 
+ * @author Eric Bruneton
+ */
+public class MethodNode extends MemberNode implements MethodVisitor {
+
+    /**
+     * The method's access flags (see {@link Opcodes}). 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 Type}).
+     */
+    public String desc;
+
+    /**
+     * The method's signature. May be <tt>null</tt>.
+     */
+    public String signature;
+
+    /**
+     * The internal names of the method's exception classes (see
+     * {@link Type#getInternalName() getInternalName}). This list is a list of
+     * {@link String} objects.
+     */
+    public List exceptions;
+
+    /**
+     * The default value of this annotation interface method. This field must be
+     * a {@link Byte}, {@link Boolean}, {@link Character}, {@link Short},
+     * {@link Integer}, {@link Long}, {@link Float}, {@link Double},
+     * {@link String} or {@link Type}, or an two elements String array (for
+     * enumeration values), a {@link AnnotationNode}, or a {@link List} of
+     * values of one of the preceding types. May be <tt>null</tt>.
+     */
+    public Object annotationDefault;
+
+    /**
+     * The runtime visible parameter annotations of this method. These lists are
+     * lists of {@link AnnotationNode} objects. May be <tt>null</tt>.
+     * 
+     * @associates org.objectweb.asm.tree.AnnotationNode
+     * @label invisible parameters
+     */
+    public List[] visibleParameterAnnotations;
+
+    /**
+     * The runtime invisible parameter annotations of this method. These lists
+     * are lists of {@link AnnotationNode} objects. May be <tt>null</tt>.
+     * 
+     * @associates org.objectweb.asm.tree.AnnotationNode
+     * @label visible parameters
+     */
+    public List[] invisibleParameterAnnotations;
+
+    /**
+     * The instructions of this method. This list is a list of
+     * {@link AbstractInsnNode} objects.
+     * 
+     * @associates org.objectweb.asm.tree.AbstractInsnNode
+     * @label instructions
+     */
+    public InsnList instructions;
+
+    /**
+     * The try catch blocks of this method. This list is a list of
+     * {@link TryCatchBlockNode} objects.
+     * 
+     * @associates org.objectweb.asm.tree.TryCatchBlockNode
+     */
+    public 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} objects. May be <tt>null</tt>
+     * 
+     * @associates org.objectweb.asm.tree.LocalVariableNode
+     */
+    public List localVariables;
+
+    /**
+     * Constructs an unitialized {@link MethodNode}.
+     */
+    public MethodNode() {
+        this.instructions = new InsnList();
+    }
+    
+    /**
+     * Constructs a new {@link MethodNode}.
+     * 
+     * @param access the method's access flags (see {@link Opcodes}). 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 Type}).
+     * @param signature the method's signature. May be <tt>null</tt>.
+     * @param exceptions the internal names of the method's exception classes
+     *        (see {@link Type#getInternalName() getInternalName}). May be
+     *        <tt>null</tt>.
+     */
+    public MethodNode(
+        final int access,
+        final String name,
+        final String desc,
+        final String signature,
+        final String[] exceptions)
+    {
+        this();
+        this.access = access;
+        this.name = name;
+        this.desc = desc;
+        this.signature = signature;
+        this.exceptions = new ArrayList(exceptions == null
+                ? 0
+                : exceptions.length);
+        boolean isAbstract = (access & Opcodes.ACC_ABSTRACT) != 0;
+        if (!isAbstract) {
+            this.localVariables = new ArrayList(5);
+        }
+        this.tryCatchBlocks = new ArrayList();
+        if (exceptions != null) {
+            this.exceptions.addAll(Arrays.asList(exceptions));
+        }
+    }
+
+    // ------------------------------------------------------------------------
+    // Implementation of the MethodVisitor interface
+    // ------------------------------------------------------------------------
+
+    public AnnotationVisitor visitAnnotationDefault() {
+        return new AnnotationNode(new ArrayList(0) {
+            public boolean add(final Object o) {
+                annotationDefault = o;
+                return super.add(o);
+            }
+        });
+    }
+
+    public AnnotationVisitor visitParameterAnnotation(
+        final int parameter,
+        final String desc,
+        final boolean visible)
+    {
+        AnnotationNode an = new AnnotationNode(desc);
+        if (visible) {
+            if (visibleParameterAnnotations == null) {
+                int params = Type.getArgumentTypes(this.desc).length;
+                visibleParameterAnnotations = new List[params];
+            }
+            if (visibleParameterAnnotations[parameter] == null) {
+                visibleParameterAnnotations[parameter] = new ArrayList(1);
+            }
+            visibleParameterAnnotations[parameter].add(an);
+        } else {
+            if (invisibleParameterAnnotations == null) {
+                int params = Type.getArgumentTypes(this.desc).length;
+                invisibleParameterAnnotations = new List[params];
+            }
+            if (invisibleParameterAnnotations[parameter] == null) {
+                invisibleParameterAnnotations[parameter] = new ArrayList(1);
+            }
+            invisibleParameterAnnotations[parameter].add(an);
+        }
+        return an;
+    }
+
+    public void visitCode() {
+    }
+
+    public void visitFrame(
+        final int type,
+        final int nLocal,
+        final Object[] local,
+        final int nStack,
+        final Object[] stack)
+    {
+        instructions.add(new FrameNode(type, nLocal, local == null
+                ? null
+                : getLabelNodes(local), nStack, stack == null
+                ? null
+                : getLabelNodes(stack)));
+    }
+
+    public void visitInsn(final int opcode) {
+        instructions.add(new InsnNode(opcode));
+    }
+
+    public void visitIntInsn(final int opcode, final int operand) {
+        instructions.add(new IntInsnNode(opcode, operand));
+    }
+
+    public void visitVarInsn(final int opcode, final int var) {
+        instructions.add(new VarInsnNode(opcode, var));
+    }
+
+    public void visitTypeInsn(final int opcode, final String type) {
+        instructions.add(new TypeInsnNode(opcode, type));
+    }
+
+    public void visitFieldInsn(
+        final int opcode,
+        final String owner,
+        final String name,
+        final String desc)
+    {
+        instructions.add(new FieldInsnNode(opcode, owner, name, desc));
+    }
+
+    public void visitMethodInsn(
+        final int opcode,
+        final String owner,
+        final String name,
+        final String desc)
+    {
+        instructions.add(new MethodInsnNode(opcode, owner, name, desc));
+    }
+
+    public void visitJumpInsn(final int opcode, final Label label) {
+        instructions.add(new JumpInsnNode(opcode, getLabelNode(label)));
+    }
+
+    public void visitLabel(final Label label) {
+        instructions.add(getLabelNode(label));
+    }
+
+    public void visitLdcInsn(final Object cst) {
+        instructions.add(new LdcInsnNode(cst));
+    }
+
+    public void visitIincInsn(final int var, final int increment) {
+        instructions.add(new IincInsnNode(var, increment));
+    }
+
+    public void visitTableSwitchInsn(
+        final int min,
+        final int max,
+        final Label dflt,
+        final Label[] labels)
+    {
+        instructions.add(new TableSwitchInsnNode(min,
+                max,
+                getLabelNode(dflt),
+                getLabelNodes(labels)));
+    }
+
+    public void visitLookupSwitchInsn(
+        final Label dflt,
+        final int[] keys,
+        final Label[] labels)
+    {
+        instructions.add(new LookupSwitchInsnNode(getLabelNode(dflt),
+                keys,
+                getLabelNodes(labels)));
+    }
+
+    public void visitMultiANewArrayInsn(final String desc, final int dims) {
+        instructions.add(new MultiANewArrayInsnNode(desc, dims));
+    }
+
+    public void visitTryCatchBlock(
+        final Label start,
+        final Label end,
+        final Label handler,
+        final String type)
+    {
+        tryCatchBlocks.add(new TryCatchBlockNode(getLabelNode(start),
+                getLabelNode(end),
+                getLabelNode(handler),
+                type));
+    }
+
+    public void visitLocalVariable(
+        final String name,
+        final String desc,
+        final String signature,
+        final Label start,
+        final Label end,
+        final int index)
+    {
+        localVariables.add(new LocalVariableNode(name,
+                desc,
+                signature,
+                getLabelNode(start),
+                getLabelNode(end),
+                index));
+    }
+
+    public void visitLineNumber(final int line, final Label start) {
+        instructions.add(new LineNumberNode(line, getLabelNode(start)));
+    }
+
+    public void visitMaxs(final int maxStack, final int maxLocals) {
+        this.maxStack = maxStack;
+        this.maxLocals = maxLocals;
+    }
+
+    /**
+     * Returns the LabelNode corresponding to the given Label. Creates a new 
+     * LabelNode if necessary. The default implementation of this method uses
+     * the {@link Label#info} field to store associations between labels and
+     * label nodes.
+     * 
+     * @param l a Label.
+     * @return the LabelNode corresponding to l.
+     */    
+    protected LabelNode getLabelNode(final Label l) {
+        if (!(l.info instanceof LabelNode)) {
+            l.info = new LabelNode(l);
+        }
+        return (LabelNode) l.info;
+    }
+
+    private LabelNode[] getLabelNodes(final Label[] l) {
+        LabelNode[] nodes = new LabelNode[l.length];
+        for (int i = 0; i < l.length; ++i) {
+            nodes[i] = getLabelNode(l[i]);
+        }
+        return nodes;
+    }
+
+    private Object[] getLabelNodes(final Object[] objs) {
+        Object[] nodes = new Object[objs.length];
+        for (int i = 0; i < objs.length; ++i) {
+            Object o = objs[i];
+            if (o instanceof Label) {
+                o = getLabelNode((Label) o);
+            }
+            nodes[i] = o;
+        }
+        return nodes;
+    }
+
+    // ------------------------------------------------------------------------
+    // Accept method
+    // ------------------------------------------------------------------------
+
+    /**
+     * 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);
+        MethodVisitor mv = cv.visitMethod(access,
+                name,
+                desc,
+                signature,
+                exceptions);
+        if (mv != null) {
+            accept(mv);
+        }
+    }
+
+    /**
+     * Makes the given method visitor visit this method.
+     * 
+     * @param mv a method visitor.
+     */
+    public void accept(final MethodVisitor mv) {
+        // visits the method attributes
+        int i, j, n;
+        if (annotationDefault != null) {
+            AnnotationVisitor av = mv.visitAnnotationDefault();
+            AnnotationNode.accept(av, null, annotationDefault);
+            if (av != null) {
+                av.visitEnd();
+            }
+        }
+        n = visibleAnnotations == null ? 0 : visibleAnnotations.size();
+        for (i = 0; i < n; ++i) {
+            AnnotationNode an = (AnnotationNode) visibleAnnotations.get(i);
+            an.accept(mv.visitAnnotation(an.desc, true));
+        }
+        n = invisibleAnnotations == null ? 0 : invisibleAnnotations.size();
+        for (i = 0; i < n; ++i) {
+            AnnotationNode an = (AnnotationNode) invisibleAnnotations.get(i);
+            an.accept(mv.visitAnnotation(an.desc, false));
+        }
+        n = visibleParameterAnnotations == null
+                ? 0
+                : visibleParameterAnnotations.length;
+        for (i = 0; i < n; ++i) {
+            List l = visibleParameterAnnotations[i];
+            if (l == null) {
+                continue;
+            }
+            for (j = 0; j < l.size(); ++j) {
+                AnnotationNode an = (AnnotationNode) l.get(j);
+                an.accept(mv.visitParameterAnnotation(i, an.desc, true));
+            }
+        }
+        n = invisibleParameterAnnotations == null
+                ? 0
+                : invisibleParameterAnnotations.length;
+        for (i = 0; i < n; ++i) {
+            List l = invisibleParameterAnnotations[i];
+            if (l == null) {
+                continue;
+            }
+            for (j = 0; j < l.size(); ++j) {
+                AnnotationNode an = (AnnotationNode) l.get(j);
+                an.accept(mv.visitParameterAnnotation(i, an.desc, false));
+            }
+        }
+        n = attrs == null ? 0 : attrs.size();
+        for (i = 0; i < n; ++i) {
+            mv.visitAttribute((Attribute) attrs.get(i));
+        }
+        // visits the method's code
+        if (instructions.size() > 0) {
+            mv.visitCode();
+            // visits try catch blocks
+            n = tryCatchBlocks == null ? 0 : tryCatchBlocks.size();
+            for (i = 0; i < n; ++i) {
+                ((TryCatchBlockNode) tryCatchBlocks.get(i)).accept(mv);
+            }
+            // visits instructions
+            instructions.accept(mv);
+            // visits local variables
+            n = localVariables == null ? 0 : localVariables.size();
+            for (i = 0; i < n; ++i) {
+                ((LocalVariableNode) localVariables.get(i)).accept(mv);
+            }
+            // visits maxs
+            mv.visitMaxs(maxStack, maxLocals);
+        }
+        mv.visitEnd();
+    }
+}

Added: tapestry/tapestry5/trunk/plastic/src/external/java/org/objectweb/asm/tree/MultiANewArrayInsnNode.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/plastic/src/external/java/org/objectweb/asm/tree/MultiANewArrayInsnNode.java?rev=1089584&view=auto
==============================================================================
--- tapestry/tapestry5/trunk/plastic/src/external/java/org/objectweb/asm/tree/MultiANewArrayInsnNode.java (added)
+++ tapestry/tapestry5/trunk/plastic/src/external/java/org/objectweb/asm/tree/MultiANewArrayInsnNode.java Wed Apr  6 19:11:34 2011
@@ -0,0 +1,78 @@
+/***
+ * ASM: a very small and fast Java bytecode manipulation framework
+ * Copyright (c) 2000-2007 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.objectweb.asm.tree;
+
+import java.util.Map;
+
+import org.objectweb.asm.Opcodes;
+import org.objectweb.asm.MethodVisitor;
+
+/**
+ * A node that represents a MULTIANEWARRAY instruction.
+ * 
+ * @author Eric Bruneton
+ */
+public class MultiANewArrayInsnNode extends AbstractInsnNode {
+
+    /**
+     * An array type descriptor (see {@link org.objectweb.asm.Type}).
+     */
+    public String desc;
+
+    /**
+     * Number of dimensions of the array to allocate.
+     */
+    public int dims;
+
+    /**
+     * Constructs a new {@link MultiANewArrayInsnNode}.
+     * 
+     * @param desc an array type descriptor (see {@link org.objectweb.asm.Type}).
+     * @param dims number of dimensions of the array to allocate.
+     */
+    public MultiANewArrayInsnNode(final String desc, final int dims) {
+        super(Opcodes.MULTIANEWARRAY);
+        this.desc = desc;
+        this.dims = dims;
+    }
+
+    public int getType() {
+        return MULTIANEWARRAY_INSN;
+    }
+
+    public void accept(final MethodVisitor mv) {
+        mv.visitMultiANewArrayInsn(desc, dims);
+    }
+
+    public AbstractInsnNode clone(final Map labels) {
+        return new MultiANewArrayInsnNode(desc, dims);
+    }
+
+}
\ No newline at end of file

Added: tapestry/tapestry5/trunk/plastic/src/external/java/org/objectweb/asm/tree/TableSwitchInsnNode.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/plastic/src/external/java/org/objectweb/asm/tree/TableSwitchInsnNode.java?rev=1089584&view=auto
==============================================================================
--- tapestry/tapestry5/trunk/plastic/src/external/java/org/objectweb/asm/tree/TableSwitchInsnNode.java (added)
+++ tapestry/tapestry5/trunk/plastic/src/external/java/org/objectweb/asm/tree/TableSwitchInsnNode.java Wed Apr  6 19:11:34 2011
@@ -0,0 +1,112 @@
+/***
+ * ASM: a very small and fast Java bytecode manipulation framework
+ * Copyright (c) 2000-2007 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.objectweb.asm.tree;
+
+import org.objectweb.asm.Label;
+import org.objectweb.asm.Opcodes;
+import org.objectweb.asm.MethodVisitor;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * A node that represents a TABLESWITCH instruction.
+ * 
+ * @author Eric Bruneton
+ */
+public class TableSwitchInsnNode extends AbstractInsnNode {
+
+    /**
+     * The minimum key value.
+     */
+    public int min;
+
+    /**
+     * The maximum key value.
+     */
+    public int max;
+
+    /**
+     * Beginning of the default handler block.
+     */
+    public LabelNode dflt;
+
+    /**
+     * Beginnings of the handler blocks. This list is a list of
+     * {@link LabelNode} objects.
+     */
+    public List labels;
+
+    /**
+     * Constructs a new {@link TableSwitchInsnNode}.
+     * 
+     * @param min the minimum key value.
+     * @param max the maximum key value.
+     * @param dflt beginning of the default handler block.
+     * @param labels beginnings of the handler blocks. <tt>labels[i]</tt> is
+     *        the beginning of the handler block for the <tt>min + i</tt> key.
+     */
+    public TableSwitchInsnNode(
+        final int min,
+        final int max,
+        final LabelNode dflt,
+        final LabelNode[] labels)
+    {
+        super(Opcodes.TABLESWITCH);
+        this.min = min;
+        this.max = max;
+        this.dflt = dflt;
+        this.labels = new ArrayList();
+        if (labels != null) {
+            this.labels.addAll(Arrays.asList(labels));
+        }
+    }
+
+    public int getType() {
+        return TABLESWITCH_INSN;
+    }
+
+    public void accept(final MethodVisitor mv) {
+        Label[] labels = new Label[this.labels.size()];
+        for (int i = 0; i < labels.length; ++i) {
+            labels[i] = ((LabelNode) this.labels.get(i)).getLabel();
+        }
+        mv.visitTableSwitchInsn(min, max, dflt.getLabel(), labels);
+    }
+
+    public AbstractInsnNode clone(final Map labels) {
+        return new TableSwitchInsnNode(min,
+                max,
+                clone(dflt, labels),
+                clone(this.labels, labels));
+    }
+}
\ No newline at end of file

Added: tapestry/tapestry5/trunk/plastic/src/external/java/org/objectweb/asm/tree/TryCatchBlockNode.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/plastic/src/external/java/org/objectweb/asm/tree/TryCatchBlockNode.java?rev=1089584&view=auto
==============================================================================
--- tapestry/tapestry5/trunk/plastic/src/external/java/org/objectweb/asm/tree/TryCatchBlockNode.java (added)
+++ tapestry/tapestry5/trunk/plastic/src/external/java/org/objectweb/asm/tree/TryCatchBlockNode.java Wed Apr  6 19:11:34 2011
@@ -0,0 +1,94 @@
+/***
+ * ASM: a very small and fast Java bytecode manipulation framework
+ * Copyright (c) 2000-2007 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.objectweb.asm.tree;
+
+import org.objectweb.asm.MethodVisitor;
+
+/**
+ * A node that represents a try catch block.
+ * 
+ * @author Eric Bruneton
+ */
+public class TryCatchBlockNode {
+
+    /**
+     * Beginning of the exception handler's scope (inclusive).
+     */
+    public LabelNode start;
+
+    /**
+     * End of the exception handler's scope (exclusive).
+     */
+    public LabelNode end;
+
+    /**
+     * Beginning of the exception handler's code.
+     */
+    public LabelNode handler;
+
+    /**
+     * Internal name of the type of exceptions handled by the handler. May be
+     * <tt>null</tt> to catch any exceptions (for "finally" blocks).
+     */
+    public String type;
+
+    /**
+     * Constructs a new {@link TryCatchBlockNode}.
+     * 
+     * @param start beginning of the exception handler's scope (inclusive).
+     * @param end end of the exception handler's scope (exclusive).
+     * @param handler beginning of the exception handler's code.
+     * @param type internal name of the type of exceptions handled by the
+     *        handler, or <tt>null</tt> to catch any exceptions (for "finally"
+     *        blocks).
+     */
+    public TryCatchBlockNode(
+        final LabelNode start,
+        final LabelNode end,
+        final LabelNode handler,
+        final String type)
+    {
+        this.start = start;
+        this.end = end;
+        this.handler = handler;
+        this.type = type;
+    }
+
+    /**
+     * Makes the given visitor visit this try catch block.
+     * 
+     * @param mv a method visitor.
+     */
+    public void accept(final MethodVisitor mv) {
+        mv.visitTryCatchBlock(start.getLabel(), end.getLabel(), handler == null
+                ? null
+                : handler.getLabel(), type);
+    }
+}

Added: tapestry/tapestry5/trunk/plastic/src/external/java/org/objectweb/asm/tree/TypeInsnNode.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/plastic/src/external/java/org/objectweb/asm/tree/TypeInsnNode.java?rev=1089584&view=auto
==============================================================================
--- tapestry/tapestry5/trunk/plastic/src/external/java/org/objectweb/asm/tree/TypeInsnNode.java (added)
+++ tapestry/tapestry5/trunk/plastic/src/external/java/org/objectweb/asm/tree/TypeInsnNode.java Wed Apr  6 19:11:34 2011
@@ -0,0 +1,84 @@
+/***
+ * ASM: a very small and fast Java bytecode manipulation framework
+ * Copyright (c) 2000-2007 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.objectweb.asm.tree;
+
+import java.util.Map;
+
+import org.objectweb.asm.MethodVisitor;
+
+/**
+ * A node that represents a type instruction. A type instruction is an
+ * instruction that takes a type descriptor as parameter.
+ * 
+ * @author Eric Bruneton
+ */
+public class TypeInsnNode extends AbstractInsnNode {
+
+    /**
+     * The operand of this instruction. This operand is an internal name (see
+     * {@link org.objectweb.asm.Type}).
+     */
+    public String desc;
+
+    /**
+     * Constructs a new {@link TypeInsnNode}.
+     * 
+     * @param opcode the opcode of the type instruction to be constructed. This
+     *        opcode must be NEW, ANEWARRAY, CHECKCAST or INSTANCEOF.
+     * @param desc the operand of the instruction to be constructed. This
+     *        operand is an internal name (see {@link org.objectweb.asm.Type}).
+     */
+    public TypeInsnNode(final int opcode, final String desc) {
+        super(opcode);
+        this.desc = desc;
+    }
+
+    /**
+     * Sets the opcode of this instruction.
+     * 
+     * @param opcode the new instruction opcode. This opcode must be NEW,
+     *        ANEWARRAY, CHECKCAST or INSTANCEOF.
+     */
+    public void setOpcode(final int opcode) {
+        this.opcode = opcode;
+    }
+
+    public int getType() {
+        return TYPE_INSN;
+    }
+
+    public void accept(final MethodVisitor mv) {
+        mv.visitTypeInsn(opcode, desc);
+    }
+
+    public AbstractInsnNode clone(final Map labels) {
+        return new TypeInsnNode(opcode, desc);
+    }
+}
\ No newline at end of file

Added: tapestry/tapestry5/trunk/plastic/src/external/java/org/objectweb/asm/tree/VarInsnNode.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/plastic/src/external/java/org/objectweb/asm/tree/VarInsnNode.java?rev=1089584&view=auto
==============================================================================
--- tapestry/tapestry5/trunk/plastic/src/external/java/org/objectweb/asm/tree/VarInsnNode.java (added)
+++ tapestry/tapestry5/trunk/plastic/src/external/java/org/objectweb/asm/tree/VarInsnNode.java Wed Apr  6 19:11:34 2011
@@ -0,0 +1,87 @@
+/***
+ * ASM: a very small and fast Java bytecode manipulation framework
+ * Copyright (c) 2000-2007 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.objectweb.asm.tree;
+
+import java.util.Map;
+
+import org.objectweb.asm.MethodVisitor;
+
+/**
+ * A node that represents a local variable instruction. A local variable
+ * instruction is an instruction that loads or stores the value of a local
+ * variable.
+ * 
+ * @author Eric Bruneton
+ */
+public class VarInsnNode extends AbstractInsnNode {
+
+    /**
+     * The operand of this instruction. This operand is the index of a local
+     * variable.
+     */
+    public int var;
+
+    /**
+     * Constructs a new {@link VarInsnNode}.
+     * 
+     * @param opcode the opcode of the local variable instruction to be
+     *        constructed. This opcode must be ILOAD, LLOAD, FLOAD, DLOAD,
+     *        ALOAD, ISTORE, LSTORE, FSTORE, DSTORE, ASTORE or RET.
+     * @param var the operand of the instruction to be constructed. This operand
+     *        is the index of a local variable.
+     */
+    public VarInsnNode(final int opcode, final int var) {
+        super(opcode);
+        this.var = var;
+    }
+
+    /**
+     * Sets the opcode of this instruction.
+     * 
+     * @param opcode the new instruction opcode. This opcode must be ILOAD,
+     *        LLOAD, FLOAD, DLOAD, ALOAD, ISTORE, LSTORE, FSTORE, DSTORE, ASTORE
+     *        or RET.
+     */
+    public void setOpcode(final int opcode) {
+        this.opcode = opcode;
+    }
+
+    public int getType() {
+        return VAR_INSN;
+    }
+
+    public void accept(final MethodVisitor mv) {
+        mv.visitVarInsn(opcode, var);
+    }
+
+    public AbstractInsnNode clone(final Map labels) {
+        return new VarInsnNode(opcode, var);
+    }
+}
\ No newline at end of file

Added: tapestry/tapestry5/trunk/plastic/src/external/java/org/objectweb/asm/tree/analysis/Analyzer.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/plastic/src/external/java/org/objectweb/asm/tree/analysis/Analyzer.java?rev=1089584&view=auto
==============================================================================
--- tapestry/tapestry5/trunk/plastic/src/external/java/org/objectweb/asm/tree/analysis/Analyzer.java (added)
+++ tapestry/tapestry5/trunk/plastic/src/external/java/org/objectweb/asm/tree/analysis/Analyzer.java Wed Apr  6 19:11:34 2011
@@ -0,0 +1,523 @@
+/***
+ * ASM: a very small and fast Java bytecode manipulation framework
+ * Copyright (c) 2000-2007 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.objectweb.asm.tree.analysis;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.objectweb.asm.Opcodes;
+import org.objectweb.asm.Type;
+import org.objectweb.asm.tree.AbstractInsnNode;
+import org.objectweb.asm.tree.IincInsnNode;
+import org.objectweb.asm.tree.InsnList;
+import org.objectweb.asm.tree.JumpInsnNode;
+import org.objectweb.asm.tree.LabelNode;
+import org.objectweb.asm.tree.LookupSwitchInsnNode;
+import org.objectweb.asm.tree.MethodNode;
+import org.objectweb.asm.tree.TableSwitchInsnNode;
+import org.objectweb.asm.tree.TryCatchBlockNode;
+import org.objectweb.asm.tree.VarInsnNode;
+
+/**
+ * A semantic bytecode analyzer. <i>This class does not fully check that JSR and
+ * RET instructions are valid.</i>
+ * 
+ * @author Eric Bruneton
+ */
+public class Analyzer implements Opcodes {
+
+    private final Interpreter interpreter;
+
+    private int n;
+
+    private InsnList insns;
+
+    private List[] handlers;
+
+    private Frame[] frames;
+
+    private Subroutine[] subroutines;
+
+    private boolean[] queued;
+
+    private int[] queue;
+
+    private int top;
+
+    /**
+     * Constructs a new {@link Analyzer}.
+     * 
+     * @param interpreter the interpreter to be used to symbolically interpret
+     *        the bytecode instructions.
+     */
+    public Analyzer(final Interpreter interpreter) {
+        this.interpreter = interpreter;
+    }
+
+    /**
+     * Analyzes the given method.
+     * 
+     * @param owner the internal name of the class to which the method belongs.
+     * @param m the method to be analyzed.
+     * @return the symbolic state of the execution stack frame at each bytecode
+     *         instruction of the method. The size of the returned array is
+     *         equal to the number of instructions (and labels) of the method. A
+     *         given frame is <tt>null</tt> if and only if the corresponding
+     *         instruction cannot be reached (dead code).
+     * @throws AnalyzerException if a problem occurs during the analysis.
+     */
+    public Frame[] analyze(final String owner, final MethodNode m)
+            throws AnalyzerException
+    {
+        if ((m.access & (ACC_ABSTRACT | ACC_NATIVE)) != 0) {
+            frames = new Frame[0];
+            return frames;
+        }
+        n = m.instructions.size();
+        insns = m.instructions;
+        handlers = new List[n];
+        frames = new Frame[n];
+        subroutines = new Subroutine[n];
+        queued = new boolean[n];
+        queue = new int[n];
+        top = 0;
+
+        // computes exception handlers for each instruction
+        for (int i = 0; i < m.tryCatchBlocks.size(); ++i) {
+            TryCatchBlockNode tcb = (TryCatchBlockNode) m.tryCatchBlocks.get(i);
+            int begin = insns.indexOf(tcb.start);
+            int end = insns.indexOf(tcb.end);
+            for (int j = begin; j < end; ++j) {
+                List insnHandlers = handlers[j];
+                if (insnHandlers == null) {
+                    insnHandlers = new ArrayList();
+                    handlers[j] = insnHandlers;
+                }
+                insnHandlers.add(tcb);
+            }
+        }
+
+        // computes the subroutine for each instruction:
+        Subroutine main = new Subroutine(null, m.maxLocals, null);
+        List subroutineCalls = new ArrayList();
+        Map subroutineHeads = new HashMap();
+        findSubroutine(0, main, subroutineCalls);
+        while (!subroutineCalls.isEmpty()) {
+            JumpInsnNode jsr = (JumpInsnNode) subroutineCalls.remove(0);
+            Subroutine sub = (Subroutine) subroutineHeads.get(jsr.label);
+            if (sub == null) {
+                sub = new Subroutine(jsr.label, m.maxLocals, jsr);
+                subroutineHeads.put(jsr.label, sub);
+                findSubroutine(insns.indexOf(jsr.label), sub, subroutineCalls);
+            } else {
+                sub.callers.add(jsr);
+            }
+        }
+        for (int i = 0; i < n; ++i) {
+            if (subroutines[i] != null && subroutines[i].start == null) {
+                subroutines[i] = null;
+            }
+        }
+
+        // initializes the data structures for the control flow analysis
+        Frame current = newFrame(m.maxLocals, m.maxStack);
+        Frame handler = newFrame(m.maxLocals, m.maxStack);
+        current.setReturn(interpreter.newValue(Type.getReturnType(m.desc)));
+        Type[] args = Type.getArgumentTypes(m.desc);
+        int local = 0;
+        if ((m.access & ACC_STATIC) == 0) {
+            Type ctype = Type.getObjectType(owner);
+            current.setLocal(local++, interpreter.newValue(ctype));
+        }
+        for (int i = 0; i < args.length; ++i) {
+            current.setLocal(local++, interpreter.newValue(args[i]));
+            if (args[i].getSize() == 2) {
+                current.setLocal(local++, interpreter.newValue(null));
+            }
+        }
+        while (local < m.maxLocals) {
+            current.setLocal(local++, interpreter.newValue(null));
+        }
+        merge(0, current, null);
+        
+        init(owner, m);
+
+        // control flow analysis
+        while (top > 0) {
+            int insn = queue[--top];
+            Frame f = frames[insn];
+            Subroutine subroutine = subroutines[insn];
+            queued[insn] = false;
+
+            AbstractInsnNode insnNode = null;
+            try {
+                insnNode = m.instructions.get(insn);
+                int insnOpcode = insnNode.getOpcode();
+                int insnType = insnNode.getType();
+
+                if (insnType == AbstractInsnNode.LABEL
+                        || insnType == AbstractInsnNode.LINE
+                        || insnType == AbstractInsnNode.FRAME)
+                {
+                    merge(insn + 1, f, subroutine);
+                    newControlFlowEdge(insn, insn + 1);
+                } else {
+                    current.init(f).execute(insnNode, interpreter);
+                    subroutine = subroutine == null ? null : subroutine.copy();
+
+                    if (insnNode instanceof JumpInsnNode) {
+                        JumpInsnNode j = (JumpInsnNode) insnNode;
+                        if (insnOpcode != GOTO && insnOpcode != JSR) {
+                            merge(insn + 1, current, subroutine);
+                            newControlFlowEdge(insn, insn + 1);
+                        }
+                        int jump = insns.indexOf(j.label);
+                        if (insnOpcode == JSR) {
+                            merge(jump, current, new Subroutine(j.label,
+                                    m.maxLocals,
+                                    j));
+                        } else {
+                            merge(jump, current, subroutine);
+                        }
+                        newControlFlowEdge(insn, jump);
+                    } else if (insnNode instanceof LookupSwitchInsnNode) {
+                        LookupSwitchInsnNode lsi = (LookupSwitchInsnNode) insnNode;
+                        int jump = insns.indexOf(lsi.dflt);
+                        merge(jump, current, subroutine);
+                        newControlFlowEdge(insn, jump);
+                        for (int j = 0; j < lsi.labels.size(); ++j) {
+                            LabelNode label = (LabelNode) lsi.labels.get(j);
+                            jump = insns.indexOf(label);
+                            merge(jump, current, subroutine);
+                            newControlFlowEdge(insn, jump);
+                        }
+                    } else if (insnNode instanceof TableSwitchInsnNode) {
+                        TableSwitchInsnNode tsi = (TableSwitchInsnNode) insnNode;
+                        int jump = insns.indexOf(tsi.dflt);
+                        merge(jump, current, subroutine);
+                        newControlFlowEdge(insn, jump);
+                        for (int j = 0; j < tsi.labels.size(); ++j) {
+                            LabelNode label = (LabelNode) tsi.labels.get(j);
+                            jump = insns.indexOf(label);
+                            merge(jump, current, subroutine);
+                            newControlFlowEdge(insn, jump);
+                        }
+                    } else if (insnOpcode == RET) {
+                        if (subroutine == null) {
+                            throw new AnalyzerException(insnNode, "RET instruction outside of a sub routine");
+                        }
+                        for (int i = 0; i < subroutine.callers.size(); ++i) {
+                            Object caller = subroutine.callers.get(i);
+                            int call = insns.indexOf((AbstractInsnNode) caller);
+                            if (frames[call] != null) {
+                                merge(call + 1,
+                                        frames[call],
+                                        current,
+                                        subroutines[call],
+                                        subroutine.access);
+                                newControlFlowEdge(insn, call + 1);
+                            }
+                        }
+                    } else if (insnOpcode != ATHROW
+                            && (insnOpcode < IRETURN || insnOpcode > RETURN))
+                    {
+                        if (subroutine != null) {
+                            if (insnNode instanceof VarInsnNode) {
+                                int var = ((VarInsnNode) insnNode).var;
+                                subroutine.access[var] = true;
+                                if (insnOpcode == LLOAD || insnOpcode == DLOAD
+                                        || insnOpcode == LSTORE
+                                        || insnOpcode == DSTORE)
+                                {
+                                    subroutine.access[var + 1] = true;
+                                }
+                            } else if (insnNode instanceof IincInsnNode) {
+                                int var = ((IincInsnNode) insnNode).var;
+                                subroutine.access[var] = true;
+                            }
+                        }
+                        merge(insn + 1, current, subroutine);
+                        newControlFlowEdge(insn, insn + 1);
+                    }
+                }
+
+                List insnHandlers = handlers[insn];
+                if (insnHandlers != null) {
+                    for (int i = 0; i < insnHandlers.size(); ++i) {
+                        TryCatchBlockNode tcb = (TryCatchBlockNode) insnHandlers.get(i);
+                        Type type;
+                        if (tcb.type == null) {
+                            type = Type.getObjectType("java/lang/Throwable");
+                        } else {
+                            type = Type.getObjectType(tcb.type);
+                        }
+                        int jump = insns.indexOf(tcb.handler);
+                        if (newControlFlowExceptionEdge(insn, jump)) {
+                            handler.init(f);
+                            handler.clearStack();
+                            handler.push(interpreter.newValue(type));
+                            merge(jump, handler, subroutine);
+                        }
+                    }
+                }
+            } catch (AnalyzerException e) {
+                throw new AnalyzerException(e.node, "Error at instruction " + insn
+                        + ": " + e.getMessage(), e);
+            } catch (Exception e) {
+                throw new AnalyzerException(insnNode, "Error at instruction " + insn
+                        + ": " + e.getMessage(), e);
+            }
+        }
+
+        return frames;
+    }
+
+    private void findSubroutine(int insn, final Subroutine sub, final List calls)
+            throws AnalyzerException
+    {
+        while (true) {
+            if (insn < 0 || insn >= n) {
+                throw new AnalyzerException(null, "Execution can fall off end of the code");
+            }
+            if (subroutines[insn] != null) {
+                return;
+            }
+            subroutines[insn] = sub.copy();
+            AbstractInsnNode node = insns.get(insn);
+
+            // calls findSubroutine recursively on normal successors
+            if (node instanceof JumpInsnNode) {
+                if (node.getOpcode() == JSR) {
+                    // do not follow a JSR, it leads to another subroutine!
+                    calls.add(node);
+                } else {
+                    JumpInsnNode jnode = (JumpInsnNode) node;
+                    findSubroutine(insns.indexOf(jnode.label), sub, calls);
+                }
+            } else if (node instanceof TableSwitchInsnNode) {
+                TableSwitchInsnNode tsnode = (TableSwitchInsnNode) node;
+                findSubroutine(insns.indexOf(tsnode.dflt), sub, calls);
+                for (int i = tsnode.labels.size() - 1; i >= 0; --i) {
+                    LabelNode l = (LabelNode) tsnode.labels.get(i);
+                    findSubroutine(insns.indexOf(l), sub, calls);
+                }
+            } else if (node instanceof LookupSwitchInsnNode) {
+                LookupSwitchInsnNode lsnode = (LookupSwitchInsnNode) node;
+                findSubroutine(insns.indexOf(lsnode.dflt), sub, calls);
+                for (int i = lsnode.labels.size() - 1; i >= 0; --i) {
+                    LabelNode l = (LabelNode) lsnode.labels.get(i);
+                    findSubroutine(insns.indexOf(l), sub, calls);
+                }
+            }
+
+            // calls findSubroutine recursively on exception handler successors
+            List insnHandlers = handlers[insn];
+            if (insnHandlers != null) {
+                for (int i = 0; i < insnHandlers.size(); ++i) {
+                    TryCatchBlockNode tcb = (TryCatchBlockNode) insnHandlers.get(i);
+                    findSubroutine(insns.indexOf(tcb.handler), sub, calls);
+                }
+            }
+
+            // if insn does not falls through to the next instruction, return.
+            switch (node.getOpcode()) {
+                case GOTO:
+                case RET:
+                case TABLESWITCH:
+                case LOOKUPSWITCH:
+                case IRETURN:
+                case LRETURN:
+                case FRETURN:
+                case DRETURN:
+                case ARETURN:
+                case RETURN:
+                case ATHROW:
+                    return;
+            }
+            insn++;
+        }
+    }
+
+    /**
+     * Returns the symbolic stack frame for each instruction of the last
+     * recently analyzed method.
+     * 
+     * @return the symbolic state of the execution stack frame at each bytecode
+     *         instruction of the method. The size of the returned array is
+     *         equal to the number of instructions (and labels) of the method. A
+     *         given frame is <tt>null</tt> if the corresponding instruction
+     *         cannot be reached, or if an error occured during the analysis of
+     *         the method.
+     */
+    public Frame[] getFrames() {
+        return frames;
+    }
+
+    /**
+     * Returns the exception handlers for the given instruction.
+     * 
+     * @param insn the index of an instruction of the last recently analyzed
+     *        method.
+     * @return a list of {@link TryCatchBlockNode} objects.
+     */
+    public List getHandlers(final int insn) {
+        return handlers[insn];
+    }
+
+    /**
+     * Initializes this analyzer. This method is called just before the
+     * execution of control flow analysis loop in #analyze. The default
+     * implementation of this method does nothing.
+     * 
+     * @param owner the internal name of the class to which the method belongs.
+     * @param m the method to be analyzed.
+     * @throws AnalyzerException if a problem occurs.
+     */
+    protected void init(String owner, MethodNode m) throws AnalyzerException {    
+    }
+    
+    /**
+     * Constructs a new frame with the given size.
+     * 
+     * @param nLocals the maximum number of local variables of the frame.
+     * @param nStack the maximum stack size of the frame.
+     * @return the created frame.
+     */
+    protected Frame newFrame(final int nLocals, final int nStack) {
+        return new Frame(nLocals, nStack);
+    }
+
+    /**
+     * Constructs a new frame that is identical to the given frame.
+     * 
+     * @param src a frame.
+     * @return the created frame.
+     */
+    protected Frame newFrame(final Frame src) {
+        return new Frame(src);
+    }
+
+    /**
+     * Creates a control flow graph edge. The default implementation of this
+     * method does nothing. It can be overriden in order to construct the
+     * control flow graph of a method (this method is called by the
+     * {@link #analyze analyze} method during its visit of the method's code).
+     * 
+     * @param insn an instruction index.
+     * @param successor index of a successor instruction.
+     */
+    protected void newControlFlowEdge(final int insn, final int successor) {
+    }
+
+    /**
+     * Creates a control flow graph edge corresponding to an exception handler.
+     * The default implementation of this method does nothing. It can be
+     * overriden in order to construct the control flow graph of a method (this
+     * method is called by the {@link #analyze analyze} method during its visit
+     * of the method's code).
+     * 
+     * @param insn an instruction index.
+     * @param successor index of a successor instruction.
+     * @return true if this edge must be considered in the data flow analysis
+     *         performed by this analyzer, or false otherwise. The default
+     *         implementation of this method always returns true.
+     */
+    protected boolean newControlFlowExceptionEdge(
+        final int insn,
+        final int successor)
+    {
+        return true;
+    }
+
+    // -------------------------------------------------------------------------
+    
+    private void merge(
+        final int insn,
+        final Frame frame,
+        final Subroutine subroutine) throws AnalyzerException
+    {
+        Frame oldFrame = frames[insn];
+        Subroutine oldSubroutine = subroutines[insn];
+        boolean changes;
+
+        if (oldFrame == null) {
+            frames[insn] = newFrame(frame);
+            changes = true;
+        } else {
+            changes = oldFrame.merge(frame, interpreter);
+        }
+
+        if (oldSubroutine == null) {
+            if (subroutine != null) {
+                subroutines[insn] = subroutine.copy();
+                changes = true;
+            }
+        } else {
+            if (subroutine != null) {
+                changes |= oldSubroutine.merge(subroutine);
+            }
+        }
+        if (changes && !queued[insn]) {
+            queued[insn] = true;
+            queue[top++] = insn;
+        }
+    }
+
+    private void merge(
+        final int insn,
+        final Frame beforeJSR,
+        final Frame afterRET,
+        final Subroutine subroutineBeforeJSR,
+        final boolean[] access) throws AnalyzerException
+    {
+        Frame oldFrame = frames[insn];
+        Subroutine oldSubroutine = subroutines[insn];
+        boolean changes;
+
+        afterRET.merge(beforeJSR, access);
+
+        if (oldFrame == null) {
+            frames[insn] = newFrame(afterRET);
+            changes = true;
+        } else {
+            changes = oldFrame.merge(afterRET, access);
+        }
+
+        if (oldSubroutine != null && subroutineBeforeJSR != null) {
+            changes |= oldSubroutine.merge(subroutineBeforeJSR);
+        }
+        if (changes && !queued[insn]) {
+            queued[insn] = true;
+            queue[top++] = insn;
+        }
+    }
+}

Added: tapestry/tapestry5/trunk/plastic/src/external/java/org/objectweb/asm/tree/analysis/AnalyzerException.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/plastic/src/external/java/org/objectweb/asm/tree/analysis/AnalyzerException.java?rev=1089584&view=auto
==============================================================================
--- tapestry/tapestry5/trunk/plastic/src/external/java/org/objectweb/asm/tree/analysis/AnalyzerException.java (added)
+++ tapestry/tapestry5/trunk/plastic/src/external/java/org/objectweb/asm/tree/analysis/AnalyzerException.java Wed Apr  6 19:11:34 2011
@@ -0,0 +1,64 @@
+/***
+ * ASM: a very small and fast Java bytecode manipulation framework
+ * Copyright (c) 2000-2007 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.objectweb.asm.tree.analysis;
+
+import org.objectweb.asm.tree.AbstractInsnNode;
+
+/**
+ * Thrown if a problem occurs during the analysis of a method.
+ * 
+ * @author Bing Ran
+ * @author Eric Bruneton
+ */
+public class AnalyzerException extends Exception {
+
+    public final AbstractInsnNode node;
+    
+    public AnalyzerException(final AbstractInsnNode node, final String msg) {
+        super(msg);
+        this.node = node;
+    }
+
+    public AnalyzerException(final AbstractInsnNode node, final String msg, final Throwable exception) {
+        super(msg, exception);
+        this.node = node;
+    }
+
+    public AnalyzerException(
+        final AbstractInsnNode node, 
+        final String msg,
+        final Object expected,
+        final Value encountered)
+    {
+        super((msg == null ? "Expected " : msg + ": expected ") + expected
+                + ", but found " + encountered);
+        this.node = node;
+    }
+}