b690c49
From aaf9dad09a9a26c5de3c2910d910b24a258b0b1d Mon Sep 17 00:00:00 2001
b690c49
From: Michael Simacek <msimacek@redhat.com>
b690c49
Date: Tue, 1 Dec 2015 12:36:21 +0100
b690c49
Subject: [PATCH 1/3] Unshade ASM
695e146
695e146
---
9695710
 .../org/apache/xbean/finder/AbstractFinder.java    | 31 ++++++++--------
695e146
 .../org/apache/xbean/finder/AnnotationFinder.java  | 43 +++++++++++-----------
b690c49
 .../xbean/recipe/XbeanAsmParameterNameLoader.java  | 16 ++++----
b690c49
 3 files changed, 46 insertions(+), 44 deletions(-)
695e146
695e146
diff --git a/xbean-finder/src/main/java/org/apache/xbean/finder/AbstractFinder.java b/xbean-finder/src/main/java/org/apache/xbean/finder/AbstractFinder.java
b690c49
index 6bf1f3c..fab8b88 100644
695e146
--- a/xbean-finder/src/main/java/org/apache/xbean/finder/AbstractFinder.java
695e146
+++ b/xbean-finder/src/main/java/org/apache/xbean/finder/AbstractFinder.java
695e146
@@ -34,10 +34,10 @@ import java.util.HashMap;
695e146
 import java.util.List;
695e146
 import java.util.Map;
695e146
 
695e146
-import org.apache.xbean.asm5.original.commons.EmptyVisitor;
695e146
 import org.apache.xbean.finder.util.SingleLinkedList;
695e146
 import org.objectweb.asm.AnnotationVisitor;
695e146
 import org.objectweb.asm.ClassReader;
695e146
+import org.objectweb.asm.ClassVisitor;
695e146
 import org.objectweb.asm.FieldVisitor;
695e146
 import org.objectweb.asm.MethodVisitor;
695e146
 import org.objectweb.asm.Opcodes;
695e146
@@ -908,15 +908,17 @@ public abstract class AbstractFinder implements IAnnotationFinder {
695e146
         }
695e146
     }
695e146
 
