aries-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From timothyjw...@apache.org
Subject svn commit: r1132910 - in /aries/trunk/proxy/proxy-impl/src/main/java/org/apache/aries/proxy/impl/weaving: AbstractWovenProxyAdapter.java WovenProxyGenerator.java
Date Tue, 07 Jun 2011 08:42:13 GMT
Author: timothyjward
Date: Tue Jun  7 08:42:13 2011
New Revision: 1132910

URL: http://svn.apache.org/viewvc?rev=1132910&view=rev
Log:
ARIES-669 - revert changes to remove ASM licensed code

Modified:
    aries/trunk/proxy/proxy-impl/src/main/java/org/apache/aries/proxy/impl/weaving/AbstractWovenProxyAdapter.java
    aries/trunk/proxy/proxy-impl/src/main/java/org/apache/aries/proxy/impl/weaving/WovenProxyGenerator.java

Modified: aries/trunk/proxy/proxy-impl/src/main/java/org/apache/aries/proxy/impl/weaving/AbstractWovenProxyAdapter.java
URL: http://svn.apache.org/viewvc/aries/trunk/proxy/proxy-impl/src/main/java/org/apache/aries/proxy/impl/weaving/AbstractWovenProxyAdapter.java?rev=1132910&r1=1132909&r2=1132910&view=diff
==============================================================================
--- aries/trunk/proxy/proxy-impl/src/main/java/org/apache/aries/proxy/impl/weaving/AbstractWovenProxyAdapter.java
(original)
+++ aries/trunk/proxy/proxy-impl/src/main/java/org/apache/aries/proxy/impl/weaving/AbstractWovenProxyAdapter.java
Tue Jun  7 08:42:13 2011
@@ -173,7 +173,7 @@ abstract class AbstractWovenProxyAdapter
       ClassLoader loader) {
     // We wrap the writer in a StaticInitMerger so we don't have to worry about
     // our generated static init clashing with an existing one!
-    super(new MyStaticInitMerger("static_init_" + UU_ID, writer));
+    super(new StaticInitMerger("static_init_" + UU_ID, writer));
     typeBeingWoven = Type.getType("L" + className.replace('.', '/') + ";");
     this.loader = loader;
   }
@@ -521,7 +521,7 @@ abstract class AbstractWovenProxyAdapter
           methodStaticFieldName, METHOD_TYPE.getDescriptor(), null, null)
           .visitEnd();
     }
