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 [1/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/external...
Author: hlship
Date: Wed Apr 6 19:11:34 2011
New Revision: 1089584
URL: http://svn.apache.org/viewvc?rev=1089584&view=rev
Log:
TAP5-853: Import ASM 3.3.1 source directly into plastic, replacing the asm-3.3.1 dependency
Added:
tapestry/tapestry5/trunk/plastic/src/external/
tapestry/tapestry5/trunk/plastic/src/external/java/
tapestry/tapestry5/trunk/plastic/src/external/java/org/
tapestry/tapestry5/trunk/plastic/src/external/java/org/objectweb/
tapestry/tapestry5/trunk/plastic/src/external/java/org/objectweb/asm/
tapestry/tapestry5/trunk/plastic/src/external/java/org/objectweb/asm/AnnotationVisitor.java
tapestry/tapestry5/trunk/plastic/src/external/java/org/objectweb/asm/AnnotationWriter.java
tapestry/tapestry5/trunk/plastic/src/external/java/org/objectweb/asm/Attribute.java
tapestry/tapestry5/trunk/plastic/src/external/java/org/objectweb/asm/ByteVector.java
tapestry/tapestry5/trunk/plastic/src/external/java/org/objectweb/asm/ClassAdapter.java
tapestry/tapestry5/trunk/plastic/src/external/java/org/objectweb/asm/ClassReader.java
tapestry/tapestry5/trunk/plastic/src/external/java/org/objectweb/asm/ClassVisitor.java
tapestry/tapestry5/trunk/plastic/src/external/java/org/objectweb/asm/ClassWriter.java
tapestry/tapestry5/trunk/plastic/src/external/java/org/objectweb/asm/Edge.java
tapestry/tapestry5/trunk/plastic/src/external/java/org/objectweb/asm/FieldVisitor.java
tapestry/tapestry5/trunk/plastic/src/external/java/org/objectweb/asm/FieldWriter.java
tapestry/tapestry5/trunk/plastic/src/external/java/org/objectweb/asm/Frame.java
tapestry/tapestry5/trunk/plastic/src/external/java/org/objectweb/asm/Handler.java
tapestry/tapestry5/trunk/plastic/src/external/java/org/objectweb/asm/Item.java
tapestry/tapestry5/trunk/plastic/src/external/java/org/objectweb/asm/Label.java
tapestry/tapestry5/trunk/plastic/src/external/java/org/objectweb/asm/MethodAdapter.java
tapestry/tapestry5/trunk/plastic/src/external/java/org/objectweb/asm/MethodVisitor.java
tapestry/tapestry5/trunk/plastic/src/external/java/org/objectweb/asm/MethodWriter.java
tapestry/tapestry5/trunk/plastic/src/external/java/org/objectweb/asm/Opcodes.java
tapestry/tapestry5/trunk/plastic/src/external/java/org/objectweb/asm/Type.java
tapestry/tapestry5/trunk/plastic/src/external/java/org/objectweb/asm/attrs/
tapestry/tapestry5/trunk/plastic/src/external/java/org/objectweb/asm/attrs/package.html
tapestry/tapestry5/trunk/plastic/src/external/java/org/objectweb/asm/commons/
tapestry/tapestry5/trunk/plastic/src/external/java/org/objectweb/asm/commons/AdviceAdapter.java
tapestry/tapestry5/trunk/plastic/src/external/java/org/objectweb/asm/commons/AnalyzerAdapter.java
tapestry/tapestry5/trunk/plastic/src/external/java/org/objectweb/asm/commons/CodeSizeEvaluator.java
tapestry/tapestry5/trunk/plastic/src/external/java/org/objectweb/asm/commons/EmptyVisitor.java
tapestry/tapestry5/trunk/plastic/src/external/java/org/objectweb/asm/commons/GeneratorAdapter.java
tapestry/tapestry5/trunk/plastic/src/external/java/org/objectweb/asm/commons/InstructionAdapter.java
tapestry/tapestry5/trunk/plastic/src/external/java/org/objectweb/asm/commons/JSRInlinerAdapter.java
tapestry/tapestry5/trunk/plastic/src/external/java/org/objectweb/asm/commons/LocalVariablesSorter.java
tapestry/tapestry5/trunk/plastic/src/external/java/org/objectweb/asm/commons/Method.java
tapestry/tapestry5/trunk/plastic/src/external/java/org/objectweb/asm/commons/Remapper.java
tapestry/tapestry5/trunk/plastic/src/external/java/org/objectweb/asm/commons/RemappingAnnotationAdapter.java
tapestry/tapestry5/trunk/plastic/src/external/java/org/objectweb/asm/commons/RemappingClassAdapter.java
tapestry/tapestry5/trunk/plastic/src/external/java/org/objectweb/asm/commons/RemappingFieldAdapter.java
tapestry/tapestry5/trunk/plastic/src/external/java/org/objectweb/asm/commons/RemappingMethodAdapter.java
tapestry/tapestry5/trunk/plastic/src/external/java/org/objectweb/asm/commons/RemappingSignatureAdapter.java
tapestry/tapestry5/trunk/plastic/src/external/java/org/objectweb/asm/commons/SerialVersionUIDAdder.java
tapestry/tapestry5/trunk/plastic/src/external/java/org/objectweb/asm/commons/SimpleRemapper.java
tapestry/tapestry5/trunk/plastic/src/external/java/org/objectweb/asm/commons/StaticInitMerger.java
tapestry/tapestry5/trunk/plastic/src/external/java/org/objectweb/asm/commons/TableSwitchGenerator.java
tapestry/tapestry5/trunk/plastic/src/external/java/org/objectweb/asm/commons/TryCatchBlockSorter.java
tapestry/tapestry5/trunk/plastic/src/external/java/org/objectweb/asm/commons/package.html
tapestry/tapestry5/trunk/plastic/src/external/java/org/objectweb/asm/optimizer/
tapestry/tapestry5/trunk/plastic/src/external/java/org/objectweb/asm/optimizer/AnnotationConstantsCollector.java
tapestry/tapestry5/trunk/plastic/src/external/java/org/objectweb/asm/optimizer/ClassConstantsCollector.java
tapestry/tapestry5/trunk/plastic/src/external/java/org/objectweb/asm/optimizer/ClassOptimizer.java
tapestry/tapestry5/trunk/plastic/src/external/java/org/objectweb/asm/optimizer/Constant.java
tapestry/tapestry5/trunk/plastic/src/external/java/org/objectweb/asm/optimizer/ConstantPool.java
tapestry/tapestry5/trunk/plastic/src/external/java/org/objectweb/asm/optimizer/FieldConstantsCollector.java
tapestry/tapestry5/trunk/plastic/src/external/java/org/objectweb/asm/optimizer/JarOptimizer.java
tapestry/tapestry5/trunk/plastic/src/external/java/org/objectweb/asm/optimizer/MethodConstantsCollector.java
tapestry/tapestry5/trunk/plastic/src/external/java/org/objectweb/asm/optimizer/MethodOptimizer.java
tapestry/tapestry5/trunk/plastic/src/external/java/org/objectweb/asm/optimizer/NameMapping.java
tapestry/tapestry5/trunk/plastic/src/external/java/org/objectweb/asm/optimizer/Shrinker.java
tapestry/tapestry5/trunk/plastic/src/external/java/org/objectweb/asm/optimizer/jdk1.2.2_017.txt.gz
tapestry/tapestry5/trunk/plastic/src/external/java/org/objectweb/asm/optimizer/jdk1.3.1_19.txt.gz
tapestry/tapestry5/trunk/plastic/src/external/java/org/objectweb/asm/optimizer/shrink-annotations.properties
tapestry/tapestry5/trunk/plastic/src/external/java/org/objectweb/asm/optimizer/shrink-frames.properties
tapestry/tapestry5/trunk/plastic/src/external/java/org/objectweb/asm/optimizer/shrink-resize.properties
tapestry/tapestry5/trunk/plastic/src/external/java/org/objectweb/asm/optimizer/shrink-signatures.properties
tapestry/tapestry5/trunk/plastic/src/external/java/org/objectweb/asm/optimizer/shrink-writer.properties
tapestry/tapestry5/trunk/plastic/src/external/java/org/objectweb/asm/optimizer/shrink.properties
tapestry/tapestry5/trunk/plastic/src/external/java/org/objectweb/asm/package.html
tapestry/tapestry5/trunk/plastic/src/external/java/org/objectweb/asm/signature/
tapestry/tapestry5/trunk/plastic/src/external/java/org/objectweb/asm/signature/SignatureReader.java
tapestry/tapestry5/trunk/plastic/src/external/java/org/objectweb/asm/signature/SignatureVisitor.java
tapestry/tapestry5/trunk/plastic/src/external/java/org/objectweb/asm/signature/SignatureWriter.java
tapestry/tapestry5/trunk/plastic/src/external/java/org/objectweb/asm/signature/package.html
tapestry/tapestry5/trunk/plastic/src/external/java/org/objectweb/asm/tree/
tapestry/tapestry5/trunk/plastic/src/external/java/org/objectweb/asm/tree/AbstractInsnNode.java
tapestry/tapestry5/trunk/plastic/src/external/java/org/objectweb/asm/tree/AnnotationNode.java
tapestry/tapestry5/trunk/plastic/src/external/java/org/objectweb/asm/tree/ClassNode.java
tapestry/tapestry5/trunk/plastic/src/external/java/org/objectweb/asm/tree/FieldInsnNode.java
tapestry/tapestry5/trunk/plastic/src/external/java/org/objectweb/asm/tree/FieldNode.java
tapestry/tapestry5/trunk/plastic/src/external/java/org/objectweb/asm/tree/FrameNode.java
tapestry/tapestry5/trunk/plastic/src/external/java/org/objectweb/asm/tree/IincInsnNode.java
tapestry/tapestry5/trunk/plastic/src/external/java/org/objectweb/asm/tree/InnerClassNode.java
tapestry/tapestry5/trunk/plastic/src/external/java/org/objectweb/asm/tree/InsnList.java
tapestry/tapestry5/trunk/plastic/src/external/java/org/objectweb/asm/tree/InsnNode.java
tapestry/tapestry5/trunk/plastic/src/external/java/org/objectweb/asm/tree/IntInsnNode.java
tapestry/tapestry5/trunk/plastic/src/external/java/org/objectweb/asm/tree/JumpInsnNode.java
tapestry/tapestry5/trunk/plastic/src/external/java/org/objectweb/asm/tree/LabelNode.java
tapestry/tapestry5/trunk/plastic/src/external/java/org/objectweb/asm/tree/LdcInsnNode.java
tapestry/tapestry5/trunk/plastic/src/external/java/org/objectweb/asm/tree/LineNumberNode.java
tapestry/tapestry5/trunk/plastic/src/external/java/org/objectweb/asm/tree/LocalVariableNode.java
tapestry/tapestry5/trunk/plastic/src/external/java/org/objectweb/asm/tree/LookupSwitchInsnNode.java
tapestry/tapestry5/trunk/plastic/src/external/java/org/objectweb/asm/tree/MemberNode.java
tapestry/tapestry5/trunk/plastic/src/external/java/org/objectweb/asm/tree/MethodInsnNode.java
tapestry/tapestry5/trunk/plastic/src/external/java/org/objectweb/asm/tree/MethodNode.java
tapestry/tapestry5/trunk/plastic/src/external/java/org/objectweb/asm/tree/MultiANewArrayInsnNode.java
tapestry/tapestry5/trunk/plastic/src/external/java/org/objectweb/asm/tree/TableSwitchInsnNode.java
tapestry/tapestry5/trunk/plastic/src/external/java/org/objectweb/asm/tree/TryCatchBlockNode.java
tapestry/tapestry5/trunk/plastic/src/external/java/org/objectweb/asm/tree/TypeInsnNode.java
tapestry/tapestry5/trunk/plastic/src/external/java/org/objectweb/asm/tree/VarInsnNode.java
tapestry/tapestry5/trunk/plastic/src/external/java/org/objectweb/asm/tree/analysis/
tapestry/tapestry5/trunk/plastic/src/external/java/org/objectweb/asm/tree/analysis/Analyzer.java
tapestry/tapestry5/trunk/plastic/src/external/java/org/objectweb/asm/tree/analysis/AnalyzerException.java
tapestry/tapestry5/trunk/plastic/src/external/java/org/objectweb/asm/tree/analysis/BasicInterpreter.java
tapestry/tapestry5/trunk/plastic/src/external/java/org/objectweb/asm/tree/analysis/BasicValue.java
tapestry/tapestry5/trunk/plastic/src/external/java/org/objectweb/asm/tree/analysis/BasicVerifier.java
tapestry/tapestry5/trunk/plastic/src/external/java/org/objectweb/asm/tree/analysis/Frame.java
tapestry/tapestry5/trunk/plastic/src/external/java/org/objectweb/asm/tree/analysis/Interpreter.java
tapestry/tapestry5/trunk/plastic/src/external/java/org/objectweb/asm/tree/analysis/SimpleVerifier.java
tapestry/tapestry5/trunk/plastic/src/external/java/org/objectweb/asm/tree/analysis/SmallSet.java
tapestry/tapestry5/trunk/plastic/src/external/java/org/objectweb/asm/tree/analysis/SourceInterpreter.java
tapestry/tapestry5/trunk/plastic/src/external/java/org/objectweb/asm/tree/analysis/SourceValue.java
tapestry/tapestry5/trunk/plastic/src/external/java/org/objectweb/asm/tree/analysis/Subroutine.java
tapestry/tapestry5/trunk/plastic/src/external/java/org/objectweb/asm/tree/analysis/Value.java
tapestry/tapestry5/trunk/plastic/src/external/java/org/objectweb/asm/tree/analysis/package.html
tapestry/tapestry5/trunk/plastic/src/external/java/org/objectweb/asm/tree/package.html
tapestry/tapestry5/trunk/plastic/src/external/java/org/objectweb/asm/util/
tapestry/tapestry5/trunk/plastic/src/external/java/org/objectweb/asm/util/ASMifiable.java
tapestry/tapestry5/trunk/plastic/src/external/java/org/objectweb/asm/util/ASMifierAbstractVisitor.java
tapestry/tapestry5/trunk/plastic/src/external/java/org/objectweb/asm/util/ASMifierAnnotationVisitor.java
tapestry/tapestry5/trunk/plastic/src/external/java/org/objectweb/asm/util/ASMifierClassVisitor.java
tapestry/tapestry5/trunk/plastic/src/external/java/org/objectweb/asm/util/ASMifierFieldVisitor.java
tapestry/tapestry5/trunk/plastic/src/external/java/org/objectweb/asm/util/ASMifierMethodVisitor.java
tapestry/tapestry5/trunk/plastic/src/external/java/org/objectweb/asm/util/AbstractVisitor.java
tapestry/tapestry5/trunk/plastic/src/external/java/org/objectweb/asm/util/CheckAnnotationAdapter.java
tapestry/tapestry5/trunk/plastic/src/external/java/org/objectweb/asm/util/CheckClassAdapter.java
tapestry/tapestry5/trunk/plastic/src/external/java/org/objectweb/asm/util/CheckFieldAdapter.java
tapestry/tapestry5/trunk/plastic/src/external/java/org/objectweb/asm/util/CheckMethodAdapter.java
tapestry/tapestry5/trunk/plastic/src/external/java/org/objectweb/asm/util/CheckSignatureAdapter.java
tapestry/tapestry5/trunk/plastic/src/external/java/org/objectweb/asm/util/TraceAbstractVisitor.java
tapestry/tapestry5/trunk/plastic/src/external/java/org/objectweb/asm/util/TraceAnnotationVisitor.java
tapestry/tapestry5/trunk/plastic/src/external/java/org/objectweb/asm/util/TraceClassVisitor.java
tapestry/tapestry5/trunk/plastic/src/external/java/org/objectweb/asm/util/TraceFieldVisitor.java
tapestry/tapestry5/trunk/plastic/src/external/java/org/objectweb/asm/util/TraceMethodVisitor.java
tapestry/tapestry5/trunk/plastic/src/external/java/org/objectweb/asm/util/TraceSignatureVisitor.java
tapestry/tapestry5/trunk/plastic/src/external/java/org/objectweb/asm/util/Traceable.java
tapestry/tapestry5/trunk/plastic/src/external/java/org/objectweb/asm/util/package.html
tapestry/tapestry5/trunk/plastic/src/external/java/org/objectweb/asm/xml/
tapestry/tapestry5/trunk/plastic/src/external/java/org/objectweb/asm/xml/ASMContentHandler.java
tapestry/tapestry5/trunk/plastic/src/external/java/org/objectweb/asm/xml/Processor.java
tapestry/tapestry5/trunk/plastic/src/external/java/org/objectweb/asm/xml/SAXAdapter.java
tapestry/tapestry5/trunk/plastic/src/external/java/org/objectweb/asm/xml/SAXAnnotationAdapter.java
tapestry/tapestry5/trunk/plastic/src/external/java/org/objectweb/asm/xml/SAXClassAdapter.java
tapestry/tapestry5/trunk/plastic/src/external/java/org/objectweb/asm/xml/SAXCodeAdapter.java
tapestry/tapestry5/trunk/plastic/src/external/java/org/objectweb/asm/xml/SAXFieldAdapter.java
tapestry/tapestry5/trunk/plastic/src/external/java/org/objectweb/asm/xml/asm-xml.dtd
tapestry/tapestry5/trunk/plastic/src/external/java/org/objectweb/asm/xml/package.html
Modified:
tapestry/tapestry5/trunk/plastic/build.gradle
Modified: tapestry/tapestry5/trunk/plastic/build.gradle
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/plastic/build.gradle?rev=1089584&r1=1089583&r2=1089584&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/plastic/build.gradle (original)
+++ tapestry/tapestry5/trunk/plastic/build.gradle Wed Apr 6 19:11:34 2011
@@ -1,11 +1,14 @@
description = "Plastic core framework"
dependencies {
- compile "asm:asm-all:3.3.1"
testCompile "org.spockframework:spock-core:0.5-groovy-1.7"
}
+// Add the source directory for the imported/repackaged ASM 3.3.1 code
+
+sourceSets.main.java.srcDir "src/external/java"
+
test {
useJUnit()
}
\ No newline at end of file
Added: tapestry/tapestry5/trunk/plastic/src/external/java/org/objectweb/asm/AnnotationVisitor.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/plastic/src/external/java/org/objectweb/asm/AnnotationVisitor.java?rev=1089584&view=auto
==============================================================================
--- tapestry/tapestry5/trunk/plastic/src/external/java/org/objectweb/asm/AnnotationVisitor.java (added)
+++ tapestry/tapestry5/trunk/plastic/src/external/java/org/objectweb/asm/AnnotationVisitor.java Wed Apr 6 19:11:34 2011
@@ -0,0 +1,97 @@
+/***
+ * 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;
+
+/**
+ * A visitor to visit a Java annotation. The methods of this interface must be
+ * called in the following order: (<tt>visit<tt> | <tt>visitEnum<tt> |
+ * <tt>visitAnnotation<tt> | <tt>visitArray<tt>)* <tt>visitEnd<tt>.
+ *
+ * @author Eric Bruneton
+ * @author Eugene Kuleshov
+ */
+public interface AnnotationVisitor {
+
+ /**
+ * Visits a primitive value of the annotation.
+ *
+ * @param name the value name.
+ * @param value the actual value, whose type must be {@link Byte},
+ * {@link Boolean}, {@link Character}, {@link Short},
+ * {@link Integer}, {@link Long}, {@link Float}, {@link Double},
+ * {@link String} or {@link Type}. This value can also be an array
+ * of byte, boolean, short, char, int, long, float or double values
+ * (this is equivalent to using {@link #visitArray visitArray} and
+ * visiting each array element in turn, but is more convenient).
+ */
+ void visit(String name, Object value);
+
+ /**
+ * Visits an enumeration value of the annotation.
+ *
+ * @param name the value name.
+ * @param desc the class descriptor of the enumeration class.
+ * @param value the actual enumeration value.
+ */
+ void visitEnum(String name, String desc, String value);
+
+ /**
+ * Visits a nested annotation value of the annotation.
+ *
+ * @param name the value name.
+ * @param desc the class descriptor of the nested annotation class.
+ * @return a visitor to visit the actual nested annotation value, or
+ * <tt>null</tt> if this visitor is not interested in visiting
+ * this nested annotation. <i>The nested annotation value must be
+ * fully visited before calling other methods on this annotation
+ * visitor</i>.
+ */
+ AnnotationVisitor visitAnnotation(String name, String desc);
+
+ /**
+ * Visits an array value of the annotation. Note that arrays of primitive
+ * types (such as byte, boolean, short, char, int, long, float or double)
+ * can be passed as value to {@link #visit visit}. This is what
+ * {@link ClassReader} does.
+ *
+ * @param name the value name.
+ * @return a visitor to visit the actual array value elements, or
+ * <tt>null</tt> if this visitor is not interested in visiting
+ * these values. The 'name' parameters passed to the methods of this
+ * visitor are ignored. <i>All the array values must be visited
+ * before calling other methods on this annotation visitor</i>.
+ */
+ AnnotationVisitor visitArray(String name);
+
+ /**
+ * Visits the end of the annotation.
+ */
+ void visitEnd();
+}
Added: tapestry/tapestry5/trunk/plastic/src/external/java/org/objectweb/asm/AnnotationWriter.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/plastic/src/external/java/org/objectweb/asm/AnnotationWriter.java?rev=1089584&view=auto
==============================================================================
--- tapestry/tapestry5/trunk/plastic/src/external/java/org/objectweb/asm/AnnotationWriter.java (added)
+++ tapestry/tapestry5/trunk/plastic/src/external/java/org/objectweb/asm/AnnotationWriter.java Wed Apr 6 19:11:34 2011
@@ -0,0 +1,316 @@
+/***
+ * 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;
+
+/**
+ * An {@link AnnotationVisitor} that generates annotations in bytecode form.
+ *
+ * @author Eric Bruneton
+ * @author Eugene Kuleshov
+ */
+final class AnnotationWriter implements AnnotationVisitor {
+
+ /**
+ * The class writer to which this annotation must be added.
+ */
+ private final ClassWriter cw;
+
+ /**
+ * The number of values in this annotation.
+ */
+ private int size;
+
+ /**
+ * <tt>true<tt> if values are named, <tt>false</tt> otherwise. Annotation
+ * writers used for annotation default and annotation arrays use unnamed
+ * values.
+ */
+ private final boolean named;
+
+ /**
+ * The annotation values in bytecode form. This byte vector only contains
+ * the values themselves, i.e. the number of values must be stored as a
+ * unsigned short just before these bytes.
+ */
+ private final ByteVector bv;
+
+ /**
+ * The byte vector to be used to store the number of values of this
+ * annotation. See {@link #bv}.
+ */
+ private final ByteVector parent;
+
+ /**
+ * Where the number of values of this annotation must be stored in
+ * {@link #parent}.
+ */
+ private final int offset;
+
+ /**
+ * Next annotation writer. This field is used to store annotation lists.
+ */
+ AnnotationWriter next;
+
+ /**
+ * Previous annotation writer. This field is used to store annotation lists.
+ */
+ AnnotationWriter prev;
+
+ // ------------------------------------------------------------------------
+ // Constructor
+ // ------------------------------------------------------------------------
+
+ /**
+ * Constructs a new {@link AnnotationWriter}.
+ *
+ * @param cw the class writer to which this annotation must be added.
+ * @param named <tt>true<tt> if values are named, <tt>false</tt> otherwise.
+ * @param bv where the annotation values must be stored.
+ * @param parent where the number of annotation values must be stored.
+ * @param offset where in <tt>parent</tt> the number of annotation values must
+ * be stored.
+ */
+ AnnotationWriter(
+ final ClassWriter cw,
+ final boolean named,
+ final ByteVector bv,
+ final ByteVector parent,
+ final int offset)
+ {
+ this.cw = cw;
+ this.named = named;
+ this.bv = bv;
+ this.parent = parent;
+ this.offset = offset;
+ }
+
+ // ------------------------------------------------------------------------
+ // Implementation of the AnnotationVisitor interface
+ // ------------------------------------------------------------------------
+
+ public void visit(final String name, final Object value) {
+ ++size;
+ if (named) {
+ bv.putShort(cw.newUTF8(name));
+ }
+ if (value instanceof String) {
+ bv.put12('s', cw.newUTF8((String) value));
+ } else if (value instanceof Byte) {
+ bv.put12('B', cw.newInteger(((Byte) value).byteValue()).index);
+ } else if (value instanceof Boolean) {
+ int v = ((Boolean) value).booleanValue() ? 1 : 0;
+ bv.put12('Z', cw.newInteger(v).index);
+ } else if (value instanceof Character) {
+ bv.put12('C', cw.newInteger(((Character) value).charValue()).index);
+ } else if (value instanceof Short) {
+ bv.put12('S', cw.newInteger(((Short) value).shortValue()).index);
+ } else if (value instanceof Type) {
+ bv.put12('c', cw.newUTF8(((Type) value).getDescriptor()));
+ } else if (value instanceof byte[]) {
+ byte[] v = (byte[]) value;
+ bv.put12('[', v.length);
+ for (int i = 0; i < v.length; i++) {
+ bv.put12('B', cw.newInteger(v[i]).index);
+ }
+ } else if (value instanceof boolean[]) {
+ boolean[] v = (boolean[]) value;
+ bv.put12('[', v.length);
+ for (int i = 0; i < v.length; i++) {
+ bv.put12('Z', cw.newInteger(v[i] ? 1 : 0).index);
+ }
+ } else if (value instanceof short[]) {
+ short[] v = (short[]) value;
+ bv.put12('[', v.length);
+ for (int i = 0; i < v.length; i++) {
+ bv.put12('S', cw.newInteger(v[i]).index);
+ }
+ } else if (value instanceof char[]) {
+ char[] v = (char[]) value;
+ bv.put12('[', v.length);
+ for (int i = 0; i < v.length; i++) {
+ bv.put12('C', cw.newInteger(v[i]).index);
+ }
+ } else if (value instanceof int[]) {
+ int[] v = (int[]) value;
+ bv.put12('[', v.length);
+ for (int i = 0; i < v.length; i++) {
+ bv.put12('I', cw.newInteger(v[i]).index);
+ }
+ } else if (value instanceof long[]) {
+ long[] v = (long[]) value;
+ bv.put12('[', v.length);
+ for (int i = 0; i < v.length; i++) {
+ bv.put12('J', cw.newLong(v[i]).index);
+ }
+ } else if (value instanceof float[]) {
+ float[] v = (float[]) value;
+ bv.put12('[', v.length);
+ for (int i = 0; i < v.length; i++) {
+ bv.put12('F', cw.newFloat(v[i]).index);
+ }
+ } else if (value instanceof double[]) {
+ double[] v = (double[]) value;
+ bv.put12('[', v.length);
+ for (int i = 0; i < v.length; i++) {
+ bv.put12('D', cw.newDouble(v[i]).index);
+ }
+ } else {
+ Item i = cw.newConstItem(value);
+ bv.put12(".s.IFJDCS".charAt(i.type), i.index);
+ }
+ }
+
+ public void visitEnum(
+ final String name,
+ final String desc,
+ final String value)
+ {
+ ++size;
+ if (named) {
+ bv.putShort(cw.newUTF8(name));
+ }
+ bv.put12('e', cw.newUTF8(desc)).putShort(cw.newUTF8(value));
+ }
+
+ public AnnotationVisitor visitAnnotation(
+ final String name,
+ final String desc)
+ {
+ ++size;
+ if (named) {
+ bv.putShort(cw.newUTF8(name));
+ }
+ // write tag and type, and reserve space for values count
+ bv.put12('@', cw.newUTF8(desc)).putShort(0);
+ return new AnnotationWriter(cw, true, bv, bv, bv.length - 2);
+ }
+
+ public AnnotationVisitor visitArray(final String name) {
+ ++size;
+ if (named) {
+ bv.putShort(cw.newUTF8(name));
+ }
+ // write tag, and reserve space for array size
+ bv.put12('[', 0);
+ return new AnnotationWriter(cw, false, bv, bv, bv.length - 2);
+ }
+
+ public void visitEnd() {
+ if (parent != null) {
+ byte[] data = parent.data;
+ data[offset] = (byte) (size >>> 8);
+ data[offset + 1] = (byte) size;
+ }
+ }
+
+ // ------------------------------------------------------------------------
+ // Utility methods
+ // ------------------------------------------------------------------------
+
+ /**
+ * Returns the size of this annotation writer list.
+ *
+ * @return the size of this annotation writer list.
+ */
+ int getSize() {
+ int size = 0;
+ AnnotationWriter aw = this;
+ while (aw != null) {
+ size += aw.bv.length;
+ aw = aw.next;
+ }
+ return size;
+ }
+
+ /**
+ * Puts the annotations of this annotation writer list into the given byte
+ * vector.
+ *
+ * @param out where the annotations must be put.
+ */
+ void put(final ByteVector out) {
+ int n = 0;
+ int size = 2;
+ AnnotationWriter aw = this;
+ AnnotationWriter last = null;
+ while (aw != null) {
+ ++n;
+ size += aw.bv.length;
+ aw.visitEnd(); // in case user forgot to call visitEnd
+ aw.prev = last;
+ last = aw;
+ aw = aw.next;
+ }
+ out.putInt(size);
+ out.putShort(n);
+ aw = last;
+ while (aw != null) {
+ out.putByteArray(aw.bv.data, 0, aw.bv.length);
+ aw = aw.prev;
+ }
+ }
+
+ /**
+ * Puts the given annotation lists into the given byte vector.
+ *
+ * @param panns an array of annotation writer lists.
+ * @param off index of the first annotation to be written.
+ * @param out where the annotations must be put.
+ */
+ static void put(
+ final AnnotationWriter[] panns,
+ final int off,
+ final ByteVector out)
+ {
+ int size = 1 + 2 * (panns.length - off);
+ for (int i = off; i < panns.length; ++i) {
+ size += panns[i] == null ? 0 : panns[i].getSize();
+ }
+ out.putInt(size).putByte(panns.length - off);
+ for (int i = off; i < panns.length; ++i) {
+ AnnotationWriter aw = panns[i];
+ AnnotationWriter last = null;
+ int n = 0;
+ while (aw != null) {
+ ++n;
+ aw.visitEnd(); // in case user forgot to call visitEnd
+ aw.prev = last;
+ last = aw;
+ aw = aw.next;
+ }
+ out.putShort(n);
+ aw = last;
+ while (aw != null) {
+ out.putByteArray(aw.bv.data, 0, aw.bv.length);
+ aw = aw.prev;
+ }
+ }
+ }
+}
Added: tapestry/tapestry5/trunk/plastic/src/external/java/org/objectweb/asm/Attribute.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/plastic/src/external/java/org/objectweb/asm/Attribute.java?rev=1089584&view=auto
==============================================================================
--- tapestry/tapestry5/trunk/plastic/src/external/java/org/objectweb/asm/Attribute.java (added)
+++ tapestry/tapestry5/trunk/plastic/src/external/java/org/objectweb/asm/Attribute.java Wed Apr 6 19:11:34 2011
@@ -0,0 +1,254 @@
+/***
+ * 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;
+
+/**
+ * A non standard class, field, method or code attribute.
+ *
+ * @author Eric Bruneton
+ * @author Eugene Kuleshov
+ */
+public class Attribute {
+
+ /**
+ * The type of this attribute.
+ */
+ public final String type;
+
+ /**
+ * The raw value of this attribute, used only for unknown attributes.
+ */
+ byte[] value;
+
+ /**
+ * The next attribute in this attribute list. May be <tt>null</tt>.
+ */
+ Attribute next;
+
+ /**
+ * Constructs a new empty attribute.
+ *
+ * @param type the type of the attribute.
+ */
+ protected Attribute(final String type) {
+ this.type = type;
+ }
+
+ /**
+ * Returns <tt>true</tt> if this type of attribute is unknown. The default
+ * implementation of this method always returns <tt>true</tt>.
+ *
+ * @return <tt>true</tt> if this type of attribute is unknown.
+ */
+ public boolean isUnknown() {
+ return true;
+ }
+
+ /**
+ * Returns <tt>true</tt> if this type of attribute is a code attribute.
+ *
+ * @return <tt>true</tt> if this type of attribute is a code attribute.
+ */
+ public boolean isCodeAttribute() {
+ return false;
+ }
+
+ /**
+ * Returns the labels corresponding to this attribute.
+ *
+ * @return the labels corresponding to this attribute, or <tt>null</tt> if
+ * this attribute is not a code attribute that contains labels.
+ */
+ protected Label[] getLabels() {
+ return null;
+ }
+
+ /**
+ * Reads a {@link #type type} attribute. This method must return a <i>new</i>
+ * {@link Attribute} object, of type {@link #type type}, corresponding to
+ * the <tt>len</tt> bytes starting at the given offset, in the given class
+ * reader.
+ *
+ * @param cr the class that contains the attribute to be read.
+ * @param off index of the first byte of the attribute's content in {@link
+ * ClassReader#b cr.b}. The 6 attribute header bytes, containing the
+ * type and the length of the attribute, are not taken into account
+ * here.
+ * @param len the length of the attribute's content.
+ * @param buf buffer to be used to call
+ * {@link ClassReader#readUTF8 readUTF8},
+ * {@link ClassReader#readClass(int,char[]) readClass} or
+ * {@link ClassReader#readConst readConst}.
+ * @param codeOff index of the first byte of code's attribute content in
+ * {@link ClassReader#b cr.b}, or -1 if the attribute to be read is
+ * not a code attribute. The 6 attribute header bytes, containing the
+ * type and the length of the attribute, are not taken into account
+ * here.
+ * @param labels the labels of the method's code, or <tt>null</tt> if the
+ * attribute to be read is not a code attribute.
+ * @return a <i>new</i> {@link Attribute} object corresponding to the given
+ * bytes.
+ */
+ protected Attribute read(
+ final ClassReader cr,
+ final int off,
+ final int len,
+ final char[] buf,
+ final int codeOff,
+ final Label[] labels)
+ {
+ Attribute attr = new Attribute(type);
+ attr.value = new byte[len];
+ System.arraycopy(cr.b, off, attr.value, 0, len);
+ return attr;
+ }
+
+ /**
+ * Returns the byte array form of this attribute.
+ *
+ * @param cw the class to which this attribute must be added. This parameter
+ * can be used to add to the constant pool of this class the items
+ * that corresponds to this attribute.
+ * @param code the bytecode of the method corresponding to this code
+ * attribute, or <tt>null</tt> if this attribute is not a code
+ * attributes.
+ * @param len the length of the bytecode of the method corresponding to this
+ * code attribute, or <tt>null</tt> if this attribute is not a code
+ * attribute.
+ * @param maxStack the maximum stack size of the method corresponding to
+ * this code attribute, or -1 if this attribute is not a code
+ * attribute.
+ * @param maxLocals the maximum number of local variables of the method
+ * corresponding to this code attribute, or -1 if this attribute is
+ * not a code attribute.
+ * @return the byte array form of this attribute.
+ */
+ protected ByteVector write(
+ final ClassWriter cw,
+ final byte[] code,
+ final int len,
+ final int maxStack,
+ final int maxLocals)
+ {
+ ByteVector v = new ByteVector();
+ v.data = value;
+ v.length = value.length;
+ return v;
+ }
+
+ /**
+ * Returns the length of the attribute list that begins with this attribute.
+ *
+ * @return the length of the attribute list that begins with this attribute.
+ */
+ final int getCount() {
+ int count = 0;
+ Attribute attr = this;
+ while (attr != null) {
+ count += 1;
+ attr = attr.next;
+ }
+ return count;
+ }
+
+ /**
+ * Returns the size of all the attributes in this attribute list.
+ *
+ * @param cw the class writer to be used to convert the attributes into byte
+ * arrays, with the {@link #write write} method.
+ * @param code the bytecode of the method corresponding to these code
+ * attributes, or <tt>null</tt> if these attributes are not code
+ * attributes.
+ * @param len the length of the bytecode of the method corresponding to
+ * these code attributes, or <tt>null</tt> if these attributes are
+ * not code attributes.
+ * @param maxStack the maximum stack size of the method corresponding to
+ * these code attributes, or -1 if these attributes are not code
+ * attributes.
+ * @param maxLocals the maximum number of local variables of the method
+ * corresponding to these code attributes, or -1 if these attributes
+ * are not code attributes.
+ * @return the size of all the attributes in this attribute list. This size
+ * includes the size of the attribute headers.
+ */
+ final int getSize(
+ final ClassWriter cw,
+ final byte[] code,
+ final int len,
+ final int maxStack,
+ final int maxLocals)
+ {
+ Attribute attr = this;
+ int size = 0;
+ while (attr != null) {
+ cw.newUTF8(attr.type);
+ size += attr.write(cw, code, len, maxStack, maxLocals).length + 6;
+ attr = attr.next;
+ }
+ return size;
+ }
+
+ /**
+ * Writes all the attributes of this attribute list in the given byte
+ * vector.
+ *
+ * @param cw the class writer to be used to convert the attributes into byte
+ * arrays, with the {@link #write write} method.
+ * @param code the bytecode of the method corresponding to these code
+ * attributes, or <tt>null</tt> if these attributes are not code
+ * attributes.
+ * @param len the length of the bytecode of the method corresponding to
+ * these code attributes, or <tt>null</tt> if these attributes are
+ * not code attributes.
+ * @param maxStack the maximum stack size of the method corresponding to
+ * these code attributes, or -1 if these attributes are not code
+ * attributes.
+ * @param maxLocals the maximum number of local variables of the method
+ * corresponding to these code attributes, or -1 if these attributes
+ * are not code attributes.
+ * @param out where the attributes must be written.
+ */
+ final void put(
+ final ClassWriter cw,
+ final byte[] code,
+ final int len,
+ final int maxStack,
+ final int maxLocals,
+ final ByteVector out)
+ {
+ Attribute attr = this;
+ while (attr != null) {
+ ByteVector b = attr.write(cw, code, len, maxStack, maxLocals);
+ out.putShort(cw.newUTF8(attr.type)).putInt(b.length);
+ out.putByteArray(b.data, 0, b.length);
+ attr = attr.next;
+ }
+ }
+}
Added: tapestry/tapestry5/trunk/plastic/src/external/java/org/objectweb/asm/ByteVector.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/plastic/src/external/java/org/objectweb/asm/ByteVector.java?rev=1089584&view=auto
==============================================================================
--- tapestry/tapestry5/trunk/plastic/src/external/java/org/objectweb/asm/ByteVector.java (added)
+++ tapestry/tapestry5/trunk/plastic/src/external/java/org/objectweb/asm/ByteVector.java Wed Apr 6 19:11:34 2011
@@ -0,0 +1,293 @@
+/***
+ * 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;
+
+/**
+ * A dynamically extensible vector of bytes. This class is roughly equivalent to
+ * a DataOutputStream on top of a ByteArrayOutputStream, but is more efficient.
+ *
+ * @author Eric Bruneton
+ */
+public class ByteVector {
+
+ /**
+ * The content of this vector.
+ */
+ byte[] data;
+
+ /**
+ * Actual number of bytes in this vector.
+ */
+ int length;
+
+ /**
+ * Constructs a new {@link ByteVector ByteVector} with a default initial
+ * size.
+ */
+ public ByteVector() {
+ data = new byte[64];
+ }
+
+ /**
+ * Constructs a new {@link ByteVector ByteVector} with the given initial
+ * size.
+ *
+ * @param initialSize the initial size of the byte vector to be constructed.
+ */
+ public ByteVector(final int initialSize) {
+ data = new byte[initialSize];
+ }
+
+ /**
+ * Puts a byte into this byte vector. The byte vector is automatically
+ * enlarged if necessary.
+ *
+ * @param b a byte.
+ * @return this byte vector.
+ */
+ public ByteVector putByte(final int b) {
+ int length = this.length;
+ if (length + 1 > data.length) {
+ enlarge(1);
+ }
+ data[length++] = (byte) b;
+ this.length = length;
+ return this;
+ }
+
+ /**
+ * Puts two bytes into this byte vector. The byte vector is automatically
+ * enlarged if necessary.
+ *
+ * @param b1 a byte.
+ * @param b2 another byte.
+ * @return this byte vector.
+ */
+ ByteVector put11(final int b1, final int b2) {
+ int length = this.length;
+ if (length + 2 > data.length) {
+ enlarge(2);
+ }
+ byte[] data = this.data;
+ data[length++] = (byte) b1;
+ data[length++] = (byte) b2;
+ this.length = length;
+ return this;
+ }
+
+ /**
+ * Puts a short into this byte vector. The byte vector is automatically
+ * enlarged if necessary.
+ *
+ * @param s a short.
+ * @return this byte vector.
+ */
+ public ByteVector putShort(final int s) {
+ int length = this.length;
+ if (length + 2 > data.length) {
+ enlarge(2);
+ }
+ byte[] data = this.data;
+ data[length++] = (byte) (s >>> 8);
+ data[length++] = (byte) s;
+ this.length = length;
+ return this;
+ }
+
+ /**
+ * Puts a byte and a short into this byte vector. The byte vector is
+ * automatically enlarged if necessary.
+ *
+ * @param b a byte.
+ * @param s a short.
+ * @return this byte vector.
+ */
+ ByteVector put12(final int b, final int s) {
+ int length = this.length;
+ if (length + 3 > data.length) {
+ enlarge(3);
+ }
+ byte[] data = this.data;
+ data[length++] = (byte) b;
+ data[length++] = (byte) (s >>> 8);
+ data[length++] = (byte) s;
+ this.length = length;
+ return this;
+ }
+
+ /**
+ * Puts an int into this byte vector. The byte vector is automatically
+ * enlarged if necessary.
+ *
+ * @param i an int.
+ * @return this byte vector.
+ */
+ public ByteVector putInt(final int i) {
+ int length = this.length;
+ if (length + 4 > data.length) {
+ enlarge(4);
+ }
+ byte[] data = this.data;
+ data[length++] = (byte) (i >>> 24);
+ data[length++] = (byte) (i >>> 16);
+ data[length++] = (byte) (i >>> 8);
+ data[length++] = (byte) i;
+ this.length = length;
+ return this;
+ }
+
+ /**
+ * Puts a long into this byte vector. The byte vector is automatically
+ * enlarged if necessary.
+ *
+ * @param l a long.
+ * @return this byte vector.
+ */
+ public ByteVector putLong(final long l) {
+ int length = this.length;
+ if (length + 8 > data.length) {
+ enlarge(8);
+ }
+ byte[] data = this.data;
+ int i = (int) (l >>> 32);
+ data[length++] = (byte) (i >>> 24);
+ data[length++] = (byte) (i >>> 16);
+ data[length++] = (byte) (i >>> 8);
+ data[length++] = (byte) i;
+ i = (int) l;
+ data[length++] = (byte) (i >>> 24);
+ data[length++] = (byte) (i >>> 16);
+ data[length++] = (byte) (i >>> 8);
+ data[length++] = (byte) i;
+ this.length = length;
+ return this;
+ }
+
+ /**
+ * Puts an UTF8 string into this byte vector. The byte vector is
+ * automatically enlarged if necessary.
+ *
+ * @param s a String.
+ * @return this byte vector.
+ */
+ public ByteVector putUTF8(final String s) {
+ int charLength = s.length();
+ int len = length;
+ if (len + 2 + charLength > data.length) {
+ enlarge(2 + charLength);
+ }
+ byte[] data = this.data;
+ // optimistic algorithm: instead of computing the byte length and then
+ // serializing the string (which requires two loops), we assume the byte
+ // length is equal to char length (which is the most frequent case), and
+ // we start serializing the string right away. During the serialization,
+ // if we find that this assumption is wrong, we continue with the
+ // general method.
+ data[len++] = (byte) (charLength >>> 8);
+ data[len++] = (byte) charLength;
+ for (int i = 0; i < charLength; ++i) {
+ char c = s.charAt(i);
+ if (c >= '\001' && c <= '\177') {
+ data[len++] = (byte) c;
+ } else {
+ int byteLength = i;
+ for (int j = i; j < charLength; ++j) {
+ c = s.charAt(j);
+ if (c >= '\001' && c <= '\177') {
+ byteLength++;
+ } else if (c > '\u07FF') {
+ byteLength += 3;
+ } else {
+ byteLength += 2;
+ }
+ }
+ data[length] = (byte) (byteLength >>> 8);
+ data[length + 1] = (byte) byteLength;
+ if (length + 2 + byteLength > data.length) {
+ length = len;
+ enlarge(2 + byteLength);
+ data = this.data;
+ }
+ for (int j = i; j < charLength; ++j) {
+ c = s.charAt(j);
+ if (c >= '\001' && c <= '\177') {
+ data[len++] = (byte) c;
+ } else if (c > '\u07FF') {
+ data[len++] = (byte) (0xE0 | c >> 12 & 0xF);
+ data[len++] = (byte) (0x80 | c >> 6 & 0x3F);
+ data[len++] = (byte) (0x80 | c & 0x3F);
+ } else {
+ data[len++] = (byte) (0xC0 | c >> 6 & 0x1F);
+ data[len++] = (byte) (0x80 | c & 0x3F);
+ }
+ }
+ break;
+ }
+ }
+ length = len;
+ return this;
+ }
+
+ /**
+ * Puts an array of bytes into this byte vector. The byte vector is
+ * automatically enlarged if necessary.
+ *
+ * @param b an array of bytes. May be <tt>null</tt> to put <tt>len</tt>
+ * null bytes into this byte vector.
+ * @param off index of the fist byte of b that must be copied.
+ * @param len number of bytes of b that must be copied.
+ * @return this byte vector.
+ */
+ public ByteVector putByteArray(final byte[] b, final int off, final int len)
+ {
+ if (length + len > data.length) {
+ enlarge(len);
+ }
+ if (b != null) {
+ System.arraycopy(b, off, data, length, len);
+ }
+ length += len;
+ return this;
+ }
+
+ /**
+ * Enlarge this byte vector so that it can receive n more bytes.
+ *
+ * @param size number of additional bytes that this byte vector should be
+ * able to receive.
+ */
+ private void enlarge(final int size) {
+ int length1 = 2 * data.length;
+ int length2 = length + size;
+ byte[] newData = new byte[length1 > length2 ? length1 : length2];
+ System.arraycopy(data, 0, newData, 0, length);
+ data = newData;
+ }
+}
Added: tapestry/tapestry5/trunk/plastic/src/external/java/org/objectweb/asm/ClassAdapter.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/plastic/src/external/java/org/objectweb/asm/ClassAdapter.java?rev=1089584&view=auto
==============================================================================
--- tapestry/tapestry5/trunk/plastic/src/external/java/org/objectweb/asm/ClassAdapter.java (added)
+++ tapestry/tapestry5/trunk/plastic/src/external/java/org/objectweb/asm/ClassAdapter.java Wed Apr 6 19:11:34 2011
@@ -0,0 +1,121 @@
+/***
+ * 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;
+
+/**
+ * An empty {@link ClassVisitor} that delegates to another {@link ClassVisitor}.
+ * This class can be used as a super class to quickly implement usefull class
+ * adapter classes, just by overriding the necessary methods.
+ *
+ * @author Eric Bruneton
+ */
+public class ClassAdapter implements ClassVisitor {
+
+ /**
+ * The {@link ClassVisitor} to which this adapter delegates calls.
+ */
+ protected ClassVisitor cv;
+
+ /**
+ * Constructs a new {@link ClassAdapter} object.
+ *
+ * @param cv the class visitor to which this adapter must delegate calls.
+ */
+ public ClassAdapter(final ClassVisitor cv) {
+ this.cv = cv;
+ }
+
+ public void visit(
+ final int version,
+ final int access,
+ final String name,
+ final String signature,
+ final String superName,
+ final String[] interfaces)
+ {
+ cv.visit(version, access, name, signature, superName, interfaces);
+ }
+
+ public void visitSource(final String source, final String debug) {
+ cv.visitSource(source, debug);
+ }
+
+ public void visitOuterClass(
+ final String owner,
+ final String name,
+ final String desc)
+ {
+ cv.visitOuterClass(owner, name, desc);
+ }
+
+ public AnnotationVisitor visitAnnotation(
+ final String desc,
+ final boolean visible)
+ {
+ return cv.visitAnnotation(desc, visible);
+ }
+
+ public void visitAttribute(final Attribute attr) {
+ cv.visitAttribute(attr);
+ }
+
+ public void visitInnerClass(
+ final String name,
+ final String outerName,
+ final String innerName,
+ final int access)
+ {
+ cv.visitInnerClass(name, outerName, innerName, access);
+ }
+
+ public FieldVisitor visitField(
+ final int access,
+ final String name,
+ final String desc,
+ final String signature,
+ final Object value)
+ {
+ return cv.visitField(access, name, desc, signature, value);
+ }
+
+ public MethodVisitor visitMethod(
+ final int access,
+ final String name,
+ final String desc,
+ final String signature,
+ final String[] exceptions)
+ {
+ return cv.visitMethod(access, name, desc, signature, exceptions);
+ }
+
+ public void visitEnd() {
+ cv.visitEnd();
+ }
+}