aries-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cschnei...@apache.org
Subject svn commit: r1778286 - in /aries/trunk/proxy: proxy-impl/ proxy-impl/src/main/java/org/apache/aries/proxy/impl/ proxy-impl/src/main/java/org/apache/aries/proxy/impl/common/ proxy-impl/src/main/java/org/apache/aries/proxy/impl/gen/ proxy-impl/src/main/j...
Date Wed, 11 Jan 2017 12:32:29 GMT
Author: cschneider
Date: Wed Jan 11 12:32:28 2017
New Revision: 1778286

URL: http://svn.apache.org/viewvc?rev=1778286&view=rev
Log:
[ARIES-1657] Make proxy impl indepdenent of aries util

Added:
    aries/trunk/proxy/proxy-impl/src/main/java/org/apache/aries/proxy/impl/interfaces/ClassLoaderProxy.java
      - copied, changed from r1778164, aries/trunk/proxy/proxy-impl/src/test/java/org/apache/aries/util/ClassLoaderProxy.java
Removed:
    aries/trunk/proxy/proxy-impl/src/main/java/org/apache/aries/proxy/impl/NLS.java
    aries/trunk/proxy/proxy-impl/src/main/resources/org/apache/aries/proxy/nls/ProxyImplMessages.properties
    aries/trunk/proxy/proxy-impl/src/test/java/org/apache/aries/util/ClassLoaderProxy.java
Modified:
    aries/trunk/proxy/proxy-impl/pom.xml
    aries/trunk/proxy/proxy-impl/src/main/java/org/apache/aries/proxy/impl/AbstractProxyManager.java
    aries/trunk/proxy/proxy-impl/src/main/java/org/apache/aries/proxy/impl/JdkProxyManager.java
    aries/trunk/proxy/proxy-impl/src/main/java/org/apache/aries/proxy/impl/ProxyManagerActivator.java
    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/AbstractWovenProxyMethodAdapter.java
    aries/trunk/proxy/proxy-impl/src/main/java/org/apache/aries/proxy/impl/common/MethodCopyingClassAdapter.java
    aries/trunk/proxy/proxy-impl/src/main/java/org/apache/aries/proxy/impl/common/OSGiFriendlyClassWriter.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/ProxySubclassGenerator.java
    aries/trunk/proxy/proxy-impl/src/main/java/org/apache/aries/proxy/impl/interfaces/ProxyClassLoader.java
    aries/trunk/proxy/proxy-impl/src/main/java/org/apache/aries/proxy/impl/weaving/ProxyWeavingHook.java
    aries/trunk/proxy/proxy-impl/src/main/java/org/apache/aries/proxy/synthesizer/Synthesizer.java
    aries/trunk/proxy/proxy-impl/src/test/java/org/apache/aries/blueprint/proxy/InterfaceProxyingTest.java
    aries/trunk/proxy/proxy-impl/src/test/java/org/apache/aries/blueprint/proxy/ProxySubclassGeneratorTest.java
    aries/trunk/proxy/proxy-impl/src/test/java/org/apache/aries/blueprint/proxy/ProxyTestClassInnerClasses.java
    aries/trunk/proxy/proxy-impl/src/test/java/org/apache/aries/blueprint/proxy/ProxyTestClassSerializable.java
    aries/trunk/proxy/proxy-impl/src/test/java/org/apache/aries/blueprint/proxy/ProxyTestClassSerializableChild.java
    aries/trunk/proxy/proxy-impl/src/test/java/org/apache/aries/blueprint/proxy/ProxyTestClassSerializableInterface.java
    aries/trunk/proxy/proxy-impl/src/test/java/org/apache/aries/blueprint/proxy/ProxyTestClassSuper.java
    aries/trunk/proxy/proxy-impl/src/test/java/org/apache/aries/blueprint/proxy/ProxyTestClassSuperWithNoDefaultOrProtectedAccess.java
    aries/trunk/proxy/proxy-impl/src/test/java/org/apache/aries/blueprint/proxy/WovenProxyGeneratorTest.java
    aries/trunk/proxy/proxy-impl/src/test/java/org/apache/aries/blueprint/proxy/WovenProxyPlusSubclassGeneratorTest.java
    aries/trunk/proxy/proxy-impl/src/test/java/org/apache/aries/blueprint/proxy/WovenSubclassGeneratorTest.java
    aries/trunk/proxy/proxy-impl/src/test/java/org/apache/aries/util/AriesFrameworkUtil.java
    aries/trunk/proxy/proxy-itests/pom.xml
    aries/trunk/proxy/proxy-itests/src/test/java/org/apache/aries/proxy/itests/AbstractProxyTest.java
    aries/trunk/proxy/proxy-itests/src/test/java/org/apache/aries/proxy/itests/AbstractWeavingProxyTest.java

Modified: aries/trunk/proxy/proxy-impl/pom.xml
URL: http://svn.apache.org/viewvc/aries/trunk/proxy/proxy-impl/pom.xml?rev=1778286&r1=1778285&r2=1778286&view=diff
==============================================================================
--- aries/trunk/proxy/proxy-impl/pom.xml (original)
+++ aries/trunk/proxy/proxy-impl/pom.xml Wed Jan 11 12:32:28 2017
@@ -78,7 +78,7 @@
         <dependency>
             <groupId>org.apache.aries.proxy</groupId>
             <artifactId>org.apache.aries.proxy.api</artifactId>
-            <version>1.0.0</version>
+            <version>1.1.0-SNAPSHOT</version>
         </dependency>
         <dependency>
             <groupId>org.ow2.asm</groupId>
@@ -103,6 +103,12 @@
         </dependency>
 
         <dependency>
+            <groupId>org.apache.commons</groupId>
+            <artifactId>commons-io</artifactId>
+            <version>1.3.2</version>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
             <groupId>org.slf4j</groupId>
             <artifactId>slf4j-simple</artifactId>
             <scope>test</scope>

Modified: aries/trunk/proxy/proxy-impl/src/main/java/org/apache/aries/proxy/impl/AbstractProxyManager.java
URL: http://svn.apache.org/viewvc/aries/trunk/proxy/proxy-impl/src/main/java/org/apache/aries/proxy/impl/AbstractProxyManager.java?rev=1778286&r1=1778285&r2=1778286&view=diff
==============================================================================
--- aries/trunk/proxy/proxy-impl/src/main/java/org/apache/aries/proxy/impl/AbstractProxyManager.java (original)
+++ aries/trunk/proxy/proxy-impl/src/main/java/org/apache/aries/proxy/impl/AbstractProxyManager.java Wed Jan 11 12:32:28 2017
@@ -18,6 +18,8 @@
  */
 package org.apache.aries.proxy.impl;
 
+import static java.lang.String.format;
+
 import java.lang.reflect.Constructor;
 import java.lang.reflect.InvocationHandler;
 import java.lang.reflect.InvocationTargetException;
@@ -28,8 +30,8 @@ import org.apache.aries.proxy.Invocation
 import org.apache.aries.proxy.ProxyManager;
 import org.apache.aries.proxy.UnableToProxyException;
 import org.apache.aries.proxy.weaving.WovenProxy;
-import org.apache.aries.util.AriesFrameworkUtil;
 import org.osgi.framework.Bundle;
