You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tapestry.apache.org by ka...@apache.org on 2014/03/20 20:23:28 UTC
[23/23] git commit: FIXED - TAP5-2214: Make tapestry5 java8
compatible - apply source from AMS 5.0 final source release and change
package name to org.apache.tapestry5.internal.plastic.asm. Also made a single
change to ASM source, promoted visibility of
FIXED - TAP5-2214: Make tapestry5 java8 compatible
- apply source from AMS 5.0 final source release and change package name
to org.apache.tapestry5.internal.plastic.asm. Also made a single change
to ASM source, promoted visibility of AnnotationNode.accept from package
private to public so I didn't have change to plastic (to instantiate
AnnotationNode)
Project: http://git-wip-us.apache.org/repos/asf/tapestry-5/repo
Commit: http://git-wip-us.apache.org/repos/asf/tapestry-5/commit/1acd9d22
Tree: http://git-wip-us.apache.org/repos/asf/tapestry-5/tree/1acd9d22
Diff: http://git-wip-us.apache.org/repos/asf/tapestry-5/diff/1acd9d22
Branch: refs/heads/master
Commit: 1acd9d22efbd11c41ff74ce1b33286dbb29bbd7f
Parents: 19b3960
Author: kaosko <ka...@apache.org>
Authored: Thu Mar 20 12:23:08 2014 -0700
Committer: kaosko <ka...@apache.org>
Committed: Thu Mar 20 12:23:08 2014 -0700
----------------------------------------------------------------------
plastic/LICENSE-ASM-3_3_1.txt | 29 -
plastic/LICENSE-ASM-5_0.txt | 29 +
plastic/NOTICE.txt | 4 +-
.../internal/plastic/asm/AnnotationVisitor.java | 82 +-
.../internal/plastic/asm/AnnotationWriter.java | 123 +-
.../internal/plastic/asm/Attribute.java | 213 +-
.../internal/plastic/asm/ByteVector.java | 168 +-
.../internal/plastic/asm/ClassReader.java | 3350 ++++++++++--------
.../internal/plastic/asm/ClassVisitor.java | 291 +-
.../internal/plastic/asm/ClassWriter.java | 666 ++--
.../tapestry5/internal/plastic/asm/Context.java | 145 +
.../tapestry5/internal/plastic/asm/Edge.java | 2 +-
.../internal/plastic/asm/FieldVisitor.java | 75 +-
.../internal/plastic/asm/FieldWriter.java | 138 +-
.../tapestry5/internal/plastic/asm/Frame.java | 1087 +++---
.../tapestry5/internal/plastic/asm/Handle.java | 65 +-
.../tapestry5/internal/plastic/asm/Handler.java | 13 +-
.../tapestry5/internal/plastic/asm/Item.java | 188 +-
.../tapestry5/internal/plastic/asm/Label.java | 169 +-
.../internal/plastic/asm/MethodVisitor.java | 808 +++--
.../internal/plastic/asm/MethodWriter.java | 1444 ++++----
.../tapestry5/internal/plastic/asm/Opcodes.java | 9 +-
.../tapestry5/internal/plastic/asm/Type.java | 333 +-
.../internal/plastic/asm/TypePath.java | 193 +
.../internal/plastic/asm/TypeReference.java | 452 +++
.../plastic/asm/commons/AdviceAdapter.java | 646 ++++
.../plastic/asm/commons/AnalyzerAdapter.java | 947 +++++
.../plastic/asm/commons/CodeSizeEvaluator.java | 238 ++
.../plastic/asm/commons/GeneratorAdapter.java | 1628 +++++++++
.../plastic/asm/commons/InstructionAdapter.java | 1170 ++++++
.../plastic/asm/commons/JSRInlinerAdapter.java | 333 +-
.../asm/commons/LocalVariablesSorter.java | 381 ++
.../internal/plastic/asm/commons/Method.java | 282 ++
.../internal/plastic/asm/commons/Remapper.java | 223 ++
.../asm/commons/RemappingAnnotationAdapter.java | 79 +
.../asm/commons/RemappingClassAdapter.java | 135 +
.../asm/commons/RemappingFieldAdapter.java | 71 +
.../asm/commons/RemappingMethodAdapter.java | 224 ++
.../asm/commons/RemappingSignatureAdapter.java | 155 +
.../asm/commons/SerialVersionUIDAdder.java | 538 +++
.../plastic/asm/commons/SimpleRemapper.java | 69 +
.../plastic/asm/commons/StaticInitMerger.java | 97 +
.../asm/commons/TableSwitchGenerator.java | 57 +
.../asm/commons/TryCatchBlockSorter.java | 96 +
.../internal/plastic/asm/commons/package.html | 48 +
.../optimizer/AnnotationConstantsCollector.java | 147 +
.../asm/optimizer/ClassConstantsCollector.java | 198 ++
.../plastic/asm/optimizer/ClassOptimizer.java | 175 +
.../plastic/asm/optimizer/Constant.java | 323 ++
.../plastic/asm/optimizer/ConstantPool.java | 249 ++
.../asm/optimizer/FieldConstantsCollector.java | 89 +
.../plastic/asm/optimizer/JarOptimizer.java | 235 ++
.../asm/optimizer/MethodConstantsCollector.java | 224 ++
.../plastic/asm/optimizer/MethodOptimizer.java | 187 +
.../plastic/asm/optimizer/NameMapping.java | 114 +
.../plastic/asm/optimizer/Shrinker.java | 283 ++
.../plastic/asm/optimizer/jdk1.2.2_017.txt.gz | Bin 0 -> 113814 bytes
.../plastic/asm/optimizer/jdk1.3.1_19.txt.gz | Bin 0 -> 128067 bytes
.../asm/optimizer/shrink-annotations.properties | 53 +
.../asm/optimizer/shrink-frames.properties | 62 +
.../asm/optimizer/shrink-resize.properties | 37 +
.../asm/optimizer/shrink-signatures.properties | 43 +
.../asm/optimizer/shrink-writer.properties | 66 +
.../plastic/asm/optimizer/shrink.properties | 380 ++
.../plastic/asm/signature/SignatureReader.java | 191 +-
.../plastic/asm/signature/SignatureVisitor.java | 88 +-
.../plastic/asm/signature/SignatureWriter.java | 6 +-
.../plastic/asm/tree/AbstractInsnNode.java | 132 +-
.../plastic/asm/tree/AnnotationNode.java | 72 +-
.../internal/plastic/asm/tree/ClassNode.java | 199 +-
.../plastic/asm/tree/FieldInsnNode.java | 48 +-
.../internal/plastic/asm/tree/FieldNode.java | 198 +-
.../internal/plastic/asm/tree/FrameNode.java | 141 +-
.../internal/plastic/asm/tree/IincInsnNode.java | 17 +-
.../plastic/asm/tree/InnerClassNode.java | 46 +-
.../internal/plastic/asm/tree/InsnList.java | 184 +-
.../internal/plastic/asm/tree/InsnNode.java | 46 +-
.../internal/plastic/asm/tree/IntInsnNode.java | 26 +-
.../plastic/asm/tree/InvokeDynamicInsnNode.java | 32 +-
.../internal/plastic/asm/tree/JumpInsnNode.java | 39 +-
.../internal/plastic/asm/tree/LabelNode.java | 4 +-
.../internal/plastic/asm/tree/LdcInsnNode.java | 18 +-
.../plastic/asm/tree/LineNumberNode.java | 16 +-
.../asm/tree/LocalVariableAnnotationNode.java | 157 +
.../plastic/asm/tree/LocalVariableNode.java | 51 +-
.../plastic/asm/tree/LookupSwitchInsnNode.java | 36 +-
.../plastic/asm/tree/MethodInsnNode.java | 77 +-
.../internal/plastic/asm/tree/MethodNode.java | 542 ++-
.../asm/tree/MultiANewArrayInsnNode.java | 17 +-
.../plastic/asm/tree/ParameterNode.java | 76 +
.../plastic/asm/tree/TableSwitchInsnNode.java | 41 +-
.../plastic/asm/tree/TryCatchBlockNode.java | 97 +-
.../plastic/asm/tree/TypeAnnotationNode.java | 100 +
.../internal/plastic/asm/tree/TypeInsnNode.java | 28 +-
.../internal/plastic/asm/tree/VarInsnNode.java | 34 +-
.../plastic/asm/tree/analysis/Analyzer.java | 549 +++
.../asm/tree/analysis/AnalyzerException.java | 61 +
.../asm/tree/analysis/BasicInterpreter.java | 358 ++
.../plastic/asm/tree/analysis/BasicValue.java | 111 +
.../asm/tree/analysis/BasicVerifier.java | 433 +++
.../plastic/asm/tree/analysis/Frame.java | 738 ++++
.../plastic/asm/tree/analysis/Interpreter.java | 226 ++
.../asm/tree/analysis/SimpleVerifier.java | 320 ++
.../plastic/asm/tree/analysis/SmallSet.java | 134 +
.../asm/tree/analysis/SourceInterpreter.java | 198 ++
.../plastic/asm/tree/analysis/SourceValue.java | 97 +
.../plastic/asm/tree/analysis/Subroutine.java | 90 +
.../plastic/asm/tree/analysis/Value.java | 45 +
.../plastic/asm/tree/analysis/package.html | 67 +
.../internal/plastic/asm/util/ASMifiable.java | 19 +-
.../internal/plastic/asm/util/ASMifier.java | 1285 +++++++
.../asm/util/CheckAnnotationAdapter.java | 136 +
.../plastic/asm/util/CheckClassAdapter.java | 1009 ++++++
.../plastic/asm/util/CheckFieldAdapter.java | 122 +
.../plastic/asm/util/CheckMethodAdapter.java | 1542 ++++++++
.../plastic/asm/util/CheckSignatureAdapter.java | 330 ++
.../internal/plastic/asm/util/Printer.java | 421 ++-
.../internal/plastic/asm/util/Textifiable.java | 16 +-
.../internal/plastic/asm/util/Textifier.java | 732 ++--
.../asm/util/TraceAnnotationVisitor.java | 32 +-
.../plastic/asm/util/TraceClassVisitor.java | 158 +-
.../plastic/asm/util/TraceFieldVisitor.java | 27 +-
.../plastic/asm/util/TraceMethodVisitor.java | 172 +-
.../plastic/asm/util/TraceSignatureVisitor.java | 70 +-
.../plastic/asm/xml/ASMContentHandler.java | 1453 ++++++++
.../internal/plastic/asm/xml/Processor.java | 1044 ++++++
.../internal/plastic/asm/xml/SAXAdapter.java | 89 +
.../plastic/asm/xml/SAXAnnotationAdapter.java | 242 ++
.../plastic/asm/xml/SAXClassAdapter.java | 335 ++
.../plastic/asm/xml/SAXCodeAdapter.java | 415 +++
.../plastic/asm/xml/SAXFieldAdapter.java | 71 +
.../internal/plastic/asm/xml/asm-xml.dtd | 349 ++
.../internal/plastic/asm/xml/package.html | 96 +
133 files changed, 30904 insertions(+), 5805 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/1acd9d22/plastic/LICENSE-ASM-3_3_1.txt
----------------------------------------------------------------------
diff --git a/plastic/LICENSE-ASM-3_3_1.txt b/plastic/LICENSE-ASM-3_3_1.txt
deleted file mode 100644
index c5aba7b..0000000
--- a/plastic/LICENSE-ASM-3_3_1.txt
+++ /dev/null
@@ -1,29 +0,0 @@
-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.
http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/1acd9d22/plastic/LICENSE-ASM-5_0.txt
----------------------------------------------------------------------
diff --git a/plastic/LICENSE-ASM-5_0.txt b/plastic/LICENSE-ASM-5_0.txt
new file mode 100644
index 0000000..c5aba7b
--- /dev/null
+++ b/plastic/LICENSE-ASM-5_0.txt
@@ -0,0 +1,29 @@
+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.
http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/1acd9d22/plastic/NOTICE.txt
----------------------------------------------------------------------
diff --git a/plastic/NOTICE.txt b/plastic/NOTICE.txt
index 96158f5..ec83bda 100644
--- a/plastic/NOTICE.txt
+++ b/plastic/NOTICE.txt
@@ -1,6 +1,6 @@
This product includes software developed by
The Apache Software Foundation (http://www.apache.org/).
-This product imports and repackages ASM 3.3.1 code which is
-released under the BSD License
+This product imports and repackages ASM 5.0 code which is
+released under a BSD style License
http://asm.ow2.org/license.html
http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/1acd9d22/plastic/src/external/java/org/apache/tapestry5/internal/plastic/asm/AnnotationVisitor.java
----------------------------------------------------------------------
diff --git a/plastic/src/external/java/org/apache/tapestry5/internal/plastic/asm/AnnotationVisitor.java b/plastic/src/external/java/org/apache/tapestry5/internal/plastic/asm/AnnotationVisitor.java
index 693b355..1102d54 100644
--- a/plastic/src/external/java/org/apache/tapestry5/internal/plastic/asm/AnnotationVisitor.java
+++ b/plastic/src/external/java/org/apache/tapestry5/internal/plastic/asm/AnnotationVisitor.java
@@ -33,7 +33,7 @@ package org.apache.tapestry5.internal.plastic.asm;
* A visitor to visit a Java annotation. The methods of this class 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
*/
@@ -41,7 +41,7 @@ public abstract class AnnotationVisitor {
/**
* The ASM API version implemented by this visitor. The value of this field
- * must be one of {@link Opcodes#ASM4}.
+ * must be one of {@link Opcodes#ASM4} or {@link Opcodes#ASM5}.
*/
protected final int api;
@@ -53,9 +53,10 @@ public abstract class AnnotationVisitor {
/**
* Constructs a new {@link AnnotationVisitor}.
- *
- * @param api the ASM API version implemented by this visitor. Must be one
- * of {@link Opcodes#ASM4}.
+ *
+ * @param api
+ * the ASM API version implemented by this visitor. Must be one
+ * of {@link Opcodes#ASM4} or {@link Opcodes#ASM5}.
*/
public AnnotationVisitor(final int api) {
this(api, null);
@@ -63,31 +64,36 @@ public abstract class AnnotationVisitor {
/**
* Constructs a new {@link AnnotationVisitor}.
- *
- * @param api the ASM API version implemented by this visitor. Must be one
- * of {@link Opcodes#ASM4}.
- * @param av the annotation visitor to which this visitor must delegate
- * method calls. May be null.
+ *
+ * @param api
+ * the ASM API version implemented by this visitor. Must be one
+ * of {@link Opcodes#ASM4} or {@link Opcodes#ASM5}.
+ * @param av
+ * the annotation visitor to which this visitor must delegate
+ * method calls. May be null.
*/
public AnnotationVisitor(final int api, final AnnotationVisitor av) {
- /*if (api != Opcodes.ASM4) {
+ if (api != Opcodes.ASM4 && api != Opcodes.ASM5) {
throw new IllegalArgumentException();
- }*/
+ }
this.api = api;
this.av = av;
}
/**
* 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} or OBJECT or ARRAY sort. 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).
+ *
+ * @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} or OBJECT or ARRAY sort. 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).
*/
public void visit(String name, Object value) {
if (av != null) {
@@ -97,10 +103,13 @@ public abstract class AnnotationVisitor {
/**
* 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.
+ *
+ * @param name
+ * the value name.
+ * @param desc
+ * the class descriptor of the enumeration class.
+ * @param value
+ * the actual enumeration value.
*/
public void visitEnum(String name, String desc, String value) {
if (av != null) {
@@ -110,13 +119,15 @@ public abstract class AnnotationVisitor {
/**
* Visits a nested annotation value of the annotation.
- *
- * @param name the value name.
- * @param desc the class descriptor of the nested annotation class.
+ *
+ * @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
+ * <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>.
*/
public AnnotationVisitor visitAnnotation(String name, String desc) {
@@ -131,11 +142,12 @@ public abstract class AnnotationVisitor {
* 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.
+ *
+ * @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
+ * <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>.
*/
http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/1acd9d22/plastic/src/external/java/org/apache/tapestry5/internal/plastic/asm/AnnotationWriter.java
----------------------------------------------------------------------
diff --git a/plastic/src/external/java/org/apache/tapestry5/internal/plastic/asm/AnnotationWriter.java b/plastic/src/external/java/org/apache/tapestry5/internal/plastic/asm/AnnotationWriter.java
index a26f5ca..679aa66 100644
--- a/plastic/src/external/java/org/apache/tapestry5/internal/plastic/asm/AnnotationWriter.java
+++ b/plastic/src/external/java/org/apache/tapestry5/internal/plastic/asm/AnnotationWriter.java
@@ -31,7 +31,7 @@ package org.apache.tapestry5.internal.plastic.asm;
/**
* An {@link AnnotationVisitor} that generates annotations in bytecode form.
- *
+ *
* @author Eric Bruneton
* @author Eugene Kuleshov
*/
@@ -89,22 +89,22 @@ final class AnnotationWriter extends AnnotationVisitor {
/**
* 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.
+ *
+ * @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)
- {
- super(Opcodes.ASM4);
+ AnnotationWriter(final ClassWriter cw, final boolean named,
+ final ByteVector bv, final ByteVector parent, final int offset) {
+ super(Opcodes.ASM5);
this.cw = cw;
this.named = named;
this.bv = bv;
@@ -190,11 +190,8 @@ final class AnnotationWriter extends AnnotationVisitor {
}
@Override
- public void visitEnum(
- final String name,
- final String desc,
- final String value)
- {
+ public void visitEnum(final String name, final String desc,
+ final String value) {
++size;
if (named) {
bv.putShort(cw.newUTF8(name));
@@ -203,10 +200,8 @@ final class AnnotationWriter extends AnnotationVisitor {
}
@Override
- public AnnotationVisitor visitAnnotation(
- final String name,
- final String desc)
- {
+ public AnnotationVisitor visitAnnotation(final String name,
+ final String desc) {
++size;
if (named) {
bv.putShort(cw.newUTF8(name));
@@ -242,7 +237,7 @@ final class AnnotationWriter extends AnnotationVisitor {
/**
* Returns the size of this annotation writer list.
- *
+ *
* @return the size of this annotation writer list.
*/
int getSize() {
@@ -258,8 +253,9 @@ final class AnnotationWriter extends AnnotationVisitor {
/**
* Puts the annotations of this annotation writer list into the given byte
* vector.
- *
- * @param out where the annotations must be put.
+ *
+ * @param out
+ * where the annotations must be put.
*/
void put(final ByteVector out) {
int n = 0;
@@ -285,16 +281,16 @@ final class AnnotationWriter extends AnnotationVisitor {
/**
* 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.
+ *
+ * @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)
- {
+ 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();
@@ -319,4 +315,57 @@ final class AnnotationWriter extends AnnotationVisitor {
}
}
}
+
+ /**
+ * Puts the given type reference and type path into the given bytevector.
+ * LOCAL_VARIABLE and RESOURCE_VARIABLE target types are not supported.
+ *
+ * @param typeRef
+ * a reference to the annotated type. See {@link TypeReference}.
+ * @param typePath
+ * the path to the annotated type argument, wildcard bound, array
+ * element type, or static inner type within 'typeRef'. May be
+ * <tt>null</tt> if the annotation targets 'typeRef' as a whole.
+ * @param out
+ * where the type reference and type path must be put.
+ */
+ static void putTarget(int typeRef, TypePath typePath, ByteVector out) {
+ switch (typeRef >>> 24) {
+ case 0x00: // CLASS_TYPE_PARAMETER
+ case 0x01: // METHOD_TYPE_PARAMETER
+ case 0x16: // METHOD_FORMAL_PARAMETER
+ out.putShort(typeRef >>> 16);
+ break;
+ case 0x13: // FIELD
+ case 0x14: // METHOD_RETURN
+ case 0x15: // METHOD_RECEIVER
+ out.putByte(typeRef >>> 24);
+ break;
+ case 0x47: // CAST
+ case 0x48: // CONSTRUCTOR_INVOCATION_TYPE_ARGUMENT
+ case 0x49: // METHOD_INVOCATION_TYPE_ARGUMENT
+ case 0x4A: // CONSTRUCTOR_REFERENCE_TYPE_ARGUMENT
+ case 0x4B: // METHOD_REFERENCE_TYPE_ARGUMENT
+ out.putInt(typeRef);
+ break;
+ // case 0x10: // CLASS_EXTENDS
+ // case 0x11: // CLASS_TYPE_PARAMETER_BOUND
+ // case 0x12: // METHOD_TYPE_PARAMETER_BOUND
+ // case 0x17: // THROWS
+ // case 0x42: // EXCEPTION_PARAMETER
+ // case 0x43: // INSTANCEOF
+ // case 0x44: // NEW
+ // case 0x45: // CONSTRUCTOR_REFERENCE
+ // case 0x46: // METHOD_REFERENCE
+ default:
+ out.put12(typeRef >>> 24, (typeRef & 0xFFFF00) >> 8);
+ break;
+ }
+ if (typePath == null) {
+ out.putByte(0);
+ } else {
+ int length = typePath.b[typePath.offset] * 2 + 1;
+ out.putByteArray(typePath.b, typePath.offset, length);
+ }
+ }
}
http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/1acd9d22/plastic/src/external/java/org/apache/tapestry5/internal/plastic/asm/Attribute.java
----------------------------------------------------------------------
diff --git a/plastic/src/external/java/org/apache/tapestry5/internal/plastic/asm/Attribute.java b/plastic/src/external/java/org/apache/tapestry5/internal/plastic/asm/Attribute.java
index 8f29872..fae580f 100644
--- a/plastic/src/external/java/org/apache/tapestry5/internal/plastic/asm/Attribute.java
+++ b/plastic/src/external/java/org/apache/tapestry5/internal/plastic/asm/Attribute.java
@@ -31,7 +31,7 @@ package org.apache.tapestry5.internal.plastic.asm;
/**
* A non standard class, field, method or code attribute.
- *
+ *
* @author Eric Bruneton
* @author Eugene Kuleshov
*/
@@ -54,8 +54,9 @@ public class Attribute {
/**
* Constructs a new empty attribute.
- *
- * @param type the type of the attribute.
+ *
+ * @param type
+ * the type of the attribute.
*/
protected Attribute(final String type) {
this.type = type;
@@ -64,7 +65,7 @@ public class Attribute {
/**
* 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() {
@@ -73,7 +74,7 @@ public class Attribute {
/**
* 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() {
@@ -82,7 +83,7 @@ public class Attribute {
/**
* 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.
*/
@@ -91,39 +92,39 @@ public class Attribute {
}
/**
- * 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.
+ * 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)
- {
+ 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);
@@ -132,31 +133,31 @@ public class Attribute {
/**
* 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.
+ *
+ * @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)
- {
+ 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;
@@ -165,7 +166,7 @@ public class Attribute {
/**
* 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() {
@@ -180,31 +181,31 @@ public class Attribute {
/**
* 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.
+ *
+ * @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)
- {
+ 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) {
@@ -218,31 +219,31 @@ public class Attribute {
/**
* 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.
+ *
+ * @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)
- {
+ 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);
http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/1acd9d22/plastic/src/external/java/org/apache/tapestry5/internal/plastic/asm/ByteVector.java
----------------------------------------------------------------------
diff --git a/plastic/src/external/java/org/apache/tapestry5/internal/plastic/asm/ByteVector.java b/plastic/src/external/java/org/apache/tapestry5/internal/plastic/asm/ByteVector.java
index e689d87..24506f9 100644
--- a/plastic/src/external/java/org/apache/tapestry5/internal/plastic/asm/ByteVector.java
+++ b/plastic/src/external/java/org/apache/tapestry5/internal/plastic/asm/ByteVector.java
@@ -32,7 +32,7 @@ package org.apache.tapestry5.internal.plastic.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 {
@@ -58,8 +58,9 @@ public class ByteVector {
/**
* Constructs a new {@link ByteVector ByteVector} with the given initial
* size.
- *
- * @param initialSize the initial size of the byte vector to be constructed.
+ *
+ * @param initialSize
+ * the initial size of the byte vector to be constructed.
*/
public ByteVector(final int initialSize) {
data = new byte[initialSize];
@@ -68,8 +69,9 @@ public class ByteVector {
/**
* Puts a byte into this byte vector. The byte vector is automatically
* enlarged if necessary.
- *
- * @param b a byte.
+ *
+ * @param b
+ * a byte.
* @return this byte vector.
*/
public ByteVector putByte(final int b) {
@@ -85,9 +87,11 @@ public class ByteVector {
/**
* Puts two bytes into this byte vector. The byte vector is automatically
* enlarged if necessary.
- *
- * @param b1 a byte.
- * @param b2 another byte.
+ *
+ * @param b1
+ * a byte.
+ * @param b2
+ * another byte.
* @return this byte vector.
*/
ByteVector put11(final int b1, final int b2) {
@@ -105,8 +109,9 @@ public class ByteVector {
/**
* Puts a short into this byte vector. The byte vector is automatically
* enlarged if necessary.
- *
- * @param s a short.
+ *
+ * @param s
+ * a short.
* @return this byte vector.
*/
public ByteVector putShort(final int s) {
@@ -124,9 +129,11 @@ public class ByteVector {
/**
* 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.
+ *
+ * @param b
+ * a byte.
+ * @param s
+ * a short.
* @return this byte vector.
*/
ByteVector put12(final int b, final int s) {
@@ -145,8 +152,9 @@ public class ByteVector {
/**
* Puts an int into this byte vector. The byte vector is automatically
* enlarged if necessary.
- *
- * @param i an int.
+ *
+ * @param i
+ * an int.
* @return this byte vector.
*/
public ByteVector putInt(final int i) {
@@ -166,8 +174,9 @@ public class ByteVector {
/**
* Puts a long into this byte vector. The byte vector is automatically
* enlarged if necessary.
- *
- * @param l a long.
+ *
+ * @param l
+ * a long.
* @return this byte vector.
*/
public ByteVector putLong(final long l) {
@@ -193,12 +202,16 @@ public class ByteVector {
/**
* Puts an UTF8 string into this byte vector. The byte vector is
* automatically enlarged if necessary.
- *
- * @param s a String.
+ *
+ * @param s
+ * a String whose UTF8 encoded length must be less than 65536.
* @return this byte vector.
*/
public ByteVector putUTF8(final String s) {
int charLength = s.length();
+ if (charLength > 65535) {
+ throw new IllegalArgumentException();
+ }
int len = length;
if (len + 2 + charLength > data.length) {
enlarge(2 + charLength);
@@ -217,38 +230,68 @@ public class ByteVector {
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 encodeUTF8(s, i, 65535);
+ }
+ }
+ length = len;
+ return this;
+ }
+
+ /**
+ * Puts an UTF8 string into this byte vector. The byte vector is
+ * automatically enlarged if necessary. The string length is encoded in two
+ * bytes before the encoded characters, if there is space for that (i.e. if
+ * this.length - i - 2 >= 0).
+ *
+ * @param s
+ * the String to encode.
+ * @param i
+ * the index of the first character to encode. The previous
+ * characters are supposed to have already been encoded, using
+ * only one byte per character.
+ * @param maxByteLength
+ * the maximum byte length of the encoded string, including the
+ * already encoded characters.
+ * @return this byte vector.
+ */
+ ByteVector encodeUTF8(final String s, int i, int maxByteLength) {
+ int charLength = s.length();
+ int byteLength = i;
+ char c;
+ 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;
+ }
+ }
+ if (byteLength > maxByteLength) {
+ throw new IllegalArgumentException();
+ }
+ int start = length - i - 2;
+ if (start >= 0) {
+ data[start] = (byte) (byteLength >>> 8);
+ data[start + 1] = (byte) byteLength;
+ }
+ if (length + byteLength - i > data.length) {
+ enlarge(byteLength - i);
+ }
+ int len = length;
+ 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);
}
}
length = len;
@@ -258,15 +301,17 @@ public class ByteVector {
/**
* 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.
+ *
+ * @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)
- {
+ public ByteVector putByteArray(final byte[] b, final int off, final int len) {
if (length + len > data.length) {
enlarge(len);
}
@@ -279,9 +324,10 @@ public class ByteVector {
/**
* 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.
+ *
+ * @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;