Permalink
Browse files

CLJ-713 - upgrade ASM to 4.1.

Signed-off-by: Stuart Halloway <stu@cognitect.com>
  • Loading branch information...
1 parent 6be0580 commit c8d3ef3929e8049a84957002bc7e2071844bfb53 @puredanger puredanger committed with stuarthalloway Oct 25, 2013
Showing with 18,967 additions and 17,511 deletions.
  1. +11 −10 src/clj/clojure/reflect/java.clj
  2. +169 −97 src/jvm/clojure/asm/AnnotationVisitor.java
  3. +318 −357 src/jvm/clojure/asm/AnnotationWriter.java
  4. +255 −253 src/jvm/clojure/asm/Attribute.java
  5. +306 −318 src/jvm/clojure/asm/ByteVector.java
  6. +0 −115 src/jvm/clojure/asm/ClassAdapter.java
  7. +2,202 −2,224 src/jvm/clojure/asm/ClassReader.java
  8. +286 −196 src/jvm/clojure/asm/ClassVisitor.java
  9. +1,693 −1,415 src/jvm/clojure/asm/ClassWriter.java
  10. +110 −0 src/jvm/clojure/asm/Context.java
  11. +75 −75 src/jvm/clojure/asm/Edge.java
  12. +121 −64 src/jvm/clojure/asm/FieldVisitor.java
  13. +273 −290 src/jvm/clojure/asm/FieldWriter.java
  14. +1,453 −1,506 src/jvm/clojure/asm/Frame.java
  15. +167 −0 src/jvm/clojure/asm/Handle.java
  16. +121 −70 src/jvm/clojure/asm/Handler.java
  17. +311 −258 src/jvm/clojure/asm/Item.java
  18. +560 −437 src/jvm/clojure/asm/Label.java
  19. +0 −186 src/jvm/clojure/asm/MethodAdapter.java
  20. +662 −396 src/jvm/clojure/asm/MethodVisitor.java
  21. +2,685 −3,029 src/jvm/clojure/asm/MethodWriter.java
  22. +358 −341 src/jvm/clojure/asm/Opcodes.java
  23. +895 −872 src/jvm/clojure/asm/Type.java
  24. +625 −681 src/jvm/clojure/asm/commons/AdviceAdapter.java
  25. +920 −938 src/jvm/clojure/asm/commons/AnalyzerAdapter.java
  26. +217 −234 src/jvm/clojure/asm/commons/CodeSizeEvaluator.java
  27. +0 −221 src/jvm/clojure/asm/commons/EmptyVisitor.java
  28. +1,623 −1,533 src/jvm/clojure/asm/commons/GeneratorAdapter.java
  29. +1,090 −0 src/jvm/clojure/asm/commons/InstructionAdapter.java
  30. +360 −330 src/jvm/clojure/asm/commons/LocalVariablesSorter.java
  31. +281 −266 src/jvm/clojure/asm/commons/Method.java
  32. +533 −508 src/jvm/clojure/asm/commons/SerialVersionUIDAdder.java
  33. +96 −102 src/jvm/clojure/asm/commons/StaticInitMerger.java
  34. +57 −55 src/jvm/clojure/asm/commons/TableSwitchGenerator.java
  35. +47 −47 src/jvm/clojure/asm/commons/package.html
  36. +87 −87 src/jvm/clojure/asm/package.html