+import org.osgi.framework.wiring.BundleWiring;
 
 public abstract class AbstractProxyManager implements ProxyManager
 {
@@ -60,7 +62,7 @@ public abstract class AbstractProxyManag
       throws UnableToProxyException 
   {
     if(dispatcher == null)
-      throw new NullPointerException(NLS.MESSAGES.getMessage("no.dispatcher"));
+      throw new NullPointerException("You must specify a dipatcher");
     
     if (template instanceof WovenProxy) {
       WovenProxy proxy = ((WovenProxy) template).
@@ -118,7 +120,8 @@ public abstract class AbstractProxyManag
   protected synchronized ClassLoader getClassLoader(final Bundle clientBundle, Collection<Class<?>> classes) 
   {
     if (clientBundle != null && clientBundle.getState() == Bundle.UNINSTALLED) {
-      throw new IllegalStateException(NLS.MESSAGES.getMessage("bundle.uninstalled", clientBundle.getSymbolicName(), clientBundle.getVersion(), clientBundle.getBundleId()));
+      throw new IllegalStateException(format("The bundle %s at version %s with id %d has been uninstalled.", 
+                                             clientBundle.getSymbolicName(), clientBundle.getVersion(), clientBundle.getBundleId()));
     }
     
     ClassLoader cl = null;
@@ -126,13 +129,17 @@ public abstract class AbstractProxyManag
     if (classes.size() == 1) cl = classes.iterator().next().getClassLoader();
 
     if (cl == null) {
-      // First of all see if the AriesFrameworkUtil can get the classloader, if it can we go with that.
-      cl = AriesFrameworkUtil.getClassLoaderForced(clientBundle);
+        cl = getWiringClassloader(clientBundle);
     }
     
     return cl;
   }
 
+  private ClassLoader getWiringClassloader(final Bundle bundle) {
+    BundleWiring wiring = bundle != null ? bundle.adapt(BundleWiring.class) : null;
+    return wiring != null ? wiring.getClassLoader() : null;
+  }
+
   private Object duplicateProxy(Collection<Class<?>> classes, Callable<Object> dispatcher, 
       Object template, InvocationListener listener)
   {

Modified: aries/trunk/proxy/proxy-impl/src/main/java/org/apache/aries/proxy/impl/JdkProxyManager.java
URL: http://svn.apache.org/viewvc/aries/trunk/proxy/proxy-impl/src/main/java/org/apache/aries/proxy/impl/JdkProxyManager.java?rev=1778286&r1=1778285&r2=1778286&view=diff
==============================================================================
--- aries/trunk/proxy/proxy-impl/src/main/java/org/apache/aries/proxy/impl/JdkProxyManager.java (original)
+++ aries/trunk/proxy/proxy-impl/src/main/java/org/apache/aries/proxy/impl/JdkProxyManager.java Wed Jan 11 12:32:28 2017
@@ -40,7 +40,7 @@ public final class JdkProxyManager exten
   {
     for (Class<?> clazz : classes) {
         if (!!!clazz.isInterface()) {
-          throw new UnableToProxyException(clazz, NLS.MESSAGES.getMessage("class.is.class", clazz.getName()));
+          throw new UnableToProxyException(clazz, String.format("The class %s is not an interface and therefore a proxy cannot be generated.", clazz.getName()));
         } 
     }
     return (Class[]) classes.toArray(new Class[classes.size()]);

Modified: aries/trunk/proxy/proxy-impl/src/main/java/org/apache/aries/proxy/impl/ProxyManagerActivator.java
URL: http://svn.apache.org/viewvc/aries/trunk/proxy/proxy-impl/src/main/java/org/apache/aries/proxy/impl/ProxyManagerActivator.java?rev=1778286&r1=1778285&r2=1778286&view=diff
==============================================================================
--- aries/trunk/proxy/proxy-impl/src/main/java/org/apache/aries/proxy/impl/ProxyManagerActivator.java (original)
+++ aries/trunk/proxy/proxy-impl/src/main/java/org/apache/aries/proxy/impl/ProxyManagerActivator.java Wed Jan 11 12:32:28 2017
@@ -28,6 +28,7 @@ public class ProxyManagerActivator imple
 {
   private static final boolean ASM_PROXY_SUPPORTED;
   private AbstractProxyManager managerService;
+  @SuppressWarnings("rawtypes")
   private ServiceRegistration registration;
   
   static

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=1778286&r1=1778285&r2=1778286&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 Wed Jan 11 12:32:28 2017
@@ -18,6 +18,7 @@
  */
 package org.apache.aries.proxy.impl.common;
 
+import static java.lang.String.format;
 import static org.apache.aries.proxy.impl.ProxyUtils.JAVA_CLASS_VERSION;
 
 import java.io.IOException;
@@ -36,7 +37,6 @@ import java.util.concurrent.Callable;
 
 import org.apache.aries.proxy.InvocationListener;
 import org.apache.aries.proxy.UnableToProxyException;
-import org.apache.aries.proxy.impl.NLS;
 import org.apache.aries.proxy.impl.SystemModuleClassLoader;
 import org.apache.aries.proxy.impl.gen.Constants;
 import org.apache.aries.proxy.weaving.WovenProxy;
@@ -280,10 +280,16 @@ public abstract class AbstractWovenProxy
       // should stop weaving and fail. Make sure we don't cause the hook to
       // throw an error though.
       UnableToProxyException u = new UnableToProxyException(name, e);
-      throw new RuntimeException(NLS.MESSAGES.getMessage("cannot.load.superclass", superName.replace('/', '.'), typeBeingWoven.getClassName()), u);
+      cannotLoadSuperClassException(superName, u);
     }
   }
 
+  private void cannotLoadSuperClassException(String superName, UnableToProxyException u) {
+      String msg = format("Unable to load the super type %s for class %s.", 
+                          superName.replace('/', '.'), typeBeingWoven.getClassName());
+      throw new RuntimeException(msg, u);
+  }
+
   /**
    * This method allows us to determine whether a superclass has a
    * non-private no-args constructor without causing it to initialize.
@@ -304,7 +310,7 @@ public abstract class AbstractWovenProxy
       new ClassReader(is).accept(cf, ClassReader.SKIP_FRAMES + ClassReader.SKIP_DEBUG + ClassReader.SKIP_CODE);
     } catch (IOException ioe) {
       UnableToProxyException u = new UnableToProxyException(name, ioe);
-      throw new RuntimeException(NLS.MESSAGES.getMessage("cannot.load.superclass", superName.replace('/', '.'), typeBeingWoven.getClassName()), u);
+      cannotLoadSuperClassException(superName, u);
     }
     return cf.hasNoArgsConstructor();
   }
@@ -394,8 +400,9 @@ public abstract class AbstractWovenProxy
         readClass(c, new MethodCopyingClassAdapter(this, loader, c, typeBeingWoven, 
             getKnownMethods(), transformedMethods));
       } catch (IOException e) {
-        // This should never happen! <= famous last words (not)
-        throw new RuntimeException(NLS.MESSAGES.getMessage("unexpected.error.processing.class", c.getName(), typeBeingWoven.getClassName()), e);
+        String msg = format("Unexpected error processing %s when weaving %s.",
+                            c.getName(), typeBeingWoven.getClassName());
+        throw new RuntimeException(msg, e);
       }
     }
     // If we need to implement woven proxy in this class then write the methods
@@ -549,7 +556,8 @@ public abstract class AbstractWovenProxy
           methodAdapter.invokeConstructor(typeBeingWoven, NO_ARGS_CONSTRUCTOR);
         else
           throw new RuntimeException(new UnableToProxyException(typeBeingWoven.getClassName(), 
-              NLS.MESSAGES.getMessage("type.lacking.no.arg.constructor", typeBeingWoven.getClassName(), superType.getClassName())));
+              String.format("The class %s and its superclass %s do not have no-args constructors and cannot be woven.",
+                            typeBeingWoven.getClassName(), superType.getClassName())));
       }
       methodAdapter.loadThis();
       methodAdapter.loadArg(0);

Modified: aries/trunk/proxy/proxy-impl/src/main/java/org/apache/aries/proxy/impl/common/AbstractWovenProxyMethodAdapter.java
URL: http://svn.apache.org/viewvc/aries/trunk/proxy/proxy-impl/src/main/java/org/apache/aries/proxy/impl/common/AbstractWovenProxyMethodAdapter.java?rev=1778286&r1=1778285&r2=1778286&view=diff
==============================================================================
--- aries/trunk/proxy/proxy-impl/src/main/java/org/apache/aries/proxy/impl/common/AbstractWovenProxyMethodAdapter.java (original)
+++ aries/trunk/proxy/proxy-impl/src/main/java/org/apache/aries/proxy/impl/common/AbstractWovenProxyMethodAdapter.java Wed Jan 11 12:32:28 2017
@@ -18,6 +18,7 @@
  */
 package org.apache.aries.proxy.impl.common;
 
+import static java.lang.String.format;
 import static org.apache.aries.proxy.impl.common.AbstractWovenProxyAdapter.DISPATCHER_FIELD;
 import static org.apache.aries.proxy.impl.common.AbstractWovenProxyAdapter.DISPATCHER_TYPE;
 import static org.apache.aries.proxy.impl.common.AbstractWovenProxyAdapter.LISTENER_FIELD;
@@ -34,13 +35,13 @@ import static org.objectweb.asm.Opcodes.
 import java.util.Arrays;
 
 import org.apache.aries.proxy.InvocationListener;
-import org.apache.aries.proxy.impl.NLS;
 import org.objectweb.asm.Label;
 import org.objectweb.asm.MethodVisitor;
 import org.objectweb.asm.Opcodes;
 import org.objectweb.asm.Type;
 import org.objectweb.asm.commons.GeneratorAdapter;
 import org.objectweb.asm.commons.Method;
+
 /**
  * This class weaves dispatch and listener code into a method, there are two known
  * subclasses {@link WovenProxyConcreteMethodAdapter} is used for weaving instance methods
@@ -477,7 +478,8 @@ public abstract class AbstractWovenProxy
       ilMethod = clazz.getMethod(name, argTypes);
     } catch (Exception e) {
       //Should be impossible!
-      throw new RuntimeException(NLS.MESSAGES.getMessage("error.finding.invocation.listener.method", name, Arrays.toString(argTypes)), e);
+      throw new RuntimeException(format("Error finding InvocationListener method %s with argument types %s.", 
+                                        name, Arrays.toString(argTypes)), e);
     }
     //get the ASM method
     return new Method(name, Type.getReturnType(ilMethod), Type.getArgumentTypes(ilMethod));

Modified: aries/trunk/proxy/proxy-impl/src/main/java/org/apache/aries/proxy/impl/common/MethodCopyingClassAdapter.java
URL: http://svn.apache.org/viewvc/aries/trunk/proxy/proxy-impl/src/main/java/org/apache/aries/proxy/impl/common/MethodCopyingClassAdapter.java?rev=1778286&r1=1778285&r2=1778286&view=diff
==============================================================================
--- aries/trunk/proxy/proxy-impl/src/main/java/org/apache/aries/proxy/impl/common/MethodCopyingClassAdapter.java (original)
+++ aries/trunk/proxy/proxy-impl/src/main/java/org/apache/aries/proxy/impl/common/MethodCopyingClassAdapter.java Wed Jan 11 12:32:28 2017
@@ -18,12 +18,13 @@
  */
 package org.apache.aries.proxy.impl.common;
 
+import static java.lang.String.format;
+
 import java.util.Map;
 import java.util.Set;
 
 import org.apache.aries.proxy.FinalModifierException;
 import org.apache.aries.proxy.UnableToProxyException;
-import org.apache.aries.proxy.impl.NLS;
 import org.objectweb.asm.AnnotationVisitor;
 import org.objectweb.asm.Attribute;
 import org.objectweb.asm.ClassReader;
@@ -115,9 +116,9 @@ final class MethodCopyingClassAdapter ex
       // We can't call up to a default access method if we aren't in the same
       // package
       if((access & (ACC_PUBLIC | ACC_PROTECTED | ACC_PRIVATE)) == 0) {
-        if(!!!samePackage)
-          throw new RuntimeException(NLS.MESSAGES.getMessage("method.from.superclass.is.hidden", name, superToCopy.getName(), overridingClassType.getClassName()),
-                                     new UnableToProxyException(superToCopy));
+        if(!!!samePackage) {
+            methodHiddenException(name);
+        }
       }
       //Safe to copy a call to this method!
       Type superType = Type.getType(superToCopy);
@@ -140,9 +141,9 @@ final class MethodCopyingClassAdapter ex
         //odd, but if class Super has a protected method foo(), then class Sub, that extends Super, cannot
         //call ((Super)o).foo() in code (it can call super.foo()). If we are in the same package then this
     	//gets around the problem, but if not the class will fail verification.
-        if(!samePackage && (access & ACC_PROTECTED) != 0)
-          throw new RuntimeException(NLS.MESSAGES.getMessage("method.from.superclass.is.hidden", name, superToCopy.getName(), overridingClassType.getClassName()),
-                new UnableToProxyException(superToCopy));
+        if(!samePackage && (access & ACC_PROTECTED) != 0) {
+            methodHiddenException(name);
+        }
         mv = new CopyingMethodAdapter((GeneratorAdapter) weaver, superType, currentTransformMethod);
       }
       else {
@@ -154,6 +155,13 @@ final class MethodCopyingClassAdapter ex
     
     return mv;
   }
+
+private void methodHiddenException(String name) {
+    String msg = format("The method %s in class %s cannot be called by %s because it is in a different package.",
+                        name, superToCopy.getName(), overridingClassType.getClassName());
+    throw new RuntimeException(msg,
+                                 new UnableToProxyException(superToCopy));
+}
   
   /**
    * This class is used to prevent any method body being copied, instead replacing

Modified: aries/trunk/proxy/proxy-impl/src/main/java/org/apache/aries/proxy/impl/common/OSGiFriendlyClassWriter.java
URL: http://svn.apache.org/viewvc/aries/trunk/proxy/proxy-impl/src/main/java/org/apache/aries/proxy/impl/common/OSGiFriendlyClassWriter.java?rev=1778286&r1=1778285&r2=1778286&view=diff
==============================================================================
--- aries/trunk/proxy/proxy-impl/src/main/java/org/apache/aries/proxy/impl/common/OSGiFriendlyClassWriter.java (original)
+++ aries/trunk/proxy/proxy-impl/src/main/java/org/apache/aries/proxy/impl/common/OSGiFriendlyClassWriter.java Wed Jan 11 12:32:28 2017
@@ -24,7 +24,6 @@ import java.util.HashSet;
 import java.util.Set;
 
 import org.apache.aries.proxy.UnableToProxyException;
-import org.apache.aries.proxy.impl.NLS;
 import org.objectweb.asm.ClassReader;
 import org.objectweb.asm.ClassWriter;
 /**
@@ -115,10 +114,11 @@ public final class OSGiFriendlyClassWrit
         }
       }
 
+      String msg = String.format("The class %s and %s do not have a common super class.", arg0, arg1);
       if (unable == null) {
-          throw new RuntimeException(NLS.MESSAGES.getMessage("no.common.superclass", arg0, arg1));
+          throw new RuntimeException(msg);
       } else {
-          throw new RuntimeException(new UnableToProxyException(unable, NLS.MESSAGES.getMessage("no.common.superclass", arg0, arg1)));
+          throw new RuntimeException(new UnableToProxyException(unable, msg));
       }
     } catch (IOException e) {
       throw new RuntimeException(e);

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=1778286&r1=1778285&r2=1778286&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 Wed Jan 11 12:32:28 2017
@@ -22,9 +22,7 @@ import java.io.IOException;
 import java.io.InputStream;
 import java.lang.reflect.Constructor;
 import java.lang.reflect.InvocationHandler;
-import java.lang.reflect.Modifier;
 
-import org.apache.aries.proxy.impl.NLS;
 import org.apache.aries.proxy.impl.ProxyUtils;
 import org.apache.aries.proxy.impl.SystemModuleClassLoader;
 import org.objectweb.asm.AnnotationVisitor;

Modified: aries/trunk/proxy/proxy-impl/src/main/java/org/apache/aries/proxy/impl/gen/ProxySubclassGenerator.java
URL: http://svn.apache.org/viewvc/aries/trunk/proxy/proxy-impl/src/main/java/org/apache/aries/proxy/impl/gen/ProxySubclassGenerator.java?rev=1778286&r1=1778285&r2=1778286&view=diff
==============================================================================
--- aries/trunk/proxy/proxy-impl/src/main/java/org/apache/aries/proxy/impl/gen/ProxySubclassGenerator.java (original)
+++ aries/trunk/proxy/proxy-impl/src/main/java/org/apache/aries/proxy/impl/gen/ProxySubclassGenerator.java Wed Jan 11 12:32:28 2017
@@ -37,7 +37,6 @@ import java.util.concurrent.ConcurrentMa
 
 import org.apache.aries.proxy.FinalModifierException;
 import org.apache.aries.proxy.UnableToProxyException;
-import org.apache.aries.proxy.impl.NLS;
 import org.objectweb.asm.ClassReader;
 import org.objectweb.asm.ClassVisitor;
 import org.objectweb.asm.ClassWriter;
@@ -46,6 +45,7 @@ import org.slf4j.LoggerFactory;
 
 import sun.reflect.ReflectionFactory;
 
+@SuppressWarnings("restriction")
 public class ProxySubclassGenerator
 {
 
@@ -196,7 +196,8 @@ public class ProxySubclassGenerator
       LOGGER.debug(Constants.LOG_EXCEPTION, iae);
       throw new ProxyClassInstantiationException(classToProxy, iae);
     } catch (VerifyError ve) {
-        LOGGER.info(NLS.MESSAGES.getMessage("no.nonprivate.noargs.constructor", classToProxy));
+        LOGGER.info(String.format("The no-argument constructor of class %s is private and therefore it may not be possible to generate a valid proxy.", 
+                                  classToProxy));
         LOGGER.debug(Constants.LOG_EXCEPTION, ve);
         throw new ProxyClassInstantiationException(classToProxy, ve);
     }

Copied: aries/trunk/proxy/proxy-impl/src/main/java/org/apache/aries/proxy/impl/interfaces/ClassLoaderProxy.java (from r1778164, aries/trunk/proxy/proxy-impl/src/test/java/org/apache/aries/util/ClassLoaderProxy.java)
URL: http://svn.apache.org/viewvc/aries/trunk/proxy/proxy-impl/src/main/java/org/apache/aries/proxy/impl/interfaces/ClassLoaderProxy.java?p2=aries/trunk/proxy/proxy-impl/src/main/java/org/apache/aries/proxy/impl/interfaces/ClassLoaderProxy.java&p1=aries/trunk/proxy/proxy-impl/src/test/java/org/apache/aries/util/ClassLoaderProxy.java&r1=1778164&r2=1778286&rev=1778286&view=diff
==============================================================================
--- aries/trunk/proxy/proxy-impl/src/test/java/org/apache/aries/util/ClassLoaderProxy.java (original)
+++ aries/trunk/proxy/proxy-impl/src/main/java/org/apache/aries/proxy/impl/interfaces/ClassLoaderProxy.java Wed Jan 11 12:32:28 2017
@@ -16,7 +16,7 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-package org.apache.aries.util;
+package org.apache.aries.proxy.impl.interfaces;
 
 public interface ClassLoaderProxy {
     ClassLoader getClassLoader();

Modified: aries/trunk/proxy/proxy-impl/src/main/java/org/apache/aries/proxy/impl/interfaces/ProxyClassLoader.java
URL: http://svn.apache.org/viewvc/aries/trunk/proxy/proxy-impl/src/main/java/org/apache/aries/proxy/impl/interfaces/ProxyClassLoader.java?rev=1778286&r1=1778285&r2=1778286&view=diff
==============================================================================
--- aries/trunk/proxy/proxy-impl/src/main/java/org/apache/aries/proxy/impl/interfaces/ProxyClassLoader.java (original)
+++ aries/trunk/proxy/proxy-impl/src/main/java/org/apache/aries/proxy/impl/interfaces/ProxyClassLoader.java Wed Jan 11 12:32:28 2017
@@ -37,8 +37,8 @@ import org.apache.aries.proxy.Invocation
 import org.apache.aries.proxy.UnableToProxyException;
 import org.apache.aries.proxy.impl.common.AbstractWovenProxyAdapter;
 import org.apache.aries.proxy.weaving.WovenProxy;
-import org.apache.aries.util.AriesFrameworkUtil;
 import org.osgi.framework.Bundle;
+import org.osgi.framework.wiring.BundleWiring;
 
 /** An implementation of ClassLoader that will be used to define our proxy class */
 final class ProxyClassLoader extends ClassLoader {
@@ -63,7 +63,15 @@ final class ProxyClassLoader extends Cla
   private final ReadWriteLock ifacesLock = new ReentrantReadWriteLock();
   
   public ProxyClassLoader(Bundle bundle) {
-    super(AriesFrameworkUtil.getClassLoader(bundle));
+//    super(AriesFrameworkUtil.getClassLoader(bundle));
+    super(getClassloader(bundle));
+  }
+
+  private static ClassLoader getClassloader(Bundle bundle) {
+    if (bundle == null) return ProxyClassLoader.class.getClassLoader();
+    if (bundle instanceof ClassLoaderProxy) return ((ClassLoaderProxy) bundle).getClassLoader();
+    BundleWiring wiring = bundle != null ? bundle.adapt(BundleWiring.class) : null;
+    return wiring != null ? wiring.getClassLoader() : null;
   }
 
   @Override

Modified: aries/trunk/proxy/proxy-impl/src/main/java/org/apache/aries/proxy/impl/weaving/ProxyWeavingHook.java
URL: http://svn.apache.org/viewvc/aries/trunk/proxy/proxy-impl/src/main/java/org/apache/aries/proxy/impl/weaving/ProxyWeavingHook.java?rev=1778286&r1=1778285&r2=1778286&view=diff
==============================================================================
--- aries/trunk/proxy/proxy-impl/src/main/java/org/apache/aries/proxy/impl/weaving/ProxyWeavingHook.java (original)
+++ aries/trunk/proxy/proxy-impl/src/main/java/org/apache/aries/proxy/impl/weaving/ProxyWeavingHook.java Wed Jan 11 12:32:28 2017
@@ -18,6 +18,8 @@
  */
 package org.apache.aries.proxy.impl.weaving;
 
+import static java.lang.String.format;
+
 import java.util.ArrayList;
 import java.util.Dictionary;
 import java.util.Hashtable;
@@ -25,7 +27,6 @@ import java.util.List;
 import java.util.regex.Pattern;
 
 import org.apache.aries.proxy.UnableToProxyException;
-import org.apache.aries.proxy.impl.NLS;
 import org.apache.aries.proxy.weaving.WovenProxy;
 import org.apache.aries.proxy.weavinghook.ProxyWeavingController;
 import org.apache.aries.proxy.weavinghook.WeavingHelper;
@@ -60,9 +61,13 @@ public final class ProxyWeavingHook impl
 
   private final List<Pattern> enabled;
   private final List<Pattern> disabled;
+  @SuppressWarnings("rawtypes")
   private final ServiceTracker controllers;
 
-  public ProxyWeavingHook(BundleContext context) {
+  @SuppressWarnings({
+ "unchecked", "rawtypes"
+})
+public ProxyWeavingHook(BundleContext context) {
     String enabledProp = context != null ? context.getProperty(WEAVING_ENABLED_CLASSES) : null;
     enabled = parseMatchers(enabledProp, WEAVING_ENABLED_CLASSES_DEFAULT);
     disabled = parseMatchers(context != null ? context.getProperty(WEAVING_DISABLED_CLASSES) : null, WEAVING_DISABLED_CLASSES_DEFAULT);
@@ -109,12 +114,10 @@ public final class ProxyWeavingHook impl
             e.getCause() instanceof UnableToProxyException){
           //This is a weaving failure that should be logged, but the class
           //can still be loaded
-          LOGGER.trace(NLS.MESSAGES.getMessage("cannot.weave", wovenClass.getClassName()), e);
+          LOGGER.trace(String.format("The class %s cannot be woven, it may not be possible for the runtime to proxy this class.",
+                                     wovenClass.getClassName()), e);
         } else {
-          String failureMessage = NLS.MESSAGES.getMessage("fatal.weaving.failure", wovenClass.getClassName());
-          //This is a failure that should stop the class loading!
-          LOGGER.error(failureMessage, e);
-          throw new WeavingException(failureMessage, e);
+          throw weavingException(wovenClass, e);
         }
       }
       
@@ -127,6 +130,7 @@ public final class ProxyWeavingHook impl
     }
   }
 
+
     private List<Pattern> parseMatchers(String matchers, String def) {
         String[] strings = (matchers != null ? matchers : def).split(",");
         List<Pattern> patterns = new ArrayList<Pattern>();
@@ -172,10 +176,7 @@ public final class ProxyWeavingHook impl
                   wovenClass.getBundleWiring().getClassLoader());
           return WovenProxy.class.isAssignableFrom(superClass);
       } catch (ClassNotFoundException e) {
-          String failureMessage = NLS.MESSAGES.getMessage("fatal.weaving.failure", wovenClass.getClassName());
-          //This is a failure that should stop the class loading!
-          LOGGER.error(failureMessage, e);
-          throw new WeavingException(failureMessage, e);
+          throw weavingException(wovenClass, e);
       }
     }
     
