You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tapestry.apache.org by th...@apache.org on 2018/11/29 00:33:51 UTC
[04/46] tapestry-5 git commit: TAP5-2588: upgrading from ASM 6 to 7
for Java 9+ support
http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/1c71aec7/plastic/src/external/java/org/apache/tapestry5/internal/plastic/asm/util/TraceAnnotationVisitor.java
----------------------------------------------------------------------
diff --git a/plastic/src/external/java/org/apache/tapestry5/internal/plastic/asm/util/TraceAnnotationVisitor.java b/plastic/src/external/java/org/apache/tapestry5/internal/plastic/asm/util/TraceAnnotationVisitor.java
old mode 100644
new mode 100755
index dbccd3c..e991756
--- a/plastic/src/external/java/org/apache/tapestry5/internal/plastic/asm/util/TraceAnnotationVisitor.java
+++ b/plastic/src/external/java/org/apache/tapestry5/internal/plastic/asm/util/TraceAnnotationVisitor.java
@@ -1,89 +1,93 @@
-/***
- * ASM: a very small and fast Java bytecode manipulation framework
- * Copyright (c) 2000-2011 INRIA, France Telecom
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the copyright holders nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
- * THE POSSIBILITY OF SUCH DAMAGE.
- */
+// ASM: a very small and fast Java bytecode manipulation framework
+// Copyright (c) 2000-2011 INRIA, France Telecom
+// All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions
+// are met:
+// 1. Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// 2. Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in the
+// documentation and/or other materials provided with the distribution.
+// 3. Neither the name of the copyright holders nor the names of its
+// contributors may be used to endorse or promote products derived from
+// this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+// THE POSSIBILITY OF SUCH DAMAGE.
package org.apache.tapestry5.internal.plastic.asm.util;
import org.apache.tapestry5.internal.plastic.asm.AnnotationVisitor;
import org.apache.tapestry5.internal.plastic.asm.Opcodes;
/**
- * An {@link AnnotationVisitor} that prints the annotations it visits with a
- * {@link Printer}.
- *
+ * An {@link AnnotationVisitor} that prints the annotations it visits with a {@link Printer}.
+ *
* @author Eric Bruneton
*/
public final class TraceAnnotationVisitor extends AnnotationVisitor {
- private final Printer p;
+ /** The printer to convert the visited annotation into text. */
+ private final Printer printer;
- public TraceAnnotationVisitor(final Printer p) {
- this(null, p);
- }
+ /**
+ * Constructs a new {@link TraceAnnotationVisitor}.
+ *
+ * @param printer the printer to convert the visited annotation into text.
+ */
+ public TraceAnnotationVisitor(final Printer printer) {
+ this(null, printer);
+ }
- public TraceAnnotationVisitor(final AnnotationVisitor av, final Printer p) {
- super(Opcodes.ASM6, av);
- this.p = p;
- }
+ /**
+ * Constructs a new {@link TraceAnnotationVisitor}.
+ *
+ * @param annotationVisitor the annotation visitor to which to delegate calls. May be {@literal
+ * null}.
+ * @param printer the printer to convert the visited annotation into text.
+ */
+ public TraceAnnotationVisitor(final AnnotationVisitor annotationVisitor, final Printer printer) {
+ super(Opcodes.ASM7, annotationVisitor);
+ this.printer = printer;
+ }
- @Override
- public void visit(final String name, final Object value) {
- p.visit(name, value);
- super.visit(name, value);
- }
+ @Override
+ public void visit(final String name, final Object value) {
+ printer.visit(name, value);
+ super.visit(name, value);
+ }
- @Override
- public void visitEnum(final String name, final String desc,
- final String value) {
- p.visitEnum(name, desc, value);
- super.visitEnum(name, desc, value);
- }
+ @Override
+ public void visitEnum(final String name, final String descriptor, final String value) {
+ printer.visitEnum(name, descriptor, value);
+ super.visitEnum(name, descriptor, value);
+ }
- @Override
- public AnnotationVisitor visitAnnotation(final String name,
- final String desc) {
- Printer p = this.p.visitAnnotation(name, desc);
- AnnotationVisitor av = this.av == null ? null : this.av
- .visitAnnotation(name, desc);
- return new TraceAnnotationVisitor(av, p);
- }
+ @Override
+ public AnnotationVisitor visitAnnotation(final String name, final String descriptor) {
+ Printer annotationPrinter = printer.visitAnnotation(name, descriptor);
+ return new TraceAnnotationVisitor(super.visitAnnotation(name, descriptor), annotationPrinter);
+ }
- @Override
- public AnnotationVisitor visitArray(final String name) {
- Printer p = this.p.visitArray(name);
- AnnotationVisitor av = this.av == null ? null : this.av
- .visitArray(name);
- return new TraceAnnotationVisitor(av, p);
- }
+ @Override
+ public AnnotationVisitor visitArray(final String name) {
+ Printer arrayPrinter = printer.visitArray(name);
+ return new TraceAnnotationVisitor(super.visitArray(name), arrayPrinter);
+ }
- @Override
- public void visitEnd() {
- p.visitAnnotationEnd();
- super.visitEnd();
- }
+ @Override
+ public void visitEnd() {
+ printer.visitAnnotationEnd();
+ super.visitEnd();
+ }
}
http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/1c71aec7/plastic/src/external/java/org/apache/tapestry5/internal/plastic/asm/util/TraceClassVisitor.java
----------------------------------------------------------------------
diff --git a/plastic/src/external/java/org/apache/tapestry5/internal/plastic/asm/util/TraceClassVisitor.java b/plastic/src/external/java/org/apache/tapestry5/internal/plastic/asm/util/TraceClassVisitor.java
old mode 100644
new mode 100755
index 95435fe..4dc095a
--- a/plastic/src/external/java/org/apache/tapestry5/internal/plastic/asm/util/TraceClassVisitor.java
+++ b/plastic/src/external/java/org/apache/tapestry5/internal/plastic/asm/util/TraceClassVisitor.java
@@ -1,36 +1,33 @@
-/***
- * ASM: a very small and fast Java bytecode manipulation framework
- * Copyright (c) 2000-2011 INRIA, France Telecom
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the copyright holders nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
- * THE POSSIBILITY OF SUCH DAMAGE.
- */
+// ASM: a very small and fast Java bytecode manipulation framework
+// Copyright (c) 2000-2011 INRIA, France Telecom
+// All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions
+// are met:
+// 1. Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// 2. Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in the
+// documentation and/or other materials provided with the distribution.
+// 3. Neither the name of the copyright holders nor the names of its
+// contributors may be used to endorse or promote products derived from
+// this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+// THE POSSIBILITY OF SUCH DAMAGE.
package org.apache.tapestry5.internal.plastic.asm.util;
import java.io.PrintWriter;
-
import org.apache.tapestry5.internal.plastic.asm.AnnotationVisitor;
import org.apache.tapestry5.internal.plastic.asm.Attribute;
import org.apache.tapestry5.internal.plastic.asm.ClassVisitor;
@@ -41,189 +38,192 @@ import org.apache.tapestry5.internal.plastic.asm.Opcodes;
import org.apache.tapestry5.internal.plastic.asm.TypePath;
/**
- * A {@link ClassVisitor} that prints the classes it visits with a
- * {@link Printer}. This class visitor can be used in the middle of a class
- * visitor chain to trace the class that is visited at a given point in this
- * chain. This may be useful for debugging purposes.
- * <p>
- * The trace printed when visiting the <tt>Hello</tt> class is the following:
- * <p>
- * <blockquote>
- *
+ * A {@link ClassVisitor} that prints the classes it visits with a {@link Printer}. This class
+ * visitor can be used in the middle of a class visitor chain to trace the class that is visited at
+ * a given point in this chain. This may be useful for debugging purposes.
+ *
+ * <p>When used with a {@link Textifier}, the trace printed when visiting the {@code Hello} class is
+ * the following:
+ *
* <pre>
* // class version 49.0 (49) // access flags 0x21 public class Hello {
- *
+ *
* // compiled from: Hello.java
- *
- * // access flags 0x1 public <init> ()V ALOAD 0 INVOKESPECIAL
- * java/lang/Object <init> ()V RETURN MAXSTACK = 1 MAXLOCALS = 1
- *
- * // access flags 0x9 public static main ([Ljava/lang/String;)V GETSTATIC
- * java/lang/System out Ljava/io/PrintStream; LDC "hello"
- * INVOKEVIRTUAL java/io/PrintStream println (Ljava/lang/String;)V RETURN
- * MAXSTACK = 2 MAXLOCALS = 1 }
+ *
+ * // access flags 0x1
+ * public <init> ()V
+ * ALOAD 0
+ * INVOKESPECIAL java/lang/Object <init> ()V
+ * RETURN
+ * MAXSTACK = 1 MAXLOCALS = 1
+ *
+ * // access flags 0x9
+ * public static main ([Ljava/lang/String;)V
+ * GETSTATIC java/lang/System out Ljava/io/PrintStream;
+ * LDC "hello"
+ * INVOKEVIRTUAL java/io/PrintStream println (Ljava/lang/String;)V
+ * RETURN
+ * MAXSTACK = 2 MAXLOCALS = 1
+ * }
* </pre>
- *
- * </blockquote> where <tt>Hello</tt> is defined by:
- * <p>
- * <blockquote>
- *
+ *
+ * <p>where {@code Hello} is defined by:
+ *
* <pre>
* public class Hello {
- *
- * public static void main(String[] args) {
- * System.out.println("hello");
- * }
+ *
+ * public static void main(String[] args) {
+ * System.out.println("hello");
+ * }
* }
* </pre>
- *
- * </blockquote>
- *
+ *
* @author Eric Bruneton
* @author Eugene Kuleshov
*/
public final class TraceClassVisitor extends ClassVisitor {
- /**
- * The print writer to be used to print the class. May be null.
- */
- private final PrintWriter pw;
-
- /**
- * The object that actually converts visit events into text.
- */
- public final Printer p;
-
- /**
- * Constructs a new {@link TraceClassVisitor}.
- *
- * @param pw
- * the print writer to be used to print the class.
- */
- public TraceClassVisitor(final PrintWriter pw) {
- this(null, pw);
- }
-
- /**
- * Constructs a new {@link TraceClassVisitor}.
- *
- * @param cv
- * the {@link ClassVisitor} to which this visitor delegates
- * calls. May be <tt>null</tt>.
- * @param pw
- * the print writer to be used to print the class.
- */
- public TraceClassVisitor(final ClassVisitor cv, final PrintWriter pw) {
- this(cv, new Textifier(), pw);
- }
-
- /**
- * Constructs a new {@link TraceClassVisitor}.
- *
- * @param cv
- * the {@link ClassVisitor} to which this visitor delegates
- * calls. May be <tt>null</tt>.
- * @param p
- * the object that actually converts visit events into text.
- * @param pw
- * the print writer to be used to print the class. May be null if
- * you simply want to use the result via
- * {@link Printer#getText()}, instead of printing it.
- */
- public TraceClassVisitor(final ClassVisitor cv, final Printer p,
- final PrintWriter pw) {
- super(Opcodes.ASM6, cv);
- this.pw = pw;
- this.p = p;
- }
-
- @Override
- public void visit(final int version, final int access, final String name,
- final String signature, final String superName,
- final String[] interfaces) {
- p.visit(version, access, name, signature, superName, interfaces);
- super.visit(version, access, name, signature, superName, interfaces);
- }
-
- @Override
- public void visitSource(final String file, final String debug) {
- p.visitSource(file, debug);
- super.visitSource(file, debug);
- }
-
- @Override
- public ModuleVisitor visitModule(String name, int flags,
- String version) {
- Printer p = this.p.visitModule(name, flags, version);
- ModuleVisitor mv = super.visitModule(name, flags, version);
- return new TraceModuleVisitor(mv, p);
- }
-
- @Override
- public void visitOuterClass(final String owner, final String name,
- final String desc) {
- p.visitOuterClass(owner, name, desc);
- super.visitOuterClass(owner, name, desc);
- }
-
- @Override
- public AnnotationVisitor visitAnnotation(final String desc,
- final boolean visible) {
- Printer p = this.p.visitClassAnnotation(desc, visible);
- AnnotationVisitor av = cv == null ? null : cv.visitAnnotation(desc,
- visible);
- return new TraceAnnotationVisitor(av, p);
- }
-
- @Override
- public AnnotationVisitor visitTypeAnnotation(int typeRef,
- TypePath typePath, String desc, boolean visible) {
- Printer p = this.p.visitClassTypeAnnotation(typeRef, typePath, desc,
- visible);
- AnnotationVisitor av = cv == null ? null : cv.visitTypeAnnotation(
- typeRef, typePath, desc, visible);
- return new TraceAnnotationVisitor(av, p);
- }
-
- @Override
- public void visitAttribute(final Attribute attr) {
- p.visitClassAttribute(attr);
- super.visitAttribute(attr);
- }
-
- @Override
- public void visitInnerClass(final String name, final String outerName,
- final String innerName, final int access) {
- p.visitInnerClass(name, outerName, innerName, access);
- super.visitInnerClass(name, outerName, innerName, access);
- }
-
- @Override
- public FieldVisitor visitField(final int access, final String name,
- final String desc, final String signature, final Object value) {
- Printer p = this.p.visitField(access, name, desc, signature, value);
- FieldVisitor fv = cv == null ? null : cv.visitField(access, name, desc,
- signature, value);
- return new TraceFieldVisitor(fv, p);
- }
-
- @Override
- public MethodVisitor visitMethod(final int access, final String name,
- final String desc, final String signature, final String[] exceptions) {
- Printer p = this.p.visitMethod(access, name, desc, signature,
- exceptions);
- MethodVisitor mv = cv == null ? null : cv.visitMethod(access, name,
- desc, signature, exceptions);
- return new TraceMethodVisitor(mv, p);
- }
-
- @Override
- public void visitEnd() {
- p.visitClassEnd();
- if (pw != null) {
- p.print(pw);
- pw.flush();
- }
- super.visitEnd();
+ /** The print writer to be used to print the class. May be {@literal null}. */
+ private final PrintWriter printWriter;
+
+ /** The printer to convert the visited class into text. */
+ // DontCheck(MemberName): can't be renamed (for backward binary compatibility).
+ public final Printer p;
+
+ /**
+ * Constructs a new {@link TraceClassVisitor}.
+ *
+ * @param printWriter the print writer to be used to print the class. May be {@literal null}.
+ */
+ public TraceClassVisitor(final PrintWriter printWriter) {
+ this(null, printWriter);
+ }
+
+ /**
+ * Constructs a new {@link TraceClassVisitor}.
+ *
+ * @param classVisitor the class visitor to which to delegate calls. May be {@literal null}.
+ * @param printWriter the print writer to be used to print the class. May be {@literal null}.
+ */
+ public TraceClassVisitor(final ClassVisitor classVisitor, final PrintWriter printWriter) {
+ this(classVisitor, new Textifier(), printWriter);
+ }
+
+ /**
+ * Constructs a new {@link TraceClassVisitor}.
+ *
+ * @param classVisitor the class visitor to which to delegate calls. May be {@literal null}.
+ * @param printer the printer to convert the visited class into text.
+ * @param printWriter the print writer to be used to print the class. May be {@literal null}.
+ */
+ public TraceClassVisitor(
+ final ClassVisitor classVisitor, final Printer printer, final PrintWriter printWriter) {
+ super(Opcodes.ASM7, classVisitor);
+ this.printWriter = printWriter;
+ this.p = printer;
+ }
+
+ @Override
+ public void visit(
+ final int version,
+ final int access,
+ final String name,
+ final String signature,
+ final String superName,
+ final String[] interfaces) {
+ p.visit(version, access, name, signature, superName, interfaces);
+ super.visit(version, access, name, signature, superName, interfaces);
+ }
+
+ @Override
+ public void visitSource(final String file, final String debug) {
+ p.visitSource(file, debug);
+ super.visitSource(file, debug);
+ }
+
+ @Override
+ public ModuleVisitor visitModule(final String name, final int flags, final String version) {
+ Printer modulePrinter = p.visitModule(name, flags, version);
+ return new TraceModuleVisitor(super.visitModule(name, flags, version), modulePrinter);
+ }
+
+ @Override
+ public void visitNestHost(final String nestHost) {
+ p.visitNestHost(nestHost);
+ super.visitNestHost(nestHost);
+ }
+
+ @Override
+ public void visitOuterClass(final String owner, final String name, final String descriptor) {
+ p.visitOuterClass(owner, name, descriptor);
+ super.visitOuterClass(owner, name, descriptor);
+ }
+
+ @Override
+ public AnnotationVisitor visitAnnotation(final String descriptor, final boolean visible) {
+ Printer annotationPrinter = p.visitClassAnnotation(descriptor, visible);
+ return new TraceAnnotationVisitor(
+ super.visitAnnotation(descriptor, visible), annotationPrinter);
+ }
+
+ @Override
+ public AnnotationVisitor visitTypeAnnotation(
+ final int typeRef, final TypePath typePath, final String descriptor, final boolean visible) {
+ Printer annotationPrinter = p.visitClassTypeAnnotation(typeRef, typePath, descriptor, visible);
+ return new TraceAnnotationVisitor(
+ super.visitTypeAnnotation(typeRef, typePath, descriptor, visible), annotationPrinter);
+ }
+
+ @Override
+ public void visitAttribute(final Attribute attribute) {
+ p.visitClassAttribute(attribute);
+ super.visitAttribute(attribute);
+ }
+
+ @Override
+ public void visitNestMember(final String nestMember) {
+ p.visitNestMember(nestMember);
+ super.visitNestMember(nestMember);
+ }
+
+ @Override
+ public void visitInnerClass(
+ final String name, final String outerName, final String innerName, final int access) {
+ p.visitInnerClass(name, outerName, innerName, access);
+ super.visitInnerClass(name, outerName, innerName, access);
+ }
+
+ @Override
+ public FieldVisitor visitField(
+ final int access,
+ final String name,
+ final String descriptor,
+ final String signature,
+ final Object value) {
+ Printer fieldPrinter = p.visitField(access, name, descriptor, signature, value);
+ return new TraceFieldVisitor(
+ super.visitField(access, name, descriptor, signature, value), fieldPrinter);
+ }
+
+ @Override
+ public MethodVisitor visitMethod(
+ final int access,
+ final String name,
+ final String descriptor,
+ final String signature,
+ final String[] exceptions) {
+ Printer methodPrinter = p.visitMethod(access, name, descriptor, signature, exceptions);
+ return new TraceMethodVisitor(
+ super.visitMethod(access, name, descriptor, signature, exceptions), methodPrinter);
+ }
+
+ @Override
+ public void visitEnd() {
+ p.visitClassEnd();
+ if (printWriter != null) {
+ p.print(printWriter);
+ printWriter.flush();
}
+ super.visitEnd();
+ }
}
http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/1c71aec7/plastic/src/external/java/org/apache/tapestry5/internal/plastic/asm/util/TraceFieldVisitor.java
----------------------------------------------------------------------
diff --git a/plastic/src/external/java/org/apache/tapestry5/internal/plastic/asm/util/TraceFieldVisitor.java b/plastic/src/external/java/org/apache/tapestry5/internal/plastic/asm/util/TraceFieldVisitor.java
old mode 100644
new mode 100755
index 29b60b2..c01176c
--- a/plastic/src/external/java/org/apache/tapestry5/internal/plastic/asm/util/TraceFieldVisitor.java
+++ b/plastic/src/external/java/org/apache/tapestry5/internal/plastic/asm/util/TraceFieldVisitor.java
@@ -1,32 +1,30 @@
-/***
- * ASM: a very small and fast Java bytecode manipulation framework
- * Copyright (c) 2000-2011 INRIA, France Telecom
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the copyright holders nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
- * THE POSSIBILITY OF SUCH DAMAGE.
- */
+// ASM: a very small and fast Java bytecode manipulation framework
+// Copyright (c) 2000-2011 INRIA, France Telecom
+// All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions
+// are met:
+// 1. Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// 2. Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in the
+// documentation and/or other materials provided with the distribution.
+// 3. Neither the name of the copyright holders nor the names of its
+// contributors may be used to endorse or promote products derived from
+// this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+// THE POSSIBILITY OF SUCH DAMAGE.
package org.apache.tapestry5.internal.plastic.asm.util;
import org.apache.tapestry5.internal.plastic.asm.AnnotationVisitor;
@@ -36,52 +34,60 @@ import org.apache.tapestry5.internal.plastic.asm.Opcodes;
import org.apache.tapestry5.internal.plastic.asm.TypePath;
/**
- * A {@link FieldVisitor} that prints the fields it visits with a
- * {@link Printer}.
- *
+ * A {@link FieldVisitor} that prints the fields it visits with a {@link Printer}.
+ *
* @author Eric Bruneton
*/
public final class TraceFieldVisitor extends FieldVisitor {
- public final Printer p;
+ /** The printer to convert the visited field into text. */
+ // DontCheck(MemberName): can't be renamed (for backward binary compatibility).
+ public final Printer p;
- public TraceFieldVisitor(final Printer p) {
- this(null, p);
- }
+ /**
+ * Constructs a new {@link TraceFieldVisitor}.
+ *
+ * @param printer the printer to convert the visited field into text.
+ */
+ public TraceFieldVisitor(final Printer printer) {
+ this(null, printer);
+ }
- public TraceFieldVisitor(final FieldVisitor fv, final Printer p) {
- super(Opcodes.ASM6, fv);
- this.p = p;
- }
+ /**
+ * Constructs a new {@link TraceFieldVisitor}.
+ *
+ * @param fieldVisitor the field visitor to which to delegate calls. May be {@literal null}.
+ * @param printer the printer to convert the visited field into text.
+ */
+ public TraceFieldVisitor(final FieldVisitor fieldVisitor, final Printer printer) {
+ super(Opcodes.ASM7, fieldVisitor);
+ this.p = printer;
+ }
- @Override
- public AnnotationVisitor visitAnnotation(final String desc,
- final boolean visible) {
- Printer p = this.p.visitFieldAnnotation(desc, visible);
- AnnotationVisitor av = fv == null ? null : fv.visitAnnotation(desc,
- visible);
- return new TraceAnnotationVisitor(av, p);
- }
+ @Override
+ public AnnotationVisitor visitAnnotation(final String descriptor, final boolean visible) {
+ Printer annotationPrinter = p.visitFieldAnnotation(descriptor, visible);
+ return new TraceAnnotationVisitor(
+ super.visitAnnotation(descriptor, visible), annotationPrinter);
+ }
- @Override
- public AnnotationVisitor visitTypeAnnotation(int typeRef,
- TypePath typePath, String desc, boolean visible) {
- Printer p = this.p.visitFieldTypeAnnotation(typeRef, typePath, desc,
- visible);
- AnnotationVisitor av = fv == null ? null : fv.visitTypeAnnotation(
- typeRef, typePath, desc, visible);
- return new TraceAnnotationVisitor(av, p);
- }
+ @Override
+ public AnnotationVisitor visitTypeAnnotation(
+ final int typeRef, final TypePath typePath, final String descriptor, final boolean visible) {
+ Printer annotationPrinter = p.visitFieldTypeAnnotation(typeRef, typePath, descriptor, visible);
+ return new TraceAnnotationVisitor(
+ super.visitTypeAnnotation(typeRef, typePath, descriptor, visible), annotationPrinter);
+ }
- @Override
- public void visitAttribute(final Attribute attr) {
- p.visitFieldAttribute(attr);
- super.visitAttribute(attr);
- }
+ @Override
+ public void visitAttribute(final Attribute attribute) {
+ p.visitFieldAttribute(attribute);
+ super.visitAttribute(attribute);
+ }
- @Override
- public void visitEnd() {
- p.visitFieldEnd();
- super.visitEnd();
- }
+ @Override
+ public void visitEnd() {
+ p.visitFieldEnd();
+ super.visitEnd();
+ }
}
http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/1c71aec7/plastic/src/external/java/org/apache/tapestry5/internal/plastic/asm/util/TraceMethodVisitor.java
----------------------------------------------------------------------
diff --git a/plastic/src/external/java/org/apache/tapestry5/internal/plastic/asm/util/TraceMethodVisitor.java b/plastic/src/external/java/org/apache/tapestry5/internal/plastic/asm/util/TraceMethodVisitor.java
old mode 100644
new mode 100755
index 053ff33..b152c48
--- a/plastic/src/external/java/org/apache/tapestry5/internal/plastic/asm/util/TraceMethodVisitor.java
+++ b/plastic/src/external/java/org/apache/tapestry5/internal/plastic/asm/util/TraceMethodVisitor.java
@@ -1,32 +1,30 @@
-/***
- * ASM: a very small and fast Java bytecode manipulation framework
- * Copyright (c) 2000-2011 INRIA, France Telecom
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the copyright holders nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
- * THE POSSIBILITY OF SUCH DAMAGE.
- */
+// ASM: a very small and fast Java bytecode manipulation framework
+// Copyright (c) 2000-2011 INRIA, France Telecom
+// All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions
+// are met:
+// 1. Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// 2. Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in the
+// documentation and/or other materials provided with the distribution.
+// 3. Neither the name of the copyright holders nor the names of its
+// contributors may be used to endorse or promote products derived from
+// this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+// THE POSSIBILITY OF SUCH DAMAGE.
package org.apache.tapestry5.internal.plastic.asm.util;
import org.apache.tapestry5.internal.plastic.asm.AnnotationVisitor;
@@ -38,255 +36,287 @@ import org.apache.tapestry5.internal.plastic.asm.Opcodes;
import org.apache.tapestry5.internal.plastic.asm.TypePath;
/**
- * A {@link MethodVisitor} that prints the methods it visits with a
- * {@link Printer}.
- *
+ * A {@link MethodVisitor} that prints the methods it visits with a {@link Printer}.
+ *
* @author Eric Bruneton
*/
public final class TraceMethodVisitor extends MethodVisitor {
- public final Printer p;
-
- public TraceMethodVisitor(final Printer p) {
- this(null, p);
- }
-
- public TraceMethodVisitor(final MethodVisitor mv, final Printer p) {
- super(Opcodes.ASM6, mv);
- this.p = p;
- }
-
- @Override
- public void visitParameter(String name, int access) {
- p.visitParameter(name, access);
- super.visitParameter(name, access);
- }
-
- @Override
- public AnnotationVisitor visitAnnotation(final String desc,
- final boolean visible) {
- Printer p = this.p.visitMethodAnnotation(desc, visible);
- AnnotationVisitor av = mv == null ? null : mv.visitAnnotation(desc,
- visible);
- return new TraceAnnotationVisitor(av, p);
- }
-
- @Override
- public AnnotationVisitor visitTypeAnnotation(int typeRef,
- TypePath typePath, String desc, boolean visible) {
- Printer p = this.p.visitMethodTypeAnnotation(typeRef, typePath, desc,
- visible);
- AnnotationVisitor av = mv == null ? null : mv.visitTypeAnnotation(
- typeRef, typePath, desc, visible);
- return new TraceAnnotationVisitor(av, p);
- }
-
- @Override
- public void visitAttribute(final Attribute attr) {
- p.visitMethodAttribute(attr);
- super.visitAttribute(attr);
- }
-
- @Override
- public AnnotationVisitor visitAnnotationDefault() {
- Printer p = this.p.visitAnnotationDefault();
- AnnotationVisitor av = mv == null ? null : mv.visitAnnotationDefault();
- return new TraceAnnotationVisitor(av, p);
- }
-
- @Override
- public AnnotationVisitor visitParameterAnnotation(final int parameter,
- final String desc, final boolean visible) {
- Printer p = this.p.visitParameterAnnotation(parameter, desc, visible);
- AnnotationVisitor av = mv == null ? null : mv.visitParameterAnnotation(
- parameter, desc, visible);
- return new TraceAnnotationVisitor(av, p);
- }
-
- @Override
- public void visitCode() {
- p.visitCode();
- super.visitCode();
- }
-
- @Override
- public void visitFrame(final int type, final int nLocal,
- final Object[] local, final int nStack, final Object[] stack) {
- p.visitFrame(type, nLocal, local, nStack, stack);
- super.visitFrame(type, nLocal, local, nStack, stack);
- }
-
- @Override
- public void visitInsn(final int opcode) {
- p.visitInsn(opcode);
- super.visitInsn(opcode);
- }
-
- @Override
- public void visitIntInsn(final int opcode, final int operand) {
- p.visitIntInsn(opcode, operand);
- super.visitIntInsn(opcode, operand);
- }
-
- @Override
- public void visitVarInsn(final int opcode, final int var) {
- p.visitVarInsn(opcode, var);
- super.visitVarInsn(opcode, var);
- }
-
- @Override
- public void visitTypeInsn(final int opcode, final String type) {
- p.visitTypeInsn(opcode, type);
- super.visitTypeInsn(opcode, type);
- }
-
- @Override
- public void visitFieldInsn(final int opcode, final String owner,
- final String name, final String desc) {
- p.visitFieldInsn(opcode, owner, name, desc);
- super.visitFieldInsn(opcode, owner, name, desc);
- }
-
- @Deprecated
- @Override
- public void visitMethodInsn(int opcode, String owner, String name,
- String desc) {
- if (api >= Opcodes.ASM5) {
- super.visitMethodInsn(opcode, owner, name, desc);
- return;
- }
- p.visitMethodInsn(opcode, owner, name, desc);
- if (mv != null) {
- mv.visitMethodInsn(opcode, owner, name, desc);
- }
- }
-
- @Override
- public void visitMethodInsn(int opcode, String owner, String name,
- String desc, boolean itf) {
- if (api < Opcodes.ASM5) {
- super.visitMethodInsn(opcode, owner, name, desc, itf);
- return;
- }
- p.visitMethodInsn(opcode, owner, name, desc, itf);
- if (mv != null) {
- mv.visitMethodInsn(opcode, owner, name, desc, itf);
- }
- }
-
- @Override
- public void visitInvokeDynamicInsn(String name, String desc, Handle bsm,
- Object... bsmArgs) {
- p.visitInvokeDynamicInsn(name, desc, bsm, bsmArgs);
- super.visitInvokeDynamicInsn(name, desc, bsm, bsmArgs);
- }
-
- @Override
- public void visitJumpInsn(final int opcode, final Label label) {
- p.visitJumpInsn(opcode, label);
- super.visitJumpInsn(opcode, label);
- }
-
- @Override
- public void visitLabel(final Label label) {
- p.visitLabel(label);
- super.visitLabel(label);
- }
-
- @Override
- public void visitLdcInsn(final Object cst) {
- p.visitLdcInsn(cst);
- super.visitLdcInsn(cst);
- }
-
- @Override
- public void visitIincInsn(final int var, final int increment) {
- p.visitIincInsn(var, increment);
- super.visitIincInsn(var, increment);
- }
-
- @Override
- public void visitTableSwitchInsn(final int min, final int max,
- final Label dflt, final Label... labels) {
- p.visitTableSwitchInsn(min, max, dflt, labels);
- super.visitTableSwitchInsn(min, max, dflt, labels);
- }
-
- @Override
- public void visitLookupSwitchInsn(final Label dflt, final int[] keys,
- final Label[] labels) {
- p.visitLookupSwitchInsn(dflt, keys, labels);
- super.visitLookupSwitchInsn(dflt, keys, labels);
- }
-
- @Override
- public void visitMultiANewArrayInsn(final String desc, final int dims) {
- p.visitMultiANewArrayInsn(desc, dims);
- super.visitMultiANewArrayInsn(desc, dims);
- }
-
- @Override
- public AnnotationVisitor visitInsnAnnotation(int typeRef,
- TypePath typePath, String desc, boolean visible) {
- Printer p = this.p
- .visitInsnAnnotation(typeRef, typePath, desc, visible);
- AnnotationVisitor av = mv == null ? null : mv.visitInsnAnnotation(
- typeRef, typePath, desc, visible);
- return new TraceAnnotationVisitor(av, p);
- }
-
- @Override
- public void visitTryCatchBlock(final Label start, final Label end,
- final Label handler, final String type) {
- p.visitTryCatchBlock(start, end, handler, type);
- super.visitTryCatchBlock(start, end, handler, type);
- }
-
- @Override
- public AnnotationVisitor visitTryCatchAnnotation(int typeRef,
- TypePath typePath, String desc, boolean visible) {
- Printer p = this.p.visitTryCatchAnnotation(typeRef, typePath, desc,
- visible);
- AnnotationVisitor av = mv == null ? null : mv.visitTryCatchAnnotation(
- typeRef, typePath, desc, visible);
- return new TraceAnnotationVisitor(av, p);
- }
-
- @Override
- public void visitLocalVariable(final String name, final String desc,
- final String signature, final Label start, final Label end,
- final int index) {
- p.visitLocalVariable(name, desc, signature, start, end, index);
- super.visitLocalVariable(name, desc, signature, start, end, index);
- }
-
- @Override
- public AnnotationVisitor visitLocalVariableAnnotation(int typeRef,
- TypePath typePath, Label[] start, Label[] end, int[] index,
- String desc, boolean visible) {
- Printer p = this.p.visitLocalVariableAnnotation(typeRef, typePath,
- start, end, index, desc, visible);
- AnnotationVisitor av = mv == null ? null : mv
- .visitLocalVariableAnnotation(typeRef, typePath, start, end,
- index, desc, visible);
- return new TraceAnnotationVisitor(av, p);
- }
-
- @Override
- public void visitLineNumber(final int line, final Label start) {
- p.visitLineNumber(line, start);
- super.visitLineNumber(line, start);
- }
-
- @Override
- public void visitMaxs(final int maxStack, final int maxLocals) {
- p.visitMaxs(maxStack, maxLocals);
- super.visitMaxs(maxStack, maxLocals);
- }
-
- @Override
- public void visitEnd() {
- p.visitMethodEnd();
- super.visitEnd();
- }
+ /** The printer to convert the visited method into text. */
+ // DontCheck(MemberName): can't be renamed (for backward binary compatibility).
+ public final Printer p;
+
+ /**
+ * Constructs a new {@link TraceMethodVisitor}.
+ *
+ * @param printer the printer to convert the visited method into text.
+ */
+ public TraceMethodVisitor(final Printer printer) {
+ this(null, printer);
+ }
+
+ /**
+ * Constructs a new {@link TraceMethodVisitor}.
+ *
+ * @param methodVisitor the method visitor to which to delegate calls. May be {@literal null}.
+ * @param printer the printer to convert the visited method into text.
+ */
+ public TraceMethodVisitor(final MethodVisitor methodVisitor, final Printer printer) {
+ super(Opcodes.ASM7, methodVisitor);
+ this.p = printer;
+ }
+
+ @Override
+ public void visitParameter(final String name, final int access) {
+ p.visitParameter(name, access);
+ super.visitParameter(name, access);
+ }
+
+ @Override
+ public AnnotationVisitor visitAnnotation(final String descriptor, final boolean visible) {
+ Printer annotationPrinter = p.visitMethodAnnotation(descriptor, visible);
+ return new TraceAnnotationVisitor(
+ super.visitAnnotation(descriptor, visible), annotationPrinter);
+ }
+
+ @Override
+ public AnnotationVisitor visitTypeAnnotation(
+ final int typeRef, final TypePath typePath, final String descriptor, final boolean visible) {
+ Printer annotationPrinter = p.visitMethodTypeAnnotation(typeRef, typePath, descriptor, visible);
+ return new TraceAnnotationVisitor(
+ super.visitTypeAnnotation(typeRef, typePath, descriptor, visible), annotationPrinter);
+ }
+
+ @Override
+ public void visitAttribute(final Attribute attribute) {
+ p.visitMethodAttribute(attribute);
+ super.visitAttribute(attribute);
+ }
+
+ @Override
+ public AnnotationVisitor visitAnnotationDefault() {
+ Printer annotationPrinter = p.visitAnnotationDefault();
+ return new TraceAnnotationVisitor(super.visitAnnotationDefault(), annotationPrinter);
+ }
+
+ @Override
+ public void visitAnnotableParameterCount(final int parameterCount, final boolean visible) {
+ p.visitAnnotableParameterCount(parameterCount, visible);
+ super.visitAnnotableParameterCount(parameterCount, visible);
+ }
+
+ @Override
+ public AnnotationVisitor visitParameterAnnotation(
+ final int parameter, final String descriptor, final boolean visible) {
+ Printer annotationPrinter = p.visitParameterAnnotation(parameter, descriptor, visible);
+ return new TraceAnnotationVisitor(
+ super.visitParameterAnnotation(parameter, descriptor, visible), annotationPrinter);
+ }
+
+ @Override
+ public void visitCode() {
+ p.visitCode();
+ super.visitCode();
+ }
+
+ @Override
+ public void visitFrame(
+ final int type,
+ final int numLocal,
+ final Object[] local,
+ final int numStack,
+ final Object[] stack) {
+ p.visitFrame(type, numLocal, local, numStack, stack);
+ super.visitFrame(type, numLocal, local, numStack, stack);
+ }
+
+ @Override
+ public void visitInsn(final int opcode) {
+ p.visitInsn(opcode);
+ super.visitInsn(opcode);
+ }
+
+ @Override
+ public void visitIntInsn(final int opcode, final int operand) {
+ p.visitIntInsn(opcode, operand);
+ super.visitIntInsn(opcode, operand);
+ }
+
+ @Override
+ public void visitVarInsn(final int opcode, final int var) {
+ p.visitVarInsn(opcode, var);
+ super.visitVarInsn(opcode, var);
+ }
+
+ @Override
+ public void visitTypeInsn(final int opcode, final String type) {
+ p.visitTypeInsn(opcode, type);
+ super.visitTypeInsn(opcode, type);
+ }
+
+ @Override
+ public void visitFieldInsn(
+ final int opcode, final String owner, final String name, final String descriptor) {
+ p.visitFieldInsn(opcode, owner, name, descriptor);
+ super.visitFieldInsn(opcode, owner, name, descriptor);
+ }
+
+ /**
+ * Deprecated.
+ *
+ * @deprecated use {@link #visitMethodInsn(int, String, String, String, boolean)} instead.
+ */
+ @Deprecated
+ @Override
+ public void visitMethodInsn(
+ final int opcode, final String owner, final String name, final String descriptor) {
+ if (api >= Opcodes.ASM5) {
+ super.visitMethodInsn(opcode, owner, name, descriptor);
+ return;
+ }
+ p.visitMethodInsn(opcode, owner, name, descriptor);
+ if (mv != null) {
+ mv.visitMethodInsn(opcode, owner, name, descriptor);
+ }
+ }
+
+ @Override
+ public void visitMethodInsn(
+ final int opcode,
+ final String owner,
+ final String name,
+ final String descriptor,
+ final boolean isInterface) {
+ if (api < Opcodes.ASM5) {
+ super.visitMethodInsn(opcode, owner, name, descriptor, isInterface);
+ return;
+ }
+ p.visitMethodInsn(opcode, owner, name, descriptor, isInterface);
+ if (mv != null) {
+ mv.visitMethodInsn(opcode, owner, name, descriptor, isInterface);
+ }
+ }
+
+ @Override
+ public void visitInvokeDynamicInsn(
+ final String name,
+ final String descriptor,
+ final Handle bootstrapMethodHandle,
+ final Object... bootstrapMethodArguments) {
+ p.visitInvokeDynamicInsn(name, descriptor, bootstrapMethodHandle, bootstrapMethodArguments);
+ super.visitInvokeDynamicInsn(name, descriptor, bootstrapMethodHandle, bootstrapMethodArguments);
+ }
+
+ @Override
+ public void visitJumpInsn(final int opcode, final Label label) {
+ p.visitJumpInsn(opcode, label);
+ super.visitJumpInsn(opcode, label);
+ }
+
+ @Override
+ public void visitLabel(final Label label) {
+ p.visitLabel(label);
+ super.visitLabel(label);
+ }
+
+ @Override
+ public void visitLdcInsn(final Object value) {
+ p.visitLdcInsn(value);
+ super.visitLdcInsn(value);
+ }
+
+ @Override
+ public void visitIincInsn(final int var, final int increment) {
+ p.visitIincInsn(var, increment);
+ super.visitIincInsn(var, increment);
+ }
+
+ @Override
+ public void visitTableSwitchInsn(
+ final int min, final int max, final Label dflt, final Label... labels) {
+ p.visitTableSwitchInsn(min, max, dflt, labels);
+ super.visitTableSwitchInsn(min, max, dflt, labels);
+ }
+
+ @Override
+ public void visitLookupSwitchInsn(final Label dflt, final int[] keys, final Label[] labels) {
+ p.visitLookupSwitchInsn(dflt, keys, labels);
+ super.visitLookupSwitchInsn(dflt, keys, labels);
+ }
+
+ @Override
+ public void visitMultiANewArrayInsn(final String descriptor, final int numDimensions) {
+ p.visitMultiANewArrayInsn(descriptor, numDimensions);
+ super.visitMultiANewArrayInsn(descriptor, numDimensions);
+ }
+
+ @Override
+ public AnnotationVisitor visitInsnAnnotation(
+ final int typeRef, final TypePath typePath, final String descriptor, final boolean visible) {
+ Printer annotationPrinter = p.visitInsnAnnotation(typeRef, typePath, descriptor, visible);
+ return new TraceAnnotationVisitor(
+ super.visitInsnAnnotation(typeRef, typePath, descriptor, visible), annotationPrinter);
+ }
+
+ @Override
+ public void visitTryCatchBlock(
+ final Label start, final Label end, final Label handler, final String type) {
+ p.visitTryCatchBlock(start, end, handler, type);
+ super.visitTryCatchBlock(start, end, handler, type);
+ }
+
+ @Override
+ public AnnotationVisitor visitTryCatchAnnotation(
+ final int typeRef, final TypePath typePath, final String descriptor, final boolean visible) {
+ Printer annotationPrinter = p.visitTryCatchAnnotation(typeRef, typePath, descriptor, visible);
+ return new TraceAnnotationVisitor(
+ super.visitTryCatchAnnotation(typeRef, typePath, descriptor, visible), annotationPrinter);
+ }
+
+ @Override
+ public void visitLocalVariable(
+ final String name,
+ final String descriptor,
+ final String signature,
+ final Label start,
+ final Label end,
+ final int index) {
+ p.visitLocalVariable(name, descriptor, signature, start, end, index);
+ super.visitLocalVariable(name, descriptor, signature, start, end, index);
+ }
+
+ @Override
+ public AnnotationVisitor visitLocalVariableAnnotation(
+ final int typeRef,
+ final TypePath typePath,
+ final Label[] start,
+ final Label[] end,
+ final int[] index,
+ final String descriptor,
+ final boolean visible) {
+ Printer annotationPrinter =
+ p.visitLocalVariableAnnotation(typeRef, typePath, start, end, index, descriptor, visible);
+ return new TraceAnnotationVisitor(
+ super.visitLocalVariableAnnotation(
+ typeRef, typePath, start, end, index, descriptor, visible),
+ annotationPrinter);
+ }
+
+ @Override
+ public void visitLineNumber(final int line, final Label start) {
+ p.visitLineNumber(line, start);
+ super.visitLineNumber(line, start);
+ }
+
+ @Override
+ public void visitMaxs(final int maxStack, final int maxLocals) {
+ p.visitMaxs(maxStack, maxLocals);
+ super.visitMaxs(maxStack, maxLocals);
+ }
+
+ @Override
+ public void visitEnd() {
+ p.visitMethodEnd();
+ super.visitEnd();
+ }
}
http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/1c71aec7/plastic/src/external/java/org/apache/tapestry5/internal/plastic/asm/util/TraceModuleVisitor.java
----------------------------------------------------------------------
diff --git a/plastic/src/external/java/org/apache/tapestry5/internal/plastic/asm/util/TraceModuleVisitor.java b/plastic/src/external/java/org/apache/tapestry5/internal/plastic/asm/util/TraceModuleVisitor.java
old mode 100644
new mode 100755
index 94dc498..610ff75
--- a/plastic/src/external/java/org/apache/tapestry5/internal/plastic/asm/util/TraceModuleVisitor.java
+++ b/plastic/src/external/java/org/apache/tapestry5/internal/plastic/asm/util/TraceModuleVisitor.java
@@ -1,101 +1,111 @@
-/***
- * ASM: a very small and fast Java bytecode manipulation framework
- * Copyright (c) 2000-2011 INRIA, France Telecom
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the copyright holders nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
- * THE POSSIBILITY OF SUCH DAMAGE.
- */
+// ASM: a very small and fast Java bytecode manipulation framework
+// Copyright (c) 2000-2011 INRIA, France Telecom
+// All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions
+// are met:
+// 1. Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// 2. Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in the
+// documentation and/or other materials provided with the distribution.
+// 3. Neither the name of the copyright holders nor the names of its
+// contributors may be used to endorse or promote products derived from
+// this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+// THE POSSIBILITY OF SUCH DAMAGE.
package org.apache.tapestry5.internal.plastic.asm.util;
import org.apache.tapestry5.internal.plastic.asm.ModuleVisitor;
import org.apache.tapestry5.internal.plastic.asm.Opcodes;
/**
- * A {@link ModuleVisitor} that prints the fields it visits with a
- * {@link Printer}.
- *
+ * A {@link ModuleVisitor} that prints the fields it visits with a {@link Printer}.
+ *
* @author Remi Forax
*/
public final class TraceModuleVisitor extends ModuleVisitor {
-
- public final Printer p;
- public TraceModuleVisitor(final Printer p) {
- this(null, p);
- }
+ /** The printer to convert the visited module into text. */
+ // DontCheck(MemberName): can't be renamed (for backward binary compatibility).
+ public final Printer p;
+
+ /**
+ * Constructs a new {@link TraceModuleVisitor}.
+ *
+ * @param printer the printer to convert the visited module into text.
+ */
+ public TraceModuleVisitor(final Printer printer) {
+ this(null, printer);
+ }
+
+ /**
+ * Constructs a new {@link TraceModuleVisitor}.
+ *
+ * @param moduleVisitor the module visitor to which to delegate calls. May be {@literal null}.
+ * @param printer the printer to convert the visited module into text.
+ */
+ public TraceModuleVisitor(final ModuleVisitor moduleVisitor, final Printer printer) {
+ super(Opcodes.ASM7, moduleVisitor);
+ this.p = printer;
+ }
+
+ @Override
+ public void visitMainClass(final String mainClass) {
+ p.visitMainClass(mainClass);
+ super.visitMainClass(mainClass);
+ }
+
+ @Override
+ public void visitPackage(final String packaze) {
+ p.visitPackage(packaze);
+ super.visitPackage(packaze);
+ }
+
+ @Override
+ public void visitRequire(final String module, final int access, final String version) {
+ p.visitRequire(module, access, version);
+ super.visitRequire(module, access, version);
+ }
+
+ @Override
+ public void visitExport(final String packaze, final int access, final String... modules) {
+ p.visitExport(packaze, access, modules);
+ super.visitExport(packaze, access, modules);
+ }
+
+ @Override
+ public void visitOpen(final String packaze, final int access, final String... modules) {
+ p.visitOpen(packaze, access, modules);
+ super.visitOpen(packaze, access, modules);
+ }
- public TraceModuleVisitor(final ModuleVisitor mv, final Printer p) {
- super(Opcodes.ASM6, mv);
- this.p = p;
- }
+ @Override
+ public void visitUse(final String use) {
+ p.visitUse(use);
+ super.visitUse(use);
+ }
- @Override
- public void visitMainClass(String mainClass) {
- p.visitMainClass(mainClass);
- super.visitMainClass(mainClass);
- }
-
- @Override
- public void visitPackage(String packaze) {
- p.visitPackage(packaze);
- super.visitPackage(packaze);
- }
-
- @Override
- public void visitRequire(String module, int access, String version) {
- p.visitRequire(module, access, version);
- super.visitRequire(module, access, version);
- }
-
- @Override
- public void visitExport(String packaze, int access, String... modules) {
- p.visitExport(packaze, access, modules);
- super.visitExport(packaze, access, modules);
- }
-
- @Override
- public void visitOpen(String packaze, int access, String... modules) {
- p.visitOpen(packaze, access, modules);
- super.visitOpen(packaze, access, modules);
- }
-
- @Override
- public void visitUse(String use) {
- p.visitUse(use);
- super.visitUse(use);
- }
-
- @Override
- public void visitProvide(String service, String... providers) {
- p.visitProvide(service, providers);
- super.visitProvide(service, providers);
- }
+ @Override
+ public void visitProvide(final String service, final String... providers) {
+ p.visitProvide(service, providers);
+ super.visitProvide(service, providers);
+ }
- @Override
- public void visitEnd() {
- p.visitModuleEnd();
- super.visitEnd();
- }
+ @Override
+ public void visitEnd() {
+ p.visitModuleEnd();
+ super.visitEnd();
+ }
}
http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/1c71aec7/plastic/src/external/java/org/apache/tapestry5/internal/plastic/asm/util/TraceSignatureVisitor.java
----------------------------------------------------------------------
diff --git a/plastic/src/external/java/org/apache/tapestry5/internal/plastic/asm/util/TraceSignatureVisitor.java b/plastic/src/external/java/org/apache/tapestry5/internal/plastic/asm/util/TraceSignatureVisitor.java
old mode 100644
new mode 100755
index 2125130..fe1908a
--- a/plastic/src/external/java/org/apache/tapestry5/internal/plastic/asm/util/TraceSignatureVisitor.java
+++ b/plastic/src/external/java/org/apache/tapestry5/internal/plastic/asm/util/TraceSignatureVisitor.java
@@ -1,317 +1,351 @@
-/***
- * ASM: a very small and fast Java bytecode manipulation framework
- * Copyright (c) 2000-2011 INRIA, France Telecom
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the copyright holders nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
- * THE POSSIBILITY OF SUCH DAMAGE.
- */
+// ASM: a very small and fast Java bytecode manipulation framework
+// Copyright (c) 2000-2011 INRIA, France Telecom
+// All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions
+// are met:
+// 1. Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// 2. Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in the
+// documentation and/or other materials provided with the distribution.
+// 3. Neither the name of the copyright holders nor the names of its
+// contributors may be used to endorse or promote products derived from
+// this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+// THE POSSIBILITY OF SUCH DAMAGE.
package org.apache.tapestry5.internal.plastic.asm.util;
import org.apache.tapestry5.internal.plastic.asm.Opcodes;
import org.apache.tapestry5.internal.plastic.asm.signature.SignatureVisitor;
/**
- * A {@link SignatureVisitor} that prints a disassembled view of the signature
- * it visits.
- *
+ * A {@link SignatureVisitor} that builds the Java generic type declaration corresponding to the
+ * signature it visits.
+ *
* @author Eugene Kuleshov
* @author Eric Bruneton
*/
public final class TraceSignatureVisitor extends SignatureVisitor {
- private final StringBuilder declaration;
-
- private boolean isInterface;
-
- private boolean seenFormalParameter;
-
- private boolean seenInterfaceBound;
-
- private boolean seenParameter;
-
- private boolean seenInterface;
-
- private StringBuilder returnType;
-
- private StringBuilder exceptions;
-
- /**
- * Stack used to keep track of class types that have arguments. Each element
- * of this stack is a boolean encoded in one bit. The top of the stack is
- * the lowest order bit. Pushing false = *2, pushing true = *2+1, popping =
- * /2.
- */
- private int argumentStack;
-
- /**
- * Stack used to keep track of array class types. Each element of this stack
- * is a boolean encoded in one bit. The top of the stack is the lowest order
- * bit. Pushing false = *2, pushing true = *2+1, popping = /2.
- */
- private int arrayStack;
-
- private String separator = "";
-
- public TraceSignatureVisitor(final int access) {
- super(Opcodes.ASM6);
- isInterface = (access & Opcodes.ACC_INTERFACE) != 0;
- this.declaration = new StringBuilder();
- }
-
- private TraceSignatureVisitor(final StringBuilder buf) {
- super(Opcodes.ASM6);
- this.declaration = buf;
- }
-
- @Override
- public void visitFormalTypeParameter(final String name) {
- declaration.append(seenFormalParameter ? ", " : "<").append(name);
- seenFormalParameter = true;
- seenInterfaceBound = false;
+ private static final String COMMA_SEPARATOR = ", ";
+ private static final String EXTENDS_SEPARATOR = " extends ";
+ private static final String IMPLEMENTS_SEPARATOR = " implements ";
+
+ /** Whether the visited signature is a class signature of a Java interface. */
+ private final boolean isInterface;
+
+ /** The Java generic type declaration corresponding to the visited signature. */
+ private final StringBuilder declaration;
+
+ /** The Java generic method return type declaration corresponding to the visited signature. */
+ private StringBuilder returnType;
+
+ /** The Java generic exception types declaration corresponding to the visited signature. */
+ private StringBuilder exceptions;
+
+ /** Whether {@link #visitFormalTypeParameter} has been called. */
+ private boolean formalTypeParameterVisited;
+
+ /** Whether {@link #visitInterfaceBound} has been called. */
+ private boolean interfaceBoundVisited;
+
+ /** Whether {@link #visitParameterType} has been called. */
+ private boolean parameterTypeVisited;
+
+ /** Whether {@link #visitInterface} has been called. */
+ private boolean interfaceVisited;
+
+ /**
+ * The stack used to keep track of class types that have arguments. Each element of this stack is
+ * a boolean encoded in one bit. The top of the stack is the least significant bit. Pushing false
+ * = *2, pushing true = *2+1, popping = /2.
+ */
+ private int argumentStack;
+
+ /**
+ * The stack used to keep track of array class types. Each element of this stack is a boolean
+ * encoded in one bit. The top of the stack is the lowest order bit. Pushing false = *2, pushing
+ * true = *2+1, popping = /2.
+ */
+ private int arrayStack;
+
+ /** The separator to append before the next visited class or inner class type. */
+ private String separator = "";
+
+ /**
+ * Constructs a new {@link TraceSignatureVisitor}.
+ *
+ * @param accessFlags for class type signatures, the access flags of the class.
+ */
+ public TraceSignatureVisitor(final int accessFlags) {
+ super(Opcodes.ASM7);
+ this.isInterface = (accessFlags & Opcodes.ACC_INTERFACE) != 0;
+ this.declaration = new StringBuilder();
+ }
+
+ private TraceSignatureVisitor(final StringBuilder stringBuilder) {
+ super(Opcodes.ASM7);
+ this.isInterface = false;
+ this.declaration = stringBuilder;
+ }
+
+ @Override
+ public void visitFormalTypeParameter(final String name) {
+ declaration.append(formalTypeParameterVisited ? COMMA_SEPARATOR : "<").append(name);
+ formalTypeParameterVisited = true;
+ interfaceBoundVisited = false;
+ }
+
+ @Override
+ public SignatureVisitor visitClassBound() {
+ separator = EXTENDS_SEPARATOR;
+ startType();
+ return this;
+ }
+
+ @Override
+ public SignatureVisitor visitInterfaceBound() {
+ separator = interfaceBoundVisited ? COMMA_SEPARATOR : EXTENDS_SEPARATOR;
+ interfaceBoundVisited = true;
+ startType();
+ return this;
+ }
+
+ @Override
+ public SignatureVisitor visitSuperclass() {
+ endFormals();
+ separator = EXTENDS_SEPARATOR;
+ startType();
+ return this;
+ }
+
+ @Override
+ public SignatureVisitor visitInterface() {
+ if (interfaceVisited) {
+ separator = COMMA_SEPARATOR;
+ } else {
+ separator = isInterface ? EXTENDS_SEPARATOR : IMPLEMENTS_SEPARATOR;
+ interfaceVisited = true;
}
-
- @Override
- public SignatureVisitor visitClassBound() {
- separator = " extends ";
- startType();
- return this;
+ startType();
+ return this;
+ }
+
+ @Override
+ public SignatureVisitor visitParameterType() {
+ endFormals();
+ if (parameterTypeVisited) {
+ declaration.append(COMMA_SEPARATOR);
+ } else {
+ declaration.append('(');
+ parameterTypeVisited = true;
}
-
- @Override
- public SignatureVisitor visitInterfaceBound() {
- separator = seenInterfaceBound ? ", " : " extends ";
- seenInterfaceBound = true;
- startType();
- return this;
+ startType();
+ return this;
+ }
+
+ @Override
+ public SignatureVisitor visitReturnType() {
+ endFormals();
+ if (parameterTypeVisited) {
+ parameterTypeVisited = false;
+ } else {
+ declaration.append('(');
}
-
- @Override
- public SignatureVisitor visitSuperclass() {
- endFormals();
- separator = " extends ";
- startType();
- return this;
+ declaration.append(')');
+ returnType = new StringBuilder();
+ return new TraceSignatureVisitor(returnType);
+ }
+
+ @Override
+ public SignatureVisitor visitExceptionType() {
+ if (exceptions == null) {
+ exceptions = new StringBuilder();
+ } else {
+ exceptions.append(COMMA_SEPARATOR);
}
-
- @Override
- public SignatureVisitor visitInterface() {
- separator = seenInterface ? ", " : isInterface ? " extends "
- : " implements ";
- seenInterface = true;
- startType();
- return this;
+ return new TraceSignatureVisitor(exceptions);
+ }
+
+ @Override
+ public void visitBaseType(final char descriptor) {
+ switch (descriptor) {
+ case 'V':
+ declaration.append("void");
+ break;
+ case 'B':
+ declaration.append("byte");
+ break;
+ case 'J':
+ declaration.append("long");
+ break;
+ case 'Z':
+ declaration.append("boolean");
+ break;
+ case 'I':
+ declaration.append("int");
+ break;
+ case 'S':
+ declaration.append("short");
+ break;
+ case 'C':
+ declaration.append("char");
+ break;
+ case 'F':
+ declaration.append("float");
+ break;
+ case 'D':
+ declaration.append("double");
+ break;
+ default:
+ throw new IllegalArgumentException();
}
-
- @Override
- public SignatureVisitor visitParameterType() {
- endFormals();
- if (seenParameter) {
- declaration.append(", ");
- } else {
- seenParameter = true;
- declaration.append('(');
- }
- startType();
- return this;
- }
-
- @Override
- public SignatureVisitor visitReturnType() {
- endFormals();
- if (seenParameter) {
- seenParameter = false;
- } else {
- declaration.append('(');
- }
- declaration.append(')');
- returnType = new StringBuilder();
- return new TraceSignatureVisitor(returnType);
- }
-
- @Override
- public SignatureVisitor visitExceptionType() {
- if (exceptions == null) {
- exceptions = new StringBuilder();
- } else {
- exceptions.append(", ");
- }
- // startType();
- return new TraceSignatureVisitor(exceptions);
- }
-
- @Override
- public void visitBaseType(final char descriptor) {
- switch (descriptor) {
- case 'V':
- declaration.append("void");
- break;
- case 'B':
- declaration.append("byte");
- break;
- case 'J':
- declaration.append("long");
- break;
- case 'Z':
- declaration.append("boolean");
- break;
- case 'I':
- declaration.append("int");
- break;
- case 'S':
- declaration.append("short");
- break;
- case 'C':
- declaration.append("char");
- break;
- case 'F':
- declaration.append("float");
- break;
- // case 'D':
- default:
- declaration.append("double");
- break;
- }
- endType();
- }
-
- @Override
- public void visitTypeVariable(final String name) {
- declaration.append(name);
- endType();
- }
-
- @Override
- public SignatureVisitor visitArrayType() {
- startType();
- arrayStack |= 1;
- return this;
- }
-
- @Override
- public void visitClassType(final String name) {
- if ("java/lang/Object".equals(name)) {
- // Map<java.lang.Object,java.util.List>
- // or
- // abstract public V get(Object key); (seen in Dictionary.class)
- // should have Object
- // but java.lang.String extends java.lang.Object is unnecessary
- boolean needObjectClass = argumentStack % 2 != 0 || seenParameter;
- if (needObjectClass) {
- declaration.append(separator).append(name.replace('/', '.'));
- }
- } else {
- declaration.append(separator).append(name.replace('/', '.'));
- }
- separator = "";
- argumentStack *= 2;
- }
-
- @Override
- public void visitInnerClassType(final String name) {
- if (argumentStack % 2 != 0) {
- declaration.append('>');
- }
- argumentStack /= 2;
- declaration.append('.');
+ endType();
+ }
+
+ @Override
+ public void visitTypeVariable(final String name) {
+ declaration.append(separator).append(name);
+ separator = "";
+ endType();
+ }
+
+ @Override
+ public SignatureVisitor visitArrayType() {
+ startType();
+ arrayStack |= 1;
+ return this;
+ }
+
+ @Override
+ public void visitClassType(final String name) {
+ if ("java/lang/Object".equals(name)) {
+ // 'Map<java.lang.Object,java.util.List>' or 'abstract public V get(Object key);' should have
+ // Object 'but java.lang.String extends java.lang.Object' is unnecessary.
+ boolean needObjectClass = argumentStack % 2 != 0 || parameterTypeVisited;
+ if (needObjectClass) {
declaration.append(separator).append(name.replace('/', '.'));
- separator = "";
- argumentStack *= 2;
+ }
+ } else {
+ declaration.append(separator).append(name.replace('/', '.'));
}
-
- @Override
- public void visitTypeArgument() {
- if (argumentStack % 2 == 0) {
- ++argumentStack;
- declaration.append('<');
- } else {
- declaration.append(", ");
- }
- declaration.append('?');
+ separator = "";
+ argumentStack *= 2;
+ }
+
+ @Override
+ public void visitInnerClassType(final String name) {
+ if (argumentStack % 2 != 0) {
+ declaration.append('>');
}
-
- @Override
- public SignatureVisitor visitTypeArgument(final char tag) {
- if (argumentStack % 2 == 0) {
- ++argumentStack;
- declaration.append('<');
- } else {
- declaration.append(", ");
- }
-
- if (tag == EXTENDS) {
- declaration.append("? extends ");
- } else if (tag == SUPER) {
- declaration.append("? super ");
- }
-
- startType();
- return this;
+ argumentStack /= 2;
+ declaration.append('.');
+ declaration.append(separator).append(name.replace('/', '.'));
+ separator = "";
+ argumentStack *= 2;
+ }
+
+ @Override
+ public void visitTypeArgument() {
+ if (argumentStack % 2 == 0) {
+ ++argumentStack;
+ declaration.append('<');
+ } else {
+ declaration.append(COMMA_SEPARATOR);
}
-
- @Override
- public void visitEnd() {
- if (argumentStack % 2 != 0) {
- declaration.append('>');
- }
- argumentStack /= 2;
- endType();
+ declaration.append('?');
+ }
+
+ @Override
+ public SignatureVisitor visitTypeArgument(final char tag) {
+ if (argumentStack % 2 == 0) {
+ ++argumentStack;
+ declaration.append('<');
+ } else {
+ declaration.append(COMMA_SEPARATOR);
}
- public String getDeclaration() {
- return declaration.toString();
+ if (tag == EXTENDS) {
+ declaration.append("? extends ");
+ } else if (tag == SUPER) {
+ declaration.append("? super ");
}
- public String getReturnType() {
- return returnType == null ? null : returnType.toString();
- }
+ startType();
+ return this;
+ }
- public String getExceptions() {
- return exceptions == null ? null : exceptions.toString();
+ @Override
+ public void visitEnd() {
+ if (argumentStack % 2 != 0) {
+ declaration.append('>');
}
-
- // -----------------------------------------------
-
- private void endFormals() {
- if (seenFormalParameter) {
- declaration.append('>');
- seenFormalParameter = false;
- }
+ argumentStack /= 2;
+ endType();
+ }
+
+ // -----------------------------------------------------------------------------------------------
+
+ /**
+ * Returns the Java generic type declaration corresponding to the visited signature.
+ *
+ * @return the Java generic type declaration corresponding to the visited signature.
+ */
+ public String getDeclaration() {
+ return declaration.toString();
+ }
+
+ /**
+ * Returns the Java generic method return type declaration corresponding to the visited signature.
+ *
+ * @return the Java generic method return type declaration corresponding to the visited signature.
+ */
+ public String getReturnType() {
+ return returnType == null ? null : returnType.toString();
+ }
+
+ /**
+ * Returns the Java generic exception types declaration corresponding to the visited signature.
+ *
+ * @return the Java generic exception types declaration corresponding to the visited signature.
+ */
+ public String getExceptions() {
+ return exceptions == null ? null : exceptions.toString();
+ }
+
+ // -----------------------------------------------------------------------------------------------
+
+ private void endFormals() {
+ if (formalTypeParameterVisited) {
+ declaration.append('>');
+ formalTypeParameterVisited = false;
}
-
- private void startType() {
- arrayStack *= 2;
- }
-
- private void endType() {
- if (arrayStack % 2 == 0) {
- arrayStack /= 2;
- } else {
- while (arrayStack % 2 != 0) {
- arrayStack /= 2;
- declaration.append("[]");
- }
- }
+ }
+
+ private void startType() {
+ arrayStack *= 2;
+ }
+
+ private void endType() {
+ if (arrayStack % 2 == 0) {
+ arrayStack /= 2;
+ } else {
+ while (arrayStack % 2 != 0) {
+ arrayStack /= 2;
+ declaration.append("[]");
+ }
}
+ }
}
http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/1c71aec7/plastic/src/external/java/org/apache/tapestry5/internal/plastic/asm/util/package.html
----------------------------------------------------------------------
diff --git a/plastic/src/external/java/org/apache/tapestry5/internal/plastic/asm/util/package.html b/plastic/src/external/java/org/apache/tapestry5/internal/plastic/asm/util/package.html
old mode 100644
new mode 100755
index 91d7420..91fb0db
--- a/plastic/src/external/java/org/apache/tapestry5/internal/plastic/asm/util/package.html
+++ b/plastic/src/external/java/org/apache/tapestry5/internal/plastic/asm/util/package.html
@@ -31,8 +31,8 @@
<body>
Provides ASM visitors that can be useful for programming and
debugging purposes. These class visitors are normally not used by applications
-at runtime. This is why they are bundled in an optional <tt>asm-util.jar</tt>
-library that is separated from (but requires) the <tt>asm.jar</tt> library,
+at runtime. This is why they are bundled in an optional <code>asm-util.jar</code>
+library that is separated from (but requires) the <code>asm.jar</code> library,
which contains the core ASM framework.
@since ASM 1.3.2