http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/1c71aec7/plastic/src/external/java/org/apache/tapestry5/internal/plastic/asm/tree/analysis/Subroutine.java ---------------------------------------------------------------------- diff --git a/plastic/src/external/java/org/apache/tapestry5/internal/plastic/asm/tree/analysis/Subroutine.java b/plastic/src/external/java/org/apache/tapestry5/internal/plastic/asm/tree/analysis/Subroutine.java old mode 100644 new mode 100755 index 2032d59..d921aea --- a/plastic/src/external/java/org/apache/tapestry5/internal/plastic/asm/tree/analysis/Subroutine.java +++ b/plastic/src/external/java/org/apache/tapestry5/internal/plastic/asm/tree/analysis/Subroutine.java @@ -1,90 +1,107 @@ -/*** - * 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.analysis; import java.util.ArrayList; import java.util.List; - import org.apache.tapestry5.internal.plastic.asm.tree.JumpInsnNode; import org.apache.tapestry5.internal.plastic.asm.tree.LabelNode; /** * A method subroutine (corresponds to a JSR instruction). - * + * * @author Eric Bruneton */ -class Subroutine { +final class Subroutine { - LabelNode start; + /** The start of this subroutine. */ + final LabelNode start; - boolean[] access; + /** + * The local variables that are read or written by this subroutine. The i-th element is true if + * and only if the local variable at index i is read or written by this subroutine. + */ + final boolean[] localsUsed; - List<JumpInsnNode> callers; + /** The JSR instructions that jump to this subroutine. */ + final List<JumpInsnNode> callers; - private Subroutine() { - } + /** + * Constructs a new {@link Subroutine}. + * + * @param start the start of this subroutine. + * @param maxLocals the local variables that are read or written by this subroutine. + * @param caller a JSR instruction that jump to this subroutine. + */ + Subroutine(final LabelNode start, final int maxLocals, final JumpInsnNode caller) { + this.start = start; + this.localsUsed = new boolean[maxLocals]; + this.callers = new ArrayList<JumpInsnNode>(); + callers.add(caller); + } - Subroutine(final LabelNode start, final int maxLocals, - final JumpInsnNode caller) { - this.start = start; - this.access = new boolean[maxLocals]; - this.callers = new ArrayList<JumpInsnNode>(); - callers.add(caller); - } + /** + * Constructs a copy of the given {@link Subroutine}. + * + * @param subroutine the subroutine to copy. + */ + Subroutine(final Subroutine subroutine) { + this.start = subroutine.start; + this.localsUsed = new boolean[subroutine.localsUsed.length]; + this.callers = new ArrayList<JumpInsnNode>(subroutine.callers); + System.arraycopy(subroutine.localsUsed, 0, this.localsUsed, 0, subroutine.localsUsed.length); + } - public Subroutine copy() { - Subroutine result = new Subroutine(); - result.start = start; - result.access = new boolean[access.length]; - System.arraycopy(access, 0, result.access, 0, access.length); - result.callers = new ArrayList<JumpInsnNode>(callers); - return result; + /** + * Merges the given subroutine into this subroutine. The local variables read or written by the + * given subroutine are marked as read or written by this one, and the callers of the given + * subroutine are added as callers of this one (if both have the same start). + * + * @param subroutine another subroutine. This subroutine is left unchanged by this method. + * @return whether this subroutine has been modified by this method. + */ + public boolean merge(final Subroutine subroutine) { + boolean changed = false; + for (int i = 0; i < localsUsed.length; ++i) { + if (subroutine.localsUsed[i] && !localsUsed[i]) { + localsUsed[i] = true; + changed = true; + } } - - public boolean merge(final Subroutine subroutine) throws AnalyzerException { - boolean changes = false; - for (int i = 0; i < access.length; ++i) { - if (subroutine.access[i] && !access[i]) { - access[i] = true; - changes = true; - } - } - if (subroutine.start == start) { - for (int i = 0; i < subroutine.callers.size(); ++i) { - JumpInsnNode caller = subroutine.callers.get(i); - if (!callers.contains(caller)) { - callers.add(caller); - changes = true; - } - } + if (subroutine.start == start) { + for (int i = 0; i < subroutine.callers.size(); ++i) { + JumpInsnNode caller = subroutine.callers.get(i); + if (!callers.contains(caller)) { + callers.add(caller); + changed = true; } - return changes; + } } -} \ No newline at end of file + return changed; + } +}
http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/1c71aec7/plastic/src/external/java/org/apache/tapestry5/internal/plastic/asm/tree/analysis/Value.java ---------------------------------------------------------------------- diff --git a/plastic/src/external/java/org/apache/tapestry5/internal/plastic/asm/tree/analysis/Value.java b/plastic/src/external/java/org/apache/tapestry5/internal/plastic/asm/tree/analysis/Value.java old mode 100644 new mode 100755 index b0d657c..8592c66 --- a/plastic/src/external/java/org/apache/tapestry5/internal/plastic/asm/tree/analysis/Value.java +++ b/plastic/src/external/java/org/apache/tapestry5/internal/plastic/asm/tree/analysis/Value.java @@ -1,45 +1,44 @@ -/*** - * 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.analysis; /** - * An immutable symbolic value for semantic interpretation of bytecode. - * + * An immutable symbolic value for the semantic interpretation of bytecode. + * * @author Eric Bruneton */ public interface Value { - /** - * Returns the size of this value in words. - * - * @return either 1 or 2. - */ - int getSize(); + /** + * Returns the size of this value in 32 bits words. This size should be 1 for byte, boolean, char, + * short, int, float, object and array types, and 2 for long and double. + * + * @return either 1 or 2. + */ + int getSize(); } http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/1c71aec7/plastic/src/external/java/org/apache/tapestry5/internal/plastic/asm/tree/analysis/package.html ---------------------------------------------------------------------- diff --git a/plastic/src/external/java/org/apache/tapestry5/internal/plastic/asm/tree/analysis/package.html b/plastic/src/external/java/org/apache/tapestry5/internal/plastic/asm/tree/analysis/package.html old mode 100644 new mode 100755 index 228da02..b60c7dd --- a/plastic/src/external/java/org/apache/tapestry5/internal/plastic/asm/tree/analysis/package.html +++ b/plastic/src/external/java/org/apache/tapestry5/internal/plastic/asm/tree/analysis/package.html @@ -39,23 +39,21 @@ Basic usage: </p> <pre> -ClassReader cr = new ClassReader(bytecode); -ClassNode cn = new ClassNode(); -cr.accept(cn, ClassReader.SKIP_DEBUG); +ClassReader classReader = new ClassReader(bytecode); +ClassNode classNode = new ClassNode(); +classReader.accept(classNode, ClassReader.SKIP_DEBUG); -List methods = cn.methods; -for (int i = 0; i < methods.size(); ++i) { - MethodNode method = (MethodNode) methods.get(i); - if (method.instructions.size() > 0) { - Analyzer a = new Analyzer(new BasicInterpreter()); - a.analyze(cn.name, method); - Frame[] frames = a.getFrames(); - // Elements of the frames arrray now contains info for each instruction - // from the analyzed method. BasicInterpreter creates BasicValue, that - // is using simplified type system that distinguishes the UNINITIALZED, - // INT, FLOAT, LONG, DOUBLE, REFERENCE and RETURNADDRESS types. - ... - } +for (MethodNode method : classNode.methods) { + if (method.instructions.size() > 0) { + Analyzer analyzer = new Analyzer(new BasicInterpreter()); + analyzer.analyze(classNode.name, method); + Frame[] frames = analyzer.getFrames(); + // Elements of the frames array now contains info for each instruction + // from the analyzed method. BasicInterpreter creates BasicValue, that + // is using simplified type system that distinguishes the UNINITIALZED, + // INT, FLOAT, LONG, DOUBLE, REFERENCE and RETURNADDRESS types. + ... + } } </pre> http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/1c71aec7/plastic/src/external/java/org/apache/tapestry5/internal/plastic/asm/tree/package.html ---------------------------------------------------------------------- diff --git a/plastic/src/external/java/org/apache/tapestry5/internal/plastic/asm/tree/package.html b/plastic/src/external/java/org/apache/tapestry5/internal/plastic/asm/tree/package.html old mode 100644 new mode 100755 index 940b876..ab295ac --- a/plastic/src/external/java/org/apache/tapestry5/internal/plastic/asm/tree/package.html +++ b/plastic/src/external/java/org/apache/tapestry5/internal/plastic/asm/tree/package.html @@ -43,8 +43,8 @@ However, this class adapter has a cost: it makes ASM bigger and slower. Indeed it requires more than twenty new classes, and multiplies the time needed to transform a class by almost two (it is almost two times faster to read, "modify" and write a class with a ClassVisitor than with a ClassNode). This is why -this package is bundled in an optional <tt>asm-tree.jar</tt> library that -is separated from (but requires) the <tt>asm.jar</tt> library, which contains +this package is bundled in an optional <code>asm-tree.jar</code> library that +is separated from (but requires) the <code>asm.jar</code> library, which contains the core ASM framework. This is also why <i><font color="red">it is recommended not to use this class adapter when it is possible</font></i>. </p> @@ -54,9 +54,9 @@ The root class is the ClassNode, that can be created from existing bytecode. For </p> <pre> - ClassReader cr = new ClassReader(source); - ClassNode cn = new ClassNode(); - cr.accept(cn, true); + ClassReader classReader = new ClassReader(source); + ClassNode classNode = new ClassNode(); + classReader.accept(classNode, 0); </pre> <p> @@ -65,8 +65,8 @@ serialized back into bytecode: </p> <pre> - ClassWriter cw = new ClassWriter(true); - cn.accept(cw); + ClassWriter classWriter = new ClassWriter(0); + classNode.accept(classWriter); </pre> <p> @@ -75,21 +75,22 @@ In this example MethodNode is acting as a buffer that is flushed out at visitEnd </p> <pre> - ClassReader cr = new ClassReader(source); - ClassWriter cw = new ClassWriter(); - ClassVisitor cv = new ClassVisitor(cw) { + ClassReader classReader = new ClassReader(source); + ClassWriter classWriter = new ClassWriter(0); + ClassVisitor classVisitor = new ClassVisitor(ASM7, classWriter) { public MethodVisitor visitMethod(int access, String name, String desc, String signature, String[] exceptions) { - final MethodVisitor mv = super.visitMethod(access, name, desc, signature, exceptions); - MethodNode mn = new MethodNode(access, name, desc, signature, exceptions) { + final MethodVisitor methodVisitor = + super.visitMethod(access, name, desc, signature, exceptions); + MethodNode methodNode = new MethodNode(access, name, desc, signature, exceptions) { public void visitEnd() { // transform or analyze method code using tree API - accept(mv); + accept(methodVisitor); } }; } }; - cr.accept(cv, true); + classReader.accept(classVisitor, 0); </pre> <p> @@ -99,8 +100,8 @@ add them to the instructions list: </p> <pre> -MethodNode m = new MethodNode(...); -m.instructions.add(new VarInsnNode(ALOAD, 0)); +MethodNode methodNode = new MethodNode(...); +methodNode.instructions.add(new VarInsnNode(ALOAD, 0)); ... </pre> @@ -111,8 +112,8 @@ the standard MethodVisitor methods: </p> <pre> -MethodNode m = new MethodNode(...); -m.visitVarInsn(ALOAD, 0); +MethodNode methodNode = new MethodNode(...); +methodNode.visitVarInsn(ALOAD, 0); ... </pre> @@ -124,12 +125,12 @@ methods insert() and insertBefore() to insert instructions at a saved pointer. </p> <pre> -MethodNode m = new MethodNode(...); -m.visitVarInsn(ALOAD, 0); -AbstractInsnNode ptr = m.instructions.getLast(); -m.visitVarInsn(ALOAD, 1); +MethodNode methodNode = new MethodNode(...); +methodNode.visitVarInsn(ALOAD, 0); +AbstractInsnNode ptr = methodNode.instructions.getLast(); +methodNode.visitVarInsn(ALOAD, 1); // inserts an instruction between ALOAD 0 and ALOAD 1 -m.instructions.insert(ptr, new VarInsnNode(ALOAD, 0)); +methodNode.instructions.insert(ptr, new VarInsnNode(ALOAD, 0)); ... </pre> @@ -140,9 +141,9 @@ ListIterator over the instruction list: </p> <pre> -ListIterator it = m.instructions.iterator(); +ListIterator it = methodNode.instructions.iterator(); while (it.hasNext()) { - AbstractInsnNode n = (AbstractInsnNode) it.next(); + AbstractInsnNode insnNode = (AbstractInsnNode) it.next(); if (...) { it.add(new VarInsnNode(ALOAD, 0)); } @@ -150,16 +151,16 @@ while (it.hasNext()) { </pre> <p> -It is also possible to convert an instruction list into an array and iterate trough +It is also possible to convert an instruction list into an array and iterate through array elements: </p> <pre> -AbstractInsnNode[] insns = m.instructions.toArray(); +AbstractInsnNode[] insns = methodNode.instructions.toArray(); for(int i = 0; i<insns.length; i++) { - AbstractInsnNode n = insns[i]; + AbstractInsnNode insn = insns[i]; if (...) { - m.instructions.insert(n, new VarInsnNode(ALOAD, 0)); + methodNode.instructions.insert(insn, new VarInsnNode(ALOAD, 0)); } } </pre> @@ -172,14 +173,14 @@ For example: </p> <pre> -AbstractInsnNode[] insns = m.instructions.toArray(); +AbstractInsnNode[] insns = methodNode.instructions.toArray(); for(int i = 0; i<insns.length; i++) { - AbstractInsnNode n = insns[i]; + AbstractInsnNode insn = insns[i]; if (...) { - MethodNode mn = new MethodNode(); - mn.visitVarInsn(ALOAD, 0); - mn.visitVarInsn(ALOAD, 1); - m.instructions.insert(n, mn.instructions); + MethodNode toInsert = new MethodNode(); + toInsert.visitVarInsn(ALOAD, 0); + toInsert.visitVarInsn(ALOAD, 1); + m.instructions.insert(insn, toInsert.instructions); } } </pre> http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/1c71aec7/plastic/src/external/java/org/apache/tapestry5/internal/plastic/asm/util/ASMifiable.java ---------------------------------------------------------------------- diff --git a/plastic/src/external/java/org/apache/tapestry5/internal/plastic/asm/util/ASMifiable.java b/plastic/src/external/java/org/apache/tapestry5/internal/plastic/asm/util/ASMifiable.java old mode 100644 new mode 100755 index 9395df4..302ffde --- a/plastic/src/external/java/org/apache/tapestry5/internal/plastic/asm/util/ASMifiable.java +++ b/plastic/src/external/java/org/apache/tapestry5/internal/plastic/asm/util/ASMifiable.java @@ -1,56 +1,44 @@ /** - * ASM: a very small and fast Java bytecode manipulation framework - * Copyright (c) 2000-2011 INRIA, France Telecom - * All rights reserved. + * 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. + * <p>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. + * <p>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.util; import java.util.Map; - import org.apache.tapestry5.internal.plastic.asm.Label; /** - * An {@link org.objectweb.asm.Attribute Attribute} that can print the ASM code - * to create an equivalent attribute. - * + * An {@link org.apache.tapestry5.internal.plastic.asm.Attribute} that can generate the ASM code to create an equivalent + * attribute. + * * @author Eugene Kuleshov */ +// DontCheck(AbbreviationAsWordInName): can't be renamed (for backward binary compatibility). public interface ASMifiable { - /** - * Prints the ASM code to create an attribute equal to this attribute. - * - * @param buf - * a buffer used for printing Java code. - * @param varName - * name of the variable in a printed code used to store attribute - * instance. - * @param labelNames - * map of label instances to their names. - */ - void asmify(StringBuffer buf, String varName, Map<Label, String> labelNames); + /** + * Generates the ASM code to create an attribute equal to this attribute. + * + * @param outputBuffer where the generated code must be appended. + * @param visitorVariableName the name of the visitor variable in the produced code. + * @param labelNames the names of the labels in the generated code. + */ + void asmify(StringBuffer outputBuffer, String visitorVariableName, Map<Label, String> labelNames); }