@@ -201,4 +202,11 @@ public final class ProxyWeavingHook impl
     return result;
   }
 
+  private WeavingException weavingException(WovenClass wovenClass, Exception e) {
+    String msg = format("There was a serious error trying to weave the class %s. See the associated exception for more information.",
+                            wovenClass.getClassName());
+    // This is a failure that should stop the class loading!
+    LOGGER.error(msg, e);
+    return new WeavingException(msg, e);
+  }
 }
\ No newline at end of file

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=1778286&r1=1778285&r2=1778286&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 Wed Jan 11 12:32:28 2017
@@ -63,7 +63,6 @@ public class Synthesizer
         //using the writer we created as the visitor
         reader.accept(cv, 0);
       } finally {
-        //close the InputStream if it is hanging around
         if (classInStream != null) classInStream.close();
       }
       FileOutputStream classOutStream = null;

Modified: aries/trunk/proxy/proxy-impl/src/test/java/org/apache/aries/blueprint/proxy/InterfaceProxyingTest.java
URL: http://svn.apache.org/viewvc/aries/trunk/proxy/proxy-impl/src/test/java/org/apache/aries/blueprint/proxy/InterfaceProxyingTest.java?rev=1778286&r1=1778285&r2=1778286&view=diff
==============================================================================
--- aries/trunk/proxy/proxy-impl/src/test/java/org/apache/aries/blueprint/proxy/InterfaceProxyingTest.java (original)
+++ aries/trunk/proxy/proxy-impl/src/test/java/org/apache/aries/blueprint/proxy/InterfaceProxyingTest.java Wed Jan 11 12:32:28 2017
@@ -27,7 +27,6 @@ import static org.junit.Assert.fail;
 
 import java.io.ByteArrayOutputStream;
 import java.io.Closeable;