-    GeneratorAdapter staticAdapter = new GeneratorAdapter(ACC_STATIC | ACC_SYNTHETIC,
+    GeneratorAdapter staticAdapter = new GeneratorAdapter(ACC_STATIC,
         new Method("<clinit>", Type.VOID_TYPE, NO_ARGS), null, null, cv);
 
     for (Entry<String, TypeMethod> entry : transformedMethods.entrySet()) {
@@ -610,7 +610,7 @@ abstract class AbstractWovenProxyAdapter
    * Get a generator for a method, this be annotated with the "invisibility"
    * annotations (and ensured synthetic)
    * 
-   * @param method
+   * @param methodSignature
    * @return
    */
   private final GeneratorAdapter getMethodGenerator(int access, Method method) {
@@ -621,95 +621,4 @@ abstract class AbstractWovenProxyAdapter
     ga.visitCode();
     return ga;
   }
-
-  /**
-   * This is a copy of the asm StaticInitMerger class modified
-   * to mark the generated static init method synthetic
-   */
-  /***
-   * ASM: a very small and fast Java bytecode manipulation framework
-   * Copyright (c) 2000-2007 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.
-   */
-  public static class MyStaticInitMerger extends ClassAdapter {
-
-    private String name;
-
-    private MethodVisitor clinit;
-
-    private final String prefix;
-
-    private int counter;
-
-    public MyStaticInitMerger(final String prefix, final ClassVisitor cv) {
-      super(cv);
-      this.prefix = prefix;
-    }
-
-    public void visit(
-        final int version,
-        final int access,
-        final String name,
-        final String signature,
-        final String superName,
-        final String[] interfaces) {
-      cv.visit(version, access, name, signature, superName, interfaces);
-      this.name = name;
-    }
-
-    public MethodVisitor visitMethod(
-        final int access,
-        final String name,
-        final String desc,
-        final String signature,
-        final String[] exceptions) {
-      MethodVisitor mv;
-      if ("<clinit>".equals(name)) {
-        int a = Opcodes.ACC_PRIVATE + Opcodes.ACC_STATIC + Opcodes.ACC_SYNTHETIC;
-        String n = prefix + counter++;
-        mv = cv.visitMethod(a, n, desc, signature, exceptions);
-
-        if (clinit == null) {
-          clinit = cv.visitMethod(a, name, desc, null, null);
-        }
-        clinit.visitMethodInsn(Opcodes.INVOKESTATIC, this.name, n, desc);
-      } else {
-        mv = cv.visitMethod(access, name, desc, signature, exceptions);
-      }
-      return mv;
-    }
-
-    public void visitEnd() {
-      if (clinit != null) {
-        clinit.visitInsn(Opcodes.RETURN);
-        clinit.visitMaxs(0, 0);
-      }
-      cv.visitEnd();
-    }
-  }
-
 }
\ No newline at end of file

Modified: aries/trunk/proxy/proxy-impl/src/main/java/org/apache/aries/proxy/impl/weaving/WovenProxyGenerator.java
URL: http://svn.apache.org/viewvc/aries/trunk/proxy/proxy-impl/src/main/java/org/apache/aries/proxy/impl/weaving/WovenProxyGenerator.java?rev=1132910&r1=1132909&r2=1132910&view=diff
==============================================================================
--- aries/trunk/proxy/proxy-impl/src/main/java/org/apache/aries/proxy/impl/weaving/WovenProxyGenerator.java
(original)
+++ aries/trunk/proxy/proxy-impl/src/main/java/org/apache/aries/proxy/impl/weaving/WovenProxyGenerator.java
Tue Jun  7 08:42:13 2011
@@ -24,7 +24,10 @@ import static org.objectweb.asm.Opcodes.
 
 import java.math.BigDecimal;
 
-import org.objectweb.asm.*;
+import org.objectweb.asm.ClassReader;
+import org.objectweb.asm.ClassVisitor;
+import org.objectweb.asm.ClassWriter;
+import org.objectweb.asm.Opcodes;
 import org.objectweb.asm.commons.SerialVersionUIDAdder;
 
 /**
@@ -48,51 +51,11 @@ public final class WovenProxyGenerator
     ClassVisitor weavingAdapter = new WovenProxyAdapter(cWriter, className, loader);
     
     //Wrap our outer layer to add the original SerialVersionUID if it was previously being
defaulted
-    weavingAdapter = new MySerialVersionUIDAdder(weavingAdapter);
+    weavingAdapter = new SerialVersionUIDAdder(weavingAdapter);
     
     // If we are Java 1.6 + then we need to skip frames as they will be recomputed
     cReader.accept(weavingAdapter, IS_AT_LEAST_JAVA_6 ? ClassReader.SKIP_FRAMES : 0);
     
     return cWriter.toByteArray();
   }
-
-  /**
-   * same as the ASM class it extends except marks the new SerialVersionUID filed synthetic
-   */
-  private static class MySerialVersionUIDAdder extends SerialVersionUIDAdder {
-    /**
-     * Creates a new {@link org.objectweb.asm.commons.SerialVersionUIDAdder}.
-     *
-     * @param cv a {@link org.objectweb.asm.ClassVisitor} to which this visitor will delegate
-     *           calls.
-     */
-    public MySerialVersionUIDAdder(ClassVisitor cv) {
-      super(cv);
-    }
-
-    /*
-    * Add the SVUID if class doesn't have one
-    */
-    public void visitEnd() {
-      // compute SVUID and add it to the class
-      if (computeSVUID && !hasSVUID) {
-        try {
-          cv.visitField(Opcodes.ACC_FINAL + Opcodes.ACC_STATIC + Opcodes.ACC_SYNTHETIC,
-              "serialVersionUID",
-              "J",
-              null,
-              new Long(computeSVUID()));
-        } catch (Throwable e) {
-          throw new RuntimeException("Error while computing SVUID for "
-              + name, e);
-        }
-      }
-      computeSVUID = false;
-      super.visitEnd();
-    }
-
-
-  }
-
-
-}
+}
\ No newline at end of file



Mime
View raw message