Comment #3 on issue 759 by [email protected]: Use ASM 4.1
http://code.google.com/p/google-guice/issues/detail?id=759

BTW the following CGLIB patch removes the need to include asm-util when using CGLIB by fixing the dynamic lookup for TraceClassVisitor:

diff -wur 3.0/src/proxy/net/sf/cglib/core/DebuggingClassWriter.java 3.0-patched/src/proxy/net/sf/cglib/core/DebuggingClassWriter.java --- 3.0/src/proxy/net/sf/cglib/core/DebuggingClassWriter.java 2012-05-25 13:21:20.000000000 +0100 +++ 3.0-patched/src/proxy/net/sf/cglib/core/DebuggingClassWriter.java 2013-04-01 13:31:58.000000000 +0100
@@ -22,13 +22,14 @@
 import org.objectweb.asm.util.TraceClassVisitor;

 import java.io.*;
+import java.lang.reflect.Constructor;

 public class DebuggingClassWriter extends ClassVisitor {

public static final String DEBUG_LOCATION_PROPERTY = "cglib.debugLocation";

     private static String debugLocation;
-    private static boolean traceEnabled;
+    private static Constructor traceCtor;

     private String className;
     private String superName;
@@ -38,15 +39,15 @@
         if (debugLocation != null) {
System.err.println("CGLIB debugging enabled, writing to '" + debugLocation + "'");
             try {
-                Class.forName("org.objectweb.asm.util.TraceClassVisitor");
-                traceEnabled = true;
+ Class clazz = Class.forName("org.objectweb.asm.util.TraceClassVisitor"); + traceCtor = clazz.getConstructor(new Class[]{ClassVisitor.class, PrintWriter.class});
             } catch (Throwable ignore) {
             }
         }
     }

     public DebuggingClassWriter(int flags) {
-       super(flags, new ClassWriter(flags));
+       super(Opcodes.ASM4, new ClassWriter(flags));
     }

     public void visit(int version,
@@ -89,20 +90,20 @@
                             out.close();
                         }

-                        if (traceEnabled) {
+                        if (traceCtor != null) {
file = new File(new File(debugLocation), dirs + ".asm"); out = new BufferedOutputStream(new FileOutputStream(file));
                             try {
                                 ClassReader cr = new ClassReader(b);
PrintWriter pw = new PrintWriter(new OutputStreamWriter(out)); - TraceClassVisitor tcv = new TraceClassVisitor(null, pw); + ClassVisitor tcv = (ClassVisitor)traceCtor.newInstance(new Object[]{null, pw});
                                 cr.accept(tcv, 0);
                                 pw.flush();
                             } finally {
                                 out.close();
                             }
                         }
-                    } catch (IOException e) {
+                    } catch (Exception e) {
                         throw new CodeGenerationException(e);
                     }
                 }

From http://sourceforge.net/p/cglib/bugs/42/

--
You received this message because this project is configured to send all issue notifications to this address.
You may adjust your notification preferences at:
https://code.google.com/hosting/settings

--
You received this message because you are subscribed to the Google Groups 
"google-guice-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/google-guice-dev.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to