-import java.io.File;
 import java.io.InputStream;
 import java.util.ArrayList;
 import java.util.Arrays;
@@ -40,18 +39,18 @@ import java.util.concurrent.Callable;
 
 import org.apache.aries.blueprint.proxy.AbstractProxyTest.TestListener;
 import org.apache.aries.mocks.BundleMock;
+import org.apache.aries.proxy.impl.interfaces.ClassLoaderProxy;
 import org.apache.aries.proxy.impl.interfaces.InterfaceProxyGenerator;
 import org.apache.aries.unittest.mocks.MethodCall;
 import org.apache.aries.unittest.mocks.Skeleton;
-import org.apache.aries.util.ClassLoaderProxy;
 import org.junit.Before;
 import org.junit.Test;
 import org.osgi.framework.Bundle;
 import org.osgi.framework.BundleException;
-import org.osgi.framework.wiring.BundleRevision;
 import org.osgi.framework.wiring.BundleWiring;
 
 
+@SuppressWarnings("unchecked")
 public class InterfaceProxyingTest {
 
   public final static class TestCallable implements Callable<Object> {
@@ -116,8 +115,7 @@ public class InterfaceProxyingTest {
   @Test
   public void testGetProxyInstance2() throws Exception{
     
-    Collection<Class<?>> classes = new ArrayList<Class<?>>(Arrays.asList(Closeable.class,
-        Iterable.class, Map.class));
+    Collection<Class<? extends Object>> classes = Arrays.asList(Closeable.class, Iterable.class, Map.class);
     
     Object o = InterfaceProxyGenerator.getProxyInstance(testBundle, null, classes, constantly(null), null);
     
@@ -137,7 +135,7 @@ public class InterfaceProxyingTest {
     TestListener tl = new TestListener();
     TestCallable tc = new TestCallable();
     
-    Callable o = (Callable) InterfaceProxyGenerator.getProxyInstance(testBundle, 
+    Callable<Object> o = (Callable<Object>) InterfaceProxyGenerator.getProxyInstance(testBundle, 
         null, classes, tc, tl);
     
     assertCalled(tl, false, false, false);
@@ -213,7 +211,7 @@ public class InterfaceProxyingTest {
     
     assertTrue(o instanceof Callable);
     
-    assertEquals(5, ((Callable)o).call());
+    assertEquals(5, ((Callable<Object>)o).call());
   }
   
   @Test

Modified: aries/trunk/proxy/proxy-impl/src/test/java/org/apache/aries/blueprint/proxy/ProxySubclassGeneratorTest.java
URL: http://svn.apache.org/viewvc/aries/trunk/proxy/proxy-impl/src/test/java/org/apache/aries/blueprint/proxy/ProxySubclassGeneratorTest.java?rev=1778286&r1=1778285&r2=1778286&view=diff
==============================================================================
--- aries/trunk/proxy/proxy-impl/src/test/java/org/apache/aries/blueprint/proxy/ProxySubclassGeneratorTest.java (original)
+++ aries/trunk/proxy/proxy-impl/src/test/java/org/apache/aries/blueprint/proxy/ProxySubclassGeneratorTest.java Wed Jan 11 12:32:28 2017
@@ -48,7 +48,7 @@ import org.apache.aries.proxy.impl.Proxy
 import org.apache.aries.proxy.impl.SingleInstanceDispatcher;
 import org.apache.aries.proxy.impl.gen.ProxySubclassGenerator;
 import org.apache.aries.proxy.impl.gen.ProxySubclassMethodHashSet;
-import org.apache.aries.util.io.IOUtils;
+import org.apache.commons.io.IOUtils;
 import org.junit.Before;
 import org.junit.Test;
 
@@ -257,7 +257,8 @@ public class ProxySubclassGeneratorTest
     super.testGenerics();
   }
 
-  @Test
+  @SuppressWarnings("unchecked")
+@Test
   public void testClassLoaders() throws Exception {
     ClassLoader clA = new LimitedClassLoader("org.apache.aries.proxy.test.a", null, null);
     ClassLoader clB = new LimitedClassLoader("org.apache.aries.proxy.test.b", "org.apache.aries.proxy.test.a", clA);

Modified: aries/trunk/proxy/proxy-impl/src/test/java/org/apache/aries/blueprint/proxy/ProxyTestClassInnerClasses.java
URL: http://svn.apache.org/viewvc/aries/trunk/proxy/proxy-impl/src/test/java/org/apache/aries/blueprint/proxy/ProxyTestClassInnerClasses.java?rev=1778286&r1=1778285&r2=1778286&view=diff
==============================================================================
--- aries/trunk/proxy/proxy-impl/src/test/java/org/apache/aries/blueprint/proxy/ProxyTestClassInnerClasses.java (original)
+++ aries/trunk/proxy/proxy-impl/src/test/java/org/apache/aries/blueprint/proxy/ProxyTestClassInnerClasses.java Wed Jan 11 12:32:28 2017
@@ -18,7 +18,6 @@
  */
 package org.apache.aries.blueprint.proxy;
 
-import java.lang.reflect.Proxy;
 
 public class ProxyTestClassInnerClasses {
 

Modified: aries/trunk/proxy/proxy-impl/src/test/java/org/apache/aries/blueprint/proxy/ProxyTestClassSerializable.java
URL: http://svn.apache.org/viewvc/aries/trunk/proxy/proxy-impl/src/test/java/org/apache/aries/blueprint/proxy/ProxyTestClassSerializable.java?rev=1778286&r1=1778285&r2=1778286&view=diff
==============================================================================
--- aries/trunk/proxy/proxy-impl/src/test/java/org/apache/aries/blueprint/proxy/ProxyTestClassSerializable.java (original)
+++ aries/trunk/proxy/proxy-impl/src/test/java/org/apache/aries/blueprint/proxy/ProxyTestClassSerializable.java Wed Jan 11 12:32:28 2017
@@ -24,6 +24,7 @@ import java.io.ByteArrayInputStream;
 import java.io.ObjectInputStream;
 import java.io.Serializable;
 
+@SuppressWarnings("serial")
 public class ProxyTestClassSerializable implements Serializable {
   
   public int value = 0;

Modified: aries/trunk/proxy/proxy-impl/src/test/java/org/apache/aries/blueprint/proxy/ProxyTestClassSerializableChild.java
URL: http://svn.apache.org/viewvc/aries/trunk/proxy/proxy-impl/src/test/java/org/apache/aries/blueprint/proxy/ProxyTestClassSerializableChild.java?rev=1778286&r1=1778285&r2=1778286&view=diff
==============================================================================
--- aries/trunk/proxy/proxy-impl/src/test/java/org/apache/aries/blueprint/proxy/ProxyTestClassSerializableChild.java (original)
+++ aries/trunk/proxy/proxy-impl/src/test/java/org/apache/aries/blueprint/proxy/ProxyTestClassSerializableChild.java Wed Jan 11 12:32:28 2017
@@ -18,6 +18,7 @@
  */
 package org.apache.aries.blueprint.proxy;
 
+@SuppressWarnings("serial")
 public class ProxyTestClassSerializableChild extends ProxyTestClassSerializable {
 
 }

Modified: aries/trunk/proxy/proxy-impl/src/test/java/org/apache/aries/blueprint/proxy/ProxyTestClassSerializableInterface.java
URL: http://svn.apache.org/viewvc/aries/trunk/proxy/proxy-impl/src/test/java/org/apache/aries/blueprint/proxy/ProxyTestClassSerializableInterface.java?rev=1778286&r1=1778285&r2=1778286&view=diff
==============================================================================
--- aries/trunk/proxy/proxy-impl/src/test/java/org/apache/aries/blueprint/proxy/ProxyTestClassSerializableInterface.java (original)
+++ aries/trunk/proxy/proxy-impl/src/test/java/org/apache/aries/blueprint/proxy/ProxyTestClassSerializableInterface.java Wed Jan 11 12:32:28 2017
@@ -23,6 +23,7 @@ import static org.junit.Assert.assertEqu
 import java.io.ByteArrayInputStream;
 import java.io.ObjectInputStream;
 
+@SuppressWarnings("serial")
 public class ProxyTestClassSerializableInterface implements
     ProxyTestSerializableInterface {
 

Modified: aries/trunk/proxy/proxy-impl/src/test/java/org/apache/aries/blueprint/proxy/ProxyTestClassSuper.java
URL: http://svn.apache.org/viewvc/aries/trunk/proxy/proxy-impl/src/test/java/org/apache/aries/blueprint/proxy/ProxyTestClassSuper.java?rev=1778286&r1=1778285&r2=1778286&view=diff
==============================================================================
--- aries/trunk/proxy/proxy-impl/src/test/java/org/apache/aries/blueprint/proxy/ProxyTestClassSuper.java (original)
+++ aries/trunk/proxy/proxy-impl/src/test/java/org/apache/aries/blueprint/proxy/ProxyTestClassSuper.java Wed Jan 11 12:32:28 2017
@@ -48,7 +48,8 @@ public class ProxyTestClassSuper
     return null;
   }
   
-  private void doTarget() {
+  @SuppressWarnings("unused")
+private void doTarget() {
     Object o = getTargetObject();
     if(this != o)
       ((ProxyTestClassSuper)o).doTarget();

Modified: aries/trunk/proxy/proxy-impl/src/test/java/org/apache/aries/blueprint/proxy/ProxyTestClassSuperWithNoDefaultOrProtectedAccess.java
URL: http://svn.apache.org/viewvc/aries/trunk/proxy/proxy-impl/src/test/java/org/apache/aries/blueprint/proxy/ProxyTestClassSuperWithNoDefaultOrProtectedAccess.java?rev=1778286&r1=1778285&r2=1778286&view=diff
==============================================================================
--- aries/trunk/proxy/proxy-impl/src/test/java/org/apache/aries/blueprint/proxy/ProxyTestClassSuperWithNoDefaultOrProtectedAccess.java (original)
+++ aries/trunk/proxy/proxy-impl/src/test/java/org/apache/aries/blueprint/proxy/ProxyTestClassSuperWithNoDefaultOrProtectedAccess.java Wed Jan 11 12:32:28 2017
@@ -48,7 +48,8 @@ public class ProxyTestClassSuperWithNoDe
     return null;
   }
   
-  private void doTarget() {
+  @SuppressWarnings("unused")
+private void doTarget() {
     Object o = getTargetObject();
     if(this != o)
       ((ProxyTestClassSuperWithNoDefaultOrProtectedAccess)o).doTarget();

Modified: aries/trunk/proxy/proxy-impl/src/test/java/org/apache/aries/blueprint/proxy/WovenProxyGeneratorTest.java
URL: http://svn.apache.org/viewvc/aries/trunk/proxy/proxy-impl/src/test/java/org/apache/aries/blueprint/proxy/WovenProxyGeneratorTest.java?rev=1778286&r1=1778285&r2=1778286&view=diff
==============================================================================
--- aries/trunk/proxy/proxy-impl/src/test/java/org/apache/aries/blueprint/proxy/WovenProxyGeneratorTest.java (original)
+++ aries/trunk/proxy/proxy-impl/src/test/java/org/apache/aries/blueprint/proxy/WovenProxyGeneratorTest.java Wed Jan 11 12:32:28 2017
@@ -48,17 +48,18 @@ import org.apache.aries.proxy.impl.AsmPr
 import org.apache.aries.proxy.impl.SingleInstanceDispatcher;
 import org.apache.aries.proxy.impl.SystemModuleClassLoader;
 import org.apache.aries.proxy.impl.gen.ProxySubclassMethodHashSet;
+import org.apache.aries.proxy.impl.interfaces.ClassLoaderProxy;
 import org.apache.aries.proxy.impl.weaving.WovenProxyGenerator;
 import org.apache.aries.proxy.weaving.WovenProxy;
 import org.apache.aries.unittest.mocks.MethodCall;
 import org.apache.aries.unittest.mocks.Skeleton;
-import org.apache.aries.util.ClassLoaderProxy;
 import org.junit.BeforeClass;
 import org.junit.Test;
 import org.osgi.framework.Bundle;
 import org.osgi.framework.wiring.BundleWiring;
 
 
+@SuppressWarnings({"unchecked", "rawtypes"})
 public class WovenProxyGeneratorTest extends AbstractProxyTest
 {
   private static final String hexPattern = "[0-9_a-f]";
@@ -140,7 +141,7 @@ public class WovenProxyGeneratorTest ext
   @BeforeClass
   public static void setUp() throws Exception
   {
-    List<Class<?>> classes = new ArrayList(CLASSES.size() + OTHER_CLASSES.size());
+    List<Class<?>> classes = new ArrayList<Class<?>>(CLASSES.size() + OTHER_CLASSES.size());
     
     classes.addAll(CLASSES);
     classes.addAll(OTHER_CLASSES);

Modified: aries/trunk/proxy/proxy-impl/src/test/java/org/apache/aries/blueprint/proxy/WovenProxyPlusSubclassGeneratorTest.java
URL: http://svn.apache.org/viewvc/aries/trunk/proxy/proxy-impl/src/test/java/org/apache/aries/blueprint/proxy/WovenProxyPlusSubclassGeneratorTest.java?rev=1778286&r1=1778285&r2=1778286&view=diff
==============================================================================
--- aries/trunk/proxy/proxy-impl/src/test/java/org/apache/aries/blueprint/proxy/WovenProxyPlusSubclassGeneratorTest.java (original)
+++ aries/trunk/proxy/proxy-impl/src/test/java/org/apache/aries/blueprint/proxy/WovenProxyPlusSubclassGeneratorTest.java Wed Jan 11 12:32:28 2017
@@ -24,13 +24,10 @@ import static org.junit.Assert.assertTru
 
 import java.lang.reflect.Constructor;
 import java.lang.reflect.Method;
-import java.lang.reflect.Modifier;
-import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Collections;
 import java.util.HashMap;
 import java.util.Iterator;
-import java.util.List;
 import java.util.Map;
 import java.util.concurrent.Callable;
 
@@ -39,13 +36,11 @@ import org.apache.aries.proxy.Invocation
 import org.apache.aries.proxy.UnableToProxyException;
 import org.apache.aries.proxy.impl.SingleInstanceDispatcher;
 import org.apache.aries.proxy.impl.gen.ProxySubclassGenerator;
-import org.apache.aries.proxy.impl.gen.ProxySubclassMethodHashSet;
+import org.apache.aries.proxy.impl.interfaces.ClassLoaderProxy;
 import org.apache.aries.proxy.impl.interfaces.InterfaceProxyGenerator;
 import org.apache.aries.proxy.weaving.WovenProxy;
 import org.apache.aries.unittest.mocks.MethodCall;
 import org.apache.aries.unittest.mocks.Skeleton;
-import org.apache.aries.util.ClassLoaderProxy;
-import org.junit.Before;
 import org.junit.BeforeClass;
 import org.junit.Test;
 import org.osgi.framework.Bundle;
@@ -54,14 +49,11 @@ import org.osgi.framework.wiring.BundleW
 /**
  * This class uses the {@link ProxySubclassGenerator} to test
  */
+@SuppressWarnings("unchecked")
 public class WovenProxyPlusSubclassGeneratorTest extends WovenProxyGeneratorTest
 {
   private static final Class<?> FINAL_METHOD_CLASS = ProxyTestClassFinalMethod.class;
   private static final Class<?> FINAL_CLASS = ProxyTestClassFinal.class;
-  private static final Class<?> GENERIC_CLASS = ProxyTestClassGeneric.class;
-  private static final Class<?> COVARIANT_CLASS = ProxyTestClassCovariantOverride.class;
-  private static ProxySubclassMethodHashSet<String> expectedMethods = new ProxySubclassMethodHashSet<String>(
-      12);
   private Callable<Object> testCallable = null;
   
   private static Bundle testBundle;
@@ -203,7 +195,7 @@ public class WovenProxyPlusSubclassGener
   {
     try {
       InterfaceProxyGenerator.getProxyInstance(null, FINAL_CLASS, Collections.EMPTY_SET, 
-          new Callable() {
+          new Callable<Object>() {
         public Object call() throws Exception {
           return null;
         }} , null).getClass();

Modified: aries/trunk/proxy/proxy-impl/src/test/java/org/apache/aries/blueprint/proxy/WovenSubclassGeneratorTest.java
URL: http://svn.apache.org/viewvc/aries/trunk/proxy/proxy-impl/src/test/java/org/apache/aries/blueprint/proxy/WovenSubclassGeneratorTest.java?rev=1778286&r1=1778285&r2=1778286&view=diff
==============================================================================
--- aries/trunk/proxy/proxy-impl/src/test/java/org/apache/aries/blueprint/proxy/WovenSubclassGeneratorTest.java (original)
+++ aries/trunk/proxy/proxy-impl/src/test/java/org/apache/aries/blueprint/proxy/WovenSubclassGeneratorTest.java Wed Jan 11 12:32:28 2017
@@ -42,12 +42,12 @@ import org.apache.aries.proxy.impl.gen.P
 import org.apache.aries.proxy.impl.gen.ProxySubclassMethodHashSet;
 import org.apache.aries.proxy.impl.interfaces.InterfaceProxyGenerator;
 import org.apache.aries.proxy.weaving.WovenProxy;
-import org.junit.Before;
 import org.junit.Test;
 
 /**
  * This class uses the {@link ProxySubclassGenerator} to test
  */
+@SuppressWarnings("unchecked")
 public class WovenSubclassGeneratorTest extends AbstractProxyTest
 {
   private static final Class<?> FINAL_METHOD_CLASS = ProxyTestClassFinalMethod.class;

Modified: aries/trunk/proxy/proxy-impl/src/test/java/org/apache/aries/util/AriesFrameworkUtil.java
URL: http://svn.apache.org/viewvc/aries/trunk/proxy/proxy-impl/src/test/java/org/apache/aries/util/AriesFrameworkUtil.java?rev=1778286&r1=1778285&r2=1778286&view=diff
==============================================================================
--- aries/trunk/proxy/proxy-impl/src/test/java/org/apache/aries/util/AriesFrameworkUtil.java (original)
+++ aries/trunk/proxy/proxy-impl/src/test/java/org/apache/aries/util/AriesFrameworkUtil.java Wed Jan 11 12:32:28 2017
@@ -18,6 +18,7 @@
  */
 package org.apache.aries.util;
 
+import org.apache.aries.proxy.impl.interfaces.ClassLoaderProxy;
 import org.osgi.framework.Bundle;
 
 /**

Modified: aries/trunk/proxy/proxy-itests/pom.xml
URL: http://svn.apache.org/viewvc/aries/trunk/proxy/proxy-itests/pom.xml?rev=1778286&r1=1778285&r2=1778286&view=diff
==============================================================================
--- aries/trunk/proxy/proxy-itests/pom.xml (original)
+++ aries/trunk/proxy/proxy-itests/pom.xml Wed Jan 11 12:32:28 2017
@@ -69,7 +69,7 @@
             <groupId>org.apache.aries.proxy</groupId>
             <artifactId>org.apache.aries.proxy.api</artifactId>
             <scope>test</scope>
-            <version>1.0.2-SNAPSHOT</version>
+            <version>1.1.0-SNAPSHOT</version>
         </dependency>
         <dependency>
             <groupId>org.apache.aries.proxy</groupId>
@@ -77,18 +77,14 @@
             <scope>test</scope>
             <version>1.0.7-SNAPSHOT</version>
         </dependency>
-        <dependency>
-            <groupId>org.apache.aries</groupId>
-            <artifactId>org.apache.aries.util</artifactId>
-            <scope>test</scope>
-            <version>1.0.0</version>
-        </dependency>
+        <!-- 
         <dependency>
             <groupId>org.apache.aries.testsupport</groupId>
             <artifactId>org.apache.aries.testsupport.unit</artifactId>
             <version>2.0.0-SNAPSHOT</version>
             <scope>test</scope>
         </dependency>
+         -->
 
         <!-- pax exam -->
         <dependency>

Modified: aries/trunk/proxy/proxy-itests/src/test/java/org/apache/aries/proxy/itests/AbstractProxyTest.java
URL: http://svn.apache.org/viewvc/aries/trunk/proxy/proxy-itests/src/test/java/org/apache/aries/proxy/itests/AbstractProxyTest.java?rev=1778286&r1=1778285&r2=1778286&view=diff
==============================================================================
--- aries/trunk/proxy/proxy-itests/src/test/java/org/apache/aries/proxy/itests/AbstractProxyTest.java (original)
+++ aries/trunk/proxy/proxy-itests/src/test/java/org/apache/aries/proxy/itests/AbstractProxyTest.java Wed Jan 11 12:32:28 2017
@@ -23,7 +23,6 @@ import static org.junit.Assert.assertFal
 import static org.junit.Assert.assertTrue;
 import static org.junit.Assert.fail;
 import static org.ops4j.pax.exam.CoreOptions.composite;
-import static org.ops4j.pax.exam.CoreOptions.junitBundles;
 import static org.ops4j.pax.exam.CoreOptions.mavenBundle;
 import static org.ops4j.pax.exam.CoreOptions.options;
 import static org.ops4j.pax.exam.CoreOptions.systemProperty;
@@ -38,7 +37,6 @@ import java.util.concurrent.Callable;
 
 import javax.inject.Inject;
 
-import org.apache.aries.itest.AbstractIntegrationTest;
 import org.apache.aries.proxy.InvocationListener;
 import org.apache.aries.proxy.ProxyManager;
 import org.junit.Test;
@@ -49,10 +47,14 @@ import org.ops4j.pax.exam.junit.PaxExam;
 import org.ops4j.pax.exam.spi.reactors.ExamReactorStrategy;
 import org.ops4j.pax.exam.spi.reactors.PerClass;
 import org.osgi.framework.Bundle;
+import org.osgi.framework.BundleContext;
 
 @RunWith(PaxExam.class)
 @ExamReactorStrategy(PerClass.class)
-public abstract class AbstractProxyTest extends AbstractIntegrationTest {
+public abstract class AbstractProxyTest {
+  @Inject
+  BundleContext bundleContext;
+  
   @Inject
   ProxyManager mgr;
 
@@ -292,35 +294,32 @@ public abstract class AbstractProxyTest
       if (localRepo == null) {
           localRepo = System.getProperty("org.ops4j.pax.url.mvn.localRepository");
       }
-	  return composite(
-			  junitBundles(),
+     return composite(
+              CoreOptions.junitBundles(),
               systemProperty("org.ops4j.pax.logging.DefaultServiceLog.level").value("INFO"),
               when(localRepo != null).useOptions(CoreOptions.vmOption("-Dorg.ops4j.pax.url.mvn.localRepository=" + localRepo)),
-	          mavenBundle("org.apache.aries", "org.apache.aries.util").versionAsInProject(),
-	          mavenBundle("org.ow2.asm", "asm-debug-all").versionAsInProject(),
-	          mavenBundle("org.apache.aries.testsupport", "org.apache.aries.testsupport.unit").versionAsInProject(),
+              mavenBundle("org.ow2.asm", "asm-debug-all").versionAsInProject(),
               mavenBundle("org.ops4j.pax.logging", "pax-logging-api").versionAsInProject(),
               mavenBundle("org.ops4j.pax.logging", "pax-logging-service").versionAsInProject()
-	         /* vmOption ("-Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=5005"),
-	          waitForFrameworkStartup(),*/
-	  );
+              /* vmOption ("-Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=5005"),
+              waitForFrameworkStartup(),*/
+     );
   }
 
   protected Option[] proxyBundles()
   {
-	  return options(
-			  generalOptions(),
-	          mavenBundle("org.apache.aries.proxy", "org.apache.aries.proxy.api").versionAsInProject(),
-	          mavenBundle("org.apache.aries.proxy", "org.apache.aries.proxy.impl").versionAsInProject()
-	  );
+    return options(
+      generalOptions(),
+      mavenBundle("org.apache.aries.proxy", "org.apache.aries.proxy.api").versionAsInProject(),
+      mavenBundle("org.apache.aries.proxy", "org.apache.aries.proxy.impl").versionAsInProject()
+    );
   }
 
-  protected Option[] proxyUberBundle()
-  {
-	  return options(
-			  generalOptions(),
-			  mavenBundle("org.apache.aries.proxy", "org.apache.aries.proxy").versionAsInProject()
-	  );
-  }
+    protected Option[] proxyUberBundle() {
+      return options(
+        generalOptions(),
+        mavenBundle("org.apache.aries.proxy", "org.apache.aries.proxy").versionAsInProject()
+      );
+    }
 
 }

Modified: aries/trunk/proxy/proxy-itests/src/test/java/org/apache/aries/proxy/itests/AbstractWeavingProxyTest.java
URL: http://svn.apache.org/viewvc/aries/trunk/proxy/proxy-itests/src/test/java/org/apache/aries/proxy/itests/AbstractWeavingProxyTest.java?rev=1778286&r1=1778285&r2=1778286&view=diff
==============================================================================
--- aries/trunk/proxy/proxy-itests/src/test/java/org/apache/aries/proxy/itests/AbstractWeavingProxyTest.java (original)
+++ aries/trunk/proxy/proxy-itests/src/test/java/org/apache/aries/proxy/itests/AbstractWeavingProxyTest.java Wed Jan 11 12:32:28 2017
@@ -89,7 +89,7 @@ public abstract class AbstractWeavingPro
   public void checkProxyController() throws Exception
   {
 
-    context().registerService(ProxyWeavingController.class.getName(), new ProxyWeavingController() {
+    bundleContext.registerService(ProxyWeavingController.class.getName(), new ProxyWeavingController() {
 
       public boolean shouldWeave(WovenClass arg0, WeavingHelper arg1)
       {



Mime
View raw message