695e146
-    public class InfoBuildingVisitor extends EmptyVisitor {
695e146
+    public class InfoBuildingVisitor extends ClassVisitor {
695e146
         private Info info;
695e146
         private String path;
695e146
 
695e146
         public InfoBuildingVisitor(String path) {
695e146
+            super(Opcodes.ASM5);
695e146
             this.path = path;
695e146
         }
695e146
 
695e146
         public InfoBuildingVisitor(Info info) {
695e146
+            super(Opcodes.ASM5);
695e146
             this.info = info;
695e146
         }
695e146
 
695e146
@@ -949,7 +951,7 @@ public abstract class AbstractFinder implements IAnnotationFinder {
695e146
             AnnotationInfo annotationInfo = new AnnotationInfo(desc);
695e146
             info.getAnnotations().add(annotationInfo);
695e146
             getAnnotationInfos(annotationInfo.getName()).add(info);
695e146
-            return new InfoBuildingVisitor(annotationInfo).annotationVisitor();
695e146
+            return null;
695e146
         }
695e146
 
695e146
         @Override
9695710
@@ -957,24 +959,23 @@ public abstract class AbstractFinder implements IAnnotationFinder {
695e146
             ClassInfo classInfo = ((ClassInfo) info);
695e146
             FieldInfo fieldInfo = new FieldInfo(classInfo, name, desc);
695e146
             classInfo.getFields().add(fieldInfo);
695e146
-            return new InfoBuildingVisitor(fieldInfo).fieldVisitor();
695e146
+            return null;
695e146
         }
695e146
 
695e146
         @Override
9695710
         public MethodVisitor visitMethod(int access, String name, String desc, String signature, String[] exceptions) {
695e146
             ClassInfo classInfo = ((ClassInfo) info);
9695710
-            MethodInfo methodInfo = new MethodInfo(classInfo, name, desc);
9695710
+            final MethodInfo methodInfo = new MethodInfo(classInfo, name, desc);
695e146
             classInfo.getMethods().add(methodInfo);
695e146
-            return new InfoBuildingVisitor(methodInfo).methodVisitor();
695e146
-        }
695e146
-
695e146
-        @Override
695e146
-        public AnnotationVisitor visitMethodParameterAnnotation(int param, String desc, boolean visible) {
695e146
-            MethodInfo methodInfo = ((MethodInfo) info);
695e146
-            List<AnnotationInfo> annotationInfos = methodInfo.getParameterAnnotations(param);
695e146
-            AnnotationInfo annotationInfo = new AnnotationInfo(desc);
695e146
-            annotationInfos.add(annotationInfo);
695e146
-            return new InfoBuildingVisitor(annotationInfo).annotationVisitor();
695e146
+            return new MethodVisitor(Opcodes.ASM5) {
695e146
+                @Override
695e146
+                public AnnotationVisitor visitParameterAnnotation(int param, String desc, boolean visible) {
695e146
+                    List<AnnotationInfo> annotationInfos = methodInfo.getParameterAnnotations(param);
695e146
+                    AnnotationInfo annotationInfo = new AnnotationInfo(desc);
695e146
+                    annotationInfos.add(annotationInfo);
695e146
+                    return null;
695e146
+                }
695e146
+            };
695e146
         }
695e146
     }
695e146
 
695e146
diff --git a/xbean-finder/src/main/java/org/apache/xbean/finder/AnnotationFinder.java b/xbean-finder/src/main/java/org/apache/xbean/finder/AnnotationFinder.java
b690c49
index 7d68cd9..6454aa1 100644
695e146
--- a/xbean-finder/src/main/java/org/apache/xbean/finder/AnnotationFinder.java
695e146
+++ b/xbean-finder/src/main/java/org/apache/xbean/finder/AnnotationFinder.java
695e146
@@ -20,13 +20,13 @@
695e146
 
695e146
 package org.apache.xbean.finder;
695e146
 
695e146
-import org.apache.xbean.asm5.original.commons.EmptyVisitor;
695e146
 import org.apache.xbean.finder.archive.Archive;
695e146
 import org.apache.xbean.finder.util.Classes;
695e146
 import org.apache.xbean.finder.util.SingleLinkedList;
695e146
 import org.objectweb.asm.AnnotationVisitor;
695e146
 import org.objectweb.asm.Attribute;
695e146
 import org.objectweb.asm.ClassReader;
695e146
+import org.objectweb.asm.ClassVisitor;
695e146
 import org.objectweb.asm.FieldVisitor;
695e146
 import org.objectweb.asm.MethodVisitor;
695e146
 import org.objectweb.asm.Opcodes;
b690c49
@@ -1790,13 +1790,15 @@ public class AnnotationFinder implements IAnnotationFinder {
695e146
         initAnnotationInfos(annotationInfo.getName()).add(info);
695e146
     }
695e146
 
695e146
-    public class InfoBuildingVisitor extends EmptyVisitor {
695e146
+    public class InfoBuildingVisitor extends ClassVisitor {
695e146
         private Info info;
695e146
 
695e146
         public InfoBuildingVisitor() {
695e146
+            super(Opcodes.ASM5);
695e146
         }
695e146
 
695e146
         public InfoBuildingVisitor(Info info) {
695e146
+            super(Opcodes.ASM5);
695e146
             this.info = info;
695e146
         }
695e146
 
b690c49
@@ -1844,7 +1846,7 @@ public class AnnotationFinder implements IAnnotationFinder {
695e146
             AnnotationInfo annotationInfo = new AnnotationInfo(desc);
695e146
             info.getAnnotations().add(annotationInfo);
695e146
             index(annotationInfo, info);
695e146
-            return new InfoBuildingVisitor(annotationInfo).annotationVisitor();
695e146
+            return null;
695e146
         }
695e146
 
695e146
         @Override
b690c49
@@ -1852,32 +1854,31 @@ public class AnnotationFinder implements IAnnotationFinder {
695e146
             ClassInfo classInfo = ((ClassInfo) info);
695e146
             FieldInfo fieldInfo = new FieldInfo(classInfo, name, desc);
695e146
             classInfo.getFields().add(fieldInfo);
695e146
-            return new InfoBuildingVisitor(fieldInfo).fieldVisitor();
695e146
+            return null;
695e146
         }
695e146
 
695e146
         @Override
695e146
         public MethodVisitor visitMethod(int access, String name, String desc, String signature, String[] exceptions) {
695e146
             ClassInfo classInfo = ((ClassInfo) info);
695e146
-            MethodInfo methodInfo = new MethodInfo(classInfo, name, desc);
695e146
+            final MethodInfo methodInfo = new MethodInfo(classInfo, name, desc);
695e146
 
695e146
             classInfo.getMethods().add(methodInfo);
695e146
-            return new InfoBuildingVisitor(methodInfo).methodVisitor();
695e146
+            return new MethodVisitor(Opcodes.ASM5) {
695e146
+                @Override
695e146
+                public AnnotationVisitor visitParameterAnnotation(int param, String desc, boolean visible) {
695e146
+                    List<AnnotationInfo> annotationInfos = methodInfo.getParameterAnnotations(param);
695e146
+                    AnnotationInfo annotationInfo = new AnnotationInfo(desc);
695e146
+                    annotationInfos.add(annotationInfo);
695e146
+
695e146
+                    ParameterInfo parameterInfo = new ParameterInfo(methodInfo, param);
695e146
+                    methodInfo.getParameters().add(parameterInfo);
695e146
+                    index(annotationInfo, parameterInfo);
695e146
+
695e146
+                    return null;
695e146
+                }
695e146
+            };
695e146
         }
695e146
 
695e146
-
695e146
-        @Override
695e146
-        public AnnotationVisitor visitMethodParameterAnnotation(int param, String desc, boolean visible) {
695e146
-            MethodInfo methodInfo = ((MethodInfo) info);
695e146
-            List<AnnotationInfo> annotationInfos = methodInfo.getParameterAnnotations(param);
695e146
-            AnnotationInfo annotationInfo = new AnnotationInfo(desc);
695e146
-            annotationInfos.add(annotationInfo);
695e146
-
695e146
-            ParameterInfo parameterInfo = new ParameterInfo(methodInfo, param);
695e146
-            methodInfo.getParameters().add(parameterInfo);
695e146
-            index(annotationInfo, parameterInfo);
695e146
-
695e146
-            return new InfoBuildingVisitor(annotationInfo).annotationVisitor();
695e146
-        }
695e146
     }
695e146
 
695e146
     public static class GenericAwareInfoBuildingVisitor extends SignatureVisitor {
b690c49
@@ -2042,4 +2043,4 @@ public class AnnotationFinder implements IAnnotationFinder {
695e146
 
695e146
     }
695e146
 
695e146
-}
695e146
\ No newline at end of file
695e146
+}
695e146
diff --git a/xbean-reflect/src/main/java/org/apache/xbean/recipe/XbeanAsmParameterNameLoader.java b/xbean-reflect/src/main/java/org/apache/xbean/recipe/XbeanAsmParameterNameLoader.java
b690c49
index dea2f2a..dbbfb51 100644
695e146
--- a/xbean-reflect/src/main/java/org/apache/xbean/recipe/XbeanAsmParameterNameLoader.java
695e146
+++ b/xbean-reflect/src/main/java/org/apache/xbean/recipe/XbeanAsmParameterNameLoader.java
b690c49
@@ -17,13 +17,6 @@
695e146
  */
695e146
 package org.apache.xbean.recipe;
695e146
 
695e146
-import org.apache.xbean.asm5.ClassReader;
b690c49
-import org.apache.xbean.asm5.ClassVisitor;
695e146
-import org.apache.xbean.asm5.Label;
695e146
-import org.apache.xbean.asm5.MethodVisitor;
695e146
-import org.apache.xbean.asm5.Opcodes;
695e146
-import org.apache.xbean.asm5.Type;
b690c49
-
b690c49
 import java.io.IOException;
b690c49
 import java.io.InputStream;
b690c49
 import java.lang.reflect.Constructor;
b690c49
@@ -37,6 +30,13 @@ import java.util.List;
b690c49
 import java.util.Map;
b690c49
 import java.util.WeakHashMap;
b690c49
 
695e146
+import org.objectweb.asm.ClassReader;
695e146
+import org.objectweb.asm.ClassVisitor;
695e146
+import org.objectweb.asm.Label;
695e146
+import org.objectweb.asm.MethodVisitor;
695e146
+import org.objectweb.asm.Opcodes;
695e146
+import org.objectweb.asm.Type;
b690c49
+
b690c49
 /**
b690c49
  * Implementation of ParameterNameLoader that uses ASM to read the parameter names from the local variable table in the
b690c49
  * class byte code.
b690c49
@@ -314,4 +314,4 @@ public class XbeanAsmParameterNameLoader implements ParameterNameLoader {
695e146
             return null;
695e146
         }
695e146
     }
695e146
-}
695e146
\ No newline at end of file
695e146
+}
695e146
-- 
b690c49
2.5.0
695e146