aries-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From eji...@apache.org
Subject svn commit: r1237821 - in /aries/trunk/proxy/proxy-impl/src/main: java/org/apache/aries/proxy/impl/common/ java/org/apache/aries/proxy/impl/gen/ java/org/apache/aries/proxy/impl/interfaces/ java/org/apache/aries/proxy/impl/weaving/ java/org/apache/arie...
Date Mon, 30 Jan 2012 17:36:52 GMT
Author: ejiang
Date: Mon Jan 30 17:36:52 2012
New Revision: 1237821

URL: http://svn.apache.org/viewvc?rev=1237821&view=rev
Log:
ARIES-817: ASM4 changes - to address some comments

Removed:
    aries/trunk/proxy/proxy-impl/src/main/java/org/apache/aries/proxy/impl/weaving/EmptyVisitor.java
Modified:
    aries/trunk/proxy/proxy-impl/src/main/java/org/apache/aries/proxy/impl/common/AbstractWovenProxyAdapter.java
    aries/trunk/proxy/proxy-impl/src/main/java/org/apache/aries/proxy/impl/common/ConstructorFinder.java
    aries/trunk/proxy/proxy-impl/src/main/java/org/apache/aries/proxy/impl/common/OSGiFriendlyClassVisitor.java
    aries/trunk/proxy/proxy-impl/src/main/java/org/apache/aries/proxy/impl/gen/Constants.java
    aries/trunk/proxy/proxy-impl/src/main/java/org/apache/aries/proxy/impl/gen/ProxySubclassAdapter.java
    aries/trunk/proxy/proxy-impl/src/main/java/org/apache/aries/proxy/impl/gen/ProxySubclassHierarchyAdapter.java
    aries/trunk/proxy/proxy-impl/src/main/java/org/apache/aries/proxy/impl/interfaces/InterfaceCombiningClassAdapter.java
    aries/trunk/proxy/proxy-impl/src/main/java/org/apache/aries/proxy/impl/interfaces/InterfaceProxyGenerator.java
    aries/trunk/proxy/proxy-impl/src/main/java/org/apache/aries/proxy/impl/weaving/MethodCopyingClassAdapter.java
    aries/trunk/proxy/proxy-impl/src/main/java/org/apache/aries/proxy/impl/weaving/SyntheticSerialVerUIDAdder.java
    aries/trunk/proxy/proxy-impl/src/main/java/org/apache/aries/proxy/synthesizer/Synthesizer.java
    aries/trunk/proxy/proxy-impl/src/main/resources/org/apache/aries/proxy/nls/ProxyImplMessages.properties

Modified: aries/trunk/proxy/proxy-impl/src/main/java/org/apache/aries/proxy/impl/common/AbstractWovenProxyAdapter.java
URL: http://svn.apache.org/viewvc/aries/trunk/proxy/proxy-impl/src/main/java/org/apache/aries/proxy/impl/common/AbstractWovenProxyAdapter.java?rev=1237821&r1=1237820&r2=1237821&view=diff
==============================================================================
--- aries/trunk/proxy/proxy-impl/src/main/java/org/apache/aries/proxy/impl/common/AbstractWovenProxyAdapter.java
(original)
+++ aries/trunk/proxy/proxy-impl/src/main/java/org/apache/aries/proxy/impl/common/AbstractWovenProxyAdapter.java
Mon Jan 30 17:36:52 2012
@@ -198,7 +198,7 @@ public abstract class AbstractWovenProxy
    */
   public AbstractWovenProxyAdapter(ClassVisitor writer, String className,
       ClassLoader loader) {
-    super(Constants.ASM4, writer);
+    super(Opcodes.ASM4, writer);
     typeBeingWoven = Type.getType("L" + className.replace('.', '/') + ";");
     this.loader = loader;
   }
@@ -343,7 +343,7 @@ public abstract class AbstractWovenProxy
       //to write our init code to static_init_UUID instead
       staticInitMethod = new Method("static_init_" + UU_ID, Type.VOID_TYPE, NO_ARGS);
       staticInitMethodFlags = staticInitMethodFlags | ACC_FINAL;