@@ -11,7 +11,7 @@
(require '[clojure.set :as set]
'[clojure.string :as str])
-(import '[clojure.asm ClassReader ClassVisitor Type]
+(import '[clojure.asm ClassReader ClassVisitor Type Opcodes]
'[java.lang.reflect Modifier]
java.io.InputStream)
@@ -202,9 +202,10 @@ the kinds of objects to which they can apply."}
result (atom {:bases #{} :flags #{} :members #{}})]
(.accept
r
- (reify
- ClassVisitor
- (visit [_ version access name signature superName interfaces]
+ (proxy
+ [ClassVisitor]
+ [Opcodes/ASM4]
+ (visit [version access name signature superName interfaces]
(let [flags (parse-flags access :class)
;; ignore java.lang.Object on interfaces to match reflection
superName (if (and (flags :interface)
@@ -219,17 +220,17 @@ the kinds of objects to which they can apply."}
(not-empty))]
(swap! result merge {:bases bases
:flags flags})))
- (visitAnnotation [_ desc visible])
- (visitSource [_ name debug])
- (visitInnerClass [_ name outerName innerName access])
- (visitField [_ access name desc signature value]
+ (visitAnnotation [desc visible])
+ (visitSource [name debug])
+ (visitInnerClass [name outerName innerName access])
+ (visitField [access name desc signature value]
(swap! result update-in [:members] (fnil conj #{})
(Field. (symbol name)
(field-descriptor->class-symbol desc)
class-symbol
(parse-flags access :field)))
nil)
- (visitMethod [_ access name desc signature exceptions]
+ (visitMethod [access name desc signature exceptions]
(when-not (= name "<clinit>")
(let [constructor? (= name "<init>")]
(swap! result update-in [:members] (fnil conj #{})
@@ -248,7 +249,7 @@ the kinds of objects to which they can apply."}
(vec (map internal-name->class-symbol exceptions))
flags))))))
nil)
- (visitEnd [_])
+ (visitEnd [])
) 0)
@result))))
@@ -1,97 +1,169 @@
-/***
- * ASM: a very small and fast Java bytecode manipulation framework
- * Copyright (c) 2000-2005 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 clojure.asm;
-
-/**
- * A visitor to visit a Java annotation. The methods of this interface must be
- * called in the following order: (<tt>visit<tt> | <tt>visitEnum<tt> |
- * <tt>visitAnnotation<tt> | <tt>visitArray<tt>)* <tt>visitEnd<tt>.
- *
- * @author Eric Bruneton
- * @author Eugene Kuleshov
- */
-public interface AnnotationVisitor{
-
-/**
- * Visits a primitive value of the annotation.
- *
- * @param name the value name.
- * @param value the actual value, whose type must be {@link Byte},
- * {@link Boolean}, {@link Character}, {@link Short},
- * {@link Integer}, {@link Long}, {@link Float}, {@link Double},
- * {@link String} or {@link Type}. This value can also be an array
- * of byte, boolean, short, char, int, long, float or double values
- * (this is equivalent to using {@link #visitArray visitArray} and
- * visiting each array element in turn, but is more convenient).
- */
-void visit(String name, Object value);
-
-/**
- * Visits an enumeration value of the annotation.
- *
- * @param name the value name.
- * @param desc the class descriptor of the enumeration class.
- * @param value the actual enumeration value.
- */
-void visitEnum(String name, String desc, String value);
-
-/**
- * Visits a nested annotation value of the annotation.
- *
- * @param name the value name.
- * @param desc the class descriptor of the nested annotation class.
- * @return a visitor to visit the actual nested annotation value, or
- * <tt>null</tt> if this visitor is not interested in visiting
- * this nested annotation. <i>The nested annotation value must be
- * fully visited before calling other methods on this annotation
- * visitor</i>.
- */
-AnnotationVisitor visitAnnotation(String name, String desc);
-
-/**
- * Visits an array value of the annotation. Note that arrays of primitive
- * types (such as byte, boolean, short, char, int, long, float or double)
- * can be passed as value to {@link #visit visit}. This is what
- * {@link ClassReader} does.
- *
- * @param name the value name.
- * @return a visitor to visit the actual array value elements, or
- * <tt>null</tt> if this visitor is not interested in visiting
- * these values. The 'name' parameters passed to the methods of this
- * visitor are ignored. <i>All the array values must be visited
- * before calling other methods on this annotation visitor</i>.
- */
-AnnotationVisitor visitArray(String name);
-
-/**
- * Visits the end of the annotation.
- */
-void visitEnd();
-}
+/***
+ * 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 clojure.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
+ */
+public abstract class AnnotationVisitor {
+
+ /**
+ * The ASM API version implemented by this visitor. The value of this field
+ * must be one of {@link Opcodes#ASM4}.
+ */
+ protected final int api;
+
+ /**
+ * The annotation visitor to which this visitor must delegate method calls.
+ * May be null.
+ */
+ protected AnnotationVisitor av;
+
+ /**
+ * Constructs a new {@link AnnotationVisitor}.
+ *
+ * @param api
+ * the ASM API version implemented by this visitor. Must be one
+ * of {@link Opcodes#ASM4}.
+ */
+ public AnnotationVisitor(final int api) {
+ this(api, null);
+ }
+
+ /**
+ * 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.
+ */
+ public AnnotationVisitor(final int api, final AnnotationVisitor av) {
+ if (api != Opcodes.ASM4) {
+ 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).
+ */
+ public void visit(String name, Object value) {
+ if (av != null) {
+ av.visit(name, value);
+ }
+ }
+
+ /**
+ * Visits an enumeration value of the annotation.
+ *
+ * @param name
+ * the value name.
+ * @param desc
+ * the class descriptor of the enumeration class.
+ * @param value
+ * the actual enumeration value.
+ */
+ public void visitEnum(String name, String desc, String value) {
+ if (av != null) {
+ av.visitEnum(name, desc, value);
+ }
+ }
+
+ /**
+ * Visits a nested annotation value of the annotation.
+ *
+ * @param name
+ * the value name.
+ * @param desc
+ * the class descriptor of the nested annotation class.
+ * @return a visitor to visit the actual nested annotation value, or
+ * <tt>null</tt> if this visitor is not interested in visiting this
+ * nested annotation. <i>The nested annotation value must be fully
+ * visited before calling other methods on this annotation
+ * visitor</i>.
+ */
+ public AnnotationVisitor visitAnnotation(String name, String desc) {
+ if (av != null) {
+ return av.visitAnnotation(name, desc);
+ }
+ return null;
+ }
+
+ /**
+ * Visits an array value of the annotation. Note that arrays of primitive
+ * types (such as byte, boolean, short, char, int, long, float or double)
+ * can be passed as value to {@link #visit visit}. This is what
+ * {@link ClassReader} does.
+ *
+ * @param name
+ * the value name.
+ * @return a visitor to visit the actual array value elements, or
+ * <tt>null</tt> if this visitor is not interested in visiting these
+ * values. The 'name' parameters passed to the methods of this
+ * visitor are ignored. <i>All the array values must be visited
+ * before calling other methods on this annotation visitor</i>.
+ */
+ public AnnotationVisitor visitArray(String name) {
+ if (av != null) {
+ return av.visitArray(name);
+ }
+ return null;
+ }
+
+ /**
+ * Visits the end of the annotation.
+ */
+ public void visitEnd() {
+ if (av != null) {
+ av.visitEnd();
+ }
+ }
+}
Oops, something went wrong.

0 comments on commit c8d3ef3

Please sign in to comment.