-      methodVisitorToReturn = new AdviceAdapter(Constants.ASM4, cv.visitMethod(access, name,
desc, signature,
+      methodVisitorToReturn = new AdviceAdapter(Opcodes.ASM4, cv.visitMethod(access, name,
desc, signature,
           exceptions), access, name, desc){
         @Override
         protected void onMethodEnter()

Modified: aries/trunk/proxy/proxy-impl/src/main/java/org/apache/aries/proxy/impl/common/ConstructorFinder.java
URL: http://svn.apache.org/viewvc/aries/trunk/proxy/proxy-impl/src/main/java/org/apache/aries/proxy/impl/common/ConstructorFinder.java?rev=1237821&r1=1237820&r2=1237821&view=diff
==============================================================================
--- aries/trunk/proxy/proxy-impl/src/main/java/org/apache/aries/proxy/impl/common/ConstructorFinder.java
(original)
+++ aries/trunk/proxy/proxy-impl/src/main/java/org/apache/aries/proxy/impl/common/ConstructorFinder.java
Mon Jan 30 17:36:52 2012
@@ -18,16 +18,13 @@
  */
 package org.apache.aries.proxy.impl.common;
 
-import org.apache.aries.proxy.impl.gen.Constants;
-import org.apache.aries.proxy.impl.weaving.EmptyVisitor;
+import static org.objectweb.asm.Opcodes.ACC_PRIVATE;
 
 import org.objectweb.asm.ClassVisitor;
 import org.objectweb.asm.MethodVisitor;
+import org.objectweb.asm.Opcodes;
 import org.objectweb.asm.Type;
 
-
-import static org.objectweb.asm.Opcodes.ACC_PRIVATE;
-
 public class ConstructorFinder extends ClassVisitor
 {
 
@@ -40,7 +37,7 @@ public class ConstructorFinder extends C
 
   public ConstructorFinder()
   {
-    super(Constants.ASM4, new EmptyVisitor(Constants.ASM4));
+    super(Opcodes.ASM4);
   }
 
   @Override

Modified: aries/trunk/proxy/proxy-impl/src/main/java/org/apache/aries/proxy/impl/common/OSGiFriendlyClassVisitor.java
URL: http://svn.apache.org/viewvc/aries/trunk/proxy/proxy-impl/src/main/java/org/apache/aries/proxy/impl/common/OSGiFriendlyClassVisitor.java?rev=1237821&r1=1237820&r2=1237821&view=diff
==============================================================================
--- aries/trunk/proxy/proxy-impl/src/main/java/org/apache/aries/proxy/impl/common/OSGiFriendlyClassVisitor.java
(original)
+++ aries/trunk/proxy/proxy-impl/src/main/java/org/apache/aries/proxy/impl/common/OSGiFriendlyClassVisitor.java
Mon Jan 30 17:36:52 2012
@@ -18,10 +18,10 @@
  */
 package org.apache.aries.proxy.impl.common;
 
-import org.apache.aries.proxy.impl.gen.Constants;
 import org.objectweb.asm.ClassVisitor;
 import org.objectweb.asm.ClassWriter;
 import org.objectweb.asm.MethodVisitor;
+import org.objectweb.asm.Opcodes;
 import org.objectweb.asm.commons.JSRInlinerAdapter;
 /**
  * We need to override ASM's default behaviour in {@link #getCommonSuperClass(String, String)}
@@ -35,7 +35,7 @@ public final class OSGiFriendlyClassVisi
   
   public OSGiFriendlyClassVisitor(ClassVisitor cv, int arg1) {
    
-    super(Constants.ASM4, cv);
+    super(Opcodes.ASM4, cv);
 
     inlineJSR = arg1 == ClassWriter.COMPUTE_FRAMES;
   }

Modified: aries/trunk/proxy/proxy-impl/src/main/java/org/apache/aries/proxy/impl/gen/Constants.java
URL: http://svn.apache.org/viewvc/aries/trunk/proxy/proxy-impl/src/main/java/org/apache/aries/proxy/impl/gen/Constants.java?rev=1237821&r1=1237820&r2=1237821&view=diff
==============================================================================
--- aries/trunk/proxy/proxy-impl/src/main/java/org/apache/aries/proxy/impl/gen/Constants.java
(original)
+++ aries/trunk/proxy/proxy-impl/src/main/java/org/apache/aries/proxy/impl/gen/Constants.java
Mon Jan 30 17:36:52 2012
@@ -18,12 +18,10 @@
  */
 package org.apache.aries.proxy.impl.gen;
 
-import org.objectweb.asm.Opcodes;
 
 public interface Constants 
 {
   final static String LOG_ENTRY = "Method entry: {}, args {}";
   final static String LOG_EXIT = "Method exit: {}, returning {}";
   final static String LOG_EXCEPTION = "Caught exception";
-  final static int ASM4 = Opcodes.ASM4;
 }

Modified: aries/trunk/proxy/proxy-impl/src/main/java/org/apache/aries/proxy/impl/gen/ProxySubclassAdapter.java
URL: http://svn.apache.org/viewvc/aries/trunk/proxy/proxy-impl/src/main/java/org/apache/aries/proxy/impl/gen/ProxySubclassAdapter.java?rev=1237821&r1=1237820&r2=1237821&view=diff
==============================================================================
--- aries/trunk/proxy/proxy-impl/src/main/java/org/apache/aries/proxy/impl/gen/ProxySubclassAdapter.java
(original)
+++ aries/trunk/proxy/proxy-impl/src/main/java/org/apache/aries/proxy/impl/gen/ProxySubclassAdapter.java
Mon Jan 30 17:36:52 2012
@@ -61,7 +61,7 @@ public class ProxySubclassAdapter extend
   public ProxySubclassAdapter(ClassVisitor writer, String newClassName, ClassLoader loader)
   {
     // call the superclass constructor
-    super(Constants.ASM4, writer);
+    super(Opcodes.ASM4, writer);
     // the writer is now the cv in the superclass of ClassAdapter
 
     LOGGER.debug(Constants.LOG_ENTRY, "ProxySubclassAdapter", new Object[] { this, writer,

Modified: aries/trunk/proxy/proxy-impl/src/main/java/org/apache/aries/proxy/impl/gen/ProxySubclassHierarchyAdapter.java
URL: http://svn.apache.org/viewvc/aries/trunk/proxy/proxy-impl/src/main/java/org/apache/aries/proxy/impl/gen/ProxySubclassHierarchyAdapter.java?rev=1237821&r1=1237820&r2=1237821&view=diff
==============================================================================
--- aries/trunk/proxy/proxy-impl/src/main/java/org/apache/aries/proxy/impl/gen/ProxySubclassHierarchyAdapter.java
(original)
+++ aries/trunk/proxy/proxy-impl/src/main/java/org/apache/aries/proxy/impl/gen/ProxySubclassHierarchyAdapter.java
Mon Jan 30 17:36:52 2012
@@ -47,7 +47,7 @@ public class ProxySubclassHierarchyAdapt
 
   ProxySubclassHierarchyAdapter(ProxySubclassAdapter adapter, Collection<String> methodsToImplement)
   {
-    super(Constants.ASM4);
+    super(Opcodes.ASM4);
     LOGGER.debug(Constants.LOG_ENTRY, "ProxySubclassHeirarchyAdapter", new Object[] {
         this, adapter, methodsToImplement });
 

Modified: aries/trunk/proxy/proxy-impl/src/main/java/org/apache/aries/proxy/impl/interfaces/InterfaceCombiningClassAdapter.java
URL: http://svn.apache.org/viewvc/aries/trunk/proxy/proxy-impl/src/main/java/org/apache/aries/proxy/impl/interfaces/InterfaceCombiningClassAdapter.java?rev=1237821&r1=1237820&r2=1237821&view=diff
==============================================================================
--- aries/trunk/proxy/proxy-impl/src/main/java/org/apache/aries/proxy/impl/interfaces/InterfaceCombiningClassAdapter.java
(original)
+++ aries/trunk/proxy/proxy-impl/src/main/java/org/apache/aries/proxy/impl/interfaces/InterfaceCombiningClassAdapter.java
Mon Jan 30 17:36:52 2012
@@ -28,22 +28,19 @@ import org.apache.aries.proxy.UnableToPr
 import org.apache.aries.proxy.impl.common.AbstractWovenProxyAdapter;
 import org.apache.aries.proxy.impl.common.OSGiFriendlyClassVisitor;
 import org.apache.aries.proxy.impl.common.OSGiFriendlyClassWriter;
-import org.apache.aries.proxy.impl.gen.Constants;
-import org.apache.aries.proxy.impl.weaving.EmptyVisitor;
 import org.apache.aries.proxy.weaving.WovenProxy;
 import org.objectweb.asm.ClassVisitor;
 import org.objectweb.asm.ClassWriter;
 import org.objectweb.asm.MethodVisitor;
 import org.objectweb.asm.Opcodes;
 import org.objectweb.asm.Type;
-
 import org.objectweb.asm.commons.Method;
 
 /**
  * This class is used to aggregate several interfaces into a real class which implements
all of them
  */
-final class InterfaceCombiningClassAdapter extends EmptyVisitor implements Opcodes {
-  
+final class InterfaceCombiningClassAdapter extends ClassVisitor implements Opcodes {
+
   /** The superclass we should use */
   private final Class<? extends WovenProxy> superclass;
   /** The interfaces we need to implement */
@@ -54,7 +51,7 @@ final class InterfaceCombiningClassAdapt
   private final InterfaceUsingWovenProxyAdapter adapter;
   /** Whether we have already written the class bytes */
   private boolean done = false;
-  
+
   /**
    * Construct an {@link InterfaceCombiningClassAdapter} to combine the supplied
    * interfaces into a class with the supplied name using the supplied classloader
@@ -62,26 +59,26 @@ final class InterfaceCombiningClassAdapt
    * @param loader
    * @param interfaces
    */
-   InterfaceCombiningClassAdapter(String className,
+  InterfaceCombiningClassAdapter(String className,
       ClassLoader loader, Class<? extends WovenProxy> superclass, Collection<Class<?>>
interfaces) {
-     super(Constants.ASM4);
+    super(Opcodes.ASM4);
     writer = new OSGiFriendlyClassWriter(ClassWriter.COMPUTE_FRAMES, loader, className, (superclass!=null)?
superclass.getName(): null);
     ClassVisitor cv = new OSGiFriendlyClassVisitor(writer, ClassWriter.COMPUTE_FRAMES);
     adapter = new InterfaceUsingWovenProxyAdapter(cv, className, loader);
-    
+
     this.interfaces = interfaces;
     this.superclass = superclass;
     String[] interfaceNames = new String[interfaces.size()];
-    
+
     int i = 0;
     for(Class<?> in : interfaces) {
       interfaceNames[i] = Type.getInternalName(in);
       i++;
     }
-    
+
     adapter.visit(V1_6, ACC_PUBLIC | ACC_SYNTHETIC, className, null,
         (superclass == null) ? AbstractWovenProxyAdapter.OBJECT_TYPE.getInternalName() :
-                               Type.getInternalName(superclass), interfaceNames);
+          Type.getInternalName(superclass), interfaceNames);
   }
 
 
@@ -98,7 +95,7 @@ final class InterfaceCombiningClassAdapt
       return adapter.visitMethod(access & ~ACC_ABSTRACT, name, desc, null, arg4);
     }
   }
-  
+
   /**
    * Generate the byte[] for our class
    * @return
@@ -114,24 +111,24 @@ final class InterfaceCombiningClassAdapt
           throw new UnableToProxyException(c, e);
         }
       }
-      
+
       Class<?> clazz = superclass;
-      
+
       while(clazz != null && (clazz.getModifiers() & Modifier.ABSTRACT) != 0)
{
         adapter.setCurrentMethodDeclaringType(Type.getType(clazz), false);
         visitAbstractMethods(clazz);
         clazz = clazz.getSuperclass();
       }
-      
+
       adapter.setCurrentMethodDeclaringType(Type.getType(Object.class), false);
       visitObjectMethods();
-      
+
       adapter.visitEnd();
       done  = true;
     }
     return writer.toByteArray();
   }
-  
+
   private void visitAbstractMethods(Class<?> clazz) {
     for(java.lang.reflect.Method m : clazz.getDeclaredMethods()) {
       int modifiers = m.getModifiers();
@@ -153,13 +150,13 @@ final class InterfaceCombiningClassAdapt
    * even if they are not on any of the interfaces
    */
   private void visitObjectMethods() {
-      MethodVisitor visitor = visitMethod(ACC_PUBLIC, "toString", "()Ljava/lang/String;",
null, null);
-      if (visitor != null) visitor.visitEnd();
-      
-      visitor = visitMethod(ACC_PUBLIC, "equals", "(Ljava/lang/Object;)Z", null, null);
-      if (visitor != null) visitor.visitEnd();
+    MethodVisitor visitor = visitMethod(ACC_PUBLIC, "toString", "()Ljava/lang/String;", null,
null);
+    if (visitor != null) visitor.visitEnd();
+
+    visitor = visitMethod(ACC_PUBLIC, "equals", "(Ljava/lang/Object;)Z", null, null);
+    if (visitor != null) visitor.visitEnd();
 
-      visitor = visitMethod(ACC_PUBLIC, "hashCode", "()I", null, null);
-      if (visitor != null) visitor.visitEnd();      
+    visitor = visitMethod(ACC_PUBLIC, "hashCode", "()I", null, null);
+    if (visitor != null) visitor.visitEnd();      
   }
 }
\ No newline at end of file

Modified: aries/trunk/proxy/proxy-impl/src/main/java/org/apache/aries/proxy/impl/interfaces/InterfaceProxyGenerator.java
URL: http://svn.apache.org/viewvc/aries/trunk/proxy/proxy-impl/src/main/java/org/apache/aries/proxy/impl/interfaces/InterfaceProxyGenerator.java?rev=1237821&r1=1237820&r2=1237821&view=diff
==============================================================================
--- aries/trunk/proxy/proxy-impl/src/main/java/org/apache/aries/proxy/impl/interfaces/InterfaceProxyGenerator.java
(original)
+++ aries/trunk/proxy/proxy-impl/src/main/java/org/apache/aries/proxy/impl/interfaces/InterfaceProxyGenerator.java
Mon Jan 30 17:36:52 2012
@@ -31,9 +31,8 @@ import java.util.concurrent.Callable;
 
 import org.apache.aries.proxy.InvocationListener;
 import org.apache.aries.proxy.UnableToProxyException;
-import org.apache.aries.proxy.impl.gen.Constants;
-import org.apache.aries.proxy.impl.weaving.EmptyVisitor;
 import org.apache.aries.proxy.weaving.WovenProxy;
+import org.objectweb.asm.ClassVisitor;
 import org.objectweb.asm.Opcodes;
 import org.osgi.framework.Bundle;
 
@@ -43,11 +42,11 @@ import org.osgi.framework.Bundle;
  * method overrides for any abstract methods in the hierarchy, but not override any non-abstract
methods.
  * To be safely used as a supertype the superclass should be a WovenProxy.
  */
-public final class InterfaceProxyGenerator extends EmptyVisitor implements Opcodes {
+public final class InterfaceProxyGenerator extends ClassVisitor implements Opcodes {
 
   public InterfaceProxyGenerator()
   {
-    super(Constants.ASM4);
+    super(Opcodes.ASM4);
     
   }
 

Modified: aries/trunk/proxy/proxy-impl/src/main/java/org/apache/aries/proxy/impl/weaving/MethodCopyingClassAdapter.java
URL: http://svn.apache.org/viewvc/aries/trunk/proxy/proxy-impl/src/main/java/org/apache/aries/proxy/impl/weaving/MethodCopyingClassAdapter.java?rev=1237821&r1=1237820&r2=1237821&view=diff
==============================================================================
--- aries/trunk/proxy/proxy-impl/src/main/java/org/apache/aries/proxy/impl/weaving/MethodCopyingClassAdapter.java
(original)
+++ aries/trunk/proxy/proxy-impl/src/main/java/org/apache/aries/proxy/impl/weaving/MethodCopyingClassAdapter.java
Mon Jan 30 17:36:52 2012
@@ -26,7 +26,6 @@ import org.apache.aries.proxy.UnableToPr
 import org.apache.aries.proxy.impl.NLS;
 import org.apache.aries.proxy.impl.common.AbstractWovenProxyAdapter;
 import org.apache.aries.proxy.impl.common.TypeMethod;
-import org.apache.aries.proxy.impl.gen.Constants;
 import org.objectweb.asm.AnnotationVisitor;
 import org.objectweb.asm.Attribute;
 import org.objectweb.asm.ClassReader;
@@ -34,7 +33,6 @@ import org.objectweb.asm.ClassVisitor;
 import org.objectweb.asm.MethodVisitor;
 import org.objectweb.asm.Opcodes;
 import org.objectweb.asm.Type;
-
 import org.objectweb.asm.commons.Method;
 
 /**
@@ -44,7 +42,7 @@ import org.objectweb.asm.commons.Method;
  * all the way up the Class hierarchy and need to override methods on the first
  * subclass we can weave.
  */
-final class MethodCopyingClassAdapter extends EmptyVisitor implements Opcodes {
+final class MethodCopyingClassAdapter extends ClassVisitor implements Opcodes {
   /** The sub-class visitor to write to */
   private final ClassVisitor cv;
   /** The super-class to copy from */
@@ -66,7 +64,7 @@ final class MethodCopyingClassAdapter ex
   public MethodCopyingClassAdapter(ClassVisitor cv, Class<?> superToCopy,
       Type overridingClassType, Set<Method> knownMethods, 
       Map<String, TypeMethod> transformedMethods) {
-    super(Constants.ASM4);
+    super(Opcodes.ASM4);
     this.cv = cv;
     this.superToCopy = superToCopy;
     this.overridingClassType = overridingClassType;
@@ -144,7 +142,7 @@ final class MethodCopyingClassAdapter ex
     
     public CopyingMethodAdapter(MethodVisitor mv, Type superType, 
         Method currentTransformMethod) {
-      super(Constants.ASM4);
+      super(Opcodes.ASM4);
       this.mv = mv;
       this.superType = superType;
       this.currentTransformMethod = currentTransformMethod;

Modified: aries/trunk/proxy/proxy-impl/src/main/java/org/apache/aries/proxy/impl/weaving/SyntheticSerialVerUIDAdder.java
URL: http://svn.apache.org/viewvc/aries/trunk/proxy/proxy-impl/src/main/java/org/apache/aries/proxy/impl/weaving/SyntheticSerialVerUIDAdder.java?rev=1237821&r1=1237820&r2=1237821&view=diff
==============================================================================
--- aries/trunk/proxy/proxy-impl/src/main/java/org/apache/aries/proxy/impl/weaving/SyntheticSerialVerUIDAdder.java
(original)
+++ aries/trunk/proxy/proxy-impl/src/main/java/org/apache/aries/proxy/impl/weaving/SyntheticSerialVerUIDAdder.java
Mon Jan 30 17:36:52 2012
@@ -18,46 +18,70 @@
  */
 package org.apache.aries.proxy.impl.weaving;
 
-import java.io.IOException;
+import java.lang.reflect.Modifier;
 
-import org.apache.aries.proxy.impl.gen.Constants;
+import org.objectweb.asm.FieldVisitor;
+import org.objectweb.asm.Opcodes;
+import org.objectweb.asm.Type;
 import org.objectweb.asm.commons.SerialVersionUIDAdder;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
 
 class SyntheticSerialVerUIDAdder extends SerialVersionUIDAdder {
 
-  private static Logger LOGGER = LoggerFactory.getLogger(SyntheticSerialVerUIDAdder.class);
-
   private WovenProxyAdapter wpa;
-  
+
+  //copied from superclass, they are now private
+  /**
+   * Flag that indicates if we need to compute SVUID.
+   */
+  private boolean computeSVUID;
+
+  /**
+   * Set to true if the class already has SVUID.
+   */
+  private boolean hasSVUID;
+
   public SyntheticSerialVerUIDAdder(WovenProxyAdapter cv) {
     super(cv);
     wpa = cv;
   }
 
+  // The following visit and visitField methods are workaround since ASM4 does not supply
the javadoced method isHasSVUID() by mistake. 
+  // When the method isHasSVUId() or similar methods available, we can remove the following
two methods.
+
   @Override
-  public void visitEnd() {
-   
-    wpa.setSVUIDGenerated(!!!isHasSVUID());
-    super.visitEnd();
+  public void visit(
+      final int version,
+      final int access,
+      final String name,
+      final String signature,
+      final String superName,
+      final String[] interfaces) {
+    computeSVUID = (access & Opcodes.ACC_INTERFACE) == 0;
+    super.visit(version, access, name, signature, superName, interfaces);
   }
-  
-  private boolean isHasSVUID() {
-    try {
-      if (computeSVUID() == 0 ) {
-        // This means the class has a serial id already
-        return true;      
-      } else {
-        return false;
-      }
-    } catch (IOException ioe) {
-   
-      LOGGER.debug(Constants.LOG_ENTRY, "cannot.compute.serial.id", new Object[] { ioe });
 
-    } finally {
-      return false;
+  @Override
+  public FieldVisitor visitField(
+      final int access,
+      final String name,
+      final String desc,
+      final String signature,
+      final Object value) {
+    if (computeSVUID) {
+      if ("serialVersionUID".equals(name) && Modifier.isFinal(access) &&
Modifier.isStatic(access) && Type.LONG_TYPE.equals(Type.getType(desc))) {
+        // since the class already has SVUID, we won't be computing it.
+        computeSVUID = false;
+        hasSVUID = true;
+      }
     }
 
+    return super.visitField(access, name, desc, signature, value);
+  }
+
+  @Override
+  public void visitEnd() {
+
+    wpa.setSVUIDGenerated(!!!hasSVUID);
+    super.visitEnd();
   }
 }

Modified: aries/trunk/proxy/proxy-impl/src/main/java/org/apache/aries/proxy/synthesizer/Synthesizer.java
URL: http://svn.apache.org/viewvc/aries/trunk/proxy/proxy-impl/src/main/java/org/apache/aries/proxy/synthesizer/Synthesizer.java?rev=1237821&r1=1237820&r2=1237821&view=diff
==============================================================================
--- aries/trunk/proxy/proxy-impl/src/main/java/org/apache/aries/proxy/synthesizer/Synthesizer.java
(original)
+++ aries/trunk/proxy/proxy-impl/src/main/java/org/apache/aries/proxy/synthesizer/Synthesizer.java
Mon Jan 30 17:36:52 2012
@@ -22,7 +22,6 @@ package org.apache.aries.proxy.synthesiz
 import java.io.FileInputStream;
 import java.io.FileOutputStream;
 
-import org.apache.aries.proxy.impl.gen.Constants;
 import org.objectweb.asm.ClassReader;
 import org.objectweb.asm.ClassVisitor;
 import org.objectweb.asm.ClassWriter;
@@ -84,7 +83,7 @@ public class Synthesizer
 
     public CustomClassVisitor( ClassVisitor cv)
     {
-      super(Constants.ASM4, cv);
+      super(Opcodes.ASM4, cv);
       
     }
     @Override

Modified: aries/trunk/proxy/proxy-impl/src/main/resources/org/apache/aries/proxy/nls/ProxyImplMessages.properties
URL: http://svn.apache.org/viewvc/aries/trunk/proxy/proxy-impl/src/main/resources/org/apache/aries/proxy/nls/ProxyImplMessages.properties?rev=1237821&r1=1237820&r2=1237821&view=diff
==============================================================================
--- aries/trunk/proxy/proxy-impl/src/main/resources/org/apache/aries/proxy/nls/ProxyImplMessages.properties
(original)
+++ aries/trunk/proxy/proxy-impl/src/main/resources/org/apache/aries/proxy/nls/ProxyImplMessages.properties
Mon Jan 30 17:36:52 2012
@@ -47,4 +47,3 @@ no.common.superclass=The class {0} and {
 cannot.weave=The class {0} cannot be woven, it may not be possible for the runtime to proxy
this class.
 # {0} The class that could not be woven.
 fatal.weaving.failure=There was a serious error trying to weave the class {0}. See the associated
exception for more information.
-cannot.compute.serial.id=An internal error occurred while computing serial id. {0}



Mime
View